mpmath is an open source Python library for arbitrary-precision floating-point arithmetic.
It can be used as a library, interactively via the Python interpreter, or from within the SymPy or Sage computer algebra systems which include mpmath as standard component.
mpmath requires Python 2.5 or later. It has been tested with Python 2.6, 2.7, and 3.2 through 3.5
Key Features
- High-level code in mpmath is implemented as methods on a “context object”. The context implements arithmetic, type conversions and other fundamental operations. The context also holds settings such as precision, and stores cache data.
- The functions plot and cplot in mpmath can be used to plot functions respectively as x-y graphs and in the complex plane. Also, splot can be used to produce 3D surface plots (requires matplotlib).
- Utility functions:
- Conversion and printing.
- Arithmetic operations.
- Complex components.
- Integer and fractional parts.
- Tolerances and approximate comparisons.
- Properties of numbers.
- Number generation.
- Precision management.
- Performance and debugging.
- Numerical integration (regular, double/triple integrals, oscillatory).
- Numerical differentiation and differintegration (arbitrary orders); partial derivatives.
- Limits and summation of infinite series (with convergence acceleration).
- Root-finding (1D and multidimensional; secant method, bisection, modified Newton’s method, and other algorithms).
- Polynomial evaluation and polynomial root-finding.
- Chebyshev approximations, Fourier and Taylor series.
- Solving ordinary differential equations.
- Integer relation detection (constant recognition).
- Linear algebra (linear system solving, LU factorization, matrix inverse, matrix norms, matrix exponentials / logarithms / square roots, eigenvalues, singular values, QR factorization).
- Inverse Laplace transforms.
- Implements a huge number of special functions, with arbitrary precision and full support for complex numbers:
- Provides extensive support for transcendental functions, evaluation of sums, integrals, limits, roots, and more.
- Rudimentary support for interval arithmetic.
Website: mpmath.org
Support: Documentation, GitHub Code Repository
Developer: Fredrik Johansson and mpmath contributors
License: BSD 3-Clause “New” or “Revised” License
mpmath is written in Python. Learn Python with our recommended free books and free tutorials.
Related Software
| Python Mathematics Tools | |
|---|---|
| scikit-learn | Machine learning library for Python |
| NumPy | Core package for scientific computing with Python |
| SciPy | Ecosystem for mathematics, science, and engineering. |
| statsmodels | Statistical modeling and econometrics |
| JAX | Python library for high-performance numerical computing |
| SageMath | Computer algebra system |
| SymPy | Library for symbolic mathematics |
| PyMC | Bayesian statistical modeling and probabilistic programming |
| Pyomo | Object-oriented algebraic modeling language |
| patsy | Package for describing statistical models and to build design matrices |
| mpmath | Library for arbitrary-precision floating-point arithmetic |
| SfePy | Finite element software package |
Read our verdict in the software roundup.
Explore our comprehensive directory of recommended free and open source software. Our carefully curated collection spans every major software category.This directory is part of our ongoing series of informative articles for Linux enthusiasts. It features hundreds of detailed reviews, along with open source alternatives to proprietary solutions from major corporations such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. You’ll also find interesting projects to try, hardware coverage, free programming books and tutorials, and much more. Discovered a useful open source Linux program that we haven’t covered yet? Let us know by completing this form. |

