This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Complementary error function

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


erfc(x, n)


erfc(x)=1erf(x)=2πxet2dt computes the complementary error function.

erfc(x,n)=xerfc(t,n1)dt with erfc(x, 0) = erfc(x) and erfc(x,1)=2πex2 returns the iterated integrals of the complementary error function. The calls erfc(x) and erfc(x, 0) are equivalent.

erfc is defined for all complex arguments x. For floating-point arguments, erfc returns floating-point results.

The implemented exact values are:

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

  • erfc(0,n)=12nΓ(n2+1), erfc(∞,n) = 0, erfc(-∞, n) = ∞

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

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 expand(erfc(x, n)) to apply the following rules. See Example 3.

  • The recurrence erfc(x,n)=erfc(x,n2)2nxerfc(x,n1)n

  • The reflection rule erfc(x,n)=(1)n+1erfc(x,n)+H(n,ix)in2n1n!, where H(n,ix) is the n-th degree Hermite polynomial at the point ix. See orthpoly::hermite.

For the function erfc with floating-point arguments of large absolute value, internal numerical underflow or overflow can happen. See Example 2. 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

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 complementary error function with exact and symbolic arguments:

erfc(0), erfc(x + 1), erfc(-infinity), erfc(3/2), erfc(sqrt(2))

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

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

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

Alternatively, use floating-points value as arguments:

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

Example 2

For large complex arguments, the complementary error function can return :

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

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

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

limit(x/(1 + x)*(1 - erfc(x)), x = infinity)

expand(erfc(x, 3))

rewrite(erfc(x), erf),
rewrite(erfc(x), erfi)

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



Arithmetical expression


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?