MapleLaplace.mws

Laplace Transform Example

Some Helpful Commands

We are going to demonstrate some of the things Maple can do to help us when using the Laplace Transform in solving the initial value problem below:

Diff(y(t),`$`(t,2))-2*Diff(y(t),t)+y(t) = 4*sin(2*t)-3*cos(2*t)-4*exp(-t)

>    restart:

>    with(plots):

Warning, the name changecoords has been redefined

>    with(inttrans):

One of the things we can do is simplify a complex algebraic expression such a s

(1+8/(s^2+4)-3*s/(s^2+4)-4/(s+1))/(s^2-2*s+1) .

>    simplify((1+8/(s^2+4)-3*s/(s^2+4)-4/(s+1))/(s^2-2*s+1));

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

We can do a partial fraction decomposition and follow this by computing an inverse Laplace transform.

>    convert((s-4)/((s^2+4)*(s+1)),parfrac,s);

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

>    invlaplace(%,s,t);

cos(2*t)-exp(-t)

We could compute the inverse Laplace transform before doing the partial fraction decomposition but the result might be a more complex looking expression.

>    invlaplace((s-4)/((s^2+4)*(s+1)),s,t);

2*cos(t)^2-2*exp(-1/2*t)*cosh(1/2*t)

Can you see that the two results are equivalent?

We can apply the laplace  command to the entire differential equation.

>    laplace(diff(y(t),t$2)-2*diff(y(t),t)+y(t)=4*sin(2*t)-3*cos(2*t)-4*exp(-t),t,s);

s*(s*laplace(y(t),t,s)-y(0))-D(y)(0)-2*s*laplace(y(t),t,s)+2*y(0)+laplace(y(t),t,s) = 8/(s^2+4)-3*s/(s^2+4)-4/(s+1)

We can apply dsolve  to the entire differential equation along with the initial conditions.  The solution may not be returned in its most simple form.

>    dsolve({diff(y(t),t$2)-2*diff(y(t),t)+y(t)=4*sin(2*t)-3*cos(2*t)-4*exp(-t),y(0)=0,D(y)(0)=1},{y(t)},method=laplace);

y(t) = 2*cos(t)^2-2*exp(-1/2*t)*cosh(1/2*t)

Maple can solve the initial value problem by other methods just as we have in class.

>    dsolve({diff(y(t),t$2)-2*diff(y(t),t)+y(t)=4*sin(2*t)-3*cos(2*t)-4*exp(-t),y(0)=0,D(y)(0)=1},{y(t)});

y(t) = exp(-t)*(cos(2*t)*exp(t)-1)

Here is a plot of the solution with t replaced by x in the command.

>    plot(cos(2*x)-exp(-x),x=0..12.56,y=-1.3..1.3,thickness=2,labels=[t,y]);

[Maple Plot]

>   

>