(50g) Normal Distribution

12032018, 04:20 PM
(This post was last modified: 01262019 10:04 PM by John Keith.)
Post: #1




(50g) Normal Distribution
I have been following these two threads and rather than trolling either with HP 50g programs I am starting this thread of normal distribution programs.
NOTE: The first two programs below should be considered obsolete. They are inaccurate for large values of x as pointed out by Dieter and Albert Chan in following posts. I am leaving them here for illustrative purposes only. The programs in posts 3 and 18 should be used instead. The function Q(x), the upper tail normal CDF, is implemented in the HP 50 as UTPN. It requires the mean on level 3, the variance on level 2, and x on level 1. Note that the HP Prime implements P(x), the lowertail CDF as NORMALD_CDF. Either function can be obtained from the other by subtracting the value from 1 as detailed in the above linked threads. For example, the lowertail normal CDF would simply (but inaccuratly) be Code:
The normal PDF Z(x), which is implemented on the Prime as NORMALD, is not built in to the HP 50. It can be easily (but inaccurately) calculated with the following program: Code:
UPDATE: Yes the normal PDF is included. It's called NDIST. Sorry to all for the confusion. Next, a program to generate normally distributed random numbers. This program uses the Marsaglia polar method and returns two random numbers: Code:
Finally, a somewhat useful example program that takes advantage of the fact that the above program returns two random numbers at a time. Given an integer or a list of array dimensions on level 1, the following program returns an array of normally distributed complex numbers. The program requires the above program stored in a variable named 'N2' in an accessible directory: Code:
I believe that all of the above programs will run on the 48g and 49g calculators but they have only been tested on the 50g. 

« Next Oldest  Next Newest »

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