Post Reply 
(newRPL) Matrix menu and help text
08-23-2023, 08:28 PM (This post was last modified: 09-02-2023 01:07 PM by Gilles.)
Post: #1
(newRPL) Matrix menu and help text
This program allows you to assign matrix commands to the LeftShift 5 key. The menus and submenus are structured very similar to standard HP50g. Help is available for each command with a long press on the corresponding key.

To install the program, copy the all text below onto the stack of the newRPL device and then
STR-> and EVAL.

Code:
@ ===============================================================
@  Menu, submenus and help definition for MATRICE commands
@ ===============================================================

@ Begin of the program to assign the procedure on LeftShift 5
«

@ Begin of the program to run when LeftShift 5 is pressed
«

@------------------------------------- Begin main menu définition
{

@------------------------------------------ Begin create submenu
{ { "Create" 1 }  « {

@---------------------------------------- Begin column subsubmenu
{ { "Column" 1 }  « {

{ "→COL" →COL
"Transform matrix to columns 
or vectors to elements
M → V1...Vn I<n>" }

{ "COL→" COL→
"Columns to matrix command
or elements to vectors
V1 Vn I<n> → M" }

{ "COL+" COL+
"Insert column (V or M) in a matrix
M V I<index> → M
V O I<index> → M" }

{ "COL-" COL-
"Remove a columns in a M (or V)
and returns the two
M (or V) I → M (or V) V (or O)" }

{ "CSWP" CSWP
"Column Swap Command :  swap column
i and j of matrix or vector
M (or V) I<i> I<i> → M (or V)" }

} TMENULST » "" } 
@------------------------------------------ End column subsubmenu

@------------------------------------------- Begin row subsubmenu
{ { "Row" 1 }  « {

{ "→ROW" →ROW
"Matrix to rows. Tansform a matrix
in vectors (or vectors to elmts)
M (or V) → V1...Vn (or O) I<n>" }

{ "ROW→" ROW→
"Row to matrix. Transform rows vectors
to matrix  (or elements to vector)
V1..Vn I<n>  → M" }

{ "ROW+" ROW+
"insert row vector in a matrix
or element in vector
M1 M2 I<index>  → M >" }

{ "ROW-" ROW-
"Delete row n from matrix or 
elmt in vector. Return the 2
M(or V) I<n>→M(or V) V(or O)" }

{ "RCI" RCI
"Multiply by <x> the row <n> 
of a matrix M
M R<x> I<n> → M" }

{ "RCIJ" RCIJ
"Add multiply row i by x and 
adds the product to row j
M R<x> I<i> I<j> → M" }

{ "RSWP" RSWP
"Row swap row i with row j
of the matrix M
M I<i> I<j> → M" }

} TMENULST » "Row" } 

@--------------------------------------------- End row subsubmenu

{ "IDN" IDN
"Identity matrix : create or modify
square n matrix with diag=1, others=0 
I<n>(or M) > → M" }

{ "CON" CON
"Creates a matrix M or vector V 
of dim L {a b} with value n
L<a b> R<v> → M" }

{ "→DIAG" →DIAG
"Matrix diagonal to vector
 
M → V" }

{ "DIAG→" DIAG→
"Vector to matrix diagonal
of dimension {i j}
V L<ij> → M" }

{ "HILBERT" HILBERT
"Returns a square Hilbert matrix
of the specified order
I → M" }

{ "RANM" RANM
"Random matrix of size L{ i j }
and elmts from -9 to  9
L<ij>(or M) → M" }

{ "RDM" →RDM
"Redim matrix M or vector V in
size L { i j }
M (or V or A)) L → M" }

} TMENULST » "Commands to create matrices" } 

@ -------------------------------------------- End Create submenu

@ -------------------------------------- Begin Operations submenu
{ { "Operations" 1 } « { 

{ "MMAP" MMAP 
"Applies a program to each 
element of a matrix or vector
M (or V) P → M (or V)" }

{ "ABS" ABS 
"returns the Frobenius (Euclidean) 
norm of the matrix M or vector V
M (or V) → R" }

{ "AXL" AXL 
"Toggles from array to list
and from list to array
M(or V or L) → L(or M or V)" }

{ "CNRM" CNRM
"Column norm : returns the column
norm of the array argument
V (or M) → R" }

{ "COND" COND
"Condition number command. Returns
the 1-norm cond number of sq matrix
M → R" }

{ "DET" DET
"Returns the determinant of 
a square matrix M
M → R" }

{ "HADAMARD" HADAMARD
"Elmt by elmt multiplication of
two matrix
M M → M" }

{ "RANK" RANK
"Rank of a rectangular matrix

M → R" }

{ "RNRM" RNRM
"Row norm of its argument array
For a vector, returns the max value
M (or V) → R" }

{ "RSD" RSD
"Residual command : compute the
residual B-AZ
M<B> M<A> M<Z> → M" }

{ "SIZE" SIZE
"Size of the matrix or vector

M (or V) → L<i j> or L<i>" }

{ "TRACE" TRACE
"Trace of square matrix wich is
the sum of its diagonal elements
M → R" }

{ "TRAN" TRAN
"Transpose matrix

M(or A) → M(or nothing)" }

{ "CHOLESKY" CHOLESKY
"Cholesky factorisation of a 
matrix
M → M" }

} TMENULST » "Operations on matrix" }

@ -------------------------------------------- End Oper submenu

@ ----------------------------------Begin Linear application  submenu
{ { "Linear application" 1 } « { 

{ "IMAGE" IMAGE 
"Computes basis of the image (range)
of a linear application 
M → M" }

{ "KER" KER 
"Basis of the kernel (nullspace)
of a linear application
M → L<m>" }

{ "PMINI" PMINI
"Minimal polymonial of a matrix
Returns polymonial as vector
M → V" }

{ "REF" REF
"Reduce matrix to echelon form
Uses Bareiss algorithm
M → M" }

{ "LU" LU
"LU decomposition of a square
matrix.P*A=L*U
M<a> → M<l> M<u> M<p>" }

} TMENULST » 
"Linear application" }
@ ------------------------------------------ End Linear app submenu

@ -------------------------------------------- Begin Vector submenu
{ { "Vector" 1 } « { 

{ "BASIS" BASIS 
"Basis of a sub-space of |Rn

L<v> → L<v>" }

{ "IBASIS" IBASIS
"Basis of the intersection between
two vector spaces
L<v> → V" }

{ "CROSS" CROSS 
"Cross product of vectors

V V → V" }

{ "DOT" DOT
"Dot product of vectors

V V → V" }

{ "→V2" →V2
"convert 2 numbers in a 2D vector

R R → V" }

{ "→V3" →V3
"convert 3 numbers in a 3D vector

R R R → V" }

{ "→POLAR" →POLAR
"Rectangular to polar coord

V → V" }

{ "→SPHER" →SPHER
"Rectangular to spheric coord

V → V" }

{ "→RECT" →RECT
"Polar or spheric to rect

V → V" }

} TMENULST » 
"" }
@ -------------------------------------------- End Vector submenu

@ ----------------------------------------- Begin Element submenu
{ { "Elements" 1 } « { 

{ "GET" GET 
"Get element z in vector or 
matrix with is position
M (or V) L<n1..ni>(or I<n>) → O<z>" }

{ "GETI" GETI
"Get and increment index command

M (or V) L(or I) → O<z> L(or I)next" }

{ "PUT" PUT 
"Put element at a specified position
in matrix etc and increment index ...
M L(or I) → M" }

{ "PUTI" PUTI
"Put element at a specified position
in matrix, vector, list, var ...
M L(or I) → M L(or I)next" }

} TMENULST » 
"" }
@ ----------------------------------------- End Element submenu

@ ------------------------------------------------- End main menu
} TMENU »       @ End of program to run when press user key LeftShift 5

"5.L"   @ User key is LeftShift 5
0       @ Works in all contexts 
ASNKEY  @ Assign the key

»


NOTA :
- AXL is very interesting to toggle list <-> matrix or vectors like standart HP50g
- You can use algebraic approch to manipulate matrix or vectors :
Code:

 [ 11 12 ] 
 [ 21 22] 

'M' STO

'M(1,2)' NUM-> 12

99 'M(1,2)' STO

M
=>

  [ 11 99 ] 
  [ 21 22 ] 
]
Find all posts by this user
Quote this message in a reply
Post Reply 




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