Post Reply 
HP 50g normal distribution
05-30-2020, 03:32 PM
Post: #1
HP 50g normal distribution
Hello,

I'm trying to plot a normal distribution on the 50g. I know the function NDIST gives the value of the curve at a given value of x, based on a mean and standard deviation. Problem is i can't figure out how to use it in a program or equation that i can then use in the plotting function.
I know that NDIST takes 3 parameters on the stack, but i can't figure out how to use it. I tried this:
Code:
<< X -> << 100 10 X NDIST >> >>
Which works as expected if i have a number on the stack, but when i go in the Y= window, i can't choose it if it's saved as a program. So i figure that the program i made must be formatted wrong, so it's not recognized as something that can be plotted. So i wrote a random equation in the Y= editor, and this is how it saved it:
Code:
<< X -> 'X+1' >>
So i tried using NDIST in that format, but i keep getting syntax errors.

So... how can i plot a normal distribution? Is using NDIST the right approach? Is there a better way?

Thank you.
Find all posts by this user
Quote this message in a reply
05-30-2020, 09:33 PM (This post was last modified: 05-30-2020 09:36 PM by peacecalc.)
Post: #2
RE: HP 50g normal distribution
Hello Christi Neagu,

If you can't get what you want, code it by yourself, this works:
Key in this:

'NP(x) = 1/SQRT(2*pi)*EXP(-(X-5)^2/2)'
Use the function DEF for getting a function out of the equation above. For example this function is defined for a mean = 5 and a variance = 1 and X for the function variable. The function NP(X) can be plottet with Y1(X) = NP(X).

Try it andf enjoy!

Sincerely peacecalc
Find all posts by this user
Quote this message in a reply
05-30-2020, 10:19 PM
Post: #3
RE: HP 50g normal distribution
Hello,

Thank you for the reply. Yes, that does work. Still, is there any way NDIST can be used? Now i'm asking just to understand User RPL a bit better.
Find all posts by this user
Quote this message in a reply
05-30-2020, 11:17 PM
Post: #4
RE: HP 50g normal distribution
Hello Christi Neagu,

I used your program << X -> << 100 10 X NDIST >> >> stored it in 'NP' und used Y1(x)=NP(X) and plotting worked fine! But of course you have to change xmin and xmax to let's say 95 and 105 because you programmed the mean = 100. The maximal value of NP ist something about 0,13 at X = 100 you also have to change ymin and ymax let's say to -0,05 an 0,15 and you see a wonderful bell.
Find all posts by this user
Quote this message in a reply
05-30-2020, 11:21 PM
Post: #5
RE: HP 50g normal distribution
(05-30-2020 11:17 PM)peacecalc Wrote:  Hello Christi Neagu,

I used your program << X -> << 100 10 X NDIST >> >> stored it in 'NP' und used Y1(x)=NP(X) and plotting worked fine! But of course you have to change xmin and xmax to let's say 95 and 105 because you programmed the mean = 100. The maximal value of NP ist something about 0,13 at X = 100 you also have to change ymin and ymax let's say to -0,05 an 0,15 and you see a wonderful bell.

Ah ok. That was my mistake i guess. I didn't think about calling it the way you did. I only tried the "choose" option from the Y= screen. Thanks for pointing that out!
Find all posts by this user
Quote this message in a reply
05-31-2020, 05:03 PM
Post: #6
RE: HP 50g normal distribution
Hello Christi Neagu,

in my humble opinion it is not a specific RPL feature, it is the way the function NDIST is programmed: it only works fine with reals or integers, but not with symbolic variables. 'X' seems to be one, but it is a concrete number. And you can't use it as 'NDIST(100, 10, X)' in an algebraic expression. The probalistic integral functions UTPX have the similar problem, you can use them in RPL programming but not as an algebraic function.

And of course the "Y=" interface has its own rules, which have to be respected (like every solution for a certain input).

Sincerely peacecalc
Find all posts by this user
Quote this message in a reply
06-03-2020, 10:39 PM (This post was last modified: 06-03-2020 10:41 PM by Csaba Tizedes.)
Post: #7
RE: HP 50g normal distribution
(05-30-2020 03:32 PM)Cristi Neagu Wrote:  
Code:
<< X -> << 100 10 X NDIST >> >>
works as expected if i have a number on the stack
Code:
<< X -> 'X+1' >>
syntax errors

I guess this is only a typo by your side, but the local variable structure is << -> var <<prg>> >> or << -> var 'algebraic' >>

Csaba
Find all posts by this user
Quote this message in a reply
06-03-2020, 11:07 PM
Post: #8
RE: HP 50g normal distribution
(06-03-2020 10:39 PM)Csaba Tizedes Wrote:  I guess this is only a typo by your side, but the local variable structure is << -> var <<prg>> >> or << -> var 'algebraic' >>

Csaba

Hello,

Yes, you're right. It was a typo.
Find all posts by this user
Quote this message in a reply
Post Reply 




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