Section 6.5

Mathematica Basics for Impulse Functions

Understanding the Dirac Delta function

The dirac delta function is an infinite spike at t=0, and zero everywhere else. It really should be thought of a generalized function.

g[ϵ_,t_]:=Piecewise[{{(1/ϵ),0≤t≤ϵ},{0,t<0},{0,t>ϵ}}]

Manipulate[Plot[g[ϵ,t],{t,0,1},PlotStyle->{Blue,Thick},BaseStyle->20,PlotRange->{{0,0.5},{0,100}},Filling->Axis],{ϵ,0.5,0.01,-0.01}]

As ϵ->∞, we get an infinite spike at t=0

Limit[g[ϵ,t],{ϵ->0}]

The shaded area is one.

(∫_(-∞)^∞)g[ϵ,t]\[DifferentialD]t

Built-in Dirac Delta function and Properties

DiracDelta[t]

The most important property is how it affects integration:

(∫_(-∞)^∞)f[t]DiracDelta[t-c]\[DifferentialD]t

And of course, we will care about it’s Laplace Transform:

LaplaceTransform[DiracDelta[t-c],t,s]

The plot is uninspiring, but notice there is a gap at t=0.

Plot[DiracDelta[t],{t,-1,1},BaseStyle->20,Axes->False,Frame->True]

Kroenecker Delta function (For Your Information)

KroneckerDelta[4]

KroneckerDelta[0]

Solve the IVP y''+2y'+y=(e^(-t))+3δ(t-1), y(0)=0,y'(0)=0.

Here is the bit we can easily do by hand, which is to take the Laplace transform of the differential equation. You will need to use Table 6.2.1, or Mathematica to determine the Laplace transforms. Table 6.2.1 will be provided on the final exam.

L [y'']+2L[y']+L [y]=L [(e^(-t))]+3L [δ(t-1)]

LaplaceTransform[y''[t],t,s]

Using the initial conditions, this reduces to L [y'']=(s^2)Y(s).

LaplaceTransform[y'[t],t,s]

Using the initial conditions, this reduces to L [y']=s Y(s).

LaplaceTransform[Exp[-t],t,s]

LaplaceTransform[DiracDelta[t-1],t,s]

This leads the the following relationship:

(s^2)Y(s)+2s Y(s)+Y(s)=(1/(1+s))+(e^(-s))
Y(s)(((s+1))^2)=(1/(1+s))+(e^(-s))
Y(s)=(1/(((s+1))^3))+((e^(-s))/(((s+1))^2))

Now, take the inverse Laplace transform:

(L^(-1))[Y(s)]=(L^(-1))[(1/(((1+s))^3))]+(L^(-1))[(e^(-s))(1/(((1+s))^2))]

Again, you may use Table 6.2.1 or Mathematica to work out the inverse transformations.

InverseLaplaceTransform[(1/(((1+s))^3)),s,t]

InverseLaplaceTransform[(E^(-s))(1/(((1+s))^2)),s,t]

Combining all these together, we get the final result for the solution to the initial value problem:

y[t_]=(1/2) (E^(-t)) (t^2)+(E^(1-t)) (-1+t) HeavisideTheta[-1+t]

Here is a plot of the solution:

plot1=Plot[y[t],{t,0,10},PlotStyle->{Red,Thick}]

Here is Mathematica's DSolve solution, which looks a bit different from ours:

Clear[y]
DSolve[{y''[t]+2y'[t]+y[t]==Exp[-t]+DiracDelta[t-1],y[0]==0,y'[0]==0},y[t],t]

plot2=Plot[(1/2) (E^(-t)) ((t^2)-2 E HeavisideTheta[-1+t]+2 E t HeavisideTheta[-1+t]),{t,0,10},PlotStyle->{Blue,Thick}]

But of course, they are the same:

Show[plot1,plot2]