Sunday, March 31, 2019

HP 17BII: Normal Distribution and Random Number Generators

HP 17BII:  Normal Distribution and Random Number Generators

Normal Distribution

The following solver approximates the area of a normal distribution.  The following equation uses L (Let) and G (Get), so this can be used for the classic HP 17BII and the silver HP 17BII+.

NORM: CDF=1-EXP(-X^2÷2)÷SQRT(2*PI)*(.4361836*
L(T:INV(1+.33267*X))-.1201676*G(T)^2+.9372980*G(T)^3)

Instructions:

For x ≥ 0, enter x in ( X ) and then press (CDF) to solve. 

For x < 0, enter abs(x) in ( X ), press (CDF) to solve, negate the result and add 1. 

The area will be calculated from 0 (the center) to x. 

Example 1:  x = 2.5

2.5 (X), (CDF):  Result:  0.99

Example 2:  x = 1

1 (X), (CDF):  Result: 0.84

Example 3:  x = -1.5

(Algebric Mode)

1.5 (X), (CDF) [+/-] [ + ] 1 [ = ]:  Result:  0.07

Source:

"Handbook of Mathematical, Scientific, and Engineering Formulas, Tables, Functions, Graphics, Transforms"  Research & Education Association.  1984  ISBN 0-87891-521-4

Random Numbers




The HP 17B series does not have a random number function.  We can use the solver to generate random numbers.  Random numbers between 0 to 1 are generator. 

The format to use will depend on the version of HP 17B you are working with.

The code used will use pseudo-random generator:

r_i+1 = frac( ( π + r_i)^5 )

Classic HP 17B and HP 17BII:

We can use Let and Get to generate random numbers, they are used to generate in recurring sequences. 

R#=FP((PI+G(R#))^5)

Instructions:

Enter a starting seed, press (R#).
For future random numbers, keep on pressing (R#).

Brown and Silver HP 17BII+:

We'll use the two variables.  Despite the fact that Let and Get are available on the silver HP 17BII+, they cannot be used in recurring sequences. 

R2#=FP((PI+R1#)^5)

Instructions: 
Enter a starting seed, press (R1#).
For the first random number, press (R2#).
For future random numbers, press [ STO ] (R1#), then (R2#).

Other pseudo-random number generators to try:

r_i+1 = frac( 997 * r_i )

r_i+1 = frac( 147 * r_i )

Eddie


All original content copyright, © 2011-2019.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

No comments:

Post a Comment

HP 42S and TI-60: Dimensions of a Race Track

HP 42S and TI-60:  Dimensions of a Race Track We have a race track that consists of two rectangular tracks connected by a circular ri...