The `ranm` command generates a random matrix. Compared to the HP50G, the DB48X can also generate a random vector in a way similar to `CON` for constant values. Fixes: #1155 Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
5.5 KiB
Executable file
Operations with Matrices and vectors
ToArray (→Arry)
Stack to Array Command: Returns a vector of n real or complex elements or a matrix of n × m real or complex elements.
The elements of the result array should be entered in row order.
A1
... An
n
▶ [ A1 ... An ]
A11
... Arc
{ r c }
▶ [[ A11 A1c] [ A21 ... Arc ]]
FromArray (Arry→)
Array to Stack Command: Takes an array and returns its elements as separate real or complex numbers. Also returns a list of the dimensions of the array. If the argument is an n-element vector, the first element is returned to level n + 1 (not level nm + 1), and the nth element to level 2.
[ A1 ... An ]
▶ A1
... An
n
[[ A11 A1c] [ A21 ... Arc ]]
▶ A11
... Arc
{ r c }
TOCOL
Split an array into column vectors
ADDCOL
Instert a column into an array
REMCOL
Remove a column from an array
FROMCOL
Assemble a matrix from its columns
TODIAG
Extract diagonal elements from a matrix
FROMDIAG
Create a matrix with the given diagonal elements
TOROW
Split an array into its row vectors
ADDROW
Insert a row into an array
REMROW
Remove a row from an array
FROMROW
Assemble an array from its rows
TOV2
Assemble a vector from two values
TOV3
Assemble a vector from three values
FROMV
Split a vector into its elements
AXL
Convert a matrix to list and vice versa
BASIS
Find vectors forming a basis of the subspace represented by the matrix
CHOLESKY
Perform Cholesky decomposition on a matrix
CNRM
Column norm (one norm) of a matrix
CON (ConstantArray)
Returns a constant array, defined as an array whose elements all have the same value.
The constant value is an object taken from argument 2/level 1. The resulting array is either a new array, or an existing array with its elements replaced by the constant, depending on the object in argument 1/level 2.
-
Creating a new array: If level 2 contains a list of one or two integers,
CON
returns a new array. If the list contains a single integern
,CON
returns a constant vector withn
elements. If the list contains two integersn
andm
,CON
returns a constant matrix withn
rows andm
columns. -
Replacing the elements of an existing array: If level 2 contains an array,
CON
returns an array of the same dimensions, with each element equal to the constant. -
If level 2 contains a name, the name must identify a variable that contains a valid input for
con
, such as an array. In this case, the content of the variable is replaced with the value generated byCON
n
k
▶ [ k ... k ]
{ n }
k
▶ [ k ... k ]
{ n m }
k
▶ [ [ k ... k ] [ k ... k ] ... [ k ... k ] ]
[ vec ]
k
▶ [ k ... k]
[ [ mat ] ]
k
▶ [ [ k ... k ]]
'name'
k
▶
COND
Column norm condition number of a matrix
CROSS
Cross produce of vectors
CSWP
Swap two columns in a matrix
Determinant (DET)
Compute the determinant of a matrix
DIAGMAP
DOT
Internal product (dot product) of vectors
EGV
EGVL
Compute the eigenvalues of a matrix
GRAMSCHMIDT
HADAMARD
Multiply corresponding elements in a matrix
HILBERT
Assemble a Hilbert symbolic array
IBASIS
Find a basis of the intersection of two vector spaces
IDN (IdentityMatrix)
Identity Matrix Command: Returns an identity matrix, that is, a square matrix with its diagonal elements equal to 1 and its off-diagonal elements equal to 0.
The result is either a new square matrix, or an existing square matrix with its elements replaced by the elements of the identity matrix, according to the argument.
-
Creating a new matrix: If the argument is an integer
n
, a new real identity matrix is returned, with its number of rows and number of columns equal ton
. -
Replacing the elements of an existing matrix: If the argument is a square matrix, an identity matrix of the same dimensions is returned.
-
Generating the identity matrix for a vector: If the argument is a vector with
n
elements, an identity matrix withn
rows andn
columns is created. -
If the argument is a name, the name must identify a variable containing on of the valid inputs. In this case, it is replaced with the result.
n
▶ IDN(n)
{ n }
▶ IDN(n)
{ n n }
▶ IDN(n)
[ n-vec ]
▶ IDN(n)
[[ nxn-mat ]]
▶ IDN(n)
'name'
▶
IMAGE
Find a basis of the image of a linear application
ISOM
JORDAN
KER
Find a basis for the kernel of a linear application
LQ
LSQ
LU
LU factorization of a matrix
MAD
MKISOM
PMINI
Minimal polynomial of a matrix
QR
QR Decomposition of a matrix
RANK
Rank of a matrix
RANM (RandomMatrix)
Returns an array containing random integer values between -9 and 9.
RCI
Multiply a row by a constant
RCIJ
Multiply a row by a constant and add to other row
RDM
Change dimensions of an array
REF
Reduce matrix to echelon form (upper triangular form)
RNRM
Row norm (infinity norm) of a matrix
RREF
Fully reduce to row-reduced echelon form
RREFMOD
RSD
Residual R=B-AX' on a system AX=B
RSWP
Swap two rows in a matrix
SCHUR
SNRM
SRAD
SVD
SVL
SYLVESTER
TRACE
Sum of the items in the diagonal of a matrix
TRAN
Transpose a matrix
TRN
Complex conjugate transpose of a matrix
VANDERMONDE
LDUP
Decompose A into LDUP such that PA=LD-1*U
MMAP
Apply expression or program to the elements of a matrix