### Basic Examples

Basic Examples

In[]:=

The expression of this example has a known symbolic Laplace inverse :

[Exp[1-Sqrt[s]]s^(-3/4),s,3.7]

In[]:=

1.27511

Out[]=

so we can compare the result with the answer from symbolic evaluation:

InverseLaplaceTransform[Exp[1-s^(1/2)]s^(-3/4),s,t]

In[]:=

BesselK,

1-

1

8t

1

4

1

8t

2

πt

Out[]=

%/.{t3.7}

In[]:=

1.27511

Out[]=

This expression cannot be inverted symbolically, only numerically:

expr2=((-1.+100.*s)*Sinh[0.5*Sqrt[s]])/(s*(Sqrt[s]*Cosh[Sqrt[s]]+s*Sinh[Sqrt[s]]));

[expr2,s,0.2727]

In[]:=

30.658

Out[]=

### Scope

Scope

In[]:=

The t can be small or large and can contain constants (like π):

expr3=Log[p^(1/4)]p^(-1/4);

[expr3,p,6.310^-3],

[expr3,p,6.310^3],

[expr3,p,2Pi]

In[]:=

{2.58943,-0.00126528,-0.105385}

Out[]=

Compare with the answer from symbolic evaluation:

InverseLaplaceTransform[expr3,p,t]

In[]:=

-Log[t]+PolyGamma0,

1

4

4tGamma

3/4

1

4

Out[]=

%/.t{6.310^-3,6.310^3,2.Pi}

In[]:=

{2.58943,-0.00126528,-0.105385}

Out[]=

Expression [p]p is not a Laplace transform of anything, because a Laplace transform must tend to zero at p → ∞. Nevertheless, numerical inversion returns a result that makes sense:

expr4=Log[p]p;

[expr4,p,10.]

In[]:=

0.01

Out[]=

One way to look at expr4 is p^2*(Log[p]/p). Note that Log[p] / p is the Laplace transform of , and 0.01 is the second derivative of at t = 10:

f[t]=--[t]

f[t]

D[InverseLaplaceTransform[Log[p]/p,p,t],{t,2}]

In[]:=

1

t

2

Out[]=

%/.t10.

In[]:=

0.01

Out[]=

In other words, numerical inversion works on a larger class of functions than inversion, but the extension is coherent with the operational rules.

### Options

Options

In[]:=

The two options “Startm” and “Method” are introduced here considering the following Laplace transform pair:

◼

expr5=Log[s]/(1+s^2);f5[t_]=Cos[t]*SinIntegral[t]-Sin[t]*CosIntegral[t];

In[]:=

The inverse f5[t] is periodic-like, but not exactly periodic. At reasonably small t values there is no problem:

f5[20.],

[expr5,s,20.]

In[]:=

{0.591257,0.591257}

Out[]=

But already at the moderate value t = 100. we get a surprise:

f5[100.],

[expr5,s,100.]

In[]:=

{1.34453,-0.009998}

Out[]=

The result from the NInverseLaplaceTransform function is wrong, and – what is even worse – we do not get an error message. This is what is happening the background: the internal numerical inversion procedures “GWR” (Gaver-Wynn-rho) and “FT” (Fixed-Talbot ) provide the same wrong answer initially, so NInverseLaplaceTransform accepts it.

Tackling the problem with option “Startm”:

◼

The default value of option “Startm” is 5. In the “FT” and “GWR” internal inversion procedures 2^m terms are used, so the default means that initially the number of terms is set to 2^5 = 32. For the given problem this does not provide enough resolution.

We can try a larger “Startm”:

We can try a larger “Startm”:

[expr5,s,100.,{"Startm"6}]

In[]:=

-0.009998

Out[]=

The result is still wrong, but increasing the starting m again:

[expr5,s,100.,{"Startm"7}]

In[]:=

1.34453

Out[]=

already provides the correct answer. Any larger “Startm” would do the same.

(Changing the default to "Startm" 7 – or a larger number – would be, however, a waste of computational resources in most of the cases, so we stick with the default, "Startm" 5 .)

Tackling the problem with option “Method”:

◼

The other option is “Method”. It can be “FT”, “GWR” or “Automatic”. The default is “Automatic”, meaning that both internal procedures “FT” and “GWR” will be used – in an alternating manner.

If we explicitly set the method to "FT", only that internal procedure will be called. The above problem can be solved with the default "Startm", if we specify “Method” “GWR”:

(However, for significantly larger t values an elevated “Startm” is needed, whatever “Method” we specify. See additional remarks in the Author’s Notes.)

### Applications

Applications

In[]:=

In the next application we need to calculate average temperature. Assume that solving a differential equation we’ve obtained the following “analytical result” for the temperature as a function of time:

Symbolic integration is unable to calculate the average temperature in the time-interval between zero and one:

Now we try numerical integration with various options:

We see that numerical integration of this function is troublesome, so we recall that the Laplace transform of f7[t] is:

Using the operational rule for integration, the average temperature is:

### Possible Issues

Possible Issues

In[]:=

In this example the expr is not a Laplace transform, and the inversion attempt fails:

For some Laplace transforms, too large (or too small) t can be detrimental and the inversion fails. Consider the transform of Sin[t]:

A larger value of “Startm” will help:

but it is better to avoid large t-s, if the inverse is periodic.

expr10=(1-s/(Exp[s]-1))/s^5;

Do[{t, NInverseLaplaceTransform[expr10, s, t]} // Print, {t, 1.5, 2.5, 0.1}]

Do[{t, NInverseLaplaceTransform[expr10, s, t]} // Print, {t, 1.5, 2.5, 0.1}]

In[]:=

The following inverse has discontinuity at t = 25 and it is zero for t < 25 :

Leaving out the Dirac delta component, the result of numerical inversion should agree with the simple expression:

Approaching from above with the numerical inversion, we can get quite near to the discontinuity (though with increasing computation time):

Numerical inversion works the best if the inverse transform is an analytic function.

### Neat Examples

Neat Examples

In[]:=

We can check symbolically that the result of the numerical inversion is correct:

Here the inverse Laplace transform happens to be the two-parameter Mittag-Leffler function:

Here the Laplace transform expression cannot be cast easily into a “real-only” form (though it is real for positive s values):

We prepare a log-linear plot: