Laplace

Documentation for Laplace.

Laplace.hyper_fixed!Method
hyper_fixed!(out::AbstractVector{T}, f::Function, t::AbstractVector{T}; N::Int = 24)

Evalue the inverse Laplace transform of f over a vector of t using a fixed hyperbola contour. The result is stored in out which must be distinct from t (they cannot alias each other) and be a vector of zeros. See hyper_fixed for more details about the implementation.

Example

```jldoctest julia> t = 1.0:0.2:2.0; julia> out = zeros(eltype(t), length(t)); julia> InverseLaplace.hyper_fixed!(out, s -> 1/(s + 1), t) 6-element Vector{Float64}: 0.3678794411714416 0.3011942119122033 0.24659696394161384 0.20189651799466898 0.16529888822160033 0.13533528323663216

source
Laplace.hyper_fixedMethod
hyper_fixed(f::Function, t::AbstractVector; N::Int = 24)

Evaluate the inverse Laplace transform of f over a vector t by approximating the Bromwhich integral with a fixed hyperbola contour. A real valued time-domain signal is assumed with the integral being calculated by a computable series applying the midpoint rule. In contrast to hyperbola where the contour is dependent on 't', the contour is fixed over the entire vector of t values. This function should be used when F(s) is computationally expensive to minimize the number of evaulations of F(s) or when the transform needs to be applied over many values of t. It operates under the assumption that f(t) is needed for many values of t over some interval t ∈ (first(t):t[end]) and t>0. The number of nodes N can be increased for accuracy, however there is an optimal N that minimizes accuracy where error increases afterwords. This approach will in general be less accurate than hyperbola as we are using the same contour over an array of time values, instead of an optimized contour at each time. Bromwhich contour approaches should only be applied for t > 0. See also: hyper_fixed!, hyperbola, talbot, talbotarr

Example

```jldoctest julia> InverseLaplace.hyper_fixed(s -> 1/(s + 1), 2.0:3.0) 2-element Vector{Float64}: 0.13533528323660948 0.0497870683678199

source
Laplace.hyperbolaMethod
hyperbola(f::Function, t::AbstractFloat; N::Int = 16)

Evaluate the inverse Laplace transform of f at the point t by approximating the Bromwhich integral with a hyperbola contour. A real valued time-domain signal is assumed with the integral being calculated by a computable series applying the midpoint rule. The contour is defined by several parameters. μ controls the extreme nodes with a larger parameter moving the outlier nodes further into left half plane. h is the uniform node spacing with N being the number of nodes on the contour. The parameters depend on both t and N such that the function must be computed N times for each t. This is very inefficient especially if f is computational expensive, so this approach is recommended when only a few values of t are needed. However, this method will provide more accurate results at the cost of computational time compared to fixed contour approaches. The number of nodes, N, defaults to 16. The optimal N is case dependent and arbitrarily increasing N will not result in more accurate results. Smaller values of N will be faster. Bromwhich contour approaches should only be applied for t > 0. We are aiming to optimize the convergence as N -> inf so our parameters are ~ N / t. In other words we want the Bromwhich integral to converge rapidly, and this can be done by starting and ending our integration path in the left hand plane causing exp(st) to decay. If t = 0, the exponential factor does not cause good convergence. If you want to evaluate for t = 0, you should try a small positive value like 1e-30. See also: hyper_fixed, talbot, talbotarr

Example

```jldoctest julia> InverseLaplace.hyperbola(s -> 1/(s + 1), 2.0) 0.13533528323665164 julia> InverseLaplace.hyperbola.(s -> 1/(s + 1), 1.0:3.0) 3-element Vector{Float64}: 0.36787944117147775 0.13533528323665164 0.04978706836793606

source
Laplace.postwidMethod
postwid(func::Function, t::AbstractArray, v::Array{AbstractFloat,1}=_PWcoeffs(N))

Evaluate the inverse Laplace transform of func over an array of t using the Gaver-Stehfest "Post-Widder" algorithm. Computes coefficients once and calculates f(t) across available threads.

Example

julia> setprecision(53); postwid(s -> 1/(s + 1), 2.0:4.0)
 0.1353356835639731
 0.049786688998390505
 0.01831327193414956
source
Laplace.postwidMethod
postwid(func::Function, t::AbstractFloat, v::Array{AbstractFloat,1}=_PWcoeffs(N))

Evaluate the inverse Laplace transform of func at the point t using the Gaver-Stehfest "Post-Widder" algorithm. Vk coefficients only depend on the number of expansion terms so can be computed once. N (which must be even) defaults to 18. In general the accuracy in double precision is poor, so arbitrary precision is used throughout. Increasing precision should be accompanied by an increase in the number of coefficients used. Increasing precision without increasing number of coefficients will not yield better accuracy. The inverse is generally true as well. This method is not robust to oscillating F(t) and must be smooth.

Example

julia> setprecision(53); InverseLaplace.postwid(s -> 1/(s + 1), 2.0)
0.1353356835639731
source