Skip to main content

Numerical differentiation

Project description

numericalderivative

What is it?

The goal of this project is to compute the derivative of a function using finite difference formulas. The difficulty with these formulas is that it must use a step which must be neither too large (otherwise the truncation error dominates the error) nor too small (otherwise the condition error dominates). For this purpose, it provides exact methods (based on the value of higher derivatives) and approximate methods (based on function values). Furthermore, the module provides finite difference formulas for the first, second, third or any arbitrary order derivative of a function. Finally, this package provides 15 benchmark problems for numerical differentiation.

This module makes it possible to do this:

import math
import numericalderivative as nd

def scaled_exp(x):
    alpha = 1.0e6
    return math.exp(-x / alpha)


h0 = 1.0e5  # This is the initial step size
x = 1.0e0
algorithm = nd.SteplemanWinarsky(scaled_exp, x)
h_optimal, iterations = algorithm.compute_step(h0)
f_prime_approx = algorithm.compute_first_derivative(h_optimal)

Documentation & references

Authors

  • Michaël Baudin, 2024

Installation

To install from Github:

git clone https://github.com/mbaudin47/numerical_derivative.git
cd numerical_derivative
python setup.py install

To install from Pip:

pip install numericalderivative

References

  • Gill, P. E., Murray, W., Saunders, M. A., & Wright, M. H. (1983). Computing forward-difference intervals for numerical optimization. SIAM Journal on Scientific and Statistical Computing, 4(2), 310-321.
  • Adaptive numerical differentiation R. S. Stepleman and N. D. Winarsky Journal: Math. Comp. 33 (1979), 1257-1264
  • Dumontet, J., & Vignes, J. (1977). Détermination du pas optimal dans le calcul des dérivées sur ordinateur. RAIRO. Analyse numérique, 11 (1), 13-25.

Roadmap

  • Implement the method of:

Shi, H. J. M., Xie, Y., Xuan, M. Q., & Nocedal, J. (2022). Adaptive finite-difference interval estimation for noisy derivative-free optimization. SIAM Journal on Scientific Computing, 44(4), A2302-A2321.

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

numericalderivative-0.2.tar.gz (38.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

numericalderivative-0.2-py3-none-any.whl (37.5 kB view details)

Uploaded Python 3

File details

Details for the file numericalderivative-0.2.tar.gz.

File metadata

  • Download URL: numericalderivative-0.2.tar.gz
  • Upload date:
  • Size: 38.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.2

File hashes

Hashes for numericalderivative-0.2.tar.gz
Algorithm Hash digest
SHA256 f675b6f1dfae28ab7ea2aefc641bd2eb926f46d9eb9024cc0385d601ee0cbd57
MD5 d59490805a05e7d2f25f849a185bc6e6
BLAKE2b-256 2c808bf6712f1cb12e0e08b4ff41e9a9ce37f7646da56ca4b7b456cce9a20471

See more details on using hashes here.

File details

Details for the file numericalderivative-0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for numericalderivative-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f3d5c5552124cb0ae0133aa7b21a3d162d6b3195a90002709ca4cf76b9a08fa8
MD5 5f0dd9d3f8952f51ecd922448b4be68b
BLAKE2b-256 42ed5e30c4ec263589102b87d706c661c0289c82f8dd259720bf0fab42831392

See more details on using hashes here.

Supported by

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