# $$\text{erf}$$¶

You can use the $$\text{erf}$$ function to calculate the error function of a value.

You can use the \erf backslash command to insert this function.

The following variants of this function are available:

• $$\text{complex } \text{erf} \left ( \text{<value>} \right )$$

Where $$\text{<value>}$$ represents any basic type.

Note that run-time type conversion allows the result of this function to be assigned to any basic type provided the returned value is compatible with that type. The compiler will also select appropriate variants of the function if the return type can be determined at compile time based on the supplied parameters.

For values near zero, this function uses the power series expansion described by [2]. For larger values, this function uses continued fractions to solve for the result. The threshold used to determine which approach is used was driven by the rate of convergence to a result with minimum error.

Aion includes distinct versions of the $$\text{erf}$$ function optimized over $$value \in \mathbb{R}$$ and optimized over $$value \in \mathbb{C}$$.

In all cases, the function relies on the reflection formula:

$\text{erf} \left ( - x \right ) = 1 - \text{erf} \left ( x \right )$

Below are two simple examples using the $$\text{erf}$$ function:

$a = \text{erf } 0.5$
$\text{a = 0.5204998778}$
$b = \text{erf } 1$
$\text{b = 0.8427007929}$