Example 2
In[50]:=
Clear[de,tde,newtde,Y,y]
Here's the differential equation:
In[51]:=
de=y''[t]+4 y[t]==t^2
Out[51]=
2
4 y[t] + y''[t] == t
Here is the transformed differential equation:
In[52]:=
tde=LaplaceTransform[de,t,s]
Out[52]=
2
4 LaplaceTransform[y[t], t, s] + s LaplaceTransform[y[t], t, s] -
2
s y[0] - y'[0] == --
3
s
Let's make use of the initial values:
In[53]:=
newtde=tde/.{y[0]->0,y'[0]->0}
Out[53]=
2
4 LaplaceTransform[y[t], t, s] + s LaplaceTransform[y[t], t, s] ==
2
--
3
s
Now solve this equation for Y[s], which Mathematica calls
LaplaceTransform[y[t],t,s]. The extra commands are to make the solution be a
function, not a list of rules.
In[54]:=
Solve[newtde,LaplaceTransform[y[t],t,s]];
Y[s_]:=Evaluate[LaplaceTransform[y[t],t,s]/.Flatten[%]]
Y[s]
Out[54]=
2
-----------
3 2
s (4 + s )
Now transform back to find y(t).
In[55]:=
y[t_]:=InverseLaplaceTransform[Y[s],s,t]
y[t]
Out[55]=
2
1 t Cos[2 t]
-(-) + -- + --------
8 4 8
Check:
In[56]:=
Simplify[D[y[t],{t,2}]+4 y[t]]
Out[56]=
2 t
Up to Solving Constant Coefficient Differential Equations (Initial Value Problems)