The computation component of the Student[LinearAlgebra] subpackage contains commands that can be used to study the various matrix and vector computations presented in an introductory linear algebra course. There are many commands, and this worksheet demonstrates the basics of a selection of them.
Most of the computation commands in this package are front-ends to more powerful (and often more complicated) commands in the top-level LinearAlgebra package. In all such cases, the help page for the command in the Student[LinearAlgebra] subpackage documents only those features which are considered relevant in a linear algebra course context. Each page includes a link to the help page for the main LinearAlgebra command, should you need more details.
For further information about the commands in the Student[LinearAlgebra] package, see the help page for that command. For a general overview, see Student[LinearAlgebra].
Commands in the package can be referred to using the long form, that is, Student[LinearAlgebra][Eigenvalues].
It is recommended to load the package first and then use the shorter command names.
The following examples show how the various routines work.
Note: If you set infolevel[Student] := 1 or infolevel[Student[LinearAlgebra]] := 1, many of the routines in this package provide additional information about the objects they are passed in the form of userinfo messages. This setting is recommended.
Basic Matrices and Vectors
Most matrices and vectors can be constructed using the angle bracket (< >) syntax. To build a column vector, for example, use this form:
A row vector is similarly constructed using vertical bars instead of commas as the separators.
A matrix is constructed out of vectors, either as rows (separated by commas) or as columns (separated by vertical bars).
The rows or columns of a matrix can be pre-existing vectors or matrices, so long as the dimensions are compatible.
These syntactic constructions result in calls to the Maple commands Vector and Matrix. These are very powerful constructor commands, taking a wide variety of options, which control the precise form and properties of the result. The constructed objects are of type Vector and Matrix.
This distinguishes these objects from the older vector and matrix objects, which were used in earlier versions of Maple to represent vectors and matrices. Because these older objects continue to exist in Maple, in the remainder of this worksheet the capitalized names, Vector and Matrix, are used whenever discussing the corresponding Maple object, as distinct from the represented mathematical object.
Arithmetic with Matrices and Vectors can be carried out using the standard + operator for addition and the . (dot) operator for non-commutative multiplication.
The dot product of two Vectors is also computed using the . operator.
The transpose of a Matrix or Vector is computed using the ^ (exponentiation) operator with the special exponent value %T.
To consider Matrices and Vectors with complex-valued components, the Hermitian transpose of a Matrix or Vector is similarly represented using the ^ operator with exponent %H.
The cross product of two 3-D Vectors is computed using the &x operator.
1,2,3 &x a,b,c
Most commands in the Student[LinearAlgebra] subpackage consider symbolic quantities to represent real variables. For example, a dot product of Vectors whose entries are symbolic expressions does not use complex conjugates when computing the result. This assumption is specific to the Student[LinearAlgebra] subpackage and does not hold in the main LinearAlgebra package. To allow variables to represent complex-valued quantities, use the package command, SetDefault( conjugate = true ).
All syntaxes, except for the cross product (&x), are available throughout Maple, whether or not the Student[LinearAlgebra] subpackage has been loaded. The definition of the . (dot) operator is, however, different if the Student[LinearAlgebra] subpackage has been loaded, in that it then treats symbolic quantities as being real-valued by default, as discussed earlier.
Other Useful Matrices and Vectors
The basic syntax described in the preceding sections suffices to construct most of the Matrices and Vectors you need. However, there are some commands in the package that build more specialized Matrices and Vectors.
The n x n identity Matrix is represented as Id(n). Note that n must be a non-negative integer, not a symbol.
Other useful Matrices and Vectors include:
There are several commands to handle basic queries about Matrices and Vectors, such as dimensionality, rank, and other properties.
Both dimensions of a Matrix can be obtained at once, using the same command as is used for the dimension of a Vector.
The simplest way to solve a linear system of equations is to represent the problem as a (Matrix, Vector) pair and call LinearSolve.
Alternatively, LinearSolve accepts a Matrix, which it interprets as an augmented matrix with the last column representing the right-hand side of the system.
The GenerateMatrix command can be used to transform a set of linear equations into an augmented Matrix suitable for use in LinearSolve.
LinearSolve also handles underdetermined systems.
There are many commands available to study the process of solving a linear system in more detail. There are factorization commands that are equivalent to the elementary row operations needed to reduce a system to a triangular or diagonal one, which can then be easily solved. For example:
To obtain the components of this reduction, use:
To obtain a triangular system, multiply the inverses of P and L.
The system can then be solved using BackwardSubstitute.
The reduced row echelon form of a Matrix is also easily obtained.
At an even more detailed level, commands for the elementary row operations are available.
The technology of solving linear systems can be used to obtain bases for various vector spaces. For example, the null space, row space, and column space of a Matrix can all be computed.
You can also determine a basis for the span of a set of Vectors, for the sum of two subspaces, or for the intersection of two subspaces.
Eigenvalues and Eigenvectors
You can compute eigenvalues and eigenvectors with a single command, Eigenvectors.
If only the eigenvalues are of interest, you can use the Eigenvalues command.
You can also study the basic computation of eigenvalues and eigenvectors.
This polynomial is the determinant of the characteristic matrix of B.
You can also obtain the eigenvalues from the Jordan canonical form.
Return to Index of Example Worksheets
Download Help Document