chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
Function approximation
|
||||
----------------------
|
||||
|
||||
Taylor series (``taylor``)
|
||||
..........................
|
||||
|
||||
.. autofunction:: mpmath.taylor
|
||||
|
||||
Pade approximation (``pade``)
|
||||
.............................
|
||||
|
||||
.. autofunction:: mpmath.pade
|
||||
|
||||
Chebyshev approximation (``chebyfit``)
|
||||
......................................
|
||||
|
||||
.. autofunction:: mpmath.chebyfit
|
||||
|
||||
Fourier series (``fourier``, ``fourierval``)
|
||||
............................................
|
||||
|
||||
.. autofunction:: mpmath.fourier
|
||||
.. autofunction:: mpmath.fourierval
|
||||
@@ -0,0 +1,19 @@
|
||||
Differentiation
|
||||
---------------
|
||||
|
||||
Numerical derivatives (``diff``, ``diffs``)
|
||||
...........................................
|
||||
|
||||
.. autofunction:: mpmath.diff
|
||||
.. autofunction:: mpmath.diffs
|
||||
|
||||
Composition of derivatives (``diffs_prod``, ``diffs_exp``)
|
||||
..........................................................
|
||||
|
||||
.. autofunction:: mpmath.diffs_prod
|
||||
.. autofunction:: mpmath.diffs_exp
|
||||
|
||||
Fractional derivatives / differintegration (``differint``)
|
||||
............................................................
|
||||
|
||||
.. autofunction:: mpmath.differint
|
||||
@@ -0,0 +1,14 @@
|
||||
Numerical calculus
|
||||
==================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
polynomials
|
||||
optimization
|
||||
sums_limits
|
||||
differentiation
|
||||
integration
|
||||
odes
|
||||
approximation
|
||||
inverselaplace
|
||||
@@ -0,0 +1,36 @@
|
||||
Numerical integration (quadrature)
|
||||
----------------------------------
|
||||
|
||||
Standard quadrature (``quad``)
|
||||
..............................
|
||||
|
||||
.. autofunction:: mpmath.quad
|
||||
|
||||
Quadrature with subdivision (``quadsubdiv``)
|
||||
............................................
|
||||
|
||||
.. autofunction:: mpmath.quadsubdiv
|
||||
|
||||
Oscillatory quadrature (``quadosc``)
|
||||
....................................
|
||||
|
||||
.. autofunction:: mpmath.quadosc
|
||||
|
||||
Quadrature rules
|
||||
................
|
||||
|
||||
.. autoclass:: mpmath.calculus.quadrature.QuadratureRule
|
||||
:members:
|
||||
|
||||
Tanh-sinh rule
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: mpmath.calculus.quadrature.TanhSinh
|
||||
:members:
|
||||
|
||||
|
||||
Gauss-Legendre rule
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: mpmath.calculus.quadrature.GaussLegendre
|
||||
:members:
|
||||
@@ -0,0 +1,71 @@
|
||||
Numerical inverse Laplace transform
|
||||
-----------------------------------
|
||||
|
||||
One-step algorithm (``invertlaplace``)
|
||||
......................................
|
||||
|
||||
.. autofunction:: mpmath.invertlaplace
|
||||
|
||||
Specific algorithms
|
||||
...................
|
||||
|
||||
Fixed Talbot algorithm
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: mpmath.calculus.inverselaplace.FixedTalbot
|
||||
:members:
|
||||
|
||||
Gaver-Stehfest algorithm
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: mpmath.calculus.inverselaplace.Stehfest
|
||||
:members:
|
||||
|
||||
de Hoog, Knight & Stokes algorithm
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: mpmath.calculus.inverselaplace.deHoog
|
||||
:members:
|
||||
|
||||
Cohen acceleration algorithm
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. autoclass:: mpmath.calculus.inverselaplace.Cohen
|
||||
:members:
|
||||
|
||||
Manual approach
|
||||
...............
|
||||
|
||||
It is possible and sometimes beneficial to re-create some of the
|
||||
functionality in ``invertlaplace``. This could be used to compute the
|
||||
Laplace-space function evaluations in a different way. For example,
|
||||
the Laplace-space function evaluations could be the result of a
|
||||
quadrature or sum, solution to a system of ordinary differential
|
||||
equations, or possibly computed in parallel from some external library
|
||||
or function call.
|
||||
|
||||
A trivial example showing the process (which could be implemented
|
||||
using the existing interface):
|
||||
|
||||
>>> from mpmath import calculus, convert, exp, mp
|
||||
>>> myTalbot = calculus.inverselaplace.FixedTalbot(mp)
|
||||
>>> t = convert(0.25)
|
||||
>>> myTalbot.calc_laplace_parameter(t)
|
||||
>>> fp = lambda p: 1/(p + 1) - 1/(p + 1000)
|
||||
>>> ft = lambda t: exp(-t) - exp(-1000*t)
|
||||
>>> fpvec = [fp(p) for p in myTalbot.p]
|
||||
>>> ft(t)-myTalbot.calc_time_domain_solution(fpvec,t,manual_prec=True)
|
||||
mpf('1.92830017952889006175687218e-21')
|
||||
|
||||
This manual approach is also useful to look at the Laplace parameter,
|
||||
order, or working precision which were computed.
|
||||
|
||||
>>> myTalbot.degree
|
||||
34
|
||||
|
||||
Credit
|
||||
......
|
||||
|
||||
The numerical inverse Laplace transform functionality was contributed
|
||||
to mpmath by Kristopher L. Kuhlman in 2017. The Cohen method was contributed
|
||||
to mpmath by Guillermo Navas-Palencia in 2022.
|
||||
@@ -0,0 +1,7 @@
|
||||
Ordinary differential equations
|
||||
-------------------------------
|
||||
|
||||
Solving the ODE initial value problem (``odefun``)
|
||||
..................................................
|
||||
|
||||
.. autofunction:: mpmath.odefun
|
||||
@@ -0,0 +1,25 @@
|
||||
Root-finding and optimization
|
||||
-----------------------------
|
||||
|
||||
Root-finding (``findroot``)
|
||||
...........................
|
||||
|
||||
.. autofunction:: mpmath.findroot(f, x0, solver=Secant, tol=None, verbose=False, verify=True, **kwargs)
|
||||
|
||||
Solvers
|
||||
^^^^^^^
|
||||
|
||||
.. autoclass:: mpmath.calculus.optimization.Secant
|
||||
.. autoclass:: mpmath.calculus.optimization.Newton
|
||||
.. autoclass:: mpmath.calculus.optimization.MNewton
|
||||
.. autoclass:: mpmath.calculus.optimization.Halley
|
||||
.. autoclass:: mpmath.calculus.optimization.Muller
|
||||
.. autoclass:: mpmath.calculus.optimization.Bisection
|
||||
.. autoclass:: mpmath.calculus.optimization.Illinois
|
||||
.. autoclass:: mpmath.calculus.optimization.Pegasus
|
||||
.. autoclass:: mpmath.calculus.optimization.Anderson
|
||||
.. autoclass:: mpmath.calculus.optimization.Ridder
|
||||
.. autoclass:: mpmath.calculus.optimization.ANewton
|
||||
.. autoclass:: mpmath.calculus.optimization.MDNewton
|
||||
.. autoclass:: mpmath.calculus.optimization.ModAB
|
||||
.. autoclass:: mpmath.calculus.optimization.Brent
|
||||
@@ -0,0 +1,15 @@
|
||||
Polynomials
|
||||
-----------
|
||||
|
||||
See also :func:`~mpmath.taylor` and :func:`~mpmath.chebyfit` for
|
||||
approximation of functions by polynomials.
|
||||
|
||||
Polynomial evaluation (``polyval``)
|
||||
...................................
|
||||
|
||||
.. autofunction:: mpmath.polyval
|
||||
|
||||
Polynomial roots (``polyroots``)
|
||||
................................
|
||||
|
||||
.. autofunction:: mpmath.polyroots
|
||||
@@ -0,0 +1,67 @@
|
||||
Sums, products, limits and extrapolation
|
||||
----------------------------------------
|
||||
|
||||
The functions listed here permit approximation of infinite
|
||||
sums, products, and other sequence limits.
|
||||
Use :func:`mpmath.fsum` and :func:`mpmath.fprod`
|
||||
for summation and multiplication of finite sequences.
|
||||
|
||||
Summation
|
||||
..........................................
|
||||
|
||||
:func:`~mpmath.nsum`
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
.. autofunction:: mpmath.nsum
|
||||
|
||||
:func:`~mpmath.sumem`
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
.. autofunction:: mpmath.sumem
|
||||
|
||||
:func:`~mpmath.sumap`
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
.. autofunction:: mpmath.sumap
|
||||
|
||||
Products
|
||||
...............................
|
||||
|
||||
:func:`~mpmath.nprod`
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
.. autofunction:: mpmath.nprod
|
||||
|
||||
Limits (``limit``)
|
||||
..................
|
||||
|
||||
:func:`~mpmath.limit`
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
.. autofunction:: mpmath.limit
|
||||
|
||||
Extrapolation
|
||||
..........................................
|
||||
|
||||
The following functions provide a direct interface to
|
||||
extrapolation algorithms. :func:`~mpmath.nsum` and :func:`~mpmath.limit`
|
||||
essentially work by calling the following functions with an increasing
|
||||
number of terms until the extrapolated limit is accurate enough.
|
||||
|
||||
The following functions may be useful to call directly if the
|
||||
precise number of terms needed to achieve a desired accuracy is
|
||||
known in advance, or if one wishes to study the convergence
|
||||
properties of the algorithms.
|
||||
|
||||
|
||||
:func:`~mpmath.richardson`
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
.. autofunction:: mpmath.richardson
|
||||
|
||||
:func:`~mpmath.shanks`
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
.. autofunction:: mpmath.shanks
|
||||
|
||||
:func:`~mpmath.levin`
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
.. autofunction:: mpmath.levin
|
||||
|
||||
:func:`~mpmath.cohen_alt`
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
.. autofunction:: mpmath.cohen_alt
|
||||
|
||||
Reference in New Issue
Block a user