Evaluates the inverse of the complementary error function.

View versions (2)

Interface

#include <codecogs/maths/special/errorfnc_inv.h>

using namespace Maths::Special;

The inverse of the complementary error function is defined as the function \mathrm{erfc}^{-1}:(0,2) \rightarrow \mathbb{R} which satisfies:

\begin{array}{rcll}
\mathrm{erfc}\left(\mathrm{erfc}^{-1}(x)\right) &=& x, &\qquad \forall x \in (0,2)\\
\mathrm{erfc}^{-1}\left(\mathrm{erfc}(x)\right) &=& x, &\qquad \forall x \in \mathbb{R}
\end{array}
(1)

where \displaystyle \mathrm{erfc} is the complementary error function. Some special values are:

\begin{array}{rcl}
\mathrm{erfc}^{-1}(0) &=& \infty \\
\\
\mathrm{erfc}^{-1}(1) &=& 0 \\
\\
\mathrm{erfc}^{-1}(2) &=& -\infty.
\end{array}
(2)

The graph of this function is shown below. \graph y=0:2

The following property also holds:

\mathrm{erfc}^{-1}(x) = \mathrm{erf}^{-1}(1 - x), \qquad \forall x \in (0,2)
(3)

where \displaystyle \mathrm{erf}^{-1} is the inverse of the error function. Based on this last formula, you may notice how the output of the example code below is linked to the example output in the ErrorFn_Inv module.

References

Mathworld, http://mathworld.wolfram.com/InverseErfc.html

Example 1

#include <codecogs/maths/special/errorfnc_inv.h>
#include <stdio.h>

int main(  )
{
  // display the value of the function at important points
  printf("x = 0     y = %.15lf\n",   Maths::Special::errorFnC_inv(0.0));
  printf("x = 1     y = %.15lf\n",   Maths::Special::errorFnC_inv(1.0));
  printf("x = 2     y = %.15lf\n\n", Maths::Special::errorFnC_inv(2.0));

  // display several values of the function
  // at equally spaced abscissas with a step of 0.1
  for (double x = 1.1; x < 1.99; x += 0.1)
    printf("x = %.1lf   y = %.15lf\n", 
    x, Maths::Special::errorFnC_inv(x));

  return 0;
}

Output

x = 0     y = 1.#INF00000000000
x = 1     y = 0.000000000000000
x = 2     y = -1.#INF00000000000

x = 1.1   y = -0.088855990494258
x = 1.2   y = -0.179143454621292
x = 1.3   y = -0.272462714726755
x = 1.4   y = -0.370807158593558
x = 1.5   y = -0.476936276204471
x = 1.6   y = -0.595116081449996
x = 1.7   y = -0.732869077959218
x = 1.8   y = -0.906193802436824
x = 1.9   y = -1.163087153676677

Parameters

y
the value at which to evaluate the function (0 \leq y \leq 2)

Returns

The inverse of the complementary error function.
GPL Licence — free for non commercial use. See Licence details.

Interactive Calculator

y
Result