The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

Entering,Saving,and Analysis /Fitting X Y Data on the Prime
Message #1 Posted by Harold A Climer on 25 Oct 2013, 1:54 a.m.

The students in my Physics Lab class did the Simple Pendulum Lab using a Vernier LabPro Interface and Photo-gate today. For me it was about time to use my Prime to analyze the data. I entered the Period vs Length using the Statistics 2 Variable App. I then used the Symbol key to choose the best fit regression equation to fit the data to. I then plotted the data to see the best fit line. Is this the best way of doing this? It took me about 10 minutes with a few fits a starts along the way.(It took me about two minutes to do the same thing on my 50G.) When I use the Matrix Writer on the 50G, I can save the data matrix using a recognizable name, can I do the same on the Prime? M1,M2,etc seem awfully generic IMHO.

      
Re: Entering,Saving,and Analysis /Fitting X Y Data on the Prime
Message #2 Posted by Eddie W. Shore on 25 Oct 2013, 9:42 a.m.,
in response to message #1 by Harold A Climer

Custom names are allowed. Any matrix with a name other than M0-M9 will appear under User Variables (accessed by the Vars key).

Using custom names for matrices in programs must be local and initialized.

Edited: 25 Oct 2013, 9:47 a.m.

            
Re: Entering,Saving,and Analysis /Fitting X Y Data on the Prime
Message #3 Posted by Han on 25 Oct 2013, 10:21 a.m.,
in response to message #2 by Eddie W. Shore

Quote:
Custom names are allowed. Any matrix with a name other than M0-M9 will appear under User Variables (accessed by the Vars key).

Using custom names for matrices in programs must be local and initialized.


To clarify Eddie's post:

EXPORT MYPROG()
BEGIN
  LOCAL mymatrix=[[0]]; // initializes a real matrix;
  mymatrix(50,50):=0; // sets the size; completely optional because matrices can be expanded dynamically

... code ... END;

Matrices can be global variables, though. If you already created a matrix named MYMATRIX, then it can be used in your program without any variable delcaration. If MYMATRIX does not exist, then the program editor will complain with a Syntax Error -- you can then just exit the program editor and create a dummy MYMATRIX and this will fix the syntax error. Lastly, one may also have MYPROG() create a global variable as well (both visible and invisible).

EXPORT MYMATRIX; // export creates a global variable named MYMATRIX; initially value is 0
initMyProg; // create a flag; initially set to 0 (note lack of EXPORT)
EXPORT MYPROG()
BEGIN
  if (initMyProg == 0) then
    MYMATRIX:=[[0]]; // initializes the variable to 1x1 real matrix
    initMyProg:=1;
  end;

... more code ... END;

Anytime a program file is edited (or even just viewed) it will get recompiled. So the flag initMyProg will determine whether or not to re-initialize the MYMATRIX or leave it intact to be reused by MYPROG().

Using EXPORT makes a global variable visible to the user, whereas leaving it out means the variable (while still global) is not visible to the user. Since we don't want users to be tinkering with the flag -- it should only be visible to the MYPROG() program -- then we do not export it.

      
Re: Entering,Saving,and Analysis /Fitting X Y Data on the Prime
Message #4 Posted by CR Haeger on 25 Oct 2013, 11:58 a.m.,
in response to message #1 by Harold A Climer

Hello,

I'm new at using HP PRIME as well but have found that for STATS 2VAR App you can:

Create lists (in HOME view) and sto> in a List (L0-9) or sto> as a user variable.

For example, say you store L1 and Test_List as lists. In STATS 2Var SYMB view, you can refer to L1, Test_List or any of the C1-C4 Columns associated with the App. PLOT and NUM views seem to work fine.

You can also refer to a range of Spreadsheet cells directly in the STATS SYMB view (ie. Spreadsheet.A1:A10).

Best, Carl

            
Re: Entering,Saving,and Analysis /Fitting X Y Data on the Prime
Message #5 Posted by Tim Wessman on 26 Oct 2013, 1:56 p.m.,
in response to message #4 by CR Haeger

Also, a lot don't realize the column definitions in the stat symb screen are actually formulas. Thus things like LN(my_list)+1 are perfectly acceptable there.

TW

      
Re: Entering,Saving,and Analysis /Fitting X Y Data on the Prime
Message #6 Posted by Harold A Climer on 26 Oct 2013, 9:46 a.m.,
in response to message #1 by Harold A Climer

Quote:
The students in my Physics Lab class did the Simple Pendulum Lab using a Vernier LabPro Interface and Photo-gate today. For me it was about time to use my Prime to analyze the data. I entered the Period vs Length using the Statistics 2 Variable App. I then used the Symbol key to choose the best fit regression equation to fit the data to. I then plotted the data to see the best fit line. Is this the best way of doing this? It took me about 10 minutes with a few fits a starts along the way.(It took me about two minutes to do the same thing on my 50G.) When I use the Matrix Writer on the 50G, I can save the data matrix using a recognizable name, can I do the same on the Prime? M1,M2,etc seem awfully generic IMHO.
I found all the responders answers to this question very helpful,but I forgot to ask another question or two. Where is the regression coefficient or the RMSE displayed when using the 2 Variable Statistics APP? Also where is the covariance displayed? They are shown when using the 50G. RMSE maybe not?
            
Re: Entering,Saving,and Analysis /Fitting X Y Data on the Prime
Message #7 Posted by Tim Wessman on 26 Oct 2013, 1:54 p.m.,
in response to message #6 by Harold A Climer

It is a numerical value or calculation, so it will be somewhere in the NUM view. Pres STATS (F6). Toggle between X or Y specific values using the menu keys.

TW


[ Return to Index | Top of Index ]

Go back to the main exhibit hall