Complementary error function

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.


erfc(x, n)


computes the complementary error function.

with erfc(x, 0) = erfc(x) and returns the iterated integrals of the complementary error function.

This function is defined for all complex arguments x.

For floating-point arguments the error functions erf, erfc, and erfi return floating-point values. The implemented exact values are:

erfc(0) = 1, erfc(∞) = 0, erfc(- ∞) = 2, erfc(i ∞) = 1 - i ∞, erfc(- i ∞) = 1 + i ∞,

, erfc(∞, n) = 0, erfc(- ∞, n) = ∞,

For all other arguments, the error function returns symbolic function calls.

The calls erfc(x) and erfc(x, 0) are equivalent.

If a numerical value of n is not an integer or if n < -1, the function call erfc(x, n) returns an error. The function also accepts symbolic values of n.

If n is a numerical value, you can use the expand(erfc(x, n)) command to apply:

See Example 3.

For the function erfc 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 functions erf(x) = 1 - erfc(x) and erfi(x) = i (erfc(x i) - 1) return 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 error functions with exact and symbolic arguments:

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

erfc(0), erfc(x + 1), erfc(-infinity)

erfc(0, n), erfc(x + 1, -1), erfc(-infinity, 5)

erfi(0), erfi(x + 1), erfi(-infinity)

inverf(-1), inverf(0), inverf(1), inverf(x + 1), inverf(1/5)

inverfc(0), inverfc(1), inverfc(2), inverfc(15), inverfc(x/5)

For floating-point arguments, the error functions return floating-point values:

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

For floating-point arguments x from the interval [-1, 1], inverf returns floating-point values:

inverf(-0.5), inverf(0.85)

For floating-point arguments outside of this interval, inverf returns symbolic function calls:

inverf(-5.3), inverf(10.0)

For floating-point arguments x from the interval [0, 2], inverfc returns floating-point values:

inverfc(0.5), inverfc(1.25)

For floating-point arguments outside of this interval, inverfc returns symbolic function calls:

inverfc(-1.25), inverfc(2.5)

Example 2

For large complex arguments, the error functions can return :

erf(38000.0 + 3801.0*I),
erfi(38000.0 + 3801.0*I),
erfc(38000.0 + 3801.0*I)

For large floating-point arguments with positive real parts, erfc can return values truncated to 0.0:

erfc(27281.1), erfc(27281.2)

Example 3

The functions diff, float, limit, expand, rewrite, and series handle expressions involving the error functions:

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

diff(erfc(x, 3), x, x)

diff(inverf(x), x)

float(ln(3 + erfi(sqrt(PI)*I)))

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

expand(erfc(x, 3))

rewrite(inverfc(x), inverf)

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

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

series(erfi(x), x = I*infinity, 3)



An arithmetical expression


An arithmetical expression representing an integer larger than or equal to - 1

Return Values

Arithmetical expression


erf, erfc, and erfi are entire functions.

Was this topic helpful?