Post Reply 
Accurate Normal Distribution for the HP67/97
12-02-2018, 10:08 PM (This post was last modified: 12-02-2018 11:11 PM by Dieter.)
Post: #18
RE: Accurate Normal Distribution for the HP67/97
(12-02-2018 07:44 PM)Albert Chan Wrote:  What is the formula for the inverse cdf guess ? Is it this one ?

https://www.johndcook.com/blog/normal_cdf_inverse/

No, that's the standard Hastings approximation which is also listed in the A&S book.
But there are better ways. If you limit the domain for p to 1E–99 (underflow limit for most classic calculators) the error can be reduced by almost one magnitude, just by selecting different coefficients.

The HP67/97 program above uses a much simpler custom approximation (line 113...152) which I designed myself. It is taylored to a certain error so that the following correction step yields about 11-digit accuracy for the Normal quantile if evaluated with sufficient precision. On the HP67/97 this means the result is about as good as it gets with 10 digit working precision.

(12-02-2018 07:44 PM)Albert Chan Wrote:  I do not have access to the Abramovitz & Stegun book.

With internet access you have. The book is freely available online. Both as PDF as well as HTML-ized. However, many/most tables have been removed since today we have other means for calculating transcendental functions. ;-)

(12-02-2018 07:44 PM)Albert Chan Wrote:  Is third order correction faster than simple Newton's method ?

Yes, significantly. After all, that's why I implemented it. ;-)

Let t be the Newton correction term (p–Q(x))/Z(x), just as in your post (except the sign).
Then the third-order correction uses expressions in t, t² and t³ to get a much better result:

x := x + t + x/2 · t² + (2x²+1)/6 · t³

Newton's method uses only the first term t.
Halley's method is comparable to the above series up to t².
And with terms up to t³ even better results are obtained.

The WP34s code for the Normal quantile also sets a rough estimate first (I don't remember the exact way, but I think I can look it up somewhere) and then merely two iterations are required to get a result with 30+ digit accuracy, only limited by the calculator's 34-digit working precision. Actually an computation with even higher precision would show that two approximations were even good for 40+ digits. So this really is a quite good extrapolation formula.

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Accurate Normal Distribution for the HP67/97 - Dieter - 12-02-2018 10:08 PM



User(s) browsing this thread: 1 Guest(s)