AD
Fast, transparent first- and second-order automatic differentiation for Python
Overview
The ad package allows you to easily and transparently perform first- and
second-order automatic differentiation. Advanced math involving trigonometric,
logarithmic, hyperbolic, and related functions can be evaluated directly using
the ad.admath submodule.
All base numeric types are supported (int, float, complex, etc.). The
package is designed so underlying numeric types interact as they normally do
during calculations. In practice, ad behaves like a lightweight wrapper that
tracks derivatives while preserving standard numeric behavior.
From the Wikipedia entry on Automatic differentiation:
"AD exploits the fact that every computer program, no matter how complicated, executes a sequence of elementary arithmetic operations (addition, subtraction, multiplication, division, etc.) and elementary functions (exp, log, sin, cos, etc.). By applying the chain rule repeatedly to these operations, derivatives of arbitrary order can be computed automatically, and accurate to working precision."
See the package documentation for details and examples.
Main Features
- Transparent calculations with derivatives, requiring little or no modification to existing code (including NumPy-based code).
- Broad mathematical operation support, including most functions from
mathandcmath, plus convenience trigonometric, hyperbolic, and logarithmic helpers (csc,acoth,ln, etc.). Comparison operators follow the same rules as the wrapped numeric values. - Seamless real and complex arithmetic through
ad.admathcounterparts. - Automatic gradient and Hessian function generator for optimization workflows
with
scipy.optimizeviagh(your_func_here). - Linear algebra routines in
ad.linalgsimilar to NumPy'slinalg, without LAPACK dependency.
Linear Algebra Routines
Decompositions
chol: Cholesky decompositionlu: LU decompositionqr: QR decomposition
Solving equations and matrix inversion
solve: General solver for linear systemslstsq: Least-squares solver for linear systemsinv: Multiplicative inverse of a matrix
Installation
uv pip install ad
Requires Python 3.10+. See the full installation guide.
Documentation
- Theory — mathematical background, hierarchical basis, algorithms
- Quickstart — runnable examples
- API Reference — class and function signatures
- References — literature citations
License
BSD-3-Clause.
Metadata
Release files for ad 1.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ad-1.5.1.tar.gz | 237.9 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ad-1.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 259.3 kB
Release files / ad-1.5.1.tar.gz
| Download URL | ad-1.5.1.tar.gz |
|---|---|
| Size | 237.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee7c5dfe8744ba43bfac9e32b0c6e9f710ad71dc4174189c82f8a8a079bfb47b
|
|
BLAKE2b-256 checksum How to use checksums |
7c4aa508b0fbc2835d49c85836a51fb6f90675a076140a92333a5b1b79b2a008
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.
Transparency logRelease files / ad-1.5.1-py3-none-any.whl
| Download URL | ad-1.5.1-py3-none-any.whl |
|---|---|
| Size | 21.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3d0c8d00027c225ca20444a9853e5c986832909dbeec27078216c9a3f2f2873a
|
|
BLAKE2b-256 checksum How to use checksums |
4861a2c983113347708bc5e6679f25d2e73595890296ada0f5f10ff5f9141a1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.
Transparency logSecurity for ad 1.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for ad-1.5.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.