Operations on Matrices

Axiom provides both left and right scalar multiplication.

You can add, subtract, and multiply matrices provided, of course, that the matrices have compatible dimensions. If not, an error message is displayed.

This following product is defined but n*m is not.

The operations nrows and ncols return the number of rows and columns of a matrix. You can extract a row or a column of a matrix using the operations row and column. The object returned ia a Vector. Here is the third column of the matrix n.

You can multiply a matrix on the left by a "row vector" and on the right by a "column vector".

The operation inverse computes the inverse of a matrix if the matrix is invertible, and returns "failed" if not. This Hilbert matrix invertible.

This matrix is not invertible.

The operation determinant computes the determinant of a matrix provided that the entries of the matrix belong to a CommutativeRing. The above matrix mm is not invertible and, hence, must have determinant 0.

The operation trace computes the trace of a square matrix.

The operation rank computes the rank of a matrix: the maximal number of linearly independent rows or columns.

The operation nullity computes the nullity of a matrix: the dimension of its null space.

The operation nullSpace returns a list containing a basis for the null space of a matrix. Note that the nullity is the number of elements in a basis for the null space.

The operation rowEchelon returns the row echelon form of a matrix. It is easy to see that the rank of this matrix is two and that its nullity is also two.

For more information see Expanding to Higher Dimensions, Computation of Eigenvalues and Eigenvectors, and An Example: Determinant of a Hilbert Matrix. Also see Permanent, Vector, OneDimensionalArray, and TwoDimensionalArray. Issue the system command

to display the full ist of operations defined by Matrix.