|Re: Internal Computation of Cumulative Distributions|
Message #13 Posted by Rodger Rosenbaum on 22 June 2006, 10:47 p.m.,
in response to message #11 by Les Wright
I tweaked the Hastings formula, 26.2.19, adding two more terms and changing the final exponent. This augmented version has about two orders of magnitude lower error (1.5E-9). The parameters are:
d1 = .066490394
d2 = .028736092
d3 = .0048418539
d4 = .00021102572
d5 = 8.6356160E-5
d6 = 1.6802053E-5
d7 = -2.2584744E-6
d8 = 4.2881737E-7
The full expression for Q(x) is:
This formula is optimized for the range 1 < x < 7. I was able to get better accuracy from the extra 2 terms if I didn't go down to x=0, but rather only down to x=1.
Formula 26.2.11 seems to be the best one for low values of x. I found that 9 terms of 26.2.11 will give 10 digit accuracy, and 11 terms will give 13 digits of accuracy for 0 <= x <= 1.
Formula 26.2.12 works best for large values of x. In fact, if you examine this formula, you will see that as x becomes very large, the series approaches 1, and Z(x)/x approaches Q(x). However, this formula doesn't work well for small values of x. When x is small, the series part diverges as you add more terms. I find that 22 terms will give 11 digit accuracy for x > 7, and for x = 47, it gives 47 digit accuracy (strictly coincidental).
So, the thing to do (so far) would be to use the 9-term 26.2.11 for the range 0 <= x <= 1, the augmented 26.2.19 for 1 < x < 7, and the 22-term 26.2.12 for 7 < x.
Is your email address as given here in the forum info correct? I should email you some pix.