Example 2
In[9]:=
Clear[s,a]
In[10]:=
DSolve[a^2 y''[x]-s^2 y[x]==0,y[x],x];
Y[x_,s_]:=Evaluate[y[x]/.Flatten[%]]
Y[x,s]
Out[10]=
C[1] (s x)/a
-------- + E C[2]
(s x)/a
E
Including the initial conditions will be much harder here. We require a bounded solution, so we must set C[2]=0.
In[11]:=
Clear[c,a]
Y[x_,s_]:=c Exp[-s x/a]
Y[x,s]
Out[11]=
c
--------
(s x)/a
E
In[12]:=
c=LaplaceTransform[Sin[2 Pi t](UnitStep[t]-UnitStep[t-1]),t,s]
Out[12]=
2 Pi
---------- - LaplaceTransform[Sin[2 Pi t] UnitStep[-1 + t],
2 2
4 Pi + s
t, s]
In[13]:=
Y[x,s]
Out[13]=
2 Pi
(---------- - LaplaceTransform[Sin[2 Pi t]
2 2
4 Pi + s
(s x)/a
UnitStep[-1 + t], t, s]) / E
Transform back to get u(x,t).
In[14]:=
Clear[y]
y[x_,t_]:=InverseLaplaceTransform[Y[x,s],s,t]
y=y[x,t]
Out[14]=
x x
Sin[2 Pi (t - -)] UnitStep[t - -] -
a a
x x x
Sin[2 Pi (t - -)] UnitStep[-1 + t - -] UnitStep[t - -]
a a a
Let's let a=1.
In[15]:=
p0=Plot[y/.{t->0,a->1},{x,0,20}];

Don't be thrown off by the (seemingly) blank graph. Check the initial conditions!
In[16]:=
p1=Plot[y/.{t->1,a->1},{x,0,20}];

In[17]:=
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.
In[18]:=
Table[Plot[Evaluate[y/.{t->k,a->1}],{x,0,20},PlotRange->{0,1}],{k,0,20}];
(This is the first frame of a 56812 byte mpg movie. Click on the graph to download the movie)