# erfi

Imaginary error function

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## Syntax

```erfi(`x`)
```

## Description

$\mathrm{erfi}\left(x\right)=-i\mathrm{erf}\left(ix\right)=\frac{2}{\sqrt{\pi }}\underset{0}{\overset{x}{\int }}{e}^{{t}^{2}}dt$ computes the imaginary error function.

This function is defined for all complex arguments `x`. For floating-point arguments, `erfi` returns floating-point results.

The implemented exact values are: `erfi(0) = 0`, ```erfi(∞) = ∞```, `erfi(-∞) = -∞`, ```erfi(i∞) = i```, and `erfi(-i∞) = -i`. For all other arguments, the error function returns symbolic function calls.

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

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

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

`float(erfi(3/2)), float(erfi(sqrt(2)))`
``` ```

Alternatively, use floating-points value as arguments:

`erfi(0.2), erfi(2.0 + 3.5*I), erfi(5.5 + 1.0*I)`
``` ```

### Example 2

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

`erfi(38000.0 + 3801.0*I)`
``` ```

### Example 3

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

`diff(erfi(x), x, x, x)`
``` ```
`float(ln(3 + erfi(sqrt(PI)*I)))`
``` ```
`limit(x/(1 + x)*erfi(I*x)*I, x = infinity)`
``` ```
`rewrite(erfi(x), erfc)`
``` ```
`series(erfi(x), x = I*infinity, 3)`
``` ```

## Parameters

 `x` Arithmetical expression

## Return Values

Arithmetical expression

## Algorithms

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