MATH529 L13
Laplace transform solution of PDEs

Example: Wave equation

Solve (Subscript[u, t t])= (a^2) (Subscript[u, x x]) in 0<x<π, t>0, u(x,0)=-sin 3x, (Subscript[u, t])(x,0)=0, u(0,t)=0, u(π,t)=0.

Laplace transform of PDE

Define the PDE, and notation for Laplace transform of u

Clear["Global`*"];PDE = (∂_(t,t))u[x,t] == (a^2) (∂_(x,x))u[x,t];
ℒ[u_,t_,s_]:=LaplaceTransform[u,t,s];
ℒinv[u_,s_,t_]:=InverseLaplaceTransform[u,s,t];
ℒu = {ℒ[u[x,t],t,s] -> U[x,s],ℒ[Derivative[2,0][u][x,t],t,s] -> Derivative[2,0][U][x,s]};
IC = {u[x,0]-> -Sin[3x],Derivative[0,1][u][x,0]->0};
ODE = ℒ[PDE,t,s] /. ℒu /. IC

Solve the ODE

sol=DSolve[ODE,U[x,s],x][[1,1]]

Inverse Laplace transform of the ODE solution

uGenSol[x_,t_]=ℒinv[U[x,s] /. sol,s,t]

BCsystem={uGenSol[0,t]==0,uGenSol[π,t]==0}

Apply boundary conditions

BCsol = Solve[BCsystem,{(C[1]),(C[2])}][[1]]

u[x_,t_] = uGenSol[x,t] /. BCsol

Verify PDE

PDE

Animate[Plot[u[x,t] /. a->1, {x,0,π},Frame->True,FrameLabel->{"x","u"},GridLines->Automatic,PlotRange->{{0,π},{-1,1}}],{t,0,π/4}]

Example: Heat equation

Solve (Subscript[u, t ])= k (Subscript[u, x x]) in 0<x<π, t>0, u(x,0)=-sin 3x, u(0,t)=0, u(π,t)=0.

Laplace transform of PDE

Define the PDE, and notation for Laplace transform of u

Clear["Global`*"];PDE = (∂_t)u[x,t] == (a^2) (∂_(x,x))u[x,t];
ℒ[u_,t_,s_]:=LaplaceTransform[u,t,s];
ℒinv[u_,s_,t_]:=InverseLaplaceTransform[u,s,t];
ℒu = {ℒ[u[x,t],t,s] -> U[x,s],ℒ[Derivative[2,0][u][x,t],t,s] -> Derivative[2,0][U][x,s]};
IC = {u[x,0]-> -Sin[3x]};
ODE = ℒ[PDE,t,s] /. ℒu /. IC

Solve the ODE, apply BC

sol=DSolve[ODE,U[x,s],x][[1,1]]

BCsystem={U[x,s] /. sol /. x->0,U[x,s] /. sol /. x->π}=={0,0}

BCsol=Solve[BCsystem,{(C[1]),(C[2])}][[1]]

Inverse Laplace transform of the ODE solution

U[x,s] /. sol /. BCsol

u[x_,t_]=ℒinv[U[x,s] /. sol /. BCsol,s,t]

PDE

Animate[Plot[u[x,t] /. a->1, {x,0,π},Frame->True,FrameLabel->{"x","u"},GridLines->Automatic,PlotRange->{{0,π},{-1,1}}],{t,0,1}]