In Mathematica, UnitStep[0] == 1 and HeavisideTheta[0] remains unevaluated. In addition, D[UnitStep[x], x] is 0 if x != 0 and Indeterminate if x == 0, whereas D[HeavisideTheta[x],x] = DiracDelta[x].

It seems to me that UnitStep is the idealization of a leading edge of a perfect pulse, whereas HeavisideTheta[x] is like an ideal Fourier Transform of the ideal UnitStep[x] function. Is this a good way to distinguish between the two, and are there any other significant programming or mathematical distinctions between the two functions?


  • 11
    $\begingroup$ As a rough rule of thumb: use HeavisideTheta[] for symbolic calculations, and UnitStep[] for numerical calculations. $\endgroup$ Commented Sep 20, 2017 at 0:20
  • $\begingroup$ Thanks @J.M. I'll keep that in mind. Kudos. $\endgroup$
    – user51904
    Commented Sep 20, 2017 at 0:22
  • 5
    $\begingroup$ Just to expand on @J.M.'s "UnitStep for numeric" comment. Doing list = RandomReal[1, 10^6]; AbsoluteTiming[UnitStep[list];] AbsoluteTiming[HeavisideTheta[list];]. UnitStep comes out as two orders of magnitude faster. $\endgroup$ Commented Sep 20, 2017 at 11:25
  • 1
    $\begingroup$ That's an interesting consideration @aardvark2012, thanks for the addition. $\endgroup$
    – user51904
    Commented Sep 28, 2017 at 22:56

1 Answer 1


HeavisideTheta is a distribution. Distributions are the kernels of linear maps by complete definite integrals over a domain for a special class of functions to complex numbers.

As such, Theta is the primitive of Delta in the following sense

Integrate[f[x] HeavisideTheta'[x],x\[Element] domain]  == 
-     Integrate[f'[x] HeavisideTheta[x],x\[Element] domain]  ==
       -f[+boundary] + f[0]

This is valid only if f, f' etc go to zero sufficently fast so that integration by parts has boundary values zero. Products of Theta and other functions, that do not decay at inifinity on the real line, make no sense. Especially, the product of distributions make no sense in general.

UnitStep on the contrary is only a piecewise continuous point-to-point function with no regard to any type of function spaces with an integrability condition, that yields the existence of Fourier transforms back and forth.

  • $\begingroup$ See, for example, Wiki for a more or less accurate proof. The integrals written down by you are not OK . $\endgroup$
    – user64494
    Commented Mar 25, 2023 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.