Operations with Matrices

Maple contains two linear algebra packages, LinearAlgebra and linalg. The former is the later package.  Each will be illustrated below.

> restart:

> with(LinearAlgebra):

Every command in the LinearAlgebra package begins with a capital letter.

> A:=Matrix([[1,2,3],[4,5,6],[7,8,9]]);

A := Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])

> B:=Matrix([[2,4,6],[8,1,3],[5,7,9]]);

B := Matrix([[2, 4, 6], [8, 1, 3], [5, 7, 9]])

> Determinant(A);

0

> Determinant(B);

54

> A+B;

Matrix([[3, 6, 9], [12, 6, 9], [12, 15, 18]])

> Multiply(A,B);

Matrix([[33, 27, 39], [78, 63, 93], [123, 99, 147]])

> restart:

> with(linalg):

Warning, the protected names norm and trace have been redefined and unprotected

> A:=matrix(3,3,[1,2,3,4,5,6,7,8,9]);

A := matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])

> B:=matrix([[2,4,6],[8,1,3],[5,7,9]]);

Either method can be used to enter matrices.

B := matrix([[2, 4, 6], [8, 1, 3], [5, 7, 9]])

> det(A);

0

> det(B);

54

> matadd(A,B);

matrix([[3, 6, 9], [12, 6, 9], [12, 15, 18]])

> multiply(A,B);

matrix([[33, 27, 39], [78, 63, 93], [123, 99, 147]])

> evalm(A&*B);

matrix([[33, 27, 39], [78, 63, 93], [123, 99, 147]])

>