Application Center - Maplesoft

App Preview:

Lesson 32 -- Using Laplace Transforms to Solve Initial Value Problems

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

Lesson32.mw

ORDINARY DIFFERENTIAL EQUATIONS POWERTOOL

Lesson 32 -- Using Laplace Tranforms to Solve Initial Value Problems

Prof. Douglas B. Meade

Industrial Mathematics Institute

Department of Mathematics

University of South Carolina

Columbia, SC 29208

URL:   http://www.math.sc.edu/~meade/

E-mail: meade@math.sc.edu

Copyright  2001  by Douglas B. Meade

All rights reserved

-------------------------------------------------------------------

>

Outline of Lesson 32

32.A Definition of Laplace Transform

32.B Laplace Transform and Initial Value Problems

>

Initialization

> restart;

> with( DEtools ):

> with( plots ):

> with( inttrans ):

Warning, the name changecoords has been redefined

>

32.A Definition of Laplace Transform

The Laplace transform of a function f defined on the interval``(0, infinity) is

F(s) = Int(exp(-s*t)*f(t), t = 0 .. infinity)

for all s for which the (improper) integral exists.

For example, the Laplace transform of the constant function f(t) = 1 is

> Fs := Int( exp(-s*t)*1, t=0..infinity );

Fs := Int(exp(-s*t), t = 0 .. infinity)

>

which Maple evaluates to

> value(Fs) assuming s>0;

1/s

>

The built-in Maple command for evaluating Laplace transforms is laplace , found in the inttrans package.

> laplace( 1, t, s );

1/s

>

Note that the laplace command obtains this result without any assumptions on the transform variable.

Similarly, the Laplace transform of an exponential function by the definition

> Fs := Int( exp(-s*t)*exp(a*t), t=0..infinity );

Fs := Int(exp(-s*t)*exp(a*t), t = 0 .. infinity)

>

is

> value(Fs) assuming s>a;

-1/(-s+a)

>

The built-in command does not require the additional information that s*`>`*a , giving immediately the transform

> laplace( exp(a*t), t, s );

1/(s-a)

>

The laplace command applies many of the properties and identities commonly found in tables of Laplace transforms. For example, the operational rule for the transform of the derivatative `f '`(t) is

L*[`f '`(t)] = s*F(s)-f(0)

where F(s) is the transform of f(t) .  Maple renders the rule as

> L(Diff(f(t),t)) = laplace( diff( f(t), t ), t, s );

L(Diff(f(t), t)) = s*laplace(f(t), t, s)-f(0)

>

The appearance of this result can be improved with the use of the alias command in which the symbol F(s) is made to stand for the string "laplace(f(t),t,s)".  With this alias in place, the derivative rule reads

> alias( F(s) = laplace( f(t), t, s ) ):

> L(Diff(f(t),t)) = laplace( Diff( f(t), t ),t,s );

L(Diff(f(t), t)) = s*F(s)-f(0)

>

The Maple command for the inverse Laplace transform is invlaplace , also in the inttrans package.  For example, suppose the Laplace transform of a function g(t) is known to be G(s) , represented in Maple by

> G := 1/(s^2+3*s+2);

G := 1/(s^2+3*s+2)

>

The function g(t) whose Laplace transform is the given function G(s) is called the inverse Laplace transform of G(s) , and is found in Maple with the command

> g := invlaplace( G, s, t );

g := exp(-t)-exp(-2*t)

>

This result can also be obtained from the partial fraction decomposition of the function in the transform domain

> convert( G, parfrac, s );

1/(s+1)-1/(s+2)

>

and an inspection of the form of the fractions returned.  Each fraction is recognized as the transform of an exponential function, and g(t) is deduced by the same type of pattern recognition that is used to evaluate definite integrals by hand.

>

32.B Laplace Transform and Initial Value Problems

The Laplace transform of a linear ODE with initial conditions for an unknown function x = x(t) is an algebraic equation for the transform function X = X(s) . The key is to solve this algebraic equation for X, then apply the inverse Laplace transform to obtain the solution to the IVP. An example demonstrates the step-by-step implementation of this procedure.

Suppose the IVP is

> ode1 := diff( x(t), t$2 ) + 2*diff( x(t), t ) + 5*x(t) = sin(3*t);

> ic1 := x(0) = 2, D(x)(0) = 0;

ode1 := (diff(x(t), `$`(t, 2)))+2*(diff(x(t), t))+5*x(t) = sin(3*t)

ic1 := x(0) = 2, D(x)(0) = 0

>

The Laplace transform of the ODE is

> alias( X(s) = laplace( x(t), t, s ) ):

> L_ode1 := laplace( ode1, t, s );

L_ode1 := s^2*X(s)-D(x)(0)-s*x(0)+2*s*X(s)-2*x(0)+5*X(s) = 3/(s^2+9)

>

where again the alias command has been used to simplify the notation.

Substitution of the initial conditions lead to the algebraic equation

> L_ivp1 := eval( L_ode1, {ic1} );

L_ivp1 := s^2*X(s)-4-2*s+2*s*X(s)+5*X(s) = 3/(s^2+9)

>

