Creating matrix on HP 50g
|
04-29-2015, 01:01 PM
Post: #1
|
|||
|
|||
Creating matrix on HP 50g
Hi, I'm programming something where I need to create a 6x6 matrix, I have all the 36 values that I must fill the matrix with. Which is the best command for this?.
Thank you. |
|||
04-29-2015, 01:49 PM
(This post was last modified: 04-29-2015 02:00 PM by Tugdual.)
Post: #2
|
|||
|
|||
RE: Creating matrix on HP 50g
(04-29-2015 01:01 PM)Cancuino Wrote: Hi, I'm programming something where I need to create a 6x6 matrix, I have all the 36 values that I must fill the matrix with. Which is the best command for this?.Depends on your starting point. Starting from values If you enter $$\begin{pmatrix} 11 & 12 \\ 21 & 22 \end{pmatrix}$$ and then call OBJ→ you'll see that the stack contains 11 12 21 22 {2 2} So you can just push all items in this specific order in the stack call If you now call →ARRY matrix is back. Starting from vectors Push all vectors in the stack and then the # of vectors [11 21] [12 22] 2 call COL→ Here we go... |
|||
04-29-2015, 01:59 PM
Post: #3
|
|||
|
|||
RE: Creating matrix on HP 50g
Thank you Tugdual, I'll try that.
I'm making my program with the PUTI command but just testing right now. |
|||
04-29-2015, 02:26 PM
(This post was last modified: 04-29-2015 02:29 PM by Gilles.)
Post: #4
|
|||
|
|||
RE: Creating matrix on HP 50g
(04-29-2015 01:01 PM)Cancuino Wrote: Hi, I'm programming something where I need to create a 6x6 matrix, I have all the 36 values that I must fill the matrix with. Which is the best command for this?. Hi there many ways for this. in addition of Tuagal post : 1/ If you know the elements of the matrix, just enter it in your program : [[ 11 21 ] [ 12 22]] 2/ Create a 6x6 identity matrix : 6 IDN 3/ If each element is a function of I J (Line, Column) 6 6 « 10 * + » LCXM @ Create a 6x6 matrix [[ 11 21 31 ...] [12 22 32 ...] ... ] 4/ If your matrice is a variable, for example M you can use this syntax 99 'M(3,5)' STO `M(I,J)` returns immediatly the value of I columns J row of M Slower but more readable in many cases than the PUT and GET command Etc. |
|||
04-29-2015, 05:00 PM
Post: #5
|
|||
|
|||
RE: Creating matrix on HP 50g
The elements of the matrix are variables, and the matrix should be created with them.
|
|||
04-29-2015, 05:47 PM
Post: #6
|
|||
|
|||
RE: Creating matrix on HP 50g
Here's another one.
The program that creates the matrix is done, let's name it "MATRIX". Now I have a FOR loop, for example from 1 to 3, so that it calls MATRIX three times and creates three matrixes. I want to store every matrix according to the FOR index, the first iteration would store the K1 matrix, the second K2 and the third K3. How can I do this?. Thank you. |
|||
04-29-2015, 06:29 PM
(This post was last modified: 04-29-2015 06:30 PM by Tugdual.)
Post: #7
|
|||
|
|||
RE: Creating matrix on HP 50g
(04-29-2015 05:47 PM)Cancuino Wrote: Here's another one.Two solutions: - you push them in stack one after the other and then call 3 consecutive STO - you push them into a list named K which I think is the preferred approach with RPL |
|||
04-29-2015, 07:09 PM
Post: #8
|
|||
|
|||
RE: Creating matrix on HP 50g
What I don't know how to do is the number besides K, for example K2, I don't know how to set a counter that automatically names the variable Ki, being i=1, 2, 3, ...
|
|||
04-29-2015, 08:07 PM
Post: #9
|
|||
|
|||
RE: Creating matrix on HP 50g
(04-29-2015 07:09 PM)Cancuino Wrote: What I don't know how to do is the number besides K, for example K2, I don't know how to set a counter that automatically names the variable Ki, being i=1, 2, 3, ...Do you need to? Try this: Create a matrix Press enter twice to have 2 additional copies Enter 3 Now choose →LIST See? The 3 matrices are now in a list! Pretty cool isn't it? Matrices are objects and you can store anything in lists then using GET with any index, you can retrieve a value. |
|||
04-29-2015, 08:34 PM
(This post was last modified: 04-29-2015 09:46 PM by Cancuino.)
Post: #10
|
|||
|
|||
RE: Creating matrix on HP 50g
That's a great way to store them. Thank you Tugdual.
I'm trying to make everything automated, so that I end up with the three matrixes stored in three different variables. I know how to decompose the list and store the matrixes but I can't figure out how to sort them. Edit: I've finally found the way to do it. "K" i + creates "Ki" then I use ->OBJ and I have 'Ki', where I can store the matrix. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)