> with(linalg):
> ?linalg
> ?det
> ?mulrow
> ?addrow
> ?matrix
> ?vector
> ?multiply
> ?augment
> A:= matrix(6,4);
| A = | 6 | 3 | -2 | 1 |
| 8 | 0 | 7 | 2 | |
| 9 | 5 | 4 | -3 |
> A:= matrix([[6,3,-2,1],[8,0,7,2],[9,5,4,-3]]);
Spaces are allowed but not required. Also, the command may span several lines.
> A[3,4];
shows that -3 is stored in row 3 column 4 of A
> A[3,4]:=9;
stores 9 in row 3 column 4 of A
|
|
|
> A:= matrix([[6,3,-2,1],[8,0,7,2],[9,5,4,-3]]);
> B:= matrix([[7,2,0],[-5,3,4],[2,1,9],[6,-7,2]]);
> C:= matrix([[7,2,0],[-5,3,4],[2,1,9]]);
> det(C);
gives the determinant of square matrix C
> inverse(A);
gives the inverse of matrix A
> rank(A);
gives the rank of matrix A
> gaussjord(A);
gives the Gauss-Jordan canonical form of matrix A
> augment(A,C);
augments two matrices A and C
> multiply(A,B);
matrix product AB
> multiply(B,A);
matrix product BA
> evalm(A);
> A:=mulrow(A,r,k);
> A:=mulcol(A,c,k);
> A:=addrow(A,r1,r2,k);
> p:=charpoly(C,x);
calls the resulting polynomial p
> eigenvals(C,'radical');
> eigenvects(C,'radical');
8x + 7z = 2
9x + 5y + 4z = -3
> M:= matrix([[6,3,-2,1],[8,0,7,2],[9,5,4,-3]]);
gives
| M = | 6 | 3 | -2 | 1 |
| 8 | 0 | 7 | 2 | |
| 9 | 5 | 4 | -3 |
> gaussjord(M);
| 1 | 0 | 0 | 142 / 197 |
| 0 | 1 | 0 | -289 / 197 |
| 0 | 0 | 1 | -106 / 197 |
As long as the identity matrix appears in the coefficient matrix portion, then the rightmost column gives the solution x, y, z.
If you use a decimal point anywhere, the solution will be given in decimal form.
Alternatively, you can solve the linear system Ax = b where A is an n x n coefficient matrix and b is the n-term constant vector by:
> A:= matrix([[6,3,-2],[8,0,7],[9,5,4]]);
defines coefficient matrix A
| A = | 6 | 3 | -2 |
| 8 | 0 | 7 | |
| 9 | 5 | 4 |
> b:= vector([1,2,-3]);
defines constant vector b
> linsolve(A,b);
gives the solution of system
Ax = b in vector form
> det(A);
gives the determinant of coefficient matrix
A
> AI:=inverse(A);
gives the inverse A-1 of
coefficient matrix A and calls it AI
> multiply(AI,b);
multiplies A-1b, which is the
solution x of Ax = b
> ?linalg;
Written and Maintained by
Last modified: 07/23/07
Copyright © 1997-2008 Kevin G. TeBeest. All rights reserved.
Maple® is a registered trademark of Waterloo Maple Software.
Prof. Kevin G. TeBeest
Applied Mathematics
Kettering University