Mpmath¶
Description:
- Python library for real and complex floating-point arithmetic with arbitrary precision.
Resources:
- [GitHub] https://github.com/mpmath/mpmath
- [Website] https://mpmath.org/
- [Docs] https://mpmath.org/doc/current/
- [Examples] https://fredrikj.net/blog/2011/03/100-mpmath-one-liners-for-pi/
Example 1¶
Computes 50 digits of pi by numerically evaluating the Gaussian integral
In [ ]:
Copied!
from mpmath import mp
mp.dps = 50
print(mp.quad(lambda x: mp.exp(-x**2), [-mp.inf, mp.inf]) ** 2)
from mpmath import mp
mp.dps = 50
print(mp.quad(lambda x: mp.exp(-x**2), [-mp.inf, mp.inf]) ** 2)