probnum
mpmath
probnum | mpmath | |
---|---|---|
2 | 10 | |
426 | 914 | |
0.5% | 1.3% | |
5.2 | 9.1 | |
15 days ago | 7 days ago | |
Python | Python | |
MIT License | BSD 3-clause "New" or "Revised" License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
probnum
mpmath
- mpmath – Python library for arbitrary-precision floating-point arithmetic
-
Lies My Calculator and Computer Told Me [pdf]
What you've done here is tell SymPy to use extra precision for the intermediate (and final) output. This doesn't truly fix the problem of cancellation and loss of precision, but for many practical purposes it can postpone the problem long enough to give you a useful result.
Internally, SymPy uses mpmath (https://mpmath.org/) for representation of numbers to arbitrary precision. You could install and use the latter library directly, gaining extra precision without going through symbolic manipulation.
All that being said, it's still good practice to avoid loss of precision at the outset. Arbitrary-precision calculations are slow compared to hardware-native floating point operations. Using the example from mpmath's homepage in iPython:
In [1]: import mpmath as mp; import scipy as sp; import numpy as np
-
mpmath VS gmpy - a user suggested alternative
2 projects | 2 Aug 2023
-
How can I compute the Mandelbrot Set at infinite zoom level
Either use a fixed point system with enough precision (determined beforehand) or consider a library like https://mpmath.org.
- How do I get more decimal places for numbers in Python?
-
My function isn't working correctly
Sure you can, check out projects for high precision numbers like https://mpmath.org/
- How to preserve decimal places
-
Math with Significant Figures
Probably the most popular package for dealing with error propagation and arbitrary precision arithmetic in Python is mpmath, more specifically the mp.iv module. For more serious applications I'd take a look at MPFR and Arb, both in C. And there are tons of ball arithmetic and interval arithmetic libraries in Fortran.
-
Integrating an extremely oscillating function!
Elaborating on /u/lanemik: if you're forced to do everything numerically and aren't able to use rationals, you can also use multiple-precision arithmetic. It's significantly slower, but it's as precise as you need it to be. Note that numpy will happily work with other objects that define arithmetic operations. I haven't messed with scipy enough to know how it does things.
- were can i find advance ( hardest ) python projects with source code ?
What are some alternatives?
tf-quant-finance - High-performance TensorFlow library for quantitative finance.
NumPy - The fundamental package for scientific computing with Python.
pybobyqa - Python-based Derivative-Free Optimization with Bound Constraints
SigFigs - Implementation of a Sigfig class and an Exact class that allow math to be done while keeping the correct number of significant digits.
nvidia-modulus-airfoil-optimisation - Using NVIDIA modulus for airfoil optimizations at different angles.
gmpy - General Multi-Precision arithmetic for Python 2.6+/3+ (GMP, MPIR, MPFR, MPC)
Keras - Deep Learning for humans
arb - Arb has been merged into FLINT -- use https://github.com/flintlib/flint/ instead
iheartla - compilable markdown for linear algebra
SciPy - SciPy library main repository
number-precision - 🚀1K tiny & fast lib for doing addition, subtraction, multiplication and division operations precisely
SymPy - A computer algebra system written in pure Python