Programming HP Calculators/Commands/Matrix Commands

ADDCOL/ADDROWEdit

DELCOL/DELROWEdit

EDITMATEdit

Syntax

EDITMAT <matrix>:

Detail

  • Opens the edit matrix screen, allowing the user to input data into a matrix. <matrix> can be one of the ten matrix variables from M0 to M9.
  • Essentially the same as PROMPT - but used for matrix input.

Example

MSGBOX "This program multiplies two matrices.":
MSGBOX "Please enter the first matrix.":
EDITMAT M1:
MSGBOX "Please enter the second matrix.":
EDITMAT M2:
M1*M2?M3:
MSGBOX "The result of the multiplication is stored in M3."

This program will multiply two matrices, as detailed in the MSGBOX commands.

RANDMATEdit

Syntax

RANDMAT <matrix>;<#rows>;<#columns>:

Detail

  • Generates a matrix in variable <matrix> of size <#rows> x <#columns>, setting each element to a random integer (apparently) from -9 to 9, inclusive.
  • Essentially the same as PROMPT - but used for matrix input.

Example

RANDMAT M1;50;50:

Makes a really big matrix filled with random integers that wastes a fair bit of your calculator's memory, as well as drains the batter power writing all that info to memory. Useful!

REDIMEdit

REPLACEEdit

SCALEEdit

Note: This information was obtained via trial and error and may be incorrect, pending verification. Splintax 12:57, 8 February 2006 (UTC)

Syntax

SCALE <matrix>;<factor>;<row>:

Detail

  • Multiplies all elements in the row <row> of matrix <matrix> by scalar <factor>.

Example

[[1,2],[3,4]] |STO| M1:
SCALE M1;5;1:
EDITMAT M1:

Generates the 2x2 matrix with [1 2] on the top and [3 4] on the bottom row, then multiplies the top row (row 1) by 5 to make it [5 10].

SCALEADDEdit

Note: This information was obtained via trial and error and may be incorrect, pending verification. Splintax 13:03, 8 February 2006 (UTC)

Syntax

SCALEADD <matrix>;<factor>;<rowa>;<rowb>:

Detail

  • Adds each element of <rowa>, multiplied by <factor>, to each element of <rowb>.

Example

[[1,2],[3,4]] |STO| M1:
SCALEADD M1;5;1;2:
EDITMAT M1:

Generates the 2x2 matrix with [1 2] on the top and [3 4] on the bottom row, then adds the top row multiplied by 5 (that is, [5 10]) to the bottom row to produce [8 14].

SUBEdit

SWAPCOL/SWAPROWEdit

Last modified on 11 May 2009, at 19:30