Expanding to Higher Dimensions
To get higher dimensional aggregates, you can create one-dimensional
aggregates with elements that are themselves aggregates, for example,
lists of list, one-dimensional arrays of list of multisets, and so on. For
applications requiring two-dimensional homogeneous aggregates, you will
likely find two-dimensional arrays and matrices useful.
The entries in TwoDimensionalArray
and Matrix objects are all the same type,
except that those for Matrix must belong to a
Ring. You create and access elements in roughly
the same way. Since matrices have an understood algebraic structure, certain
algebraic operations are available for matrices but not for arrays. Because
of this, we limit our discussion here to Matrix,
that can be regarded as an extension of
TwoDimensionalArray. See
TwoDimensionalArray
For more
information about Axiom's linear algebra facilities see
Matrix,
Permanent,
SquareMatrix,
Vector,
Computation of Eigenvalues and Eigenvectors, and
Solution of Linear and Polynomial Equations.
You can create a matrix from a list of lists, where each of the inner
lists represents a row of the matrix.
The "collections" construct (see
Creating Lists and Streams with Iterators)
is useful for creating matrices whose entries are given by formulas.
Let vm denote the three by three Vandermonde matrix.
Use this syntax to extract an entry in the matrix.
You can also pull out a row or a column.
You can do arithmetic.
You can perform operations such as
transpose,
trace, and
determinant