Approximation With Elementary Functions
Abramowitz and Stegun give several approximations of varying accuracy (equations 7.1.25–28). This allows one to choose the fastest approximation suitable for a given application. In order of increasing accuracy, they are:
- (maximum error: 5·10−4)
where a1 = 0.278393, a2 = 0.230389, a3 = 0.000972, a4 = 0.078108
- (maximum error: 2.5·10−5)
where p = 0.47047, a1 = 0.3480242, a2 = −0.0958798, a3 = 0.7478556
- (maximum error: 3·10−7)
where a1 = 0.0705230784, a2 = 0.0422820123, a3 = 0.0092705272, a4 = 0.0001520143, a5 = 0.0002765672, a6 = 0.0000430638
- (maximum error: 1.5·10−7)
where p = 0.3275911, a1 = 0.254829592, a2 = −0.284496736, a3 = 1.421413741, a4 = −1.453152027, a5 = 1.061405429
All of these approximations are valid for x ≥ 0. To use these approximations for negative x, use the fact that erf(x) is an odd function, so erf(x) = −erf(−x).
Another approximation is given by
where
This is designed to be very accurate in a neighborhood of 0 and a neighborhood of infinity, and the error is less than 0.00035 for all x. Using the alternate value a ≈ 0.147 reduces the maximum error to about 0.00012.
This approximation can also be inverted to calculate the inverse error function:
Read more about this topic: Error Function
Famous quotes containing the words elementary and/or functions:
“Listen. We converse as we liveby repeating, by combining and recombining a few elements over and over again just as nature does when of elementary particles it builds a world.”
—William Gass (b. 1924)
“Let us stop being afraid. Of our own thoughts, our own minds. Of madness, our own or others. Stop being afraid of the mind itself, its astonishing functions and fandangos, its complications and simplifications, the wonderful operation of its machinerymore wonderful because it is not machinery at all or predictable.”
—Kate Millett (b. 1934)