HP 32sII Integration Error of Standard Normal Curve  Printable Version + HP Forums (https://archived.hpcalc.org/museumforum) + Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum1.html) + Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum2.html) + Thread: HP 32sII Integration Error of Standard Normal Curve (/thread214176.html) 
HP 32sII Integration Error of Standard Normal Curve  Anthony (USA)  03132012 Hello, everyone. When I integrate I usually use my graphing calculator so I haven't encountered any obstacles/errors. My favorite scientific calculator (the calculator I always have with me everywhere I go) is HP 32sII, and recently I decided to use its numeric integration capability. Specifically I integrated the standard normal curve, exp^(z^2/2)/sqrt(2*pi)it produced inaccurate results using the EQN method, but produced accurate results using the PRGM method. The expression I entered in EQN is exp^(z^2/2)/sqrt(2*pi), and when I integrate it from z=0 to z=1, the result is 0.4767 (the correct result should be 0.3413). Integrating over smaller ranges (like z=0 to z=0.1, z=0 to z=0.5, etc), the error starts to accumulate. I also integrated the standard normal curve by programming it:
A01 LBL A The results of integrating the PRGM above of the standard normal curve are accurate. I tried inputting the EQN and PRGM in HP 33s and HP 35s and the results are accurate. I guess that's one of the reasons why the HP32sII was discontinued and better versions were conceived. It's a shame really, HP 32sII is the best among the last 3 great scientific calculators (HP 32sII, HP 33s, HP35s) that HP produced. HP 32sII has floating comma when inputting numbers, unlike the HP 35s. Number crunching is crisper in the 32sII, there's no worry that some buttons may not have registered (*cough* HP 35s *cough*), there's a large ENTER button unlike the miniscule ENTER button on the 33s. Entry of simple fractions, for example 3/4, is 3decimaldecimal4, not decimal3decimal4 that 35s requires. Everything is so fluid in the HP 32sII...Ahh, sorry for the short spiel there, I'm just so passionate about the 32sII. :) As a businessrelated student I use a financial calculator, too (HP 10bII+), and it has a "Z<>P" capability that converts zscores to probabilities/areas under the standard normal curve, so I'm not that too hampered by my HP32sII's shortcomings, integrationwise. Now that I'm on the topic of financial calculators, HP SHOULD MAKE a hybrid of HP32sII and HP 10bII+, an RPN scientific/financial calculator in which all the functions are accessible through the shift keys as opposed to having to invoke a menu to access such math functions like LOG. I love RPN, but I didn't gravitate towards the HP 30b when selecting my financial calculator because of that nuisance: in order to use the math functions like LOG, LN, etc, one would have to go through a menu. Oh, well. Well, I just wanted to share the error in the HP 32sII to make everyone aware of its inaccurate integration of the standard normal curve.
Thanks.
Re: HP 32sII Integration Error of Standard Normal Curve  Dieter  03132012 Anthony, the result 0.4767 you mentioned is correct for the integral from 0 to 1 of the function exp((z)^2/2)/sqrt(2*pi), i.e. where z (or z) is squared. So the problem most probably is caused by a somewhat incorrect function definition. BTW that's why the 35s uses two different characters for the operator "" and the sign of a negative number. ;) So, you may simply try something like exp((z^2/2))/sqrt(2*pi). Or, much better, use one of the numerous other ways to evaluate the normal integral  as well as its inverse. I prefer rational approximations for both. Another approach is shown in the 15C Advanced Functions Handbook (p. 60 ff.) which uses an elegant variable transformation and the integrate function to obtain exact results for the normal integral even far out in the tails. So there's nothing wrong with your 32s. It's just the usual precedence of the minus sign that is evaluated before the square. In other words: z^2 is the same as (z)^2 and not (z^2). As far as I know most calculators work this way. By the way: the 34s of course has functions for various statistical distributions and their inverse. The standard normal integral and its quantile function are directly accessible from the keyboard. With full 16digit precision (or 32, if you wish) ;) Dieter
Edited: 13 Mar 2012, 6:51 p.m.
Re: HP 32sII Integration Error of Standard Normal Curve  Anthony (USA)  03132012 Oh, but that's how I entered the expression in my other calculators, too: exp^(z^2/2)/sqrt(2*pi) I get the correct 0.3413 result in all my calculators except the HP 32sII. I tried what you said, to input (z^2/s), that is, to factor out the 1 outside the (z^2/2) subexpression and the HP 32sII gives the correct 0.3413 result. That leads to a troubling dilemma though...Why won't HP 32sII square the zvariable first then negate it, which is what it should do? Why is it negating z first then squaring it? In the expression (z^2/2), which is equivalent to 1*z^2/2, the order of operations clearly dictate that exponents/powers (i.e., z^2) have to be evaluated first before multiplication/division (i.e., *1 and /2)? I'm looking at my HP 33s and HP 35s, and the expression I inputted is exp^(z^2/2)/sqrt(2*pi), and they're correctly honoring the order of operations by squaring z first then negating it; I don't have to clearly factor out the 1 outside of the expression: (z^2/2) So, as a recap, by negating z first then squaring it, the expression exp^(z^2/2)/sqrt(2*pi) is essentially being evaluated as exp^(z^2/2)/sqrt(2*pi) by HP 32sII. Thank you for telling me this, now I'll make sure to
exp^(z^2/2)/sqrt(2*pi) I get the correct 0.3413 result in all my calculators except the HP 32sII. I tried what you said, to input (z^2/2), that is, to factor out the 1 outside the (z^2/2) subexpression and the HP 32sII gives the correct 0.3413 result. That leads to a troubling dilemma though...Why won't HP 32sII square the zvariable first then negate it (which is what it should do for the standard normal curve)? Why is it negating z first then squaring it (which is (z)^2 = z^2)? In the expression (z^2/2), which is equivalent to 1*z^2/2, the order of operations clearly dictate that exponents/powers (i.e., z^2) have to be evaluated first before multiplication/division (i.e., *1 and /2)? The result 0.4767 is being obtained by integrating exp^(+z^2/2)/sqrt(2*pi) from z=0 to z=1. I'm looking at my HP 33s and HP 35s, and the expression I inputted is exp^(z^2/2)/sqrt(2*pi), and they're correctly honoring the order of operations by squaring z first then negating it; I don't have to clearly factor out the 1 outside of the expression: (z^2/2) So, as a recap, by negating z first then squaring it, the expression exp^(z^2/2)/sqrt(2*pi) is essentially being evaluated as exp^(z^2/2)/sqrt(2*pi) by HP 32sII. Thank you for telling me this, now I'll make sure to add in extra sets of parentheses to make sure that HP 32sII is evaluating expressions correctly. ... Hopefully I conveyed the problem clearly. To sum up, the HP 32sII is evaluating the standard normal curve exp^(z^2/2)/sqrt(2*pi) as if it's exp^(z^2/2)/sqrt(2*pi), because HP 32sII is treating (z^2/2) as if it's (z)^2/2. HP 32sII is not honoring the order of operations. In the expression (z^2/2) (which is the same as (1*z^2/2)), z has to be squared first then negated (multiplied to 1) because exponents/powers are evaluated before multiplication/division. HP 32sII is negating z first then squaring the result after, which is not what it should do, rather, z should be squared first then the result negated after.
Re: HP 32sII Integration Error of Standard Normal Curve  Jeff Kearns  03132012 Quote: My first thought upon reading this (the original post refers to an 'older' calculator after all) was that your 34S reference had mistaken the 32E for the 34C, not realizing that HP was not the implied brand. The 32E has an extensive Statistical function set for a 1978 model. It includes Normal Distribution and Inverse Normal Distribution directly from the keyboard (Q and Q^1). You can calculate your ZScore with these. Useful for LeanSigma projects! I have ordered my 30b chassis and look forward to having a latest version 34s soon.
Re: HP 32sII Integration Error of Standard Normal Curve  Nick_S  03142012 I can reproduce both your results with the HP15c:  the value of 0.4767 occurs if you negate z before squaring,  while 0.3413 is obtained if you square z and then negate.
Try inserting parentheses around (z^2) in your formula: This is another case where RPN is nice as the ambiguities in operator precedence for a given implementation of infix notation do not occur.
Nick Edited: 14 Mar 2012, 3:21 a.m.
