What is the Error Function?
The error function, written \(\operatorname{erf}(x)\), is a special function that appears throughout probability, statistics, and the theory of diffusion and heat conduction. It is defined as twice the integral of the Gaussian (bell-curve) from 0 to x, normalized so that \(\operatorname{erf}(\infty) = 1\). Closely related is the complementary error function, \(\operatorname{erfc}(x) = 1 - \operatorname{erf}(x)\), which measures the area in the tail of the distribution.
$$\operatorname{erf}\!\left(x\right) = \frac{2}{\sqrt{\pi}} \int_{0}^{x} e^{-t^{2}}\,dt, \qquad \operatorname{erfc}\!\left(x\right) = 1 - \operatorname{erf}\!\left(x\right)$$
How to use this calculator
Enter any real number x and the calculator returns both \(\operatorname{erf}(x)\) and \(\operatorname{erfc}(x)\). Positive and negative values are both supported because erf is an odd function: \(\operatorname{erf}(-x) = -\operatorname{erf}(x)\). The result is dimensionless and always lies between \(-1\) and \(1\).
The formula explained
The error function has no elementary closed form, so it must be evaluated numerically. This tool uses the classic Abramowitz & Stegun rational-polynomial approximation 7.1.26. It substitutes \(\tau = 1/(1 + px)\) with \(p = 0.3275911\) and the coefficients \(a_1 = 0.254829592\), \(a_2 = -0.284496736\), \(a_3 = 1.421413741\), \(a_4 = -1.453152027\), \(a_5 = 1.061405429\). Then \(\operatorname{erf}(x) \approx 1 - (a_1\tau + a_2\tau^{2} + a_3\tau^{3} + a_4\tau^{4} + a_5\tau^{5})\cdot e^{-x^{2}}\). The maximum absolute error of this approximation is about \(1.5 \times 10^{-7}\), accurate enough for nearly all engineering work.
Worked example
For \(x = 1\): \(\tau = 1/(1 + 0.3275911) \approx 0.753139\). Evaluating the polynomial and multiplying by \(e^{-1}\) gives \(\operatorname{erf}(1) \approx 0.842701\), matching the true value of \(0.8427008\). The complementary value is \(\operatorname{erfc}(1) \approx 0.157299\).
FAQ
What range does erf(x) take? It ranges from \(-1\) (as \(x \to -\infty\)) to \(+1\) (as \(x \to +\infty\)), passing through 0 at \(x = 0\).
How accurate is the result? The approximation is accurate to roughly 7 decimal places (error \(< 1.5\mathrm{e}{-7}\)).
What is erfc used for? The complementary error function is common in tail probabilities, bit-error rates in communications, and solutions to the diffusion equation.