# SECTION 7.5# Example 1restart; de := diff(y(t),t,t) - 2*diff(y(t),t) + 5*y(t) = -8*exp(-t);with(inttrans);alias(Y = laplace(y(t),t,s));laplace(de,t,s);subs({y(0)=2,D(y)(0)=12},%);solve(%,Y);Ysol := %;invlaplace(Ysol,s,t);# Example 2de := diff(y(t),t,t) + 4*diff(y(t),t) - 5*y(t) = t*exp(t);laplace(de,t,s);subs({y(0)=1,D(y)(0)=0},%);solve(%,Y);Ysol := %;convert(Ysol,parfrac,s);invlaplace(%,s,t);# Example 4de := diff(y(t),t,t) + 2*t*diff(y(t),t) - 4*y(t) = 1;laplace(de,t,s);subs({y(0)=0,D(y)(0)=0},%);# This is a first order linear differential equation which can be solved by the#methods of Section 2.3
Y := 'Y';denew := diff(Y(s),s) +(3/s-s/2)*Y(s) = -1/(2*s^2);# Put into standard formP := (3/s-s/2);mu := exp(int(P,s));simplify(%);mu := %;denew2 := denew*mu;# Check that LHS of above equation is the derivative of mu*Y(s):lhs(denew2) - diff(mu*Y(s),s);simplify(%);# Solve denew2 by integrating both sides: RHS := rhs(denew2);int(RHS,s);sol := mu*Y = % + C;solve(sol,Y);simplify(%);expand(%);simplify(%);subs(C=0,%);invlaplace(%,s,t);# Check solution using dsolve:dsolve({de,y(0)=0,D(y)(0) = 0});# Example 5# Since the symbol I is used in this example, and I is Maple's reserved symbol# for sqrt(-1), we begin by defining a new sybol for sqrt(-1), as in Example 1,
# Section 3.5interface(imaginaryunit=j);de := I*diff(y(t),t,t) = -k*(e(t));alias(Y=laplace(y(t),t,s),E = laplace(e(t),t,s));laplace(de,t,s);subs({y(0)=0,D(y)(0)=0},%);subs(Y=E+a/s^2,%);Esol := solve(%,E);invlaplace(%,s,t);# This unexpected result can be fixed by telling Maple that I>0 and k>0: assume(I>0,k>0);Esol;invlaplace(Esol,s,t);