skillfed

numdifftools

Solves automatic numerical differentiation problems in one or more variables.

numdifftools v0.10.1 478.0K downloads/30d#6,440 on PyPI282
Permissive license new BSD Active released

What it is and what it does

Numdifftools is a numerical differentiation library that computes derivatives of any order for scalar and vector functions without requiring symbolic expressions or hand-coded gradients. It uses adaptive finite differences coupled with Richardson extrapolation to achieve high accuracy, and lets you choose between complex-step, central, forward, or backward difference schemes. The library provides high-level interfaces for common tasks like computing Jacobians, Hessians, and directional derivatives, along with error estimates on all results.

The package is built on numpy and scipy and is designed for scientific computing workflows where you need to compute derivatives of functions that are only available as Python callables. It also provides an interface to AlgoPy for algorithmic differentiation when needed. It supports Python 3.10 and later and is actively maintained.

Use it for:

  • Compute gradients for optimization algorithms when analytical derivatives are unavailable or expensive to derive.
  • Calculate Jacobians for nonlinear least-squares fitting and parameter estimation problems.
  • Evaluate Hessian matrices for second-order optimization methods and sensitivity analysis.
  • Verify hand-coded derivatives by comparing them against numerical estimates.
  • Compute directional derivatives and higher-order partial derivatives for scientific analysis.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Computes numerical derivatives, gradients, Jacobians, Hessians, and higher-order partial derivatives of scalar and vector functions using adaptive finite differences and Richardson extrapolation.

Yes. The package is actively maintained, has no known vulnerabilities, installs cleanly with minimal dependencies, and solves a well-defined problem in numerical computing. It is a good fit if you need to compute derivatives without symbolic math or hand-coding gradients. The permissive BSD license poses no restrictions.

Install

numdifftools on PyPI

pip

pip install numdifftools

uv

uv add numdifftools

poetry

poetry add numdifftools

Installing numdifftools

Before you install

Low install friction; pure Python wheel with only numpy and scipy as runtime dependencies. Active maintenance with a release 2 days ago and recent commits.

License in practice

Licensed under new BSD (permissive), so you can use it freely in commercial and private projects with minimal restrictions.

Quickstart

pip install numdifftools

import numdifftools as nd
import numpy as np

# Compute first derivative of exp(x) at x=1
fd = nd.Derivative(np.exp)
result = fd(1)

# Compute gradient of sum(x**2)
fun = lambda x: np.sum(x**2)
dfun = nd.Gradient(fun)
grad = dfun([1, 2, 3])

Verify before relying

  • Whether the package supports automatic differentiation (AD) modes beyond finite differences, or if AlgoPy integration is optional.
  • Performance characteristics for high-dimensional problems or very large Hessians.
  • Whether error estimates are always reliable or have known failure modes.

Package facts

License new BSD (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 2 — numpy, scipy
Maintenance actively maintained — 2 days since the last release
Last repo commit
First released
Downloads 477,954/month — #6,440 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: numdifftools-0.10.1-py3-none-any.whl

Environment :: ConsoleIntended Audience :: EducationIntended Audience :: Science/ResearchLicense :: OSI Approved :: BSD LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: OS IndependentOperating System :: POSIX :: LinuxOperating System :: UnixProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/Engineering :: GISTopic :: Scientific/Engineering :: Mathematics

Tags

numerical differentiationautomatic derivativesgradient computationjacobian matrixhessian matrixfinite differencesnumerical derivatives
numerical-methodsoptimizationscientific-computing

More Mathematics packages