\(\text{erfc}\)

You can use the \(\text{erfc}\) function to calculate the complementary error function of a value.

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

The following variants of this function are available:

  • \(\text{complex } \text{erfc} \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.

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

The \(\text{erfc}\) function uses either uses the power series described by [2], calculates \(\text{erfc}\) by continued fractions, or in the case of the real version, computes \(\text{erfc}\) function using the incomplete gamma function:

\[\text{erfc} \left ( x \right ) = \frac{1}{\sqrt{\pi}} \Gamma \left ( \frac{1}{2}, x ^ 2 \right )\]

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

\[\text{erfc} \left ( -x \right ) = 2 - \text{erfc} \left ( x \right )\]
\[\text{erfc} \left ( -x \right ) = 1 + \text{erf} \left ( x \right )\]

The thresholds used to determine which approach is used and, for negative values, which reflection formula was used was determined based on the speed of computation to converge to a result with minimum error.

Below are two simple examples using the \(\text{erfc}\) function:

\[a = \text{erfc } 0.5\]
\[\text{a = 0.4795001222}\]
\[b = \text{erfc } 1\]
\[\text{b = 0.1572992071}\]