# Documentation

### This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

# `erfc`

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.

## Syntax

```erfc(`x`)
erfc(`x`, `n`)
```

## Description

$\mathrm{erfc}\left(x\right)=1-\mathrm{erf}\left(x\right)=\frac{2}{\sqrt{\pi }}\underset{x}{\overset{\infty }{\int }}{e}^{-{t}^{2}}dt$ computes the complementary error function.

$\mathrm{erfc}\left(x,n\right)=\underset{x}{\overset{\infty }{\int }}\mathrm{erfc}\left(t,n-1\right)dt$ with ```erfc(x, 0) = erfc(x)``` and $erfc\left(x,-1\right)=\frac{2}{\sqrt{\pi }}{e}^{-{x}^{2}}$ 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∞`

• $\mathrm{erfc}\left(0,n\right)=\frac{1}{{2}^{n}\Gamma \left(\frac{n}{2}+1\right)}$, ```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 $\mathrm{erfc}\left(x,n\right)=\frac{\mathrm{erfc}\left(x,n-2\right)}{2n}-\frac{x\mathrm{erfc}\left(x,n-1\right)}{n}$

• The reflection rule $\mathrm{erfc}\left(-x,n\right)={\left(-1\right)}^{n+1}\mathrm{erfc}\left(x,n\right)+\frac{H\left(n,ix\right)}{{i}^{n}{2}^{n-1}n!}$, 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.

## Examples

### 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)`

## Parameters

 `x` Arithmetical expression `n` Arithmetical expression representing an integer larger than or equal to `-1`.

## Return Values

Arithmetical expression

## Algorithms

`erf`, `erfc`, and `erfi` are entire functions.

## See Also

### Topics

Was this topic helpful?

Watch now