Page 1 of 1

calculate values of Z-table with DM42

Posted: Tue Dec 10, 2019 9:50 pm
by fridlmue
Hi there,

as I'm not a native speaker probably there is already the solution for my question in the forums but I'm not able to find it because I search for the wrong terms.
I'm a happy new owner of a DM42 and now I'm searching for a solution to calculate the "values of the Z-table" with the calculator. (Like in https://www.dummies.com/education/math/ ... e-z-table/.)
I know what to search for in German ("(einseitige) Abgrenzung der Standardnormalverteilung" but I don't know what to search for in English :?
E.g. I want to calculate the probability for z=2,26 in the standard normal distibution.
Is there any program, either "pre-installed" in the program lib or some you know from, that can solve that task?
Or is it even possible to build a program calculating that?

Thanks and best regards
Friedrich

Re: calculate values of Z-table with DM42

Posted: Wed Dec 11, 2019 3:37 pm
by PierreMengisen
It is a normal distribution centered and reduced. You must evaluate it by a numerical integration of the function "(exp (-0.5 * x ** 2)) / sqrt (2π)" from -∞ to x. For this you have the HP42S digital integration program.

Re: calculate values of Z-table with DM42

Posted: Wed Dec 11, 2019 5:21 pm
by fridlmue
Ok, I'll try that! Thanks!

Re: calculate values of Z-table with DM42

Posted: Thu Dec 12, 2019 1:26 pm
by fridlmue
So I wrote the following program representing the formula:

Code: Select all

01 LBL "SND"
02 MVAR "z"
03 RCL "z"
04 x^2
05 +/-
06 0.5
07 x
08 e^x
09 2
10 ENTER
11 PI
12 x
13 SQRT
14 /
Now I try to integrate this for the variable z from LLIM = -1 to ULIM = 1 with different accuracy. Shouldn't that return ~0.682 (68,2%)? But I get something around 0.2724
It looks like I'm doing wrong somehow. Any idea what?

My second question is: What do I insert, if I want to integrate from -∞. Do i just use a very, very big negative number instead of -∞?

EDIT: I inserted the SQRT on line 13 as I got pointed to that a few posts later...

Re: calculate values of Z-table with DM42

Posted: Thu Dec 12, 2019 1:49 pm
by rprosperi
fridlmue wrote:
Thu Dec 12, 2019 1:26 pm
My second question is: What do I insert, if I want to integrate from -∞. Do i just use a very, very big negative number instead of -∞?
Basically, yes. The 42S "Programming Examples and Techniques" manual discusses this exact topic on p.127; I'd suggest reading that as there is some explanation and examples to illustrate how to do this.

Re: calculate values of Z-table with DM42

Posted: Thu Dec 12, 2019 1:50 pm
by Coyotte
Hello,

I'm far from being a specialist of the subject but just with a developper point of view, I do not see the Square Root appear in your program.
(But maybe is it normal...)

Regards,

Coyotte

Re: calculate values of Z-table with DM42

Posted: Thu Dec 12, 2019 2:02 pm
by fridlmue
Coyotte wrote:
Thu Dec 12, 2019 1:50 pm
Hello,

I'm far from being a specialist of the subject but just with a developper point of view, I do not see the Square Root appear in your program.
(But maybe is it normal...)

Regards,

Coyotte
Oh, men, you are so right! That was the Issue :lol:
Thanks!

Re: calculate values of Z-table with DM42

Posted: Thu Dec 12, 2019 2:14 pm
by fridlmue
rprosperi wrote:
Thu Dec 12, 2019 1:49 pm
fridlmue wrote:
Thu Dec 12, 2019 1:26 pm
My second question is: What do I insert, if I want to integrate from -∞. Do i just use a very, very big negative number instead of -∞?
Basically, yes. The 42S "Programming Examples and Techniques" manual discusses this exact topic on p.127; I'd suggest reading that as there is some explanation and examples to illustrate how to do this.
Cool! Thanks for the hint! This works pretty well for me with arguments LLIM -1000 and ACC 0.00001. I'm going to Iterate the best Value. Perhaps after that I'll pack all of it into a nice program... Makes fun so far to figure out the possibility :-)

Re: calculate values of Z-table with DM42

Posted: Thu Dec 12, 2019 3:53 pm
by PierreMengisen
With a centered and reduced distribution, it is not wise to use infinity as lower limit. For x <0 the probability is (0.5 - integral from x to 0). For x> 0 the probability is (0.5 + integral from 0 to x).
Pierre

Re: calculate values of Z-table with DM42

Posted: Thu Dec 12, 2019 9:46 pm
by fridlmue
PierreMengisen wrote:
Thu Dec 12, 2019 3:53 pm
With a centered and reduced distribution, it is not wise to use infinity as lower limit. For x <0 the probability is (0.5 - integral from x to 0). For x> 0 the probability is (0.5 + integral from 0 to x).
Pierre
If i think about it, this makes fully sense. Thank you for this second very valuable hint!