411 REFERENCE · Wikibooks
Maxima/Data types
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Data Types
Maxima data types generally can be categorized as follows:
Atomic
Non-atomic
Atomic Data Types
Numerical
Strings
Constants
Non-atomic Data Types
Lists
Arrays
Structures
Matrices
Sets
Matrices
"In Maxima, a matrix is implemented as a nested list (namely a list of rows of the matrix)". E.g. :the Maxima mailing list : [Maxima] array and matrix? - answer by Robert Dodier
(($MATRIX) ((MLIST) 1 2 3) ((MLIST) 4 5 6))
Construction of matrices from nested lists :
(%i3) M:matrix([1,2,3],[4,5,6],[0,-1,-2]);
[ 1 2 3 ]
[ ]
(%o3) [ 4 5 6 ]
[ ]
[ 0 - 1 - 2 ]
Interesting examples by Burkhard Bunk : Maxima Overview by Burkhard Bunk
A: matrix([a, b, c], [d, e, f], [g, h, i]); /* (3x3) matrix */
u: matrix([x, y, z]); /* row vector */
v: transpose(matrix([r, s, t])); /* column vector */
Reference to elements etc:
u[1,2]; /* second element of u */
v[2,1]; /* second element of v */
A[2,3]; or A[2][3]; /* (2,3) element */
A[2]; /* second row of A */
transpose(transpose(A)[2]); /* second column of A */
Element by element operations:
A + B;
A - B;
A * B;
A / B;
A ^ s;
s ^ A;
Matrix operations :
A . B; /* matrix multiplication */
A ^^ s; /* matrix exponentiation (including inverse) */
transpose(A);
determinant(A);
invert(A);
Category: Matrices :maxima manual : Category Matrices
addcol
addrow
adjoint
augcoefmatrix
cauchy_matrix
charpoly
coefmatrix
col
columnvector
covect
copymatrix
determinant
detout
diag
diagmatrix
doallmxops
domxexpt
domxmxops
domxnctimes
doscmxops
doscmxplus
echelon
eigen
ematrix
entermatrix
genmatrix
ident
invert
list_matrix_entries
lmxchar
matrix
matrix_element_add
matrix_element_mult
matrix_element_transpose
matrixmap
matrixp
mattrace
minor
ncharpoly
newdet
nonscalar
nonscalarp
permanent
rank
ratmx
row
scalarmatrixp
scalarp
setelmx
sparse
submatrix
tracematrix
transpose
triangularize
zeromatrix
Function: matrix
Function: matrix (row_1, …, row_n)
Returns a rectangular matrix which has the rows row_1, …, row_n. Each row is a list of expressions. All rows must be the same length.
. operator
"The dot operator, for matrix (non-commutative) multiplication. When "." is used in this way, spaces should be left on both sides of it, e.g.
A . B
This distinguishes it plainly from a decimal point in a floating point number.
The operator . represents noncommutative multiplication and scalar product. When the operands are 1-column or 1-row matrices a and b, the expression a.b is equivalent to sum (a[i]*b[i], i, 1, length(a)). If a and b are not complex, this is the scalar product, also called the inner product or dot product, of a and b. The scalar product is defined as conjugate(a).b when a and b are complex; innerproduct in the eigen package provides the complex scalar product.
When the operands are more general matrices, the product is the matrix product a and b. The number of rows of b must equal the number of columns of a, and the result has number of rows equal to the number of rows of a and number of columns equal to the number of columns of b.
To distinguish . as an arithmetic operator from the decimal point in a floating point number, it may be necessary to leave spaces on either side. For example, 5.e3 is 5000.0 but 5 . e3 is 5 times e3.
There are several flags which govern the simplification of expressions involving ., namely dot0nscsimp, dot0simp, dot1simp, dotassoc, dotconstrules, dotdistrib, dotexptsimp, dotident, and dotscrules." ( from Maxima CAS doc)
Vectors
Category: Vectors :
Vectors
eigen
express
nonscalar
nonscalarp
scalarp
Category: Package vectmaxima manual : Package vect
vect
scalefactors
vect_cross
vectorpotential
vectorsimp