numericalderivative


Namenumericalderivative JSON
Version 0.3 PyPI version JSON
download
home_pagehttps://github.com/mbaudin47/numericalderivative
SummaryNumerical differentiation
upload_time2025-01-05 14:59:33
maintainerNone
docs_urlNone
authorMichaël Baudin
requires_pythonNone
licenseGNU Lesser General Public License v3 (LGPLv3)
keywords numerical differentiation first derivative finite difference optimal step size numerical analysis
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:

```python
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

- [Package documentation](https://mbaudin47.github.io/numericalderivative/main/index.html)

## Authors

* Michaël Baudin, 2024

## Installation

To install from Github:

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

To install from Pip:

```bash
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
- GillMurraySaundersWright: update to setup from absolute precision instead
  of relative precision.
  This is because the current computation based on the relative precision
  cannot work if the function value at point x is zero.
- 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.

- Implement a method to compute the absolute error of evaluation of the function f, 
  for example :

    J. J. Moré and S. M. Wild, _Estimating computational noise_, 
    _SIAM Journal on Scientific Computing_, 33 (2011), pp. 1292–1314.

- Make sure that the API help page of each method has a paragraph on the
  cases of failure.
  Also, add a paragraph on an alternative method using compute_step of F.D.
  formula, with some extra assumption on a higher derivative.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mbaudin47/numericalderivative",
    "name": "numericalderivative",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "Numerical Differentiation, First Derivative, Finite Difference, Optimal Step Size, Numerical Analysis",
    "author": "Micha\u00ebl Baudin",
    "author_email": "Micha\u00ebl Baudin <michael.baudin@gmail.com>",
    "download_url": null,
    "platform": null,
    "description": "# numericalderivative\n\n## What is it?\n\nThe goal of this project is to compute the derivative of a function\nusing finite difference formulas.\nThe difficulty with these formulas is that it must use a \nstep which must be neither too large (otherwise the truncation error dominates \nthe error) nor too small (otherwise the condition error dominates).\nFor this purpose, it provides exact methods (based on the value \nof higher derivatives) and approximate methods (based on function values).\nFurthermore, the module provides finite difference formulas for the \nfirst, second, third or any arbitrary order derivative of a function.\nFinally, this package provides 15 benchmark problems for numerical\ndifferentiation.\n\nThis module makes it possible to do this:\n\n```python\nimport math\nimport numericalderivative as nd\n\ndef scaled_exp(x):\n    alpha = 1.0e6\n    return math.exp(-x / alpha)\n\n\nh0 = 1.0e5  # This is the initial step size\nx = 1.0e0\nalgorithm = nd.SteplemanWinarsky(scaled_exp, x)\nh_optimal, iterations = algorithm.compute_step(h0)\nf_prime_approx = algorithm.compute_first_derivative(h_optimal)\n```\n\n## Documentation & references\n\n- [Package documentation](https://mbaudin47.github.io/numericalderivative/main/index.html)\n\n## Authors\n\n* Micha\u00ebl Baudin, 2024\n\n## Installation\n\nTo install from Github:\n\n```bash\ngit clone https://github.com/mbaudin47/numerical_derivative.git\ncd numerical_derivative\npython setup.py install\n```\n\nTo install from Pip:\n\n```bash\npip install numericalderivative\n```\n\n## References\n- Gill, P. E., Murray, W., Saunders, M. A., & Wright, M. H. (1983). \n  Computing forward-difference intervals for numerical optimization. \n  SIAM Journal on Scientific and Statistical Computing, 4(2), 310-321.\n- Adaptive numerical differentiation\n  R. S. Stepleman and N. D. Winarsky\n  Journal: Math. Comp. 33 (1979), 1257-1264 \n- Dumontet, J., & Vignes, J. (1977). \n  D\u00e9termination du pas optimal dans le calcul des d\u00e9riv\u00e9es sur ordinateur. \n  RAIRO. Analyse num\u00e9rique, 11 (1), 13-25.\n\n## Roadmap\n- GillMurraySaundersWright: update to setup from absolute precision instead\n  of relative precision.\n  This is because the current computation based on the relative precision\n  cannot work if the function value at point x is zero.\n- Implement the method of:\n\n    Shi, H. J. M., Xie, Y., Xuan, M. Q., & Nocedal, J. (2022). \n    Adaptive finite-difference interval estimation for noisy \n    derivative-free optimization. _SIAM Journal on Scientific Computing_, \n    _44_(4), A2302-A2321.\n\n- Implement a method to compute the absolute error of evaluation of the function f, \n  for example :\n\n    J. J. Mor\u00e9 and S. M. Wild, _Estimating computational noise_, \n    _SIAM Journal on Scientific Computing_, 33 (2011), pp. 1292\u20131314.\n\n- Make sure that the API help page of each method has a paragraph on the\n  cases of failure.\n  Also, add a paragraph on an alternative method using compute_step of F.D.\n  formula, with some extra assumption on a higher derivative.\n",
    "bugtrack_url": null,
    "license": "GNU Lesser General Public License v3 (LGPLv3)",
    "summary": "Numerical differentiation",
    "version": "0.3",
    "project_urls": {
        "Homepage": "https://github.com/mbaudin47/numericalderivative"
    },
    "split_keywords": [
        "numerical differentiation",
        " first derivative",
        " finite difference",
        " optimal step size",
        " numerical analysis"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3188e300811f561cab7b2184474a665ed830f10cf0a604bbccbe60ecdc966618",
                "md5": "f76599873ea08bb13eaf8d52f87af4a0",
                "sha256": "5092e489d655020a150d2169a234fd0cf041a94e99553a5a45ea807ca94e939d"
            },
            "downloads": -1,
            "filename": "numericalderivative-0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f76599873ea08bb13eaf8d52f87af4a0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 52793,
            "upload_time": "2025-01-05T14:59:33",
            "upload_time_iso_8601": "2025-01-05T14:59:33.230313Z",
            "url": "https://files.pythonhosted.org/packages/31/88/e300811f561cab7b2184474a665ed830f10cf0a604bbccbe60ecdc966618/numericalderivative-0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-05 14:59:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mbaudin47",
    "github_project": "numericalderivative",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "circle": true,
    "lcname": "numericalderivative"
}
        
Elapsed time: 0.39790s