Post Reply 
HP 40gs how to get a submartix from a matrix
09-03-2023, 08:02 AM (This post was last modified: 09-03-2023 03:20 PM by carey.)
Post: #8
RE: HP 40gs how to get a submartix from a matrix
(08-31-2023 04:30 AM)Anthony The Koala Wrote:  I have a 3x3 matrix:
M1 =
1,2,3
4,5,6
7,8,9

It is stored as:
[[1,2,3],[4,5,6],[7,8,9]] STO M1

Display M1
M1 ENTER

How do I get a sub-matrix such as:
M2 =
5,6
8,9

Are there any column and row operations or any indexing operations in order to get a sub matrix M2?
By indexing operations, using index and row column numbers as in arrays in python, matlab.

Thank you
Anthony of Sydney

Hi Anthony,

In answer to your original question using HP40GS commands, the command

SUB M2;M1;{2,2};{3,3}

entered on the Home screen extracts submatrix M2 from matrix M1, starting at {2,2} in a list using row, column notation and ending at {3,3}.

Before issuing the above SUB command, the original 3x3 matrix M1 and an arbitrary 2x2 M2 matrix must be created.

Attached are HP40GS emulator screenshots of the original matrix M1, arbitrary matrix M2 filled with zeros, and the Home screen showing the SUB command and the resulting sub-matrix M2 that you are seeking.

Additional Notes:
1) The above command also works within a program if the command line ends with a colon as follows
SUB M2;M1;{2,2};{3,3}:
In fact, the SUB command can be accessed from CMDS (Shift-MATH) on the keyboard which shows available program commands.
2) As the SUB command is not part of the 40GS CAS, it works also on the HP39GS (as well as the 39G+, 39G, and 38G).


Attached File(s) Thumbnail(s)
           
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP 40gs how to get a submartix from a matrix - carey - 09-03-2023 08:02 AM



User(s) browsing this thread: 1 Guest(s)