Using Mathematica to evaluate Laplace Transforms and
their inverses, plus Cauchy’s PV prescription
Laplace Transforms (straightforward in Mathematica)
Here are the examples discussed in class
LaplaceTransform@1, t, pD1
p
LaplaceTransform@t^n, t, pDp
-1-nGamma@1 + nD
LaplaceTransform@Exp@a tD, t, pD1
-a + p
LaplaceTransform@Sin@b tD, t, pDb
b2 + p2
The results for L.T. of derivatives also come out simply:
LaplaceTransform@y'@tD, t, pDp LaplaceTransform@y@tD, t, pD - y@0DLaplaceTransform@y''@tD, t, pDp2LaplaceTransform@y@tD, t, pD - p y@0D - y
¢@0D
Checking the solution to Sec. 8.9 #4 (solved in class using L.T.)
InverseLaplaceTransform@1 � Hp^2 + 1L^2 + p � Hp^2 + 1L, p, tD
Cos@tD +1
2
H-t Cos@tD + Sin@tDL
Alternatively, solve directly:
TrigExpand@DSolve@8y''@tD + y@tD � Sin@tD, y@0D == 1, y'@0D � 0<, y@tD, tDD
::y@tD ® Cos@tD -1
2
t Cos@tD +Sin@tD
2
>>
Convolutions
Convolutions are defined for functions with infinite range in Mathematica
To use for our functions (which vanish for t<0) need to append a unit step.
Plot@UnitStep@tD, 8t, -1, 1<, PlotStyle ® 8Red, Thick<, Exclusions ® NoneD
-1.0 -0.5 0.5 1.0
0.2
0.4
0.6
0.8
1.0
Convolve[ ] has the form Convolve[ f[x], g[x], x, y (new variable)]
ConvolveB1
x4 + 1
, x, x, yF
Π y
2
Which we see is equivalent to,
IntegrateB1
Hy - xL4 + 1
* x, 8x, -¥, ¥<, Assumptions ® Im@yD � 0F
Π y
2
The order of the functions in a convolution doesn’t matter:
IntegrateB1
x4 + 1
* Hy - xL, 8x, -¥, ¥<, Assumptions ® Im@yD � 0F
Π y
2
Convolution needed for Sec. 8.10 #6
conv1 = Convolve@Exp@-a tauD UnitStep@tauD, Sinh@b tauD UnitStep@tauD � b, tau, tDHb ã-a t - b Cosh@b tD + a Sinh@b tDL UnitStep@tD
b Ha2 - b2LHere is the result we found in lecture notes:
conv2 = UnitStep@tD HExp@-a tD � H2 bLLHHExp@Ha + bL tD - 1L � Ha + bL + H1 - Exp@Ha - bL tDL � Ha - bLL
ã-a t J 1-ãHa-bL t
a-b+
-1+ãHa+bL t
a+bN UnitStep@tD
2 b
2 RevisedLT.nb
conv2 �� FullSimplify
Hb ã-a t - b Cosh@b tD + a Sinh@b tDL UnitStep@tDb Ha2 - b2L
They agree!
FullSimplify@conv1 - conv2D0
Inverse Laplace Transforms (with no pain)
Examples discussed in class, done using Bromwich integral:
InverseLaplaceTransform@1 � Hp - aL, p, tDãa t
InverseLaplaceTransform@1 � Hp^2 Hp + 1LL, p, tD-1 + ã
-t+ t
Sometimes you’ll need to FullSimplify a result from an InverseLaplaceTransform[ ] to get back what you
started with:
LaplaceTransform@Sin@tD Exp@tD, t, sD1
1 + H-1 + sL2
InverseLaplaceTransform@%, s, tD
-1
2
ä ãH1-äL t I-1 + ã
2 ä tM
% �� FullSimplify
1
1 + H-1 + sL2
(Cauchy) Principle Value Integral
Typically Mathematica will not let you integrate over a pole as the integral diverges at that point
RevisedLT.nb 3
PlotB1
x - 2, 8x, 0, 3<F
0.5 1.0 1.5 2.0 2.5 3.0
-5
5
IntegrateB1
x - 2, 8x, 0, 3<F
Integrate::idiv : Integral of
1
-2 + x
does not converge on 80, 3<. �
à0
3 1
-2 + x
âx
If we wanted to make sense of this integral somehow, we can use the Cauchy principle value of the
integral where you integrate excluding the pole and add the parts together.
IntegrateB1
x - 2, 8x, 0, 2 - a<, Assumptions ® a > 0F
LogBa2
F
IntegrateB1
x - 2, 8x, 2 + a, 3<, Assumptions ® 1 > a > 0F
-Log@aD
LimitBLogBa
2
F - Log@aD, a ® 0F
-Log@2DMathematica has this as the built in option “PrincipleValue”
IntegrateB1
x - 2, 8x, 0, 3<, PrincipalValue ® TrueF
-Log@2DThis also works for other integrals which are improper.
Consider a very simple example:
4 RevisedLT.nb
Integrate@x, 8x, -¥, ¥<D
Integrate::idiv : Integral of x does not converge on 8-¥, ¥<. �
à-¥
¥
x âx
This divergese because improper integrals are defined as:
à-¥
¥
f HxL â x = lima®¥
à-a
0
f HxL â x +limb®¥
à0
b
f HxL â x
and,
Integrate@x, 8x, 0, b<Db2
2
LimitBb2
2
, b ® ¥F
¥
The principle value in this case is defined by:
lima®¥
à-a
a
f HxL â x
Integrate@x, 8x, -¥, ¥<, PrincipalValue ® TrueD0
The result vanishes because the integrand is odd.
Recap of PV derivation done in class:
Often to do a principle value integral by hand you would use a contour integral, for example
IntegrateBExp@I * xD
x
, 8x, -¥, ¥<, PrincipalValue ® TrueF
ä Π
The contour we would use is:
RevisedLT.nb 5
ShowB:ListPlot@880, 0<<, PlotStyle ® [email protected],PlotRange ® 88-2, 2<, 8-2, 2<<, AspectRatio ® 1D,
GraphicsB:Text@C, 81.5, 1.5<D, Text@S, 8.25, .25<D, Text@r, 8.09, .13<D,
Text@R, 8-.7, .9<D, LineB:80, 0<, :.25
2
,
.25
2
>>F, LineB:80, 0<, :-2
2
,
2
2
>>F,
Line@88-2, 0<, 8-.25, 0<<D, [email protected], 0<, 82, 0<<D,[email protected], 1<, 81.3, 1.3<<D, [email protected], .1<, 8-.75, .1<<D,Circle@80, 0<, .25, 80, Π<D, Circle@80, 0<, 2, 80, Π<D>F>F
C
S
r
R
-2 -1 1 2
-2
-1
1
2
Where we care about the integral of the part over the real line in the limit as as r ® 0 and R® ¥
No poles are contained in the contour so we know:
limR®¥
r® 0
àC
+ àS
+à-R
-r
+àr
R
= 0
The C integral vanishes by Jordan’s lemma so:
limR®¥
r® 0
à-R
-r
+àr
R
= PV à-¥
¥
= -limr® 0
àS
The integral S is simply half what you would get for a full circle, integrated clockwise (so you get a -
sign) around the pole:
- -äΠ * ResidueBExp@I * zD
z
, 8z, 0<F
äΠ
A semicircle being half the value of the full circle is a lemma to the residue theorem which can be
proven by looking at the Laurent series about the pole and bounding non-pole term.
6 RevisedLT.nb
A semicircle being half the value of the full circle is a lemma to the residue theorem which can be
proven by looking at the Laurent series about the pole and bounding non-pole term.
To show it explicitly in this case:
z=r eiΘ, dz=i z dΘ
àΠ
0
i ei r e
iΘ
â Θ
As r ® 0:
àΠ
0
i â Θ = -iΠ
RevisedLT.nb 7