Numerical differentiation
Project description
numericalderivative
What is it?
The goal of this project is to compute the first derivative of a function using finite difference formulas. The difficulty with these formulas is that it must use a finite difference step which must be neither too large (otherwise truncation error dominates the error) nor too small (otherwise condition error dominates). To solve this issue, the module provides algorithms to compute an approximate optimal finite difference step.
Furthermore, this package provides benchmark problems for numerical differentiation.
This module allows you to do this:
import math
import numericalderivative as nd
def scaled_exp(x):
alpha = 1.0e6
return math.exp(-x / alpha)
h0 = 1.0e5
x = 1.0e0
algorithm = nd.SteplemanWinarsky(scaled_exp, x)
h_optimal, iterations = algorithm.compute_step(h0)
number_of_function_evaluations = algorithm.get_number_of_function_evaluations()
f_prime_approx = algorithm.compute_first_derivative(h_optimal)
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
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
- Use bracket_step as a list of two floats in GillMurraySaundersWright and DumontetVignes (this is done in SteplemanWinarsky)
- Create a benchmark feature to test a given method on several benchmark problems
- Use a relative precision in SteplemanWinarsky and GillMurraySaundersWright.
- Remove NumericalDerivative: move it to FiniteDifferenceFormula.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file numericalderivative-0.1.tar.gz.
File metadata
- Download URL: numericalderivative-0.1.tar.gz
- Upload date:
- Size: 25.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d13898b5c25cf8700235496224dd540bcae559ed6b294d5887aead1371c49fc
|
|
| MD5 |
67c784768216b45f90607f8ab7e6832e
|
|
| BLAKE2b-256 |
7510c9991bc17b6b155232d7659bc5144c9e53f112c1f26f4f4c6c340cb6725b
|
File details
Details for the file numericalderivative-0.1-py3-none-any.whl.
File metadata
- Download URL: numericalderivative-0.1-py3-none-any.whl
- Upload date:
- Size: 27.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bbb0d2dd26ba7c1c2ca0be89902d3939baf04c9648f09c265208c9a09fbec51
|
|
| MD5 |
d436a1bfc06a6554cc0b6ee46d6644e1
|
|
| BLAKE2b-256 |
a8d896a3c88b217b1427b37f293b354b6ced62171e6cb35164af84637f947a12
|