Error Function Calculator
erf(x) · erfc(x) · erfcx(x) · erfi(x) · Tables · Step-by-step
Quick Examples
Any real number. For erfi, large |x| may be slow to compute.
Step-by-Step Approximation
Quick Examples
erf⁻¹: y ∈ (−1, 1) · erfc⁻¹: y ∈ (0, 2)
Step-by-Step (Newton-Raphson)
Function Plot (x from −4 to 4)
Generate Table of Values
| x | erf(x) | erfc(x) | erfcx(x) | erfi(x) |
|---|
What is the Error Function?
The error function, denoted erf(x), is one of the most important special functions in mathematics and applied science. It is defined as the integral erf(x) = (2/√π) ∫₀ˣ e⁻t² dt. The factor 2/√π normalizes the function so that erf(∞) = 1. The function outputs values between −1 and +1, is odd (erf(−x) = −erf(x)), and is strictly increasing. It emerges naturally whenever Gaussian integrals appear in a context with a finite upper limit — which happens in probability theory, heat conduction, and diffusion.
The name "error function" comes from the theory of observational errors in astronomy and surveying, where Gauss and Laplace used it to describe the probability that a measurement error falls within a given range. Today it is indispensable in statistics (it gives the CDF of the normal distribution), physics (diffusion, the heat equation), and engineering (communications, signal detection).
Complementary Error Function (erfc)
The complementary error function is simply erfc(x) = 1 − erf(x). It represents the probability mass in the tail of the Gaussian beyond x. While erf(x) focuses on accumulated probability from 0 to x, erfc(x) focuses on the remaining tail from x to ∞. Special values are erfc(0) = 1 and erfc(∞) = 0. In reliability engineering, erfc often appears directly because you care about failure probabilities — the chance that a quantity exceeds a threshold — rather than the accumulated mass below it.
For large positive x, erfc(x) decays very rapidly: erfc(1) ≈ 0.1573, erfc(2) ≈ 0.00468, erfc(3) ≈ 0.0000221. This fast decay makes direct computation numerically unstable for large x, which motivates the scaled version erfcx.
How to Calculate erf(x) — Abramowitz & Stegun Approximation
While erf(x) has no closed-form expression in terms of elementary functions, it can be computed to high accuracy using rational polynomial approximations. The most widely used approximation is from Abramowitz and Stegun (formula 7.1.26), which achieves a maximum absolute error of less than 1.5 × 10⁻⁷ across all real x:
Set t = 1/(1 + 0.3275911 |x|), then compute the polynomial p(t) = t(0.254829592 + t(−0.284496736 + t(1.421413741 + t(−1.453152027 + t · 1.061405429)))), and finally erf(x) = sign(x) · (1 − p(t) · e⁻x²). This five-coefficient Horner-form polynomial runs in constant time and is the standard choice in most scientific computing libraries.
Common Values of erf(x)
| x | erf(x) | erfc(x) | erfcx(x) |
|---|---|---|---|
| 0 | 0.000000 | 1.000000 | 1.000000 |
| 0.5 | 0.520500 | 0.479500 | 0.615080 |
| 1 | 0.842701 | 0.157299 | 0.427584 |
| 1.5 | 0.966105 | 0.033895 | 0.253994 |
| 2 | 0.995322 | 0.004678 | 0.134641 |
| 3 | 0.999978 | 0.000022 | 0.057289 |
Applications of the Error Function
Normal Distribution and Probability
For a standard normal variable Z ~ N(0,1), P(−x ≤ Z ≤ x) = erf(x/√2). Equivalently,
the normal CDF is Φ(x) = (1 + erf(x/√2))/2. This means every probability calculation
involving the normal distribution can be expressed in terms of erf. In Python's SciPy,
scipy.special.erf is directly accessible; in C99 and C++11, std::erf
is a standard library function.
Heat Conduction and Diffusion
The solution to the one-dimensional heat equation ∂T/∂t = α ∂²T/∂x² in a semi-infinite medium with a step-change boundary condition is T(x,t) = T₀ erfc(x / (2√(αt))). Here, α is the thermal diffusivity. The argument x/(2√(αt)) is the dimensionless similarity variable for diffusion problems. This formula is used to compute how far heat (or a diffusing species) has penetrated into a material at time t — essential in materials science, geophysics, and semiconductor fabrication.
Signal Processing and Communications
In digital communications, the bit error rate (BER) for binary phase-shift keying (BPSK) transmitted over an additive white Gaussian noise (AWGN) channel is BER = erfc(√(Eₛ/N₀))/2, where Eₛ/N₀ is the signal-to-noise ratio per bit. The Q-function used in communications is Q(x) = erfc(x/√2)/2. System designers use erfc tables and calculators to determine the minimum transmit power needed to achieve a target error rate, making erfc fundamental to wireless communication system design.
erfc vs erfcx — When to Use Each
For small to moderate values of x (roughly |x| ≤ 3), computing erfc(x) = 1 − erf(x) directly is numerically stable. However, for large positive x, erfc(x) becomes extremely small (e.g., erfc(5) ≈ 1.54 × 10⁻²²), and floating-point cancellation errors in 1 − erf(x) dominate. The scaled function erfcx(x) = e^(x²) · erfc(x) avoids this: for x = 5, erfcx(5) ≈ 0.1107, a perfectly representable number. After obtaining erfcx(x), you can recover erfc(x) = erfcx(x) · e^(−x²) using high-precision arithmetic only when needed. Use erfcx when computing erfc for arguments x > 3 in any numerically sensitive context.