--- id: numdifftools version: "0.10.1" license: new BSD license_treatment: permissive maintenance: active --- # numdifftools — Solves automatic numerical differentiation problems in one or more variables. License: permissive · Maintenance: active · Downloads: 478.0K/mo ## 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 above — 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 pip install numdifftools uv add numdifftools 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_current - Install friction: low - Maintenance: active - Downloads: 478.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags numerical differentiation, automatic derivatives, gradient computation, jacobian matrix, hessian matrix, finite differences, numerical derivatives, numerical-methods, optimization, scientific-computing [View on SkillFed](https://skillfed.io/packages/numdifftools) · [View on PyPI](https://pypi.org/project/numdifftools/)