Example 1

Let's solve the initial value problem y'+4y=t, y(0)=5. The procedure is just like we did by hand, but with Mathematica relieving us of the tedium.


  Clear[de,tde,newtde,Y,y]

Here's the differential equation:


  de=y'[t]+4 y[t]==t

Here is the transformed differential equation:


  tde=LaplaceTransform[de,t,s]

Let's make use of the initial value:


  newtde=tde/.y[0]->5

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.


  Solve[newtde,LaplaceTransform[y[t],t,s]];
  Y[s_]:=Evaluate[LaplaceTransform[y[t],t,s]/.Flatten[%]]
  Y[s]

Now transform back to find y(t).


  y[t_]:=InverseLaplaceTransform[Y[s],s,t]
  y[t]

Check:


  Simplify[D[y[t],t]+4 y[t]]

Up to Solving Constant Coefficient Differential Equations (Initial Value Problems)