Linear Algebra with Maple
First we load the "linalg" package:
> with(linalg):
Warning, new definition for norm
Warning, new definition for trace
Ignore the warning statements. Notice the line above ended in ":" rather than ";". Change this and see what happens.
We shall now define some martices and do simple manipulations.
> A:=matrix([[3, 4, 2],[3, 5, 1],[0,2,1]]);
> b:=matrix([[1],[2],[0]]);
> evalm(A &* b);
> evalm(A &* b + 4*b);
> evalm(A &* A - 3*transpose(A));
Now let's work on solving systems of equations. Suppose Ax=b. We set up the augmented matrix.
> Ab:=augment(A,b);
>
Next we put it into reduced row echelon form.
> rref(Ab);
The solution is x=1/3, y=1/3, z=-2/3. Here is a one step method:
> linsolve(A,b);
Let's try another one.
> A:=matrix([[1,2,0,1],[0,-1,3,1],[1,1,3,2],[1,1,1,1]]);
> b:=matrix([[1],[2],[3],[1]]);
> rref(augment(A,b));
Write out the solutions in vector form. Compare with the output of linsolve. If you want the answer in decimal form use evalf(rref(augment(A,b)));.
Homework Problem: Solve the three martix equations below using rref. Write the solution in vector form. You can check your work with linsove.
Sovle Ax=a, Bx=b and Cx=c.