Notes on Installing and Using Maple��������� B 02

 

Why use Maple for linear algebra?

        it quickly obtains the Final Form (RREF) of a matrix using the Gauss Jordan algorithm requiring only that you key in the coefficients

  • it quickly does matrix multiplication, inversion and eigenvalues

 

Options:�� there are a number of ways you can go about using Maple at WPI.

1)      install a PC based version (7) 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 sitefor 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

 

 

Installation over the network

1)      on your PC go to START�� then Control Panelthen Advertised Programs Wizard

2)      check off Maple 7 from the list(and/or anything else you want)

3)      select Finish��� You should eventually end up with a Maple7 icon on your desktop

 

Using Maple from a Unix session

����������� this assumes you are in a text based window and have a Unix prompt, >, showing

���������� at the > prompt simply enter��� >maple

 

���������� and you will againget 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

 

�������

Performing Linear Algebra Tasks in Maple 7

 Part OneSolving Systems of Equations

����������� (start Maple and try the commands below as you read this. They are shown in blue )

 

��������� First open the linear algebra library

������������������ >with(linalg);

 

��������� As in class, let�s solve problem 21 d, page 63 of Kolman, which is

 

������������������ 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 thefunction

������������������ gaussjordand apply it to your matrix

 

������������������������������������� >gaussjord(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

��������������������������������������������������������� warbitrary��������� ).Note the signs.

 

Part TwoMatrix Arithmetic With Maple(see 10/29 class notes also)

 

��������� > 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. Thenumber 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.