Error function

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.




erf(x) represents the error function 2π0xet2dt.

This function is defined for all complex arguments x. For floating-point arguments, erf returns floating-point results.

The implemented exact values are: erf(0) = 0, erf(∞) = 1, erf(-∞) = -1, erf(i ∞) = i ∞, and erf(-i ∞) = -i ∞. For all other arguments, the error function returns symbolic function calls.

For the function call erf(x) = 1 - erfc(x) with floating-point arguments of large absolute value, internal numerical underflow or overflow can happen. If a call to erfc causes underflow or overflow, this function returns:

  • The result truncated to 0.0 if x is a large positive real number

  • The result rounded to 2.0 if x is a large negative real number

  • RD_NAN if x is a large complex number and MuPAD® cannot approximate the function value

The error function erf(x) = 1 - erfc(x) returns corresponding values for large arguments. See Example 2.

MuPAD can simplify expressions that contain error functions and their inverses. For real values x, the system applies the following simplification rules:

  • inverf(erf(x)) = inverf(1 - erfc(x)) = inverfc(1 - erf(x)) = inverfc(erfc(x)) = x

  • inverf(-erf(x)) = inverf(erfc(x) - 1) = inverfc(1 + erf(x)) = inverfc(2 - erfc(x)) = -x

For any value x, the system applies the following simplification rules:

  • inverf(-x) = -inverf(x)

  • inverfc(2 - x) = -inverfc(x)

  • erf(inverf(x)) = erfc(inverfc(x)) = x

  • erf(inverfc(x)) = erfc(inverf(x)) = 1 - x

Environment Interactions

When called with a floating-point argument, the functions are sensitive to the environment variable DIGITS, which determines the numerical working precision.


Example 1

You can call the error function with exact and symbolic arguments:

erf(0), erf(3/2), erf(sqrt(2)), erf(infinity)

To approximate exact results with floating-point numbers, use float:

float(erf(3/2)), float(erf(sqrt(2)))

Alternatively, use a floating-point value as an argument:

erf(-7.2), erf(2.0 + 3.5*I), erfc(3.0, 4), erf(5.5 + 1.0*I)

Example 2

For large complex arguments, the error function can return :

erf(38000.0 + 3801.0*I)

Example 3

diff, float, limit, series, and other functions handle expressions involving the error function:

diff(erf(x), x, x, x)

limit(x/(1 + x)*erf(x), x = infinity)

series(erf(x), x = infinity, 3)

Return Values

Arithmetical expression


erf, erfc, and erfi are entire functions.

Was this topic helpful?