Need suggestion about long matrix program
|
03-26-2021, 08:11 PM
(This post was last modified: 03-26-2021 08:11 PM by Amer7.)
Post: #1
|
|||
|
|||
Need suggestion about long matrix program
Hi,
I'm not sure what would be the best idea to make this program. 1.) Start i will always have three matrices witch size may vary from issue to issue. I plan on using the calculator M1, M2, M3 matrix variables 2.) The rest of matrices M4,M5,M6,M7,M8, M9, A1, A2, A3, A4, A5, A6, A7 are different calculations of matrices M1,M2,M3,M5... etc. 3.) Is there a way that I input into calculator memory M1, M2, M3 matrices, and run the program then have the program save all of the Matrices in Variables M4....A7 so I could view them. ( Because In past I have used the PRINT for Matrix and it's not really good for displaying them. The calculator option of displaying matrix in HOME is excellent for me). This would be some operations between the matrices Code: /// A -M1 P-M2 W-M3 Any help is really appreciated. |
|||
03-26-2021, 10:02 PM
Post: #2
|
|||
|
|||
RE: Need suggestion about long matrix program
Are you looking for something like the EDITMAT() command?
EXPORT matrixdata() BEGIN EDITMAT(M1); EDITMAT(M2); EDITMAT(M3); END; -road |
|||
03-27-2021, 04:39 AM
Post: #3
|
|||
|
|||
RE: Need suggestion about long matrix program
Hi Amer,
matrices M0 to M9 always are not local to a program (its the same with lists L0 to L9). That is you just put them in the computer outside of the program, you use them in the program as defined variables without defining them in the program, you modify them in the program and after the program ends you will have them as results and can look on them. So I think this is rather convenient. I used this extensively for instance in the following thread: https://www.hpmuseum.org/forum/thread-14...#pid124464 Best Raimund |
|||
03-27-2021, 05:29 PM
(This post was last modified: 03-27-2021 05:41 PM by Amer7.)
Post: #4
|
|||
|
|||
RE: Need suggestion about long matrix program
Thank you road and Raimund for your replies.
I don't understand the code for these "clusters", i just want something simple. @road No, I just want to utilize the HP primes stored M1, M2, M3 variables Why - because from problem to problem the dimensions of the M1,M2,M3 matrix can change. I want program to utilize M1, M2, M3 - matrices, products of program calculations will be new matrices M4,M5....A1...A7. And I want to store these in calculator variables because I could view them. ( these will be large matrices with 9 decimal numbers, and print option is awful. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Can someone just tell me how to make this program. M1 - Matrix that I input in ( Shift Matrix menu) M2- Matrix that I input in ( Shift Matrix menu) //// Program When I run the program I want it to do Transpose M1*M2*TransposeM1 - And save it in user variable A1 So when the program finishes I press button VARS-USER And i get the matrix A1 with its values. |
|||
03-27-2021, 06:14 PM
Post: #5
|
|||
|
|||
RE: Need suggestion about long matrix program
(03-27-2021 05:29 PM)Amer7 Wrote: I want program to utilize M1, M2, M3 - matrices, products of program calculations will be new matrices M4,M5....A1...A7. The variables M1 to M9 are predefined as global matrix variables so you can use them as you want. To have A1 to A7 defined as global matrix variables that you can view in the matrix editor you have to declare them before the beginning and outside of your program with: EXPORT A1,A2,A3,A4,A5,A6,A7; For example: Code: #pragma mode( separator(.,;) integer(h32) ) After executing TST() you'll find A1 in the matrix editor. |
|||
03-28-2021, 05:05 PM
(This post was last modified: 03-28-2021 05:22 PM by Amer7.)
Post: #6
|
|||
|
|||
RE: Need suggestion about long matrix program
(03-27-2021 06:14 PM)Didier Lachieze Wrote:(03-27-2021 05:29 PM)Amer7 Wrote: I want program to utilize M1, M2, M3 - matrices, products of program calculations will be new matrices M4,M5....A1...A7. When I try to run that i get syntax error, and when I try to run Code:
Gosh why does everything has to be complicated about this calculator, i'm not a programmer... |
|||
03-29-2021, 06:39 PM
(This post was last modified: 03-29-2021 07:01 PM by Amer7.)
Post: #7
|
|||
|
|||
RE: Need suggestion about long matrix program
@Didier Lachieze your program text worked for export, i just didn't know how to c/p hahah. But I don't know the values of matrix" A1:=[[1,2],[3,4]];" matrix A1 should be a calculation of a know Matrix M1..M2.. which values are stored in calculator variables.
This seems to work for export Code:
But it doesn't import values stored in M1 memory of calculator into the program sto the output variable A1 is 0, and A2 is also 0 Is there a simple code that will let me Use the values stored in M1,M2,M3 matrix memory, and when I execute the program let me see the new matrices values for viewing ? |
|||
03-29-2021, 07:02 PM
Post: #8
|
|||
|
|||
RE: Need suggestion about long matrix program
(03-29-2021 06:39 PM)Amer7 Wrote: Is there a simple code that will let me Use the values stored in M1,M2,M3 matrix memory, and when I execute the program let me see the new matrices values for viewing ? Your program works for me and does exactly that. With M1 being [[1,−3],[−1,1],[2,−2]], after executing function1 I get for A1: [[2,−6],[−2,2],[4,−4]] and for A2: [[0,0],[0,0],[0,0]] However one thing that can explain that you have 0 for A1 and for A2 is if you have the spreadsheet app active, in this case when you type A1 or A2 on the command line you're referring to the A1 and A2 cells of the spreadsheet, not to your global variables which should anyway be available in the Matrix editor. |
|||
03-29-2021, 07:27 PM
Post: #9
|
|||
|
|||
RE: Need suggestion about long matrix program
(03-29-2021 07:02 PM)Didier Lachieze Wrote:(03-29-2021 06:39 PM)Amer7 Wrote: Is there a simple code that will let me Use the values stored in M1,M2,M3 matrix memory, and when I execute the program let me see the new matrices values for viewing ? Thank you, I've tested on a calculator and it works. What is your view, how would you solve this program. Is there any trick to print Matrices in Terminal an them staying the same style like when we view them in home screen? Would like to label to each one, so I dont have to write on paper A1 - Standard deviation matrix... etc... |
|||
04-01-2021, 04:47 PM
Post: #10
|
|||
|
|||
RE: Need suggestion about long matrix program
Try M3:=M1+M2 M3:=M1*M2
As far as I know you cannot store a Matrix in a Variable like A or A1 etc A Matrix can only be stored into another Matrix. |
|||
04-01-2021, 06:04 PM
Post: #11
|
|||
|
|||
RE: Need suggestion about long matrix program
(04-01-2021 04:47 PM)BERNARD MICHAUD Wrote: Try M3:=M1+M2 M3:=M1*M2 Other than in Matrix variables, you can only store matrices in LOCAL variables. Tom L Cui bono? |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)