Example 2

ytt=a^2yxx
y(x,0)=yt(x,0)=0
y(0,t)=sin (2 Pi t) if 0<=t<=1 and 0 otherwise.


  Clear[s,a]


  DSolve[a^2 y''[x]-s^2 y[x]==0,y[x],x];
  Y[x_,s_]:=Evaluate[y[x]/.Flatten[%]]
  Y[x,s]

Including the initial conditions will be much harder here. We require a bounded solution, so we must set C[2]=0.


  Clear[c,a]
  Y[x_,s_]:=c Exp[-s x/a]
  Y[x,s]


  c=LaplaceTransform[Sin[2 Pi t](UnitStep[t]-UnitStep[t-1]),t,s]


  Y[x,s]

Transform back to get u(x,t).


  Clear[y]
  y[x_,t_]:=InverseLaplaceTransform[Y[x,s],s,t]
  y=y[x,t]

Let's let a=1.


  p0=Plot[y/.{t->0,a->1},{x,0,20}];

Don't be thrown off by the (seemingly) blank graph. Check the initial conditions!


  p1=Plot[y/.{t->1,a->1},{x,0,20}];


  p2=Plot[y/.{t->5,a->1},{x,0,20}];

Let's animate. Do not evaluate this next cell! Double click on the graph to start the animation. You can control the animation by using the buttons on the lower left hand corner of the screen.


  Table[Plot[Evaluate[y/.{t->k,a->1}],{x,0,20},PlotRange->{0,1}],{k,0,20}];

Up to PDE and Laplace Transform Examples