package owl-base
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=38d210ce6c1c2f09631fd59951430e4f364b5ae036c71ed1b32ce559b2a29263
sha512=c468100556445384b9c6adad9c37b5a9b8c27db8be35f61979e65fafa88c60221b8bda0a9c06cfbbc8d4e216a1ed08a315dfefb45bb4f5f15aa82d4358f57567
doc/owl-base/Owl_maths_quadrature/index.html
Module Owl_maths_quadrature
Numerical Integration
Integration functions
``trapz f a b`` computes the integral of ``f`` on the interval ``a,b
`` using the trapezoidal rule, i.e. :math:`\int_a^b f(x) dx`.
Parameters: * ``f``: function to be integrated. * ``n``: the maximum allowed number of steps. The default value is ``20``. * ``eps``: the desired fractional accuracy. The default value is ``1e-6``. * ``a``: lower bound of the integrated interval. * ``b``: upper bound of the integrated interval.
Returns: * ``y``: the integral of ``f`` on ``a, b
``.
``simpson f a b`` computes the integral of ``f`` on the interval ``a,b
`` using the Simpson's rule, i.e. :math:`\int_a^b f(x) dx`.
Parameters: * ``f``: function to be integrated. * ``n``: the maximum allowed number of steps. The default value is ``20``. * ``eps``: the desired fractional accuracy. The default value is ``1e-6``. * ``a``: lower bound of the integrated interval. * ``b``: upper bound of the integrated interval.
Returns: * ``y``: the integral of ``f`` on ``a, b
``.
``romberg f a b`` computes the integral of ``f`` on the interval ``a,b
`` using the Romberg method, i.e. :math:`\int_a^b f(x) dx`. Note that this algorithm is much faster than ``trapz`` and ``simpson``.
Parameters: * ``f``: function to be integrated. * ``n``: the maximum allowed number of steps. The default value is ``20``. * ``eps``: the desired fractional accuracy. The default value is ``1e-6``. * ``a``: lower bound of the integrated interval. * ``b``: upper bound of the integrated interval.
Returns: * ``y``: the integral of ``f`` on ``a, b
``.
``gaussian_fixed f a b`` computes the integral of ``f`` on the interval ``a,b
`` using the Gaussian quadrature of fixed order. Note that this algorithm is much faster than others due to cached weights.
Parameters: * ``f``: function to be integrated. * ``n``: the order of polynomial. The default value is ``10``. * ``a``: lower bound of the integrated interval. * ``b``: upper bound of the integrated interval.
Returns: * ``y``: the integral of ``f`` on ``a, b
``.
``gaussian f a b`` computes the integral of ``f`` on the interval ``a,b
`` using adaptive Gaussian quadrature of fixed tolerance.
Parameters: * ``f``: function to be integrated. * ``n``: the maximum order. The default value is ``50``. * ``eps``: the desired fractional accuracy. The default value is ``1e-6``. * ``a``: lower bound of the integrated interval. * ``b``: upper bound of the integrated interval.
Returns: * ``y``: the integral of ``f`` on ``a, b
``.
Helper functions
The function computes the nth stage of refinement of an extended trapezoidal rule. It is the workhorse of several integration functions including ``trapz``, ``simpson``, and ``romberg``.
Parameters: * ``f``: function to be integrated. * ``a``: lower bound of the integrated interval. * ``b``: upper bound of the integrated interval. * ``n``: the nth stage.
Returns: * ``y``: the integral of ``f`` on ``a, b
``.