The Heaviside step function
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.
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(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)
heaviside reacts to assumptions set by assume:
assume(x > 0): heaviside(x)
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)