which is next solved for X(s) , the Laplace transform of the unknown function x(t) .  A little algebra shows that the Laplace transform of the solution is the rational function

> q1 := isolate( L_ivp1, X(s) );

q1 := X(s) = (3/(s^2+9)+4+2*s)/(s^2+2*s+5)

>

or better still,

> X_sol1 := simplify( q1 );

X_sol1 := X(s) = (39+4*s^2+2*s^3+18*s)/((s^2+9)*(s^2+2*s+5))

>

the inverse Laplace transform of which is

> x_sol1 := collect(invlaplace( X_sol1, s, t ), exp);

x_sol1 := x(t) = (55/26*cos(2*t)+61/52*sin(2*t))*exp(-t)-3/26*cos(3*t)-1/13*sin(3*t)

>

the solution to the IVP.

Note that if initial conditions are not provided, the Laplace transform still can be used to obtain the general solution.  The Laplace transform of the differential equation is still computed, and again solved for X(s) , the transform of the unknown function x(t) .  However, this time the expression for X(s) will contain the unknown values of x(0) and `x'`(0) , as the following calculation shows.

> Xg_sol1 := isolate( L_ode1, X(s) );

Xg_sol1 := X(s) = (3/(s^2+9)+D(x)(0)+s*x(0)+2*x(0))/(s^2+2*s+5)

>

If the inverse Laplace transform of this expression for X(s) is obtained, it will contain the parameters x(0) and `x'`(0) , as the following shows.

> q2 := invlaplace( Xg_sol1, s, t );

q2 := x(t) = -3/26*cos(3*t)-1/13*sin(3*t)+1/52*exp(-t)*(2*cos(2*t)*(3+26*x(0))+sin(2*t)*(26*D(x)(0)+26*x(0)+9))

>

Collecting terms in x(0) and `x'`(0) puts the expression for x(t) into the form

> xg_sol1 := collect( q2, [x,exp] );

xg_sol1 := x(t) = (cos(2*t)+1/2*sin(2*t))*exp(-t)*x(0)+1/2*exp(-t)*sin(2*t)*D(x)(0)+(3/26*cos(2*t)+9/52*sin(2*t))*exp(-t)-3/26*cos(3*t)-1/13*sin(3*t)

>

Note that this result is a solution to the ODE, as verified by

> odetest( xg_sol1, ode1 );

0

>

The form of the general solution illustrates how the initial conditions enter into the solution of an initial value problem. In particular, when the initial conditions are substituted into the general solution via

> collect(eval( xg_sol1, {ic1} ), exp);

x(t) = (55/26*cos(2*t)+61/52*sin(2*t))*exp(-t)-3/26*cos(3*t)-1/13*sin(3*t)

>

the result is idential to the solution obtained previously :

> x_sol1;

x(t) = (55/26*cos(2*t)+61/52*sin(2*t))*exp(-t)-3/26*cos(3*t)-1/13*sin(3*t)

>

This process can be automated with the use of dsolve and the optional argument method=laplace :

> infolevel[dsolve] := 3:

> dsolve( { ode1, ic1 }, x(t), method=laplace );

> infolevel[dsolve] := 0:

`dsolve/inttrans/solveit:`, `Transform of eqns is`, {_s1^2*`laplace/inte\
rnal`(x(t), t, _s1)-4-2*_s1+2*_s1*`laplace/internal`(x(t), t, _s1)+5*`la\

place/internal`(x(t), t, _s1)-3/(_s1^2+9)}

`dsolve/inttrans/solveit:`, `Algebraic Solution is`, {`laplace/internal`\

(x(t), t, _s1) = (4*_s1^2+39+2*_s1^3+18*_s1)/(_s1^4+14*_s1^2+2*_s1^3+18*\

_s1+45)}

x(t) = -3/26*cos(3*t)-1/13*sin(3*t)+1/52*exp(-t)*(110*cos(2*t)+61*sin(2*t))

>

Laplace transforms are also useful when the forcing function is not explicitly given. For example, if the ODE is

> ode2 := diff( x(t), t ) + 3*x(t) = f(t);

ode2 := (diff(x(t), t))+3*x(t) = f(t)

>

the solution can be written, using the Laplace transform, as

> dsolve( ode2, x(t), method=laplace );

x(t) = x(0)*exp(-3*t)+int(f(_U1)*exp(-3*t+3*_U1), _U1 = 0 .. t)

>

Careful inspection of this result reminds us that this first-order linear ODE has as its integrating factor

> mu = intfactor( ode2 );

mu = exp(3*t)

>

Note that the result obtained with the Laplace transform provides more detailed information about the dependence on the initial condition and the forcing function than is obtained with the basic dsolve command, which only gives

> infolevel[dsolve] := 3:

> dsolve( ode2, x(t) );

> infolevel[dsolve] := 0:

`Methods for first order ODEs:`
`--- Trying classification methods ---`

`trying a quadrature`

`trying 1st order linear`

`<- 1st order linear successful`

x(t) = (Int(f(t)*exp(3*t), t)+_C1)*exp(-3*t)

>

as the solution.

>

[Back to ODE Powertool Table of Contents]

>