# Heaviside Step Function and its conventional definition

Well known and conventional defintion of Heaviside function is

 H(x) = 0,   x < 0
H(x) = 1/2, x = 0
H(x) = 1,   x > 0


Mathematica uses instead unconventional "unit step" for its $HeavisideTheta[x]$ function

 S(x) = 0,   x < 0
S(x) = 1,   x > 0


How to use in Mathematica proper Heaviside function with normal definiton $H(x)$?

• Actually, UnitStep is a separate function, and the link you provided states that HeavisideTheta can be defined in different ways. – Jens May 16 '17 at 19:35

myHeaviside[x_] := Which[x < 0, 0, x == 0, 1/2, x > 0, 1]


Note that the derivative, computed as a limit, is properly a representation of a DiracDelta function (though its integral and higher derivatives might not be appropriately represented):

Limit[(myHeaviside[x + ε] - myHeaviside[x])/ε, ε -> 0]


$\begin{cases} \infty & x=0 \\ 0 & \text{True} \end{cases}$

• What do you mean by the derivative is properly calculated''? The derivative should yield DiracDelta, I believe. – user46676 May 16 '17 at 18:09

As the link in the question states, you can get the desired definition as follows:

heaviside[x_] := 1/2 (1 + Sign[x])


Here is a test:

heaviside /@ {-1, 0, 1}


{0, 1/2, 1}