Skip to main content

Compute numerical derivatives.

Project description

https://img.shields.io/pypi/v/jacobi https://img.shields.io/badge/github-docs-success https://img.shields.io/badge/github-source-blue

Fast numerical derivatives for real analytic functions with arbitrary round-off error.

Features

  • Robustly compute the generalised Jacobi matrix for an arbitrary real analytic mapping of ℝⁿ → ℝⁱ¹ × … × ℝⁱⁿ

  • Derivative is computed to specified accuracy or until precision of function is reached

  • Algorithm based on John D’Errico’s DERIVEST: flawlessly works even with functions that have large round-off error

  • Up to 1200x faster than numdifftools at equivalent precision

  • Returns error estimates for derivatives

  • Supports calculation of derivative up to target precision (speed-up)

  • Supports arbitrary auxiliary function arguments

  • Lightweight package, only depends on numpy

Example

from matplotlib import pyplot as plt
import numpy as np
from jacobi import jacobi


# function of one variable with auxiliary argument; returns a vector
def f(p, x):
    y = p + x
    return np.sin(y) / y


x = np.linspace(-10, 10, 1000)
fx = f(0, x)
fdx, fdex = jacobi(f, 0, x)

plt.plot(x, fx, label="f(x) = sin(x) / x")
plt.plot(x, fdx, ls="--", label="f'(x)")
plt.legend()
https://hdembinski.github.io/jacobi/_images/example.svg

Comparison to numdifftools

Speed

Jacobi makes better use of vectorised computation than numdifftools.

https://hdembinski.github.io/jacobi/_images/speed.svg

Precision

The machine precision is indicated by the dashed line.

https://hdembinski.github.io/jacobi/_images/precision.svg

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jacobi-0.1.5.tar.gz (425.4 kB view details)

Uploaded Source

Built Distribution

jacobi-0.1.5-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file jacobi-0.1.5.tar.gz.

File metadata

  • Download URL: jacobi-0.1.5.tar.gz
  • Upload date:
  • Size: 425.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for jacobi-0.1.5.tar.gz
Algorithm Hash digest
SHA256 4eaf59ef22020554752668fc3d788482e4fb63ea681647348b32f9c8e3ec1af3
MD5 10c70cc27787a8ae0e8543561469b764
BLAKE2b-256 c28fdb8672c7c015a1295fa936dd52cbe90c5c7f8ba7d3ccda42fe0217ddb6a0

See more details on using hashes here.

File details

Details for the file jacobi-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: jacobi-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for jacobi-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 37def9325b2234853aa7bd26bbe416b33f7bfaf466e6335ac70fcce7b40661a3
MD5 6510805dd83b1aabacaac871cbef1d75
BLAKE2b-256 7ba175936591b1f1b4f79a7c6720a4d0e88c700b27f3df59ca38af8965d85da6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page