Accurate Bernoulli numbers on the 41C, or "how close can you get"?
03-19-2014, 06:47 AM (This post was last modified: 03-19-2014 06:52 AM by Ángel Martin.)
Post: #17
 Ángel Martin Senior Member Posts: 1,303 Joined: Dec 2013
RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"?
Hi Dieter, glad to see you find the SandMath worth looking at. Which revision are you using? Are there two appendices 9a and 9b, or only one appendix 9?

http://hp41.claughan.com/file/SANDMATH_4...Manual.pdf

I say this because in the latest versions (Revision "M", see above link) there are a couple of functions directly related to the quantile, one (ICPF) using the inverse error function on a general Normal distribution (s,m), and another (QNTL) using Halley's iterative method on a standard Normal (0,1). The functions are a bit buried in the -FACTORIAL group, in the sub-functions FAT

The manual has room for improvement, but isn't the quantile function QNTL what you're asking about? It is briefly (and poorly) documented in page 48. Below you can see the FOCAL code for this function, which uses Halley's method to solve for a CPF (Cumulative Probability Function) equation equal to the quantile's value. The convergence criteria is a poor E-7, probably not what you're looking for I'm afraid.

Code:
 01    LBL "QNTL" 02    STO 03 03    CLX 04    STO 04 05    LBL 01 06    0 07    ENTER^ 08    1 09    RCL 04 10    CPF 11    RCL 03 12    - 13    STO 05 14    0 15    ENTER^ 16    1 17    RCL 04 18    PDF 19    RCL 05 20    X<>Y 21    ST* Y 22    X^2 23    LASTX 24    RCL 04 25    * 26    RCL 05 27    * 28    2 29     / 30    + 31     / 32    ST- 04 33    ABS 34    E-7 35    X<Y? 36    GTO 01 37    END

As per ICPF, it's a much simpler code since IERF does all the work in there:

Code:
 01    LBL "ICPF"  02    ST+ X 03    E 04    - 05    IERF 06    2 07    SQRT 08    * 09    * 10    + 11    END

I use the CUDA library algorithms to calculate the inverse error function - it's a very fast implementation (yes, even on a normal HP-41) that takes a huge MCODE listing code.

I may be confusing subjects, statistics is not my forte (I'm really a jack of all trades and master of none, as I'm sure you have noticed ;-) I think this function is equivalent to the 38E's, but haven't looked at the 34S at all (don't have one myself).

l hope this clarifies, but let me know if you see any issues or would like additions/changes made.

Best,
'AM
 « Next Oldest | Next Newest »

 Messages In This Thread Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Dieter - 03-09-2014, 07:12 PM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Thomas Klemm - 03-10-2014, 12:20 AM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Dieter - 03-10-2014, 08:23 PM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Thomas Klemm - 03-12-2014, 04:34 PM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Ángel Martin - 03-14-2014, 10:05 AM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Dieter - 03-14-2014, 09:37 PM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Thomas Klemm - 03-14-2014, 10:00 PM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Thomas Klemm - 03-14-2014, 10:21 PM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Thomas Klemm - 03-14-2014, 10:04 PM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Ángel Martin - 03-15-2014, 09:32 AM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Thomas Klemm - 03-15-2014, 12:26 PM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Dieter - 03-15-2014, 06:12 PM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Thomas Klemm - 03-15-2014, 07:17 PM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Ángel Martin - 03-15-2014, 12:56 PM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Ángel Martin - 03-15-2014, 08:47 PM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Dieter - 03-18-2014, 09:24 PM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Ángel Martin - 03-19-2014 06:47 AM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Dieter - 03-19-2014, 01:37 PM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Ángel Martin - 03-19-2014, 07:32 PM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Dieter - 03-19-2014, 08:31 PM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Ángel Martin - 03-20-2014, 06:46 AM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Dieter - 03-20-2014, 12:44 PM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Ángel Martin - 03-20-2014, 02:21 PM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Dieter - 03-20-2014, 09:07 PM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Ángel Martin - 03-21-2014, 05:54 AM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Dieter - 03-21-2014, 01:37 PM RE: Accurate Bernoulli numbers on the 41C, or "how close can you get"? - Dieter - 03-28-2014, 07:56 PM

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