The Heaviside step function

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.




heaviside(x) represents the Heaviside step function.

If the argument represents a positive real number, then 1 is returned. If the argument represents a negative real number, then 0 is returned. If the argument is zero, is returned. If the argument is a complex number of domain type DOM_COMPLEX, then undefined is returned. For all other arguments, an unevaluated function call is returned.

The derivative of heaviside is the delta distribution dirac.


Example 1

heaviside returns 1 or 0 for arguments representing positive or negative real numbers, respectively:

heaviside(-3), heaviside(-sqrt(3)), heaviside(-2.1),
heaviside(PI - exp(1)), heaviside(sqrt(3))

heaviside returns if the argument is zero:

heaviside(0), heaviside(0.0)

Arguments of domain type DOM_COMPLEX yield undefined:

heaviside(1 + I), heaviside(2/3 + 7*I), heaviside(0.1*I)

An unevaluated call is returned for other arguments:

heaviside(x), heaviside(ln(-5)), heaviside(x + I)

Example 2

heaviside reacts to assumptions set by assume:

assume(x > 0): heaviside(x)


Example 3

The derivative of heaviside is the delta distribution dirac:

diff(heaviside(x - 4), x)

The integrator int handles heaviside:

int(exp(-x)*heaviside(x), x = -infinity..infinity)

We do not recommend to use heaviside in numerical integration. It is much more efficient to split the quadrature into pieces, each of which having a smooth integrand:

DIGITS := 3: numeric::int(exp(-x)*heaviside(x^2 - 2), x=-3..10)

numeric::int(exp(-x), x = -3..-2^(1/2)) +
numeric::int(exp(-x), x = 2^(1/2)..10)

delete DIGITS:



An arithmetical expression

Return Values

Arithmetical expression.

Overloaded By


See Also

MuPAD Functions

Was this topic helpful?