cancel
Showing results for 
Search instead for 
Did you mean: 
REYNEL
Level 3
38 34 1 3
Message 1 of 8
1,016
Flag Post

Solved!

Normal Distribution Table

HP Recommended
HP 50g
Other

Is it possible create  a program that takes as input a 10X3 matrix where each row is an observation and each column represents one of the three arguments (mean distribution (m)=column 1, standard deviation(s)=column 2 and a parameter (x)=column 3) for the  built-in function NDIST?

The NDIST function has this form  NDIST(m,s,x)

NDIST is equivalent to ( exp-(x-m)^2/(2*s))/(sqrt(2*pi*s)

The program that I created  takes  3 arguments from the stack to produce the equivalent normal probability distribution single value, but I am interesed in getting 10 normal probability distributions simultaneously from a 10X3 matrix or the equivalent 3 10X1 vectors.

'normD' << ->  m s x  << 'EXP(-(x-m)^2/(2*s))/sqroot(2*pi *s)' ->NUM >>

 

Example  for NDIST(10,2,3) the probability is 1.3498*10-6matrix.PNG

 

 

Any help would is very much appreciated.

Thanks

Reynel

 

 

0 Kudos
Tags (2)
7 REPLIES 7
calcpeace
Level 4
54 54 7 7
Message 2 of 8
Flag Post
HP Recommended

Hello Reynel,

 

why not, what is the problem?

 

The hp 50g has a lot of matrix functions and you have access to every element of a matrix.

 

The primer question is, from where your values of the matrix come from, randomigly generated or manually typed in a matrix?

 

The further question is, why you don't use NDIST and wrote an own proggie which does the same?

 

Sincerely

calcpeace

0 Kudos
Maké
Level 9
3,551 3,490 180 541
Message 3 of 8
Flag Post
HP Recommended

Hi!, @REYNEL:

 

You can see, this video with many examples, created as Library, for Statistical. The unique problem is what is created in Spanish Language ... https://youtu.be/NZnL_UzBWJE

 

Now, you can download from ... https://sites.google.com/site/cesarv1821/statdes. Press, in ... Statdes V3.01

The Library, is ... STATDES+V301.zip

Kind Regards !.
Have a nice day !.
@Maké (Technical Advisor Premium - HP Program Top Contributor).
Provost in HP Spanish Public Forum ... https://h30467.www3.hp.com/
En este video aprenderemos a agrupar datos estadísticos con la calculadora hp 50g.Para esto debes tener instalada la biblioteca STATDES versión 3.00 que pued...
0 Kudos
REYNEL
Author
Level 3
38 34 1 3
Message 4 of 8
Flag Post
HP Recommended

Hi Calcpeace,

 

Thank you very much for your suggestions! I followed your hints and I came up with a short prog by using the first 3 rows of the example matrix in my first post. I am really very newbi in UserRPL programming, most of the very little I know of HP 50g programming has been the result of valuable help given by the HP forum community in  previous posting that I have submitted. I am really very thankful to all of you.

 

This is what I did.

 

step 1:  I created a 3x3 matrix [[10 2 3][13 2 4][11 2 5]]

This is an arbitrary matrix (manually generated)

setp 2:  I created a short program based on your suggestions.

 

( ->ROW DROP OBJ ->« NDIST » EVAL SWAP OBJ->DROP « NDIST » EVAL ROT OBJ-> DROP « NDIST » EVAL) 

step 3: This is the final results

 

3.4813...E-5

4.5282...E-10

1.3438...E-6.

 

So I was able to use a 3X3 matrix as the argument of the NDIST function. Things get complicated with a bigger matrix, because my program will grow longer by repeating the same sequence of commands if I have to add new rows to the matrix. That would result in an inefficient program. My guess is that I have to cycle through a loop that counts the number of rows in the matrix and it executes few lines of common codes in every row of the matrix. There my be other ways to deal with this problem, but I am stucked at this point.

Any hints about how to go from here, or are there other methods of solving this problem? Eventually the program should be able to get any matrix size as input.

Thank you very much for any help.

Reynel

 

 

 

 

 

0 Kudos
REYNEL
Author
Level 3
38 34 1 3
Message 5 of 8
Flag Post
HP Recommended

Thank very much professor Make, I don't have difficulties in listening & understanding  Spanish. I was able to listen to the video and find it very interesting although it doesn't address directly my question. Further suggestions would be very much appreciated.

Reynel

REYNEL
Author
Level 3
38 34 1 3
Message 6 of 8
Flag Post
HP Recommended

Hi Calcpeace,

 

Thank you very much for your suggestions! I followed your hints and I came up with a short prog by using the first 3 rows of the example matrix in my first post. I am really very newbi in UserRPL programming, most of the very little I know of HP 50g programming has been the result of valuable help given by the HP forum community in  previous posting that I have submitted. I am really very thankful to all of you.

 

This is what I did.

 

step 1:  I created a 3x3 matrix [[10 2 3][13 2 4][11 2 5]]

This is an arbitrary matrix (manually generated)

setp 2:  I created a short program based on your suggestions.

 

( ->ROW DROP OBJ ->« NDIST » EVAL SWAP OBJ->DROP « NDIST » EVAL ROT OBJ-> DROP « NDIST » EVAL) 

step 3: This is the final results

 

3.4813...E-5

4.5282...E-10

1.3438...E-6.

 

So I was able to use a 3X3 matrix as the argument of the NDIST function. Things get complicated with a bigger matrix, because my program will grow longer by repeating the same sequence of commands if I have to add new rows to the matrix. That would result in an inefficient program. My guess is that I have to cycle through a loop that counts the number of rows in the matrix and it executes few lines of common codes in every row of the matrix. There my be other ways to deal with this problem, but I am stucked at this point.

Any hints about how to go from here, or are there other methods of solving this problem? Eventually the program should be able to get any matrix size as input.

Thank you very much for any help.

Reynel

0 Kudos
mark4flies
Level 3
26 23 1 5
Message 7 of 8
Flag Post
HP Recommended

Try this program:

 

<< ->ROW -> r << 1 r START OBJ-> DROP NDIST r ROLLD NEXT >> >>

Tags (2)
REYNEL
Author
Level 3
38 34 1 3
Message 8 of 8
Flag Post
HP Recommended

Hi Mrk4files,

 

I appreciate very very much for this little marvel. Your program worked very well as intended. Now I can use it in many different situations. You really found for me the missing part. I can't thank you enough!

 

Kind regards,

Reynel

0 Kudos
† The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation