newuser,topic08

(8) Linear Algebra

Before examining this topic, please make sure that you have read: (1) Working Through the New User's Tour.

One of the most frequently used packages in Maple is the linear algebra package, LinearAlgebra . This package provides a robust set of commands for working with Vectors and Matrices. (By convention, functions in this package start with a capital letter.) Maple can find Eigenvalues and Eigenvectors, determine curvilinear coordinates, find Matrix normal forms, and calculate many types of Matrix decompositions, including Cholesky, LU, and QR.

Use the restart command to clear Maple's internal memory and get started with this page of the tour.

> restart;

To access the functions in Linear Algebra by their short names, place your cursor on the with(LinearAlgebra) command below and press Enter.

> with(LinearAlgebra);

[Add, Adjoint, BackwardSubstitute, BandMatrix, Basi...
[Add, Adjoint, BackwardSubstitute, BandMatrix, Basi...
[Add, Adjoint, BackwardSubstitute, BandMatrix, Basi...
[Add, Adjoint, BackwardSubstitute, BandMatrix, Basi...
[Add, Adjoint, BackwardSubstitute, BandMatrix, Basi...
[Add, Adjoint, BackwardSubstitute, BandMatrix, Basi...
[Add, Adjoint, BackwardSubstitute, BandMatrix, Basi...
[Add, Adjoint, BackwardSubstitute, BandMatrix, Basi...
[Add, Adjoint, BackwardSubstitute, BandMatrix, Basi...
[Add, Adjoint, BackwardSubstitute, BandMatrix, Basi...
[Add, Adjoint, BackwardSubstitute, BandMatrix, Basi...
[Add, Adjoint, BackwardSubstitute, BandMatrix, Basi...
[Add, Adjoint, BackwardSubstitute, BandMatrix, Basi...
[Add, Adjoint, BackwardSubstitute, BandMatrix, Basi...
[Add, Adjoint, BackwardSubstitute, BandMatrix, Basi...
[Add, Adjoint, BackwardSubstitute, BandMatrix, Basi...
[Add, Adjoint, BackwardSubstitute, BandMatrix, Basi...
[Add, Adjoint, BackwardSubstitute, BandMatrix, Basi...
[Add, Adjoint, BackwardSubstitute, BandMatrix, Basi...
[Add, Adjoint, BackwardSubstitute, BandMatrix, Basi...

Determinants and Inverses of Matrices

Define a new three-by-three Matrix, and call it A .

> A := Matrix( 3, 3, [[1/2, -1/3, 2], [-5, 14/3, 9], [0, 11, -5/6]]);

A := _rtable[7225968]

Using the Determinant command, you can easily compute the determinant of a Matrix.

> Determinant(A);

-2881/18

Since the determinant is non-zero, you can enter the MatrixInverse command to compute the inverse of A .

> MatrixInverse(A);

_rtable[6945020]

Define a second Matrix, B , containing unknown variables theta and phi .

> B := Matrix( 3, 3, [[phi, 0, 0], [0, 3, 2], [-1, 2/3, theta]] );

B := _rtable[6958140]

You can multiply Matrices and define the result as a third Matrix, C .

> C := A . B;

C := _rtable[4160696]

Again, compute the determinant.

> Determinant(B);

phi*(3*theta-4/3)

Eigenvalues and Eigenvectors

Using the Eigenvectors command, Maple can determine the Eigenvectors of a Matrix. The result of the Eigenvectors command is an expression sequence with two elements: The first is a vector whose elements are the Eigenvalues, and the second is a Matrix whose column vectors consist of the corresponding Eigenvectors.

> M := Matrix( 3, 3, [[1, -3, 3], [3, -5, 3], [6, -6, 4]] );

M := _rtable[5524728]

> Eigenvectors(M);

_rtable[3289444], _rtable[3707244]

The following command computes the sequence of Eigenvalues of the Matrix B that was defined in the previous section.

> Eigenvalues(B);

_rtable[4937180]

Special Matrices

The LinearAlgebra package also contains specialized matrices encountered in mathematics, such as Hilbert and Vandermonde matrices.

You can, for example, use Maple to compute a six-by-six Hilbert Matrix.

> HilbertMatrix(6);

_rtable[5094104]

Maple can also generate the Vandermonde Matrix for the variables s , t , u , v , and w .

> VandermondeMatrix( [s, t, u, v, w] );

_rtable[5190476]

Click here to return to the Main Menu.

© 2009 by the Rector and Visitors of the University of Virginia.

The information contained on the University of Virginia’s Department of Information Technology and Communication (ITC) website is provided as a public service with the understanding that ITC makes no representations or warranties, either expressed or implied, concerning the accuracy, completeness, reliability or suitability of the information, including warrantees of title, non-infringement of copyright or patent rights of others. These pages are expected to represent the University of Virginia community and the State of Virginia in a professional manner in accordance with the University of Virginia’s Computing Policies.