Why use Maple
for linear algebra?
· it quickly obtains the Final Form (RREF) of a matrix using the Gaussian Elimination algorithm requiring only that you key in the coefficients
1) install a PC based version (8 or 9) over the Network to your
PC. This assumes you are hooked
up to the network and therefore in the dorms. In
all cases of students not being able
to
install Maple over the Network, it was found that
they were not part of the Academic LAN
nor in
the SMS database, so their computer would not receive Advertised Programs nor
have
the S: drive mapped to \\argus\applications.
You might
go to the following CCC
site for detailed information
which will result in your
computer becoming part of the Academic
LAN.
2) install from a CD if you have purchased a Student Edition of
Maple (bookstore etc)
3) start a Unix terminal session and use the text based version
of Maple. This would rule out graphics
but in linear algebra this doesn’t amount to
much
1) on your PC go to START then Control Panel
then Advertised Programs
Wizard
2) check off Maple 7 or 8 or 9
from the list (and/or anything else
you want)
3) select Finish You should eventually
end up with a Maple icon on your desktop
this assumes you are in a text based
window and have a Unix prompt, >, showing
at the >
prompt simply enter
>maple
and you will again get a > prompt but this is from Maple, not Unix.
This is an older
version of Maple but it will do all the linear
algebra problems fine, exactly the same as
the newer versions. When finished, enter >
quit to return to
Unix
Part One Solving
Systems of Equations
(start Maple and
try the commands below as you read this. They are shown in blue
)
>with(linalg);
As in
class, let’s solve a problem
x + 2y + 3z – w =0
2x + y - z + w = 3
x -
y + w = -2
Now create a 3x5 matrix A to hold all 15 coefficients, which are
entered equation by equation
>A:=matrix(3 ,5
,[1, 2, 3, -1, 0 ,2 , 1, -1, 1, 3, 1, -1, 1, 0,
-2]);
noting that there are 15 entries inside brackets
[
] and also that
they are entered row by row with a 0 if
there is no term present (z in 3rd eqn)
That’s the hard part! To perform the Gauss Jordan algorithm, simple call
the function
gaussjord and apply it to
your matrix
>rref(A);
and the software will do the rest, producing the Final Form (RREF) for you:
at this point, you have
to assign arbitrary variables or decide there is no solution. Maple has only
done the computations for you. (w would be arbitrary here and the final,
scalar solution, would be
x = -w/3 +
1/3
y =
w/15 +
4/3
z = 2w/5 –
1
w
arbitrary
). Note the signs.
Part Two Matrix Arithmetic With
Maple
> with(linalg): * open linear
algebra library always *
> A: = matrix (3,2,[1,2,3,4,5,6]);
*
create a matrix A *
> B: = matrix(2 , 2,
[,1,5,2]);
> C: = multiply(A,B);
*
product of A and B *
> H:= inverse(B);
*
multiplicative inverse, if it has one *
> G:=multiply(B,B^2);
*
raise B to third power
*
Part Three - Eigenvalues and Eigenvectors (see notes from 11/25
also)
>with(linalg):
>A:=
matrix(3,3,[2,1,0,1,2,1,0,1,2]);
> cp:=charpoly(A,x);
x3 – 6x2 + 10x
-4
>solve(cp=0,x);
x = 2 , 2 +/-
21/2
or look at the plot and see where it crosses the x
axis
> plot(cp, x = -5..5);
(you need to adjust the range of x to see the intercepts
clearly)
or use the library functions eigenvals and/or eigenvects
> eigenvals(A);
2, 2 +/- √2
> eigenvects(A);
[2,1, { [-1,0,1]} ], [2 +√2,1, { [1, √2,1] } ], [2-√2 , 1, {
[1,- √2,1]) ]
the last output is a little confusing to read. The 3 eigenvectors as in
{brackets} and are preceded
by the eigenvalue associated with them. The number 1,
which appears each time, indicates that the eigenvalue was a single root. You should get out of this
the following:
eigenvalue 2, single root,
eigenvector [-1,0,1]
eigenvalue 2
+√2, single root, eigenvector [1,
√2,1]
eigenvalue 2
-√2, single
root, eigenvector [1,
-√2,1]
Later on we will deal
with the problems of running into double and triple roots.