Problems with the Impulse Response - Part III:
The Resolution

Thank you, Mariusz and Marcos. Perhaps Devendra Kapadia, the head of the Calculus and Algebra Group at Wolfram, if I recall correctly, could tell us why they defined the Heaviside function the way they did, i.e., why they left this function undefined at zero.

The Two Solutions of a Model Impulse Response Problem

Recall our model impulse response problem and the two ways we tried to solve it:

The Solution Popular in the Signal Processing Community

Here is the solution of the model problem by the method taught by Leila and Mariusz:
In[]:=
sol1=DSolveValue[{y'[t]+y[t]==0,y[0]==1},y[t],t]
Out[]=
-t


The Natural/Intuitive Solution

Here is the more natural/intuitive solution with an explicit impulse forcing
In[]:=
sol2a=DSolveValue[{y'[t]+y[t]==DiracDelta[t],y[0]==0},y[t],t,Assumptionst>0]
Out[]=
0
This one doesn’t work, because
t
should be defined for ALL non-negative times, including, rather than excluding,
t=0
, where the impulse and the initial condition are imposed. The impulse and the initial condition seem incompatible, but, actually, they are not: we should think of the DiracDelta distribution as a limit of a sequence of smooth functions that is imposed an infinitesimal amount of time right after
t=0
, or, as it is often denoted, at time t =
+
0
.
The correct natural/intuitive formulation of our model problem thus is one that includes
t=0
:
In[]:=
sol2=DSolveValue[{y'[t]+y[t]==DiracDelta[t],y[0]==0},y[t],t,Assumptionst≥0]
Out[]=
-
-t

(HeavisideTheta[0]-HeavisideTheta[t])
As already noted, the two solutions, sol1 and sol2, have to be identical (for
t>0
but NOT at
t=0
), which means that following relations HAVE TO HOLD:
HeavisideTheta[0]=0
(
1
)
HeavisideTheta[t]=1forallt>0
(
2
)
But Mathematica leaves
HeavisideTheta[0]
UNDEFINED, which is an ERROR, in my opinion. Indeed:
In[]:=
{HeavisideTheta[-1],HeavisideTheta[0],HeavisideTheta[1.5]}
Out[]=
{0,HeavisideTheta[0],1}

The Heaviside Function

Directly related to the impulse function,
In[]:=
D[HeavisideTheta[x],x]
Out[]=
DiracDelta[x]
here is what the Heaviside function should look like.
Out[]=
Note that the only disagreement with Mathematica is at
x=0
, where the Heaviside function is left UNDEFINED.
And here is what it should be defined as in order to be consistent with (1) and (2):
θ(t)=

0
fort≤0
1
fort>0
​​
(
3
)

Redefining the Heaviside Function

So, let’s redefine the system function
HeavisideTheta[ t ]
, but to be safe, let’s follow the example from the tutorial Modifying Built-in Functions:
In[]:=
Attributes[HeavisideTheta]
Out[]=
{Listable,Orderless,Protected}
In[]:=
(Unprotect[HeavisideTheta];HeavisideTheta[0]=0;Protect[HeavisideTheta];)
In[]:=
Attributes[HeavisideTheta]
Out[]=
{Listable,Orderless,Protected,ReadProtected}
Now it works (compare with the same evaluation above before we re-defined the function).
In[]:=
{HeavisideTheta[-1],HeavisideTheta[0],HeavisideTheta[1.5]}
Out[]=
{0,0,1}
Now, let’s see what the response to the impulse forcing of the Dirac delta, δ(t), is:
In[]:=
sol2=DSolveValue[{y'[t]+y[t]==DiracDelta[t],y[0]==0},y[t],t]
Out[]=
-t

HeavisideTheta[t]
Note that sol2 now agrees with the solution obtained by Mariusz and Leila’s method for
t>0
. Indeed,
In[]:=
Simplify[sol2,Assumptionst>0]
Out[]=
-t

But also note that sol2 is compatible with the zero initial condition, whereas Mariusz and Leila’s solution is not--a minor nuance of no practical importance, but nevertheless an interesting nugget:
In[]:=
sol2/.t->0
Out[]=
0

One More Problem: Solution by the Two Methods

With the re-defined Heaviside function, we can now naturally and more intuitively solve all impulse problems. Take for example one involving a second-order ODE.
In[]:=
sol3=DSolveValue[{y''[t]-y'[t]+y[t]==0,y[0]==0,y'[0]==1},y[t],t]//Simplify
Out[]=
2
t/2

Sin
3
t
2

3
In[]:=
sol4=DSolveValue[{y''[t]-y'[t]+y[t]==DiracDelta[t],y[0]==0,y'[0]==0},y[t],t]
Out[]=
2
t/2

HeavisideTheta[t]Sin
3
t
2

3
In[]:=
Simplify[sol4,Assumptionst>0]
Out[]=
2
t/2

Sin
3
t
2

3
Indeed, sol3 and sol4 are identical for
t>0
.

Conclusion: Error in Mathematica

It seems that our discussion clearly demonstrates that the Heaviside function should not be left undefined at zero, but instead it should be defined at the argument zero to have the value zero, as specified by equation (1), which I restate here:
HeavisideTheta[0]=0
Thanks
6
10
to Mariusz and Marcos for this stimulating discussion and for putting up with me.