Error function
In mathematics, the error function, often denoted by erf, is a complex function of a complex variable defined as:
This integral is a special and sigmoid function that occurs often in probability, statistics, and partial differential equations. In many of these applications, the function argument is a real number. If the function argument is real, then the function value is also real.
In statistics, for non-negative values of, the error function has the following interpretation: for a random variable that is normally distributed with mean 0 and variance 1/2, is the probability that falls in the range.
Two closely related functions are the complementary error function defined as
and the imaginary error function defined as
where is the imaginary unit.
Name
The name "error function" and its abbreviation were proposed by J. W. L. Glaisher in 1871 on account of its connection with "the theory of Probability, and notably the theory of Errors." The error function complement was also discussed by Glaisher in a separate publication in the same year.For the "law of facility" of errors whose density is given by
, Glaisher calculates the chance of an error lying between and as:
Applications
When the results of a series of measurements are described by a normal distribution with standard deviation and expected value 0, then is the probability that the error of a single measurement lies between −a and +a, for positive a. This is useful, for example, in determining the bit error rate of a digital communication system.The error and complementary error functions occur, for example, in solutions of the heat equation when boundary conditions are given by the Heaviside step function.
The error function and its approximations can be used to estimate results that hold with high probability or with low probability. Given random variable and constant :
where A and B are certain numeric constants. If L is sufficiently far from the mean, i.e., then:
so the probability goes to 0 as.
Properties
The property means that the error function is an odd function. This directly results from the fact that the integrand is an even function.For any complex number z:
where is the complex conjugate of z.
The integrand f = exp and f = erf are shown in the complex z-plane in figures 2 and 3. Level of Im = 0 is shown with a thick green line. Negative integer values of Im are shown with thick red lines. Positive integer values of Im are shown with thick blue lines. Intermediate levels of Im = constant are shown with thin green lines. Intermediate levels of Re = constant are shown with thin red lines for negative values and with thin blue lines for positive values.
The error function at +∞ is exactly 1. At the real axis, erf approaches unity at z → +∞ and −1 at z → −∞. At the imaginary axis, it tends to ±i∞.
Taylor series
The error function is an entire function; it has no singularities and its Taylor expansion always converges, but is famously known " for its bad convergence if x > 1."The defining integral cannot be evaluated in closed form in terms of elementary functions, but by expanding the integrand e−z2 into its Maclaurin series and integrating term by term, one obtains the error function's Maclaurin series as:
which holds for every complex number z. The denominator terms are sequence in the OEIS.
For iterative calculation of the above series, the following alternative formulation may be useful:
because expresses the multiplier to turn the kth term into the st term.
The imaginary error function has a very similar Maclaurin series, which is:
which holds for every complex number z.
Derivative and integral
The derivative of the error function follows immediately from its definition:From this, the derivative of the imaginary error function is also immediate:
An antiderivative of the error function, obtainable by integration by parts, is
An antiderivative of the imaginary error function, also obtainable by integration by parts, is
Higher order derivatives are given by
where are the physicists' Hermite polynomials.
Bürmann series
An expansion, which converges more rapidly for all real values of than a Taylor expansion, is obtained by using Hans Heinrich Bürmann's theorem:By keeping only the first two coefficients and choosing and the resulting approximation shows its largest relative error at where it is less than :
Inverse functions
Given a complex number z, there is not a unique complex number w satisfying, so a true inverse function would be multivalued. However, for, there is a unique real number denoted satisfyingThe inverse error function is usually defined with domain, and it is restricted to this domain in many computer algebra systems. However, it can be extended to the disk of the complex plane, using the Maclaurin series
where c0 = 1 and
So we have the series expansion :
The error function's value at ±∞ is equal to ±1.
For, we have.
The inverse complementary error function is defined as
For real x, there is a unique real number satisfying. The inverse imaginary error function is defined as.
For any real x, Newton's method can be used to compute, and for, the following Maclaurin series converges:
where ck is defined as above.
Asymptotic expansion
A useful asymptotic expansion of the complementary error function for large real x iswhere !! is the double factorial of, which is the product of all odd numbers up to. This series diverges for every finite x, and its meaning as asymptotic expansion is that, for any one has
where the remainder, in Landau notation, is
as
Indeed, the exact value of the remainder is
which follows easily by induction, writing
and integrating by parts.
For large enough values of x, only the first few terms of this asymptotic expansion are needed to obtain a good approximation of erfc .
Continued fraction expansion
A continued fraction expansion of the complementary error function is:Integral of error function with Gaussian density function
Factorial series
- The inverse factorial series:
- Representation by an infinite sum containing the double factorial:
Numerical approximations
Approximation with elementary functions
- Abramowitz and Stegun give several approximations of varying accuracy. This allows one to choose the fastest approximation suitable for a given application. In order of increasing accuracy, they are:
- Exponential bounds and a pure exponential approximation for the complementary error function are given by
- A tight approximation of the complementary error function for is given by Karagiannidis & Lioumpas who showed for the appropriate choice of parameters that
- A single-term lower bound is
- Another approximation is given by Sergei Winitzki using his "global Padé approximations":
Polynomial
with
and
Table of values
x | erf | 1-erf |
0 | ||
0.02 | ||
0.04 | ||
0.06 | ||
0.08 | ||
0.1 | ||
0.2 | ||
0.3 | ||
0.4 | ||
0.5 | ||
0.6 | ||
0.7 | ||
0.8 | ||
0.9 | ||
1 | ||
1.1 | ||
1.2 | ||
1.3 | ||
1.4 | ||
1.5 | ||
1.6 | ||
1.7 | ||
1.8 | ||
1.9 | ||
2 | ||
2.1 | ||
2.2 | ||
2.3 | ||
2.4 | ||
2.5 | ||
3 | ||
3.5 |
Related functions
Complementary error function
The complementary error function, denoted, is defined aswhich also defines, the scaled complementary error function. Another form of for non-negative is known as Craig's formula, after its discoverer:
This expression is valid only for positive values of x, but it can be used in conjunction with erfc = 2 − erfc to obtain erfc for negative values. This form is advantageous in that the range of integration is fixed and finite.
Imaginary error function
The imaginary error function, denoted erfi, is defined aswhere D is the Dawson function.
Despite the name "imaginary error function", is real when x is real.
When the error function is evaluated for arbitrary complex arguments z, the resulting complex error function is usually discussed in scaled form as the Faddeeva function:
Cumulative distribution function
The error function is essentially identical to the standard normal cumulative distribution function, denoted Φ, also named norm by some software languages, as they differ only by scaling and translation. Indeed,or rearranged for erf and erfc:
Consequently, the error function is also closely related to the Q-function, which is the tail probability of the standard normal distribution. The Q-function can be expressed in terms of the error function as
The inverse of is known as the normal quantile function, or probit function and may be expressed in terms of the inverse error function as
The standard normal cdf is used more often in probability and statistics, and the error function is used more often in other branches of mathematics.
The error function is a special case of the Mittag-Leffler function, and can also be expressed as a confluent hypergeometric function :
It has a simple expression in terms of the Fresnel integral.
In terms of the regularized gamma function P and the incomplete gamma function,
is the sign function.
Generalized error functions
Some authors discuss the more general functions:Notable cases are:
- E0 is a straight line through the origin:
- E2 is the error function, erf.
These generalised functions can equivalently be expressed for x > 0 using the gamma function and incomplete gamma function:
Therefore, we can define the error function in terms of the incomplete Gamma function:
Iterated integrals of the complementary error function
The iterated integrals of the complementary error function are defined byThe general recurrence formula is
They have the power series
from which follow the symmetry properties
and
Implementations
As real function of a real argument
- In Posix compliant operating systems, the header math.h shall declare and the mathematical library libm shall provide the functions erf and erfc as well as there single precision and extended precision counterparts erff, erfl and erfc, erfcl.
- The GNU Scientific Library provides erf, erfc, log, and scaled error functions.
As complex function of a complex argument
- , numeric C library for complex error functions, provides the complex functions cerf, cerfc, cerfcx and the real functions erfi, erfcx with approximately 13–14 digits precision, based on the Faddeeva function as implemented in the
Related functions
- Gaussian integral, over the whole real line
- Gaussian function, derivative
- Dawson function, renormalized imaginary error function
- Goodwin–Staton integral
In probability
- Normal distribution
- Normal cumulative distribution function, a scaled and shifted form of error function
- Probit, the inverse or quantile function of the normal CDF
- Q-function, the tail probability of the normal distribution