(50g) Normal Distribution
|
12-03-2018, 08:45 PM
(This post was last modified: 12-03-2018 09:03 PM by John Keith.)
Post: #3
|
|||
|
|||
RE: (50g) Normal Distribution
Thank you for your valuable insights, Dieter.
(12-03-2018 07:05 PM)Dieter Wrote: Yes, that's simple, but not a good idea. Try this for x=–10 to see why. ;-) HP 50 version of above: Code:
(12-03-2018 07:05 PM)Dieter Wrote: By the way, another useful function is the two-sided symmetric CDF A(x), i.e. the integral from –x to +x. Here similar considerations apply to get an accurate result for any x. If A(x) is calculated the tricky part is maintaining a decent accuracy for x close to 0, while for 1–A(x) the less trivial cases are those with large x. But this requires more than just a function for the upper or lower tail integral. What we need is an accurate value for the integral from 0 to x. Otherwise the trivial way of calculating A(x) = 1–2·UPTN(abs(x)) will suffer from digit cancellation for x<0,12566... As a rule of thumb, at x=10–n the last n digits are lost. But in praxi this admittedly is not much of a problem. And for x<10–6 you can simply set A(x) = x·√(2/pi). ;–) The HP 50 does have a constant pi but it is symbolic by default and converting it to a numeric value takes longer than the rest of the code to execute. \pi \->NUM saves about 5 bytes over the in-line constant but I feel the extra memory is worth it if the code is to be executed inside a loop. Also, I cannot code √(2pi) directly because the actual formula is √(2*pi*v). The ... 2. * ... in the program is where the variance v is multiplied by 2. (12-03-2018 07:05 PM)Dieter Wrote: But, more important, this direct method is not exact for large x. The reason for the problem is explained more detailled in the HP67/97 program thread you have linked to. If you take a look at the program you will see a more elaborate method for calculating Z(x) which provides better accuracy. The HP 50 does not have inverse CDF functions, nor does it have a built-in command for normal RANDs. The Prime does have all of the above functions but I am trying to provide the missing ones for the HP 50. I will look at your other suggestions when I have time but I fear some of them are "above my pay grade". John |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)