# Aproximation of a Normal Distribution function

I am reviewing and documenting a software application (part of a supply chain system) which implements an approximation of a Normal Distribution function; the original documentation mentions the same/similar formula quoted here

Φ(x) = from -∞ to x ∫ ( (1 ⁄ √ ( 2π)) * ( e -½ x² ) )

This is approximated with what looks like an asymptotic series like here however the expression is slightly different:

Φ(x) ≈ (1 ⁄ ( x √ 2π)) * [ 1 - 1 ⁄x² + 3⁄x4 - 15⁄x6 + 105⁄x8]

The original document quotes a "Cambridge Statistical Tables" book which I don't have; also, the software uses a precalculated table for values of x between [-8.2, 8,2] and uses the approximation function for values of x outside that interval.

I need to find some reference that explains why this particular formula was chosen, and how accurate the approximation really is. (The documentation claims that an error less then the 7th decimal is "not bad")

Also, the constant 1 ⁄ √ 2π does it have a name? All I was able to find was that "this expression ensures that the total area under the curve Φ(x) is equal to one"

Does it matter if the constant has only 10 decimals when the double type in Java (IEEE 754) has a precision of aproximate 16 decimals?

-
In the first equation the exponent should have a minus. In the second one, you have an unclosed paren. The expansion is wrong. Fragments of it resemble the correct expansion for integral from x to $\infty$, but the series shouldn't be in a denominator, and you're missing an overall factor of $\exp(-x^2/2)$. –  Mio Mar 26 '10 at 11:32
See here mathworld.wolfram.com/Erf.html , there's a section about the asymptotic expansion and how it's obtained. Mind the factors of 1/2. –  Mio Mar 26 '10 at 11:40
Thanks Mio, I fixed the parts which were wrong. The Erf page describe asymptotic series where the x variables are nominators while the expression I found in my application has the x variables on the denominator; the original documentation mentions the formula as described above hence I am still puzzled. –  Adrian Mar 26 '10 at 12:42
I don't see how that asymptotic expansion makes any sense at all --- it is going to zero for large x while Phi(x) is going to one. PS You may want to look at Abramowitz & Stegun (Handbook of Mathematical Functions) which gives a lot of details on various functions, expansions etc. I don't have my copy here but I'll bet they have something useful. –  Apollo Apr 12 '10 at 14:35

The source code of R (http://cran.r-project.org/mirrors.html ) contains implementation (in C) of various distributions, and among them, of a normal one (see, for example, the file src/nmath/pnorm.c in the source tree of the latest version 2.10.1). The approximation they are using seems to be different (and more precise) than yours, but there are references in comments. Probably you may get a hint by looking there.

-

This is the (divergent) asymptotic development for $f(x)=\int_x^{\infty} e^{-{1\over 2}t^2} \ dt$ given by

$$f(x) \sim e^{-{x^2\over 2}}\ (\ {1\over x}\ + \ \Sigma_{k=1}^{\infty}\ {(-1)^k(2k-1)!\over 2^{k-1}(k-1)!}\ {1\over x^{2k+1}}\ )$$ or $$f(x) \sim e^{-{x^2\over 2}}\ (\ {1\over x}\ - {1\over x^2} + {3\over x^5} - {15\over x^7} + {105\over x^9} - {945\over x^{11}}...)$$

It is easily obtained from an integration by parts. The rest is given by an explicit integral. From its expression, one can check that f(x) is in fact squeezed between two consecutive sums of the series. As a result, we have the bound, for all x>0,

$$0 \geq f(x) - e^{-{x^2\over 2}}\ (\ {1\over x}\ - {1\over x^2} + {3\over x^5} - {15\over x^7} + {105\over x^9}) \geq - e^{-{x^2\over 2}}\ {945\over x^{11}}$$

Divergent series were standard tools at the beginning of the XXe century. I can't provide a reference, but the book of Hardy "Divergent series" may be a starting point for a bibliographic search.

The divergent asymptotics was chosen because it is "good" at infinity. When truncated to some power (say 9), it has the correct behavior when x goes to infinity, that is, it goes to zero, just like f(x). So it gives an interesting approximation of f for all sufficiently big value of x. This of course is not the case of a development obtained by truncating a converging series in positive powers of x.

-