mp_laplace¶
Class summary¶
Talbot (f[, n, shift, dps]) |
Numerical inverse Laplace transform using mpmath for high precision |
Module listing¶
this module implements numerical inverse laplace transform using mpmath
-
class
geotecha.mathematics.mp_laplace.
Talbot
(f, n=24, shift=0.0, dps=None)[source]¶ Bases:
object
Numerical inverse Laplace transform using mpmath for high precision
Parameters: - f : function or method
Function to perform inverse Laplace transform on. Function should be vectorised.
- n : even int, optional
Number of integration points. if n is even it will be rounded up to nearest even number Default n=24.
- shift : float
Shift contour to the right in case there is a pole on the positive real axis. Default shift=0.0.
- dps : int, optional
mpmath.mp.dps. Default dps=None i.e. use what exists usually 15. note that this changes the global dps value
See also
geotecha.mathematics.laplace.Talbot
- numerical inverse laplace without mpmath; less precision (though still adequate) but faster.
Notes
Talbot suggested that the Bromwich line be deformed into a contour that begins and ends in the left half plane, i.e., z infinity at both ends. Due to the exponential factor the integrand decays rapidly on such a contour. In such situations the trapezoidal rule converge extraordinarily rapidly.
Shift contour to the right in case there is a pole on the positive real axis : Note the contour will not be optimal since it was originally devoloped for function with singularities on the negative real axis For example take F(s) = 1/(s-1), it has a pole at s = 1, the contour needs to be shifted with one unit, i.e shift = 1.
References
Code adapted (vectorised, args added) from [1] and [2] (including much of the text taken verbatim). Algorithm from [3]:
[1] (1, 2) Created by Fernando Damian Nieuwveldt, 25 October 2009, fdnieuwveldt@gmail.com, http://code.activestate.com/recipes/576934-numerical-inversion-of-the-laplace-transform-using/ [2] (1, 2) Adapted to mpmath and classes by Dieter Kadelka, 27 October 2009, Dieter.Kadelka@kit.edu, http://code.activestate.com/recipes/578799-numerical-inversion-of-the-laplace-transform-with-/ [3] (1, 2) L.N.Trefethen, J.A.C.Weideman, and T.Schmelzer. Talbot quadratures and rational approximations. BIT. Numerical Mathematics, 46(3):653 670, 2006. Attributes: dps
Get the dps property.
Methods
__call__
(t[, args])Numerical inverse laplace transform of F at various time t. -
dps
¶ Get the dps property.