This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / Add-ons / Standard Packages / Calculus  /


This package defines the function UnitStep and its generalized derivative DiracDelta. The Dirac delta function is not a true function in the usual mathematical sense since it is not defined for every value of x. However, it is commonly used to represent ideal distributions in problems in physics and engineering. The unit step function may be used to represent piecewise continuous functions.
This package is automatically loaded by the transform packages in the Calculus


UnitStep and DiracDelta, the generalized derivative of UnitStep.

  • This loads the package.
  • In[1]:= <<Calculus`DiracDelta`

  • has a step of size unity at . The default value of at

    is unity.
  • In[2]:= Table[UnitStep[x], {x, -3, 3}]


  • The Dirac delta function is usually defined as the limit of a sequence of functions that integrate to unity, but have increasing height and decreasing width.
  • In[3]:= Integrate[DiracDelta[x],
    {x, -Infinity, Infinity}]


  • has "zero width" because it is zero for all . Although can be considered equal to infinity at

    , it is usually advantageous to leave the expression unevaluated.
  • In[4]:= Table[DiracDelta[x], {x, -3, 3}]


  • This demonstrates the sampling property of the Dirac delta. It is assumed that is continuous at

  • In[5]:= Integrate[DiracDelta[x - a] f[x],
    {x, -Infinity, Infinity}]


  • This demonstrates the sampling property of derivatives of the Dirac delta.
  • In[6]:= Integrate[DiracDelta''[x] f[x],
    {x, -Infinity, Infinity}]


  • Only half of the singularity at the lower limit contributes to this definite integral.
  • In[7]:= Integrate[DiracDelta[x], {x, 0, Infinity}]


  • A definite integral that includes a singularity occurring at the lower limit may be explicitly constructed using Limit.
  • In[8]:= (int = Integrate[DiracDelta[x], x];
    Limit[int, x -> Infinity] -
    Limit[int, x -> 0, Direction -> 1])


    Multidimensional UnitStep and DiracDelta.

  • A multidimensional unit step may be expressed as or as the product

  • In[9]:= Integrate[Sin[x y] UnitStep[x, y], x, y]


  • Here the integral in x does not evaluate because is not continuous at . The integral in y evaluates only for the real solution of

  • In[10]:= Integrate[Cot[x] g[y]
    DiracDelta[x, y^3 + y], x, y]

    Syntax::newl: The newline character after "Integrate[Cot[x] g[y]" is understood as a multiplication operator.


  • Since the unit step is separable, the value of at is

  • In[11]:= UnitStep[0, y]


  • This is a plot of the characteristic or indicator function for the set



  • In[12]:= Plot3D[UnitStep[1 - x^2 - y^2, x + y - 1],
    {x, 0, 1}, {y, 0, 1}, PlotPoints -> 30]

    Option for UnitStep.

  • A unit step that is continuous at from the left may be expressed using the ZeroValue

  • In[13]:= UnitStep[0, ZeroValue -> 0]


  • The default value of at can be changed by redefining Options[UnitStep]. Now evaluates to

  • In[14]:= (SetOptions[UnitStep, ZeroValue -> 1/2];
    UnitStep[0, 0])


    Simplifying expressions involving UnitStep.

  • Complicated expressions involving UnitStep can sometimes be simplified using SimplifyUnitStep.
  • In[15]:= UnitStep[x - 2] (DiracDelta[x - 3] +
    UnitStep[x, y] UnitStep[y - 1]) //


    Simplifying expressions involving DiracDelta.

  • Expressions containing terms equivalent to the zero distribution can sometimes be simplified using SimplifyDiracDelta.
  • In[16]:= (1 + x^2 DiracDelta[x, y])/x //