The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

HP Prime SIZE and OBJ-> with matrices/vectors/lists
Message #1 Posted by Helge Gabert on 27 Sept 2013, 4:58 p.m.

Two questions:

1) I'm writing a program for the HP Prime where I would like to get the dimensions for an nxm matrix (user inputs the matrix).

On the 50g, I can use SIZE and I'll get the dimensions as a list {n m}. On the Prime, I only get the row dimensions n.

Any idea on how to get the column dimensions as well? Thanks.

2) Also, the 50G has the command OBJ->, spitting out all the elements (plus the dimensions) of matrices, vectors, or lists onto the stack. On the Prime, do I need to write a program to achieve this (basically, calling each element in a loop)? That's what I need SIZE for - - see above. Thanks again!

      
Re: HP Prime SIZE and OBJ-> with matrices/vectors/lists
Message #2 Posted by iconmaster on 27 Sept 2013, 5:21 p.m.,
in response to message #1 by Helge Gabert

1) Try rowDim and colDim.

2) The programming language does not work on a stack, so an OBJ-> equivalent would be almost useless. Simply call each element in sequence.

            
Re: HP Prime SIZE and OBJ-> with matrices/vectors/lists
Message #3 Posted by Tim Wessman on 27 Sept 2013, 5:29 p.m.,
in response to message #2 by iconmaster

1) SIZE on a matrix here seems to return { r, c } ???

2) m1(r,c) for direct access/storage.

TW

                  
Re: HP Prime SIZE and OBJ-> with matrices/vectors/lists
Message #4 Posted by Helge Gabert on 27 Sept 2013, 5:41 p.m.,
in response to message #3 by Tim Wessman

Yes, in home view you get {n m}, but not in CAS view (only n).

This brings up an interesting question - - if the user runs the program in home view vs. CAS view, are there possible inconsistencies to contend with?

                        
Re: HP Prime SIZE and OBJ-> with matrices/vectors/lists
Message #5 Posted by Han on 27 Sept 2013, 5:52 p.m.,
in response to message #4 by Helge Gabert

Quote:
Yes, in home view you get {n m}, but not in CAS view (only n).

This brings up an interesting question - - if the user runs the program in home view vs. CAS view, are there possible inconsistencies to contend with?


Probably because in CAS it's treated as a "vector of vectors" (with which I disagree).

                              
Re: HP Prime SIZE and OBJ-> with matrices/vectors/lists
Message #6 Posted by Helge Gabert on 27 Sept 2013, 5:55 p.m.,
in response to message #5 by Han

Thanks for the insight . . . that would explain it . . . but then you HAVE to be in home view for things to work properly, or not?

                                    
Re: HP Prime SIZE and OBJ-> with matrices/vectors/lists
Message #7 Posted by Tim Wessman on 27 Sept 2013, 6:19 p.m.,
in response to message #6 by Helge Gabert

No, the programs created normally in the program catalog are numerical in nature. Thus any call to "size" will be the correct one - whether called from the CAS or anywhere else.

CAS functions can be created, but currently only by manually creating them in the CAS environment. eg: myfunc(a,b,c):=begin a+b+c; end; [ENTER]

TW

                                          
Re: HP Prime SIZE and OBJ-> with matrices/vectors/lists
Message #8 Posted by Helge Gabert on 27 Sept 2013, 6:56 p.m.,
in response to message #7 by Tim Wessman

OK Thanks!

            
Re: HP Prime SIZE and OBJ-> with matrices/vectors/lists
Message #9 Posted by Helge Gabert on 27 Sept 2013, 5:44 p.m.,
in response to message #2 by iconmaster

Yes that works. Thanks for rowDim and colDim!


[ Return to Index | Top of Index ]

Go back to the main exhibit hall