# 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.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

# erfcx

Scaled complementary error function

## Syntax

``erfcx(x)``

## Description

example

````erfcx(x)` returns the value of the Scaled Complementary Error Function for each element of `x`. Use the `erfcx` function to replace expressions containing `exp(x^2)*erfc(x)` to avoid underflow or overflow errors.```

## Examples

collapse all

`erfcx(5)`
```ans = 0.1107 ```

Find the scaled complementary error function of the elements of a vector.

```V = [-Inf -1 0 1 10 Inf]; erfcx(V)```
```ans = Inf 5.0090 1.0000 0.4276 0.0561 0 ```

Find the scaled complementary error function of the elements of a matrix.

```M = [-0.5 15; 3.2 1]; erfcx(M)```
```ans = 1.9524 0.0375 0.1687 0.4276 ```

You can use the scaled complementary error function `erfcx` in place of `exp(x^2)*erfc(x)` to avoid underflow or overflow errors.

Show how to avoid roundoff errors by calculating `exp(35^2)*erfc(35)` using `erfcx(35)`. The original calculation returns `NaN` while `erfcx(35)` returns the correct result.

```x = 35; exp(x^2)*erfc(x)```
```ans = NaN ```
`erfcx(x)`
```ans = 0.0161 ```

## Input Arguments

collapse all

Input, specified as a real number, or a vector, matrix, or multidimensional array of real numbers. `x` cannot be sparse.

Data Types: `single` | `double`

collapse all

### Scaled Complementary Error Function

The scaled complementary error function `erfcx(x)` is defined as

`$\text{erfcx}\left(x\right)={e}^{{x}^{2}}\text{erfc}\left(x\right).$`
For large `X`, `erfcx(X)` is approximately $\left(\frac{1}{\sqrt{\pi }}\right)\frac{1}{x}.$

## Tips

• For expressions of the form `exp(-x^2)*erfcx(x)`, use the complementary error function `erfc` instead. This substitution maintains accuracy by avoiding roundoff errors for large values of `x`.