Maxima by Example: Ch.10: Fourier Series, Fourier and Laplace Transforms
Maxima by Example: Ch.10: Fourier Series, Fourier and Laplace Transforms
This version uses Maxima 5.18.1. This is a live document. Check http://www.csulb.edu/
n=1
[a
n
cos(nx) +b
n
sin(nx)] (10.1)
and the constant coefcients (a
n
, b
n
) are
a
n
=
1
n=1
_
a
n
cos
_
nx
p
_
+b
n
sin
_
nx
p
__
(10.4)
with the corresponding coefcients (for a
n
, n = 0, 1, ..., for b
n
, n = 1, ...):
a
n
=
1
p
_
p
p
f(y) cos
_
ny
p
_
dy, b
n
=
1
p
_
p
p
f(y) sin
_
ny
p
_
dy. (10.5)
We need to warn the user of the package fourie.mac that they use the symbol a
0
to mean our a
0
/2.
Our a
0
is dened by
a
0
=
1
p
_
p
p
f(x) dx (10.6)
The fourie.mac packages denition of their a
0
is
[a
0
]
fourie.mac
=
1
2p
_
p
p
f(x) dx (10.7)
which denes the average value of the function over the domain and which becomes the rst term of the fourier
series expansion they provide.
7
10.2.5 Fourier Series Expansion of the Function [x[
We dene the function to have period 4 with f(x) = [x[ for 2 x 2. This function is an even function of x
so the sin coefcients b
n
are all zero. The average value of [x[ over the domain (2, 2) is greater than zero so
we willl have a non-zero coefcient a
0
which we will calculate separately. We do this calculation by hand here.
Note that the Maxima function integrate cannot cope with abs(x):
(%i13) integrate(abs(x)
*
cos(n
*
%pi
*
x/2),x,-2,2)/2;
2
/
[ %pi n x
I abs(x) cos(-------) dx
] 2
/
- 2
(%o13) ---------------------------
2
so we will split up the region of integration into two sub-intervals: 2 x 0, in which [x[ = x, and the
interval 0 x 2 in which [x[ = x. We will use the formula Eq. (10.5) for the coefcients a
n
(note that
a
n
= 0 if n is even) and the expansion formula Eq. (10.4).
(%i1) (declare(n,integer),assume(n > 0), facts() );
(%o1) [kind(n, integer), n > 0]
(%i2) a0 :integrate(-x,x,-2,0)/2 + integrate(x,x,0,2)/2;
(%o2) 2
(%i3) an : integrate((-x)
*
cos(n
*
%pi
*
x/2),x,-2,0)/2 +
integrate(x
*
cos(n
*
%pi
*
x/2),x,0,2)/2;
n
4 (- 1) 4
(%o3) -------- - -------
2 2 2 2
%pi n %pi n
(%i4) an : (ratsimp(an), factor(%%) );
n
4 ((- 1) - 1)
(%o4) --------------
2 2
%pi n
(%i5) define(a(n),an);
n
4 ((- 1) - 1)
(%o5) a(n) := --------------
2 2
%pi n
(%i6) map( a, [1,2,3,4,5] );
8 8 8
(%o6) [- ----, 0, - ------, 0, - -------]
2 2 2
%pi 9 %pi 25 %pi
(%i7) fs(nmax) := a0/2 + sum(a(m)
*
cos(m
*
%pi
*
x/2),m,1,nmax)$
8
(%i8) map(fs, [1, 3, 5] );
%pi x 3 %pi x %pi x
8 cos(-----) 8 cos(-------) 8 cos(-----)
2 2 2
(%o8) [1 - ------------, - -------------- - ------------ + 1,
2 2 2
%pi 9 %pi %pi
5 %pi x 3 %pi x %pi x
8 cos(-------) 8 cos(-------) 8 cos(-----)
2 2 2
- -------------- - -------------- - ------------ + 1]
2 2 2
25 %pi 9 %pi %pi
(%i9) (load(draw),load(qdraw))$
qdraw(...), qdensity(...), syntax: type qdraw();
(%i10) qdraw( ex([abs(x),fs(1)],x,-2,2),key(bottom) )$
(%i11) qdraw( ex([abs(x),fs(1),fs(3)],x,-2,2),key(bottom) )$
(%i12) qdraw( ex([abs(x),fs(5) ],x,-2,2),key(bottom) )$
The rst function in the plot list is [x[, represented by abs(x), which appears in the color blue. We see that the
expansion out to n = 5 provides a close t to [x[. Here is that comparison:
0
0.5
1
1.5
2
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
1
2
Figure 3: n = 5 Approximation to [x[
We now try out the package fourie.mac on this example:
(%i1) ( load(fourie),facts() );
(%o1) []
(%i2) (declare(n,integer),facts());
(%o2) [kind(n, integer)]
9
(%i3) fourier(abs(x),x,2);
(%t3) a = 1
0
n
4 (- 1) 4
(%t4) a = -------- - -------
n 2 2 2 2
%pi n %pi n
(%t5) b = 0
n
(%o5) [%t3, %t4, %t5]
(%i6) clist : foursimp(%);
(%t6) a = 1
0
n
4 ((- 1) - 1)
(%t7) a = --------------
n 2 2
%pi n
(%t8) b = 0
n
(%o8) [%t6, %t7, %t8]
(%i9) facts();
(%o9) [kind(n, integer), n > 0]
(%i10) fs(nmax) := fourexpand(clist,x,2,nmax )$
(%i11) map( fs, [1,3,5] );
%pi x 3 %pi x %pi x
8 cos(-----) 8 cos(-------) 8 cos(-----)
2 2 2
(%o11) [1 - ------------, - -------------- - ------------ + 1,
2 2 2
%pi 9 %pi %pi
5 %pi x 3 %pi x %pi x
8 cos(-------) 8 cos(-------) 8 cos(-----)
2 2 2
- -------------- - -------------- - ------------ + 1]
2 2 2
25 %pi 9 %pi %pi
Notice that (a
0
)
fourie
= 1 =
1
2
(a
0
)
ourdef
, (see Eq. (10.7) ) so that fourie.macs expansion starts off with
the term a
0
rather than
1
2
a
0
. Of course, the actual end results look the same, with the rst term in this example
being 1, which is the average value of [x[ over the domain (2, 2).
Here we chose to use the package function foursimp to simplify the appearance of the coefcients. We see
that fourie.mac is able to cope with the appearance of abs(x) in the integrand, and produces the same
coefcients and expansions as were found by hand.
10
10.2.6 Fourier Series Expansion of a Rectangular Pulse
We dene f(x) to be a function of period 4, with f = 0 for 2 x < 1, 3/2 for 1 x 1 and f = 0 for
1 < x 2.
(%i1) f(x):= if x >= -1 and x <= 1 then 3/2 else 0$
(%i2) map(f, [-3/2,-1,0,1,3/2] );
3 3 3
(%o2) [0, -, -, -, 0]
2 2 2
(%i3) (load(draw),load(qdraw) )$
qdraw(...), qdensity(...), syntax: type qdraw();
(%i4) qdraw( yr(-0.5,2), ex1(f(x),x,-2,2,lw(5),lc(blue) ) )$
The plot of f(x) shows a square pulse with height 3/2 above the x axis and with a width of 2 units over the
interval 1 x 1. Over the rest of the domain 2 x 2, f(x) is dened to be zero.
-0.5
0
0.5
1
1.5
2
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Figure 4: Rectangular Pulse of Height 3/2
Although we can make a plot of the function f(x) as dened , Maximas integrate function cannot do anything
useful with it, and hence neither can fourie.mac at the time of writing.
(%i5) integrate(f(x),x,-2,2);
2
/
[ 3
(%o5) I (if (x >= - 1) and (x <= 1) then - else 0) dx
] 2
/
- 2
Hence we must compute the Fourier series expansion by hand. We see that f(x) is an even function
(f(x) = f(x)), so only the cos(nx/2) terms will contribute, so we only need to calculate the a
n
coef-
cients.
(%i6) (declare(n,integer), assume(n>0),facts() );
(%o6) [kind(n, integer), n > 0]
11
(%i7) a0 : (1/2)
*
integrate( (3/2),x,-1,1 );
3
(%o7) -
2
(%i8) define(a(n),(1/2)
*
integrate((3/2)
*
cos(n
*
%pi
*
x/2),x,-1,1));
%pi n
3 sin(-----)
2
(%o8) a(n) := ------------
%pi n
(%i9) map( a, makelist(i,i,1,7) );
3 1 3 3
(%o9) [---, 0, - ---, 0, -----, 0, - -----]
%pi %pi 5 %pi 7 %pi
We see that for n > 0, a
n
= 0 for n even, and the non-zero coefcients have n = 1, 3, 5, 7, .... Hence we only
get a better approximation if we increase n
max
by 2 each time.
(%i10) fs(nmax) := a0/2 + sum( a(m)
*
cos(m
*
%pi
*
x/2),m,1,nmax )$
(%i11) map( fs, [1,3] );
%pi x 3 %pi x %pi x
3 cos(-----) cos(-------) 3 cos(-----)
2 3 2 2 3
(%o11) [------------ + -, - ------------ + ------------ + -]
%pi 4 %pi %pi 4
(%i12) qdraw( yr(-0.5,2),ex([f(x),fs(1),fs(3) ],x,-2,2) )$
(%i13) qdraw( yr(-0.5,2),ex([f(x),fs(11) ],x,-2,2) )$
The plot with the approximations fs(1) and fs(3) was drawn rst.
-0.5
0
0.5
1
1.5
2
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
1
2
3
Figure 5: nmax = 1, 3 Approx. to Rectangular Pulse
12
Then a plot showing the fs(11) approximation:
-0.5
0
0.5
1
1.5
2
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
1
2
Figure 6: nmax = 11 Approx. to Rectangular Pulse
10.2.7 Fourier Series Expansion of a Two Element Pulse
We compute the Fourier series expansion of a function which has the denition over the interval (10, 10)
(and whose Fourier series expansion will be a function with period 20 for all x) given by: for 10 x < 5,
f = 0, and for 5 x < 0, f = 5, and for 0 x 5, f = 5, and for 5 < x 10, f = 0. First we dene
such a function for our plots.
(%i1) f(x):= if x >= -5 and x < 0 then -5
elseif x >= 0 and x <= 5 then 5 else 0$
(%i2) map(f,[-6,-5,-1,0,1,5,6]);
(%o2) [0, - 5, - 5, 5, 5, 5, 0]
and plot the function
(%i3) ( load(draw),load(qdraw) )$
qdraw(...), qdensity(...), syntax: type qdraw();
(%i4) qdraw( yr(-8,8), ex1(f(x),x,-10,10,lw(5),lc(blue) ) )$
which looks like
-8
-6
-4
-2
0
2
4
6
8
-10 -5 0 5 10
Figure 7: Two Element Pulse with Period 20
13
Since we have an odd function, only terms like b
n
sin(nx/10) will contribute to the expansion, but, just for
practice, we nd a
n
too.
(%i5) a0 : (1/10)
*
( integrate( -5, x, -5, 0 ) +
integrate( 5, x, 0, 5 ) );
(%o5) 0
(%i6) an : (1/10)
*
(integrate( -5
*
cos( n
*
%pi
*
x/10 ), x, -5, 0 ) +
integrate(5
*
cos(n
*
%pi
*
x/10), x, 0, 5 ) );
(%o6) 0
(%i7) bn : ( (1/10)
*
(integrate( -5
*
sin(n
*
%pi
*
x/10), x, -5, 0 ) +
integrate( 5
*
sin(n
*
%pi
*
x/10), x, 0, 5 ) ),
ratsimp(%%) );
%pi n
10 cos(-----) - 10
2
(%o7) - ------------------
%pi n
(%i8) define( b(n), bn );
%pi n
10 cos(-----) - 10
2
(%o8) b(n) := - ------------------
%pi n
(%i9) map(b,makelist(i,i,1,7));
10 10 10 2 10 10
(%o9) [---, ---, -----, 0, ---, -----, -----]
%pi %pi 3 %pi %pi 3 %pi 7 %pi
(%i10) fs(nmax) := sum( b(m)
*
sin(m
*
%pi
*
x/10), m, 1, nmax )$
(%i11) map(fs,[1,2,3]);
%pi x %pi x %pi x
10 sin(-----) 10 sin(-----) 10 sin(-----)
10 5 10
(%o11) [-------------, ------------- + -------------,
%pi %pi %pi
3 %pi x %pi x %pi x
10 sin(-------) 10 sin(-----) 10 sin(-----)
10 5 10
--------------- + ------------- + -------------]
3 %pi %pi %pi
(%i12) qdraw( xr(-15, 15), yr(-10, 10),
ex( [f(x), fs(1), fs(2) ], x, -10, 10 ) )$
The plot of f(x) with the two lowest approximations looks like
-10
-5
0
5
10
-15 -10 -5 0 5 10 15
1
2
3
Figure 8: Two Lowest Order Approximations
14
The expansion fs(11) does pretty well as a rough approximation
(%i13) qdraw( xr(-15, 15), yr(-10, 10),
ex( [ f(x), fs(11) ], x, -10, 10 ) )$
-10
-5
0
5
10
-15 -10 -5 0 5 10 15
1
2
Figure 9: nmax = 11 Approx. to Two Element Pulse
Whether you are working with a periodic function or not, the Fourier series expansion always represents a
periodic function for all x. For this example, the period is 20, and if we make a plot of fs(11) over the range
[-10, 30], we are including two periods.
(%i14) qdraw(yr(-10, 10),ex( fs(11), x, -10 , 30 ) )$
which looks like
-10
-5
0
5
10
-10 -5 0 5 10 15 20 25 30
1
Figure 10: nmax = 11 Approx. Drawn for Two Periods
15
10.2.8 Exponential Form of a Fourier Series Expansion
The exponential form of a Fourier series can be based on the completeness and orthogonality (in the Hermitian
sense) of the set of exponential functions
_
exp
_
2i nx
b a
__
(n = 0, 1, 2, ) (10.8)
on the interval (a, b). Dene the function
n
(x) as
n
(x) = exp
_
2i nx
b a
_
. (10.9)
This function has the properties
n
(x) =
n
(x)
,
n
(x)
n
(x)
= 1. (10.10)
in which the asterisk indicates the complex conjugate.
The (Hermitian) orthogonality of the
n
(x) over (a, b) is expressed by
_
b
a
n
(x)
m
(x)
dx = (b a)
nm
, (10.11)
in which the Kronecker delta symbol is
nm
=
_
1 for n = m
0 for n ,= m.
_
(10.12)
Eq.(10.11) is clearly true for n = m, using Eq.(10.10). For m ,= n, we can simplify this integral by us-
ing the exponential product law e
A
e
B
= e
A+B
, letting r = mn ,= 0, and changing the variable of inte-
gration x y via x = (b a) y +a. The resulting integral in terms of y will then be over the interval
(0, 1). The differential dx (b a) dy and (b a) comes outside the integral. Also, inside the exponential,
x/(b a) a/(b a) +y, and we can take outside an exponential function of a constant. Thus the integral
is proportional to
_
1
0
exp(2i r y) dy, which is proportional to exp(2i r) 1 = exp(2i)
r
1 = 0.
We now write some function of x as a linear combination of the
n
(x) with coefcients C
n
to be determined.
f(x) =
n=
C
n
n
(x). (10.13)
To nd the C
n
, we multiply both sides of Eq.(10.13) by
m
(x)
dx =
n=
C
n
_
b
a
n
(x)
m
(x)
dx
=
n=
C
n
(b a)
nm
= (b a) C
m
.
16
Hence we have for the coefcients
C
n
=
1
(b a)
_
b
a
f(x)
n
(x)
dx. (10.14)
Inserting these coefcients into Eq.(10.13) we can write
f(x) =
n=
C
n
n
(x)
=
exp
_
2i nx
b a
_
1
b a
_
b
a
f(y) exp
_
2i ny
b a
_
dy
=
1
b a
_
b
a
f(y) exp
_
2i n(y x)
b a
_
dy.
We now separate out the n = 0 term and combine the n = m terms into a sum over the positive integers.
f(x) =
1
b a
_
b
a
f(y) dy +
1
b a
n=1
_
b
a
f(y)
_
exp
_
2i n(y x)
b a
_
+exp
_
2i n(y x)
b a
__
dy
=
1
b a
_
b
a
f(y) dy +
2
b a
n=1
_
b
a
f(y) cos
_
2n(y x)
b a
_
dy
Using the trig identity cos(AB) = cosAcosB+sinAsinB, we recover the trigonometric form of the
Fourier series expansion of a function over the interval (a, b), which will represent a function which has period
equal to (b - a) for all values of x.
f(x) =
1
2
a
0
+
n=1
_
a
n
cos
_
2nx
b a
_
+b
n
sin
_
2 nx
b a
__
(10.15)
The coefcients are given by the integrals
a
n
=
2
b a
_
b
a
f(y) cos
_
2ny
b a
_
dy, b
n
=
2
b a
_
b
a
f(y) sin
_
2 ny
b a
_
dy. (10.16)
The expansion starts with the term
f(x) =
1
2
a
0
+ =
1
b a
_
b
a
f(y) + (10.17)
which is the (unweighted) average of f(x) over (a, b).
If we specialize to a function dened over the interval (-p, p), whose Fourier expansion will represent a function
which has period 2 p for all x, the above results have the replacements 2/(b a) 2/(2p) 1/p, and the
appropriate exspansion equations are
f(x) =
1
2
a
0
+
n=1
_
a
n
cos
_
nx
p
_
+b
n
sin
_
nx
p
__
(10.18)
with coefcients
a
n
=
1
p
_
p
p
f(y) cos
_
ny
p
_
dy, b
n
=
1
p
_
p
p
f(y) sin
_
ny
p
_
dy. (10.19)
17
If we specialize further to p = , the appropriate equations are
f(x) =
1
2
a
0
+
n=1
[a
n
cos(nx) +b
n
sin(nx)] (10.20)
with coefcients
a
n
=
1
_
0
cos(x) f(x) dx (10.22)
The given function f(x) can then be written as an integral over positive values of :
f(x) =
_
0
F
C
(f, ) cos(x) d (10.23)
The two equations (10.22) and (10.23) are an example of a Fourier transform pair, which include conventions
about where to place the factor of 2/.
Here is a simple example. We let the function be f(x) = sin(x) e
x
, dened for x 0. Let the letter w be
used to stand for . We rst calculate the Fourier cosine transform F
C
(f, ) (we use the symbol fcw in our
work here) using integrate and then show that the inverse integral over gives back the original function.
(%i1) f:sin(x)
*
exp(-x)$
(%i2) integrate(f
*
cos(w
*
x),x,0,inf);
2
2 2 w
(%o2) ------ - --------
4 4
w + 4 2 w + 8
(%i3) fcw : (2/%pi)
*
ratsimp(%);
2
2 (w - 2)
(%o3) - ------------
4
%pi (w + 4)
(%i4) integrate(fcw
*
cos(w
*
x),w,0,inf);
Is x positive, negative, or zero?
p;
- x
(%o4) %e sin(x)
18
We can also use the package fourie.mac, which we explored in the section on Fourier series. This package
provides for the calculation of our Fourier cosine transform integral via the fourintcos(expr,var) function.
The function fourintcos(f,x) returns an answer with the label a
z
which contains the Fourier cosine integral
F
C
(f, z), with the letter z being the package convention for what we called w (),
(%i5) load(fourie);
(%o5) C:/PROGRA1/MAXIMA3.1/share/maxima/5.18.1/share/calculus/fourie.mac
(%i6) fourintcos(f,x);
2
2 z
2 (------ - ------)
4 4
z + 4 z + 4
(%t6) a = -------------------
z %pi
(%o6) [%t6]
(%i7) az : ratsimp(rhs(%t6));
2
2 z - 4
(%o7) - --------------
4
%pi z + 4 %pi
(%i8) (2/%pi)
*
ratsimp(%pi
*
az/2);
2
2 (z - 2)
(%o8) - ------------
4
%pi (z + 4)
Thus fourintcos(expr,var) agrees with our denition of the Fourier cosine transform.
10.3.2 Fourier Sine Integrals and fourintsin(..)
Given some function f(x) dened for x 0, we dene the Fourier sine transform of this function as
F
S
(f, ) =
2
_
0
sin(x) f(x) dx (10.24)
The given function f(x) can then be written as an integral over positive values of :
f(x) =
_
0
F
S
(f, ) sin(x) d (10.25)
The two equations (10.24) and (10.25) are another Fourier transform pair, which include conventions about
where to place the factor of 2/.
19
Here is a simple example. We let the function be f(x) = cos(x) e
x
, dened for x 0. Let the letter w stand
for . We rst calculate the Fourier sine transform F
S
(f, ) (we use the symbol fsw in our work here) using
integrate and then show that the inverse integral over gives back the original function.
(%i1) f:cos(x)
*
exp(-x)$
(%i2) assume(w>0)$
(%i3) integrate(f
*
sin(w
*
x),x,0,inf);
3
w
(%o3) ------
4
w + 4
(%i4) fsw : (2/%pi)
*
%;
3
2 w
(%o4) ------------
4
%pi (w + 4)
(%i5) integrate(fsw
*
sin(w
*
x),w,0,inf);
Is x positive, negative, or zero?
p;
- x
(%o5) %e cos(x)
We can also use the package fourie.mac, which we used above. This package provides for the calculation of
our Fourier sine transform integral via the fourintsin(expr,var) function. The function fourintsin(f,x) returns
an answer with the label b
z
which contains the Fourier sine integral F
S
(f, z), with the letter z being the
package convention for what we called w ().
(%i6) load(fourie);
(%o6) C:/PROGRA1/MAXIMA3.1/share/maxima/5.18.1/share/calculus/fourie.mac
(%i7) facts();
(%o7) [w > 0]
(%i8) (forget(w>0),facts());
(%o8) []
(%i9) fourintsin(f,x);
3
2 z
(%t9) b = ------------
z 4
%pi (z + 4)
(%o9) [%t9]
(%i10) bz : rhs(%t9);
3
2 z
(%o10) ------------
4
%pi (z + 4)
Thus fourintsin(expr,var) agrees with our denition of the Fourier sine transform.
20
10.3.3 Exponential Fourier Integrals and fourint
Given some function f(x) dened for < x < , we dene the exponential Fourier transform of this
function as
F
Exp
(f, ) =
1
2
_
f(x)e
i x
dx (10.26)
The given function f(x) can then be written as an integral over both positive and negative values of :
f(x) =
_
F
Exp
(f, ) e
i x
d (10.27)
The two equations (10.26) and (10.27) are another Fourier transform pair, which include conventions about
where to place the factor of 2 as well as which member has the minus sign in the exponent.
If the given function is even, f(x) = f(x), then the exponential Fourier transform has the symmetry
F
Exp
(f, ) = F
Exp
(f, ) (10.28)
and can be expressed in terms of the Fourier cosine transform:
F
Exp
(f, ) =
1
2
F
C
(f, ). (10.29)
If the given function is odd, f(x) = f(x), then the exponential Fourier transform has the symmetry
F
Exp
(f, ) = F
Exp
(f, ) (10.30)
and can be expressed in terms of the Fourier sine transform:
F
Exp
(f, ) =
i
2
F
S
(f, ). (10.31)
If the given function is neither even nor odd, the function can always be written as the sum of an even function
f
e
(x) and an odd function f
o
(x):
f(x) f
e
(x) +f
o
(x) =
1
2
(f(x) +f(x) +
1
2
(f(x) f(x) (10.32)
and can be expressed in terms of the Fourier cosine transform of f
e
(x) and the Fourier sine transform of f
o
(x):
F
Exp
(f, ) F
Exp
(f
e
+f
o
, ) =
1
2
F
C
(f
e
, ) +
i
2
F
S
(f
o
, ) (10.33)
The fourie.mac package function fourint(expr,var) displays the non-zero coefcients a
z
and/or the b
z
, in
terms of which we can write down the value of F
Exp
(f, z) (with our conventions):
F
Exp
(f, z) =
1
2
a
z
+
i
2
b
z
(10.34)
10.3.4 Example 1: Even Function
We calculate here the exponential fourier transformF
Exp
(f, ) when the function is f(x) = cos(x) e
|x|
which
is an even function f(x) = f(x) and is dened for < x < .
We rst use integrate, by separating the integral into two pieces, i1 is the integral over (, 0) and i2 is the
integral over (0, ) (we ignore the overall factor of 1/(2) initially).
21
(%i1) assume(w>0)$
(%i2) i1:integrate(exp(%i
*
w
*
x)
*
cos(x)
*
exp(x),x,minf,0);
2 3
w + 2 %i w
(%o2) ------ - ------
4 4
w + 4 w + 4
(%i3) i2:integrate(exp(%i
*
w
*
x)
*
cos(x)
*
exp(-x),x,0,inf);
3 2
%i w w + 2
(%o3) ------ + ------
4 4
w + 4 w + 4
(%i4) i12:ratsimp(i1+i2);
2
2 w + 4
(%o4) --------
4
w + 4
(%i5) 2
*
ratsimp(i12/2);
2
2 (w + 2)
(%o5) ----------
4
w + 4
(%i6) iexp:%/(2
*
%pi);
2
w + 2
(%o6) ------------
4
%pi (w + 4)
Hence, direct use of integrate provides the exponential Fourier transform
F
Exp
(cos(x) exp([x[), ) =
2
+2
(
4
+4)
(10.35)
We can use integrate to calculate the inverse Fourier exponential transform, recovering our original even
function of x.
(%i7) integrate(exp(-%i
*
w
*
x)
*
iexp,w,minf,inf);
Is x positive, negative, or zero?
p;
- x
(%o7) %e cos(x)
(%i8) integrate(exp(-%i
*
w
*
x)
*
iexp,w,minf,inf);
Is x positive, negative, or zero?
n;
x
(%o8) %e cos(x)
22
Next we use integrate again directly to calculate the Fourier cosine transform of the given even function, now
considered as dened for x 0 and conrm that the required exponential Fourier transform in this case is
correctly given by
1
2
F
C
(f, ).
(%i9) i3:ratsimp(integrate(cos(x)
*
exp(-x)
*
cos(w
*
x),x,0,inf));
2
w + 2
(%o9) ------
4
w + 4
(%i10) i3:(2/%pi)
*
i3;
2
2 (w + 2)
(%o10) ------------
4
%pi (w + 4)
Output %o10 is the value of F
C
(f, ), and one half of that value is the required exponential Fourier transform.
Next we use fourint(expr,var) with this even function.
(%i1) load(fourie);
(%o1) C:/PROGRA1/MAXIMA3.1/share/maxima/5.18.1/share/calculus/fourie.mac
(%i2) fourint(cos(x)
*
exp(-abs(x)),x);
2
z 2
2 (------ + ------)
4 4
z + 4 z + 4
(%t2) a = -------------------
z %pi
(%t3) b = 0
z
(%o3) [%t2, %t3]
(%i4) ratsimp(rhs(%t2));
2
2 z + 4
(%o4) --------------
4
%pi z + 4 %pi
(%i5) (2/%pi)
*
ratsimp(%pi
*
%/2);
2
2 (z + 2)
(%o5) ------------
4
%pi (z + 4)
which conrms that for an even function, the required exponential Fourier transform is correctly given (using
fourint) by F
Exp
(f, z) = a
z
/2.
23
10.3.5 Example 2: Odd Function
We calculate here the exponential fourier transformF
Exp
(f, ) when the function is f(x) = sin(x) e
|x|
which
is an odd function f(x) = f(x) and is dened for < x < .
We rst use integrate, by separating the integral into two pieces, i1 is the integral over (, 0) and i2 is the
integral over (0, ) (we ignore the overall factor of 1/(2) initially).
(%i1) ( assume(w>0), facts());
(%o1) [w > 0]
(%i2) i1:ratsimp(integrate(exp(%i
*
w
*
x)
*
sin(x)
*
exp(x),x,minf,0));
2
w + 2 %i w - 2
(%o2) ---------------
4
w + 4
(%i3) i2:ratsimp(integrate(exp(%i
*
w
*
x)
*
sin(x)
*
exp(-x),x,0,inf));
2
w - 2 %i w - 2
(%o3) - ---------------
4
w + 4
(%i4) iexp:ratsimp(i1+i2)/(2
*
%pi);
2 %i w
(%o4) ------------
4
%pi (w + 4)
(%i5) facts();
(%o5) [w > 0]
Hence, direct use of integrate provides the exponential Fourier transform
F
Exp
(sin(x) exp([x[), ) =
2i
(
4
+4)
(10.36)
We can use integrate to calculate the inverse Fourier exponential transform, recovering our original odd func-
tion of x.
(%i6) integrate(exp(-%i
*
w
*
x)
*
iexp,w,minf,inf);
Is x positive, negative, or zero?
p;
- x
(%o6) %e sin(x)
(%i7) integrate(exp(-%i
*
w
*
x)
*
iexp,w,minf,inf);
Is x positive, negative, or zero?
n;
x
(%o7) %e sin(x)
(%i8) facts();
(%o8) [w > 0]
24
Next we use integrate again directly to calculate the Fourier sine transform of the given odd function, now
considered as dened for x 0 and conrm that the required exponential Fourier transform in this case is
correctly given by
i
2
F
S
(f, ).
(%i9) ratsimp(integrate(sin(x)
*
exp(-x)
*
sin(w
*
x),x,0,inf));
2 w
(%o9) ------
4
w + 4
(%i10) (2/%pi)
*
%;
4 w
(%o10) ------------
4
%pi (w + 4)
Output %o10 is the value of F
S
(f, ), and multiplying by i/2 yields the required exponential Fourier trans-
form.
Next we use fourint(expr,var) with this odd function.
(%i11) load(fourie);
(%o11) C:/PROGRA1/MAXIMA3.1/share/maxima/5.18.1/share/calculus/fourie.mac
(%i12) fourint(sin(x)
*
exp(-abs(x)),x);
(%t12) a = 0
z
4 z
(%t13) b = ------------
z 4
%pi (z + 4)
(%o13) [%t12, %t13]
which conrms that for an odd function, the required exponential Fourier transform is correctly given (using
fourint) by F
Exp
(f, z) = (i b
z
)/2.
25
10.3.6 Example 3: A Function Which is Neither Even nor Odd
We calculate here the exponential fourier transform F
Exp
(f, ) when the function is f(x) = cos
2
(x 1) e
|x|
which is dened for < x < and is neither even nor odd.
We rst use integrate, by separating the integral into two pieces. i1 is the integral over (, 0) and i2 is the
integral over (0, ) (we ignore the overall factor of 1/(2) initially).
(%i1) ( assume(w>0), facts());
(%o1) [w > 0]
(%i2) i1:ratsimp(integrate(exp(%i
*
w
*
x)
*
cos(x-1)2
*
exp(x),x,minf,0));
5 4
(%o2) - ((%i cos(2) + %i) w + (- 2 sin(2) - cos(2) - 1) w
3 2
+ (- 4 %i sin(2) - 2 %i cos(2) - 6 %i) w + (8 sin(2) - 6 cos(2) + 6) w
+ (- 4 %i sin(2) - 3 %i cos(2) + 25 %i) w + 10 sin(2) - 5 cos(2) - 25)
6 4 2
/(2 w - 10 w + 38 w + 50)
(%i3) i2:ratsimp(integrate(exp(%i
*
w
*
x)
*
cos(x-1)2
*
exp(-x),x,0,inf));
5 4
(%o3) ((%i cos(2) + %i) w + (- 2 sin(2) + cos(2) + 1) w
3 2
+ (4 %i sin(2) - 2 %i cos(2) - 6 %i) w + (8 sin(2) + 6 cos(2) - 6) w
+ (4 %i sin(2) - 3 %i cos(2) + 25 %i) w + 10 sin(2) + 5 cos(2) + 25)
6 4 2
/(2 w - 10 w + 38 w + 50)
(%i4) i12 : rectform(ratsimp(i1 + i2));
4 2
(cos(2) + 1) w + (6 cos(2) - 6) w + 5 cos(2) + 25
(%o4) ---------------------------------------------------
6 4 2
w - 5 w + 19 w + 25
3
%i (4 sin(2) w + 4 sin(2) w)
+ -----------------------------
6 4 2
w - 5 w + 19 w + 25
(%i5) i12 : map(ratsimp,i12);
4 2
(cos(2) + 1) w + (6 cos(2) - 6) w + 5 cos(2) + 25 4 %i sin(2) w
(%o5) --------------------------------------------------- + --------------
6 4 2 4 2
w - 5 w + 19 w + 25 w - 6 w + 25
(%i6) i12 : realpart(i12)/(2
*
%pi) + %i
*
imagpart(i12)/(2
*
%pi);
4 2
(cos(2) + 1) w + (6 cos(2) - 6) w + 5 cos(2) + 25
(%o6) ---------------------------------------------------
6 4 2
2 %pi (w - 5 w + 19 w + 25)
2 %i sin(2) w
+ --------------------
4 2
%pi (w - 6 w + 25)
The nal i12 is the desired exponential Fourier transform.
26
We can now calculate the inverse Fourier transform.
(%i7) integrate(exp(-%i
*
w
*
x)
*
i12,w,minf,inf);
Is x positive, negative, or zero?
p;
- x
%e (sin(2) sin(2 x) + cos(2) cos(2 x) + 1)
(%o7) ---------------------------------------------
2
As an exercise in the manipulation of trigonometric functions, we nowgo back and forth between the coefcient
of %e(-x) in this result and our starting function (for positive x).
(%i8) cos(x-1)2;
2
(%o8) cos (x - 1)
(%i9) trigreduce(%);
cos(2 (x - 1)) + 1
(%o9) ------------------
2
(%i10) ratsimp(%);
cos(2 x - 2) + 1
(%o10) ----------------
2
(%i11) trigexpand(%);
sin(2) sin(2 x) + cos(2) cos(2 x) + 1
(%o11) -------------------------------------
2
which gets us from the original coefcient to that returned by our inverse transform integral. Now we go in the
opposite direction:
(%i12) trigreduce(%);
cos(2 x - 2) + 1
(%o12) ----------------
2
(%i13) factor(%);
cos(2 (x - 1)) + 1
(%o13) ------------------
2
(%i14) trigexpand(%);
2 2
- sin (x - 1) + cos (x - 1) + 1
(%o14) -------------------------------
2
(%i15) trigsimp(%);
2
(%o15) cos (x - 1)
which returns us from the transform integral coefcient to our original coefcient. Hence we have veried the
correctness of the exponential Fourier transform for this case.
27
Next we use fourint(expr,var) with this function which is neither even nor odd.
(%i16) load(fourie);
(%o16) C:/PROGRA1/MAXIMA3.1/share/maxima/5.18.1/share/calculus/fourie.mac
(%i17) fourint(cos(x-1)2
*
exp(-abs(x)),x);
4 2
(cos(2) + 1) z + (6 cos(2) - 6) z + 5 cos(2) + 25
(%t17) a = ---------------------------------------------------
z 6 4 2
%pi (z - 5 z + 19 z + 25)
4 sin(2) z
(%t18) b = --------------------
z 4 2
%pi (z - 6 z + 25)
(%o18) [%t17, %t18]
(%i19) az : rhs(%t17);
4 2
(cos(2) + 1) z + (6 cos(2) - 6) z + 5 cos(2) + 25
(%o19) ---------------------------------------------------
6 4 2
%pi (z - 5 z + 19 z + 25)
(%i20) bz : rhs(%t18);
4 sin(2) z
(%o20) --------------------
4 2
%pi (z - 6 z + 25)
(%i21) iexp_f : az/2 + %i
*
bz/2;
4 2
(cos(2) + 1) z + (6 cos(2) - 6) z + 5 cos(2) + 25
(%o21) ---------------------------------------------------
6 4 2
2 %pi (z - 5 z + 19 z + 25)
2 %i sin(2) z
+ --------------------
4 2
%pi (z - 6 z + 25)
To compare this with our result using integrate we need to replace z by w:
(%i22) subst(z=w,iexp_f) - i12;
(%o22) 0
which shows that, except for notation, the results are the same. We have conrmed that for a general function,
the required exponential Fourier transform is correctly given (using fourint) by F
Exp
(f, z) = a
z
/2 + (i b
z
)/2.
10.3.7 Dirac Delta Function (x)
It is conventional to dene the Dirac delta function (unit impulse function) (x) by
(x) = (x) even function (10.37)
(x) = 0 for x ,= 0 (10.38)
_
b
a
(x) dx = 1 for a, b > 0 (10.39)
28
These equations imply
(y x) = (x y) (10.40)
and
_
f(y) (y x) dy = f(x) (10.41)
for any well behaved function f(x) (we are more careful below), provided the range of integration includes the
point x. For since (y x) is zero except at the single point y = x, we can evaluate f(y) at that single point
and take the result outside the integral. The resulting integral which is left is
_
(y x) dy, and the change of
variables y t = y x for xed x yields the integral
_
(t) dt = 1.
Now let c be a positive constant (independent of the integration variable x). In the integral
_
b
a
(c x) dx, we
change variables, x y = c x so dx = dy/c.
_
b
a
(c x) dx =
1
c
_
c b
c a
(y) dy =
1
c
(10.42)
since (c a) > 0 and (c b) > 0.
If, on the other hand, c is a negative constant, c = [c[, and we make the same change of variables,
_
b
a
(c x) dx =
1
c
_
c b
c a
(y) dy =
1
c
_
|c| b
|c| a
(y) dy =
1
c
_
|c| a
|c| b
(y) dy =
1
[c[
(10.43)
Evidently, we can always write (since both x and y are dummy integration variables
_
(c x) dx =
_
(x)
[c[
dx (10.44)
or simply (with the understanding that this kind of relation only makes sense inside an integral)
(c x) =
(x)
[c[
(10.45)
We can nd a sometimes useful representation of the Dirac delta function by using the exponential Fourier
transform pair Eqs.(10.26) and (10.27). If we use y as the (dummy) variable of integration in Eq.(10.26), and
insert into Eq.(10.27), we get (interchanging the order of integration)
f(x) =
_
_
1
2
_
e
i y
f(y) dy
_
e
i x
d
=
_
f(y)
_
1
2
_
e
i (yx)
d
_
dy
=
_
f(y) (y x) dy
Hence we can write
(x) =
1
2
_
e
i x
d (10.46)
One use of such a representation of the one dimensional Dirac delta function is to derive in a different way the
result of Eq.(10.45). From Eq.(10.46) we have
(c x) =
1
2
_
e
i c x
d (10.47)
29
Again, suppose c is a constant and c > 0. Then if we change variables y = c, we have d = dy/c.
When = , y = . When = , y = . Hence
(c x) =
1
c
_
1
2
_
e
i yx
dy
_
=
1
c
(x) (10.48)
If, on the other hand, c < 0, c = [c[ in Eq.(10.47), and we make the same change of variables, when
= , y = , and when = , y = . Hence, for this case,
(c x) =
1
c
_
1
2
_
e
i y x
dy
_
=
1
c
_
1
2
_
e
i yx
dy
_
=
1
[c[
(x). (10.49)
Combining the two cases leads us again to Eq.(10.45).
Although the representation Eq.(10.46) can be useful for formal properties of the Dirac delta function, for
actual calculation of integrals one is safer using a limiting form of that result, or even simpler versions, as we
will see. If we replace the innite limits in Eq.(10.46) by nite limits, we can work with the representation
(x) = lim
L
d
L
(x) (10.50)
where
d
L
(x) =
1
2
_
L
L
e
i xy
dy =
sin(xL)
x
(10.51)
which can then be used as
_
f(x) (x) dx = lim
L
_
f(x) d
L
(x) dx = lim
L
_
f(x)
sin(xL)
x
. (10.52)
However, this will only be useful if the resulting integrals can be done.
An easier approach to the careful use of the Dirac delta function for the calculation of integrals is to create a
mathematically simple model of a function of x which has the required properties and whose use will result
in integrals which can easily be done. Mathematically rigorous treatments (see the Theory of Distributions) of
the Dirac delta function justify the use of such models .
Here we follow the approach of William E. Boyce and Richard C. DiPrima, in their textbook Elementary Dif-
ferential Equations and Boundary Value Problems, Fifth Edition, John Wiley & Sons, Inc, New York, 1992,
Section 6.5, Impulse Functions.
Let
d
(x) =
_
1/(2 ) for < x <
0 for x or x
_
(10.53)
which denes a rectangular pulse with base length 2, height 1/(2) with area under the curve equal to 1.
This is an even function of x centered on x = 0 which gets narrower and taller as 0.
Then
d
(y x) =
_
1/(2 ) for (x ) < y < (x +)
0 for y (x ) or y (x +)
_
(10.54)
30
This model can then be used in the form (with the range of integration assumed to include the point y = x):
_
f(y) (y x) dy = lim
0
_
f(y) d
(y x) dy = lim
0
1
2
_
x+
x
f(y) dy. (10.55)
The integral should be done before taking the limits in this safer approach.
However, if f(y) is a continuous function and possesses a derivative in a complete neighborhood of x, we can
use the mean value theorem of calculus to write this limit as
lim
0
1
2
f( y) (2) = lim
0
f( y)). (10.56)
where (x ) < y < (x +) As 0, y x, and f( y) f(x), which recovers Eq. (10.41), and which
we repeat here for emphasis.
_
f(y) (y x) dy = f(x) (10.57)
for any function f(x) which is continuous and possesses a derivative in a complete neighborhood of x, provided
the range of integration includes the point x.
10.3.8 Laplace Transform of the Delta Function Using a Limit Method
Use of Eq. (10.57) allows us to immediately write down the Laplace transform of (t t
0
) for t
0
> 0, the
integral
_
0
e
s t
(t t
0
) dt, since the function e
s t
which multiplies the delta function is continuous and
possesses a derivative for all values of t.
However, as a consistency check, lets also use the limit method just discussed to derive this result.
L(t t
0
)
_
0
e
s t
(t t
0
) dt = e
s t
0
(10.58)
provided s and t
0
are positive.
(%i1) assume(s>0,e>0,t0>0)$
(%i2) i1: integrate(exp(-s
*
t),t,t0-e,t0+e)/(2
*
e);
e s - s t0 - s t0 - e s
%e %e
------------ - --------------
s s
(%o2) -----------------------------
2 e
(%i3) limit(i1,e,0,plus);
- s t0
(%o3) %e
As a bonus, the limit of Eq.(10.58) as t
0
0
+
then gives us the Laplace transform of (t).
L(t)
_
0
e
s t
(t) dt = 1 (10.59)
31
10.4 Laplace Transform Integrals
10.4.1 Laplace Transform Integrals: laplace(..), specint(..)
A subgroup of denite integrals is so useful in applications that Maxima has functions which calculate the
Laplace transform (laplace and specint) of a given expression, as well as the inverse Laplace transform (ilt).
laplace(expr, t, s) calculates the integral
_
0
e
s t
f(t) dt = Lf(t) = F(s) (10.60)
where f(t) stands for the expr argument (here assumed to depend explicitly on t) of laplace. laplace assumes
that s is a very large positive number. If there are convergence issues of the integral, one allows s to be a
complex number s = x +i y and the assumption is made that the integral converges to the right of some line
Re(s) = const in the complex s plane.
10.4.2 Comparison of laplace and specint
specint( exp(- s*t) * expr, t) is equivalent to laplace(expr, t, s) in its effect, but has been specially designed
to handle special functions with care. You need to prepare specint with assume statement(s) that s is both
positive and larger than other positive parameters in expr.
L1 = 1/s
We start the following comparison of laplace and specint with an assume statement (needed by specint alone).
(%i1) assume( s>0, a > 0, b > 0, s > a, s > b )$
(%i2) laplace(1,t,s);
1
(%o2) -
s
(%i3) specint(exp(-s
*
t),t);
1
(%o3) -
s
(%i4) ilt(%,s,t);
(%o4) 1
Lt = 1/s
2
(%i5) laplace(t,t,s);
1
(%o5) --
2
s
(%i6) specint(exp(-s
*
t)
*
t,t);
1
(%o6) --
2
s
(%i7) ilt(%,s,t);
(%o7) t
32
Le
at
= 1/(s a)
(%i8) laplace(exp(a
*
t),t,s);
1
(%o8) -----
s - a
(%i9) specint(exp(-s
*
t)
*
exp(a
*
t),t);
1
(%o9) -----
s - a
Lsin(a t)/a = (s
2
+a
2
)
1
(%i10) laplace(sin(a
*
t)/a,t,s);
1
(%o10) -------
2 2
s + a
(%i11) (specint(exp(-s
*
t)
*
sin(a
*
t)/a,t),ratsimp(%%) );
1
(%o11) -------
2 2
s + a
Lcos(a t) = s (s
2
+a
2
)
1
(%i12) laplace(cos(a
*
t),t,s);
s
(%o12) -------
2 2
s + a
(%i13) (specint(exp(-s
*
t)
*
cos(a
*
t),t ), ratsimp(%%) );
s
(%o13) -------
2 2
s + a
Lt sin(a t)/(2a) = s (s
2
+a
2
)
2
(%i14) laplace(sin(a
*
t)
*
t/(2
*
a),t,s);
s
(%o14) ----------
2 2 2
(s + a )
(%i15) (specint(exp(-s
*
t)
*
sin(a
*
t)
*
t/(2
*
a),t ),ratsimp(%%) );
s
(%o15) -----------------
4 2 2 4
s + 2 a s + a
(%i16) map(factorsum,%);
s
(%o16) ----------
2 2 2
(s + a )
33
Le
at
cos(bt) = (s a) ( (s a)
2
+b
2
)
1
(%i17) laplace(exp(a
*
t)
*
cos(b
*
t),t,s);
s - a
(%o17) --------------------
2 2 2
s - 2 a s + b + a
(%i18) map(factorsum,%);
s - a
(%o18) -------------
2 2
(s - a) + b
(%i19) (specint(exp(-s
*
t)
*
exp(a
*
t)
*
cos(b
*
t),t ),ratsimp(%%) );
s - a
(%o19) --------------------
2 2 2
s - 2 a s + b + a
(%i20) map(factorsum,%);
s - a
(%o20) -------------
2 2
(s - a) + b
L
t bessel j (1, 2
a t) =
a s
2
e
a/s
(%i21) expr : t(1/2)
*
bessel_j(1, 2
*
a(1/2)
*
t(1/2));
(%o21) bessel_j(1, 2 sqrt(a) sqrt(t)) sqrt(t)
(%i22) laplace(expr,t,s);
- a/s
sqrt(a) %e
(%o22) ---------------
2
s
(%i23) specint(exp(-s
*
t)
*
expr,t);
- a/s
sqrt(a) %e
(%o23) ---------------
2
s
(%i24) ilt(%,s,t);
- a/s
sqrt(a) %e
(%o24) ilt(---------------, s, t)
2
s
We nd in the above example that ilt cannot nd the inverse Laplace transform.
34
Lerf(
t) = ( s
s +1)
1
Here again ilt fails.
(%i25) assume(s>0)$
(%i26) laplace(erf(sqrt(t)),t,s);
1
(%o26) -------------
s sqrt(s + 1)
(%i27) specint(exp(-s
*
t)
*
erf(sqrt(t)),t);
1
(%o27) ----------------
1 3/2
sqrt(- + 1) s
s
(%i28) radcan(%);
1
(%o28) -------------
s sqrt(s + 1)
(%i29) ilt(%,s,t);
1
(%o29) ilt(-------------, s, t)
s sqrt(s + 1)
Lerf(t) = e
s
2
/4
(1 erf(s/2)) s
1
Here laplace succeeds, and ilt and specint fail.
(%i30) laplace(erf(t),t,s);
2
s
--
4 s
%e (1 - erf(-))
2
(%o30) -----------------
s
(%i31) ilt(%,s,t);
2
s
--
4 s
%e (1 - erf(-))
2
(%o31) ilt(-----------------, s, t)
s
(%i32) specint(exp(-s
*
t)
*
erf(t),t);
- s t
(%o32) specint(%e erf(t), t)
35
10.4.3 Use of the Dirac Delta Function (Unit Impulse Function) delta with laplace(..)
The laplace function recognises delta(arg) as part of the expression supplied to laplace. We have introduced
the Dirac delta function (unit impulse function) in Sections 10.3.7 and 10.3.8. Here are three examples of using
delta with laplace.
L(t) = 1
(%i1) laplace(delta(t),t,s);
(%o1) 1
(%i2) ilt(1,s,t);
(%o2) ilt(1, s, t)
L(t a) = e
as
(for a > 0):
(%i3) laplace(delta(t-a),t,s);
Is a positive, negative, or zero?
p;
- a s
(%o3) %e
L(t a) sin(bt) = sin(a b) e
as
(for a > 0):
(%i4) laplace(delta(t-a)
*
sin(b
*
t),t,s);
Is a positive, negative, or zero?
p;
- a s
(%o4) sin(a b) %e
In this last example, we see that laplace is simply using
_
0
f(t) (t a) dt = f(a) (10.61)
with a > 0 and f(t) = e
s t
sin(bt).
10.5 The Inverse Laplace Transform and Residues at Poles
10.5.1 ilt: Inverse Laplace Transform
The Maxima function: ilt (expr, s, t) computes the inverse Laplace transform of expr with respect to s and in
terms of the parameter t. This Maxima function is able to compute the inverse Laplace transform only if expr
is a rational algebraic function (a quotient of two polynomials).
In elementary work with Laplace transforms, one uses a look-up table of Laplace transforms, together with
general properties of Laplace and inverse Laplace transforms, to determine inverse Laplace transforms of ele-
mentary and special functions.
36
For advanced work, one can use the general formula for the inverse Laplace transform
f(t > 0) =
1
2i
_
+i
i
e
s t
F(s) ds (10.62)
where the contour of integration is a vertical line in the complex s = x +i y plane (ie., along a line x = ), to
the right of all singularities (poles, branch points, and essential singularities) of the integrand. Here we assume
the only type of singularities we need to worry about are poles, isolated values of s where the approximate
power series expansion for s near s
j
is g(s
j
)/(s s
j
)
m
, where g(s
j
) is a nite number, and m is the order of
the pole. If m = 1, we call it a simple pole. At a particular point (x, y) of the contour, the exponential factor
has the forme
s t
= e
i t y
e
t x
. Because t > 0 the integrand is heavily damped by the factor e
xt
when x ,
and the contour of integration can be turned into a closed contour by adding a zero contribution which is the
integral of the same integrand along a large arc in the left hand s plane (in the limit that the radius of the arc
approaches ), and the resulting closed contour integral can then be evaluated using the residue theorem of
complex variable theory. The (counter-clockwise) closed contour integral is then given by 2i times the sum
of the residues of the integrand at the isolated poles enclosed by the contour.
The factor 2 i coming from the integral part of Eq.(10.62) is then cancelled by the factor 1/(2i) which
appears in the denition (Eq.(10.62)) of the inverse Laplace transform, and one has the simple result that the
inverse Laplace transform is the sum of the residues of the poles of the integrand.
10.5.2 residue: Residues at Poles
We can use the Maxima residue function to illustrate how the sum of the residues at all the poles of the
integrand reproduces the answer returned by ilt.
residue (expr, z, z_0)
Computes the residue in the complex plane of the expression expr when the variable z assumes
the value z_0. The residue is the coefcient of (z - z_0)(-1) in the Laurent series for
expr.
(%i1) residue (s/(s2+a2), s, a
*
%i);
1
(%o1) -
2
(%i2) residue (sin(a
*
x)/x4, x, 0);
3
a
(%o2) - --
6
We start with some arbitrary rational algebraic function of s, use ilt to determine the corresponding function
of t, and then compute the inverse Laplace transform (a second way) by summing the values of the residues of
the Laplace inversion integrand in the complex s plane.
(%i3) fs : -s/(s3 +4
*
s2 + 5
*
s +2)$
(%i4) ft : ( ilt(fs,s,t),collectterms(%%,exp(-t),exp(-2
*
t) ) );
- t - 2 t
(%o4) (t - 2) %e + 2 %e
37
(%i5) (laplace(ft,t,s), ratsimp(%%) );
s
(%o5) - -------------------
3 2
s + 4 s + 5 s + 2
(%i6) fs - %;
(%o6) 0
(%i7) fst : exp(s
*
t)
*
fs;
s t
s %e
(%o7) - -------------------
3 2
s + 4 s + 5 s + 2
(%i8) partfrac(fst,s);
s t s t s t
2 %e 2 %e %e
(%o8) ------- - ------- + --------
s + 2 s + 1 2
(s + 1)
The inverse Laplace transform integrand above was called fst, and we used partfrac on fst to exhibit the poles
of this integrand. We see that there is one simple pole at s = 2 and one pole of order 2 located at s = 1.
To use the Maxima function residue, we need to tell Maxima that t > 0.
(%i9) assume( t > 0 )$
(%i10) r1 : residue(fst,s,-2);
- 2 t
(%o10) 2 %e
(%i11) r2 : residue(fst,s,-1);
- t
(%o11) (t - 2) %e
(%i12) r1 + r2 - ft;
(%o12) 0
which shows that the sum of the residues reproduces the function of t which ilt produced.
This concludes our discussion of the inverse Laplace transform.
38