Python math libraries

Updated Nov 2026

Python math libraries extend the language's built-in numbers with arrays, symbolic algebra, and arbitrary-precision arithmetic. A computer algebra system keeps expressions exact rather than rounding each step to a floating-point value. These libraries let researchers, engineers, and AI agents run numerical and symbolic calculations in Python.

Popularity

NumPy has the most monthly downloads in this comparison, at 1.1B.

LibraryMonthly downloadsStarsLast releaseLicense
NumPy
1.1B
33.4KNov 2026BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0
SciPy
392.1M
15.2KAug 2026BSD-3-Clause
SymPy
169.9M
15.1KApr 2025BSD
mpmath
168.4M
1.2KMar 2026BSD-3-Clause
PyTorch
59.5M
105.6KOct 2026Apache-2.0 AND Apache-2.0 WITH LLVM-exception AND BSD-2-Clause AND BSD-3-Clause AND BSL-1.0 AND ISC AND MIT AND Zlib
Dask
31.6M
14.0KAug 2026BSD-3-Clause
NumExpr
14.4M
2.5KJul 2026MIT
JAX
12.8M
36.6KNov 2026Apache-2.0
Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Libraries and code examples

Provides multidimensional arrays and operations for numerical computing.

Downloads / mo
1.1B
Stars
33.4K
Last release
2.5.5
License
BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0

Strengths

  • Calculates whole arrays elementwise. Apply mathematical operations to array elements with broadcasting.
  • Integrates sampled data. Use trapezoid to integrate values sampled along an axis.

Limitations

  • Fixed-width integers can overflow. Choose a data type large enough for intermediate and final values.
  • Negative real roots return NaN. Use complex inputs when square roots need complex results.

Quickstart

From quickstart.html
$ pip install numpy
import numpy as np

a = np.array([[1, 2], [3, 5]])

b = np.array([1, 2])

x = np.linalg.solve(a, b)

x

NumPy examples

From open-source projects on GitHub

Provides numerical algorithms and scientific-computing tools built on NumPy.

Downloads / mo
392.1M
Stars
15.2K
Last release
1.18.1
License
BSD-3-Clause

Strengths

  • Integrates callable functions. Use quad to compute a definite integral of a callable.
  • Approximates callable derivatives. Use differentiate.derivative to estimate a callable’s derivative.

Limitations

  • Sharp features can be missed. Pulses narrow relative to the integration interval can be integrated incorrectly.
  • Returned errors are estimates. Treat quad’s reported absolute error as an estimate.

Quickstart

From integrate.html
$ pip install scipy
import numpy as np

a = np.array([[3, 2, 0], [1, -1, 0], [0, 5, 1]])

b = np.array([2, 4, -1])

from scipy.linalg import solve

x = solve(a, b)

x

a @ x == b

SciPy examples

From open-source projects on GitHub

Performs computer algebra in Python.

Downloads / mo
169.9M
Stars
15.1K
Last release
1.14.0
License
BSD

Quickstart

From matrices.html
$ pip install sympy
from sympy import Matrix

M = Matrix(3, 3, [0, 1, 1, 1, 0, 0, 1, 1, 1])

M.eigenvals()

SymPy examples

From open-source projects on GitHub

Provides arbitrary-precision floating-point mathematical computation.

Downloads / mo
168.4M
Stars
1.2K
Last release
1.4.1
License
BSD-3-Clause

Strengths

  • Offers configurable working precision. Set mp.dps to choose the working decimal precision.
  • Integrates functions along complex paths. Use quad to evaluate integrals over a specified complex path.

Limitations

  • Float inputs retain earlier rounding. Use decimal strings when constructing high-precision decimal inputs.
  • Default precision changes persist. Use workdps when a precision change should be temporary.

Quickstart

From basics.html
$ pip install mpmath==1.4.1
from mpmath import mp
with mp.workdps(50):
    print(mp.sqrt(2))

Computes with tensors and dynamic neural networks on GPUs.

Downloads / mo
59.5M
Stars
105.6K
Last release
2.15.0
License
Apache-2.0 AND Apache-2.0 WITH LLVM-exception AND BSD-2-Clause AND BSD-3-Clause AND BSL-1.0 AND ISC AND MIT AND Zlib
$ pip install torch
import torch

A = torch.randn(3, 3)
b = torch.randn(3)
x = torch.linalg.solve(A, b)
print(x)

PyTorch examples

From open-source projects on GitHub

Runs PyData workloads in parallel with task scheduling.

Downloads / mo
31.6M
Stars
14.0K
Last release
2026.8.0
License
BSD-3-Clause

Quickstart

From array-api.html
$ pip install "dask[array]"
import dask.array as da

x = da.eye(2, chunks=2)
u, s, v = da.linalg.svd(x)
print(s.compute())

Dask examples

From open-source projects on GitHub

Evaluates numerical expressions on NumPy arrays.

Downloads / mo
14.4M
Stars
2.5K
Last release
2.14.2
License
MIT

Quickstart

From user_guide.rst
$ pip install numexpr==2.14.2 numpy==2.5.5
import numpy as np
import numexpr as ne
a = np.arange(10)
print(ne.evaluate("a**2 + 1", local_dict={"a": a}))

NumExpr examples

From open-source projects on GitHub

Differentiates, compiles, and transforms NumPy code.

Downloads / mo
12.8M
Stars
36.6K
Last release
0.12.1
License
Apache-2.0
$ pip install jax
import jax.numpy as jnp

x = jnp.array([[1., 2., 3.], [4., 5., 7.]])
print(jnp.linalg.norm(x))

JAX examples

From open-source projects on GitHub
def operator_to_matrix(operator_fn, problem):
    """Only used for when debugging.
    Can be used to print the matrix, check the conditional number, etc.
    """
    J = jax.jacfwd(operator_fn)(np.zeros(problem.num_total_dofs_all_vars))
    return J

FAQ

NumPy suits numerical work on arrays and matrices. SciPy adds integration, optimization, and other scientific algorithms on top of NumPy arrays. SymPy suits exact symbolic math. mpmath suits arithmetic at arbitrary precision.

NumPy is the core package for array computing in Python, with broadcasting, elementwise functions, and linear algebra.

SymPy is a computer algebra system that keeps expressions exact and manipulates them symbolically. Its evalf method computes numerical approximations to a chosen number of digits.

NumPy supplies the array type and core numerical operations. SciPy builds on those arrays with algorithms for integration, differential equations, optimization, and signal processing.

JAX runs NumPy-style array code with automatic differentiation and compilation on supported accelerators.

For coding agents

Found your math library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official