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

# `erf`

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

```erf(`x`)
```

## Description

`erf(x)` represents the error function $\frac{2}{\sqrt{\pi }}\underset{0}{\overset{x}{\int }}{e}^{-{t}^{2}}dt$.

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.

## Examples

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

## Parameters

 `x` Arithmetical expression

## Return Values

Arithmetical expression

## Algorithms

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