<<

18.06 at ESG Spring, 2000 Determinants on Maple or Matlab

As promised, there is much more that can be done with Athena software to avoid long computations. What I’ll do is include instructions for both Maple and Matlab in this document, with the assumption that the reader has seen and used some of the previous notes that give the basic instructions for the respective pro- grams. One thing that may be seen is that, as with Guass-Jordan elimination, matrices are easier to enter and manipulate in Matlab than in Maple. It’s your choice, of course. Finding inverses and solving systems of equations can be done, as demonstrated in previous notes, by using Gauss-Jordan elimination (row reduction, or reduced rwo-echelon form); however, there are more direct commands on either program. These notes will consider the following examples, all from the Problems Sections of Apostol, II. • Page 80, Problem 4(), for Maple only, as it requires symbolic manipulation. The problem is, in effect, find the determinant of   1111  abcd  . a2b2c2d2 a3b3c3d3

•Page 80, Problem 4(e), as an example of a long calculation that reduces to one’s ability to type. The problem is, in effect, to find the determinant of   111111  −−−  111111  −−   111111.  −− −   111111 1−11−111 1−1−111−1

•Page 95, Problem 5(a), solving the system

x +2y+3z=8 2x−y+4z=7 −y+z=1,

1 rendered in form as    123 x 8  1−14y=7. 5(a) 0−11 z 1

The ASCII commands that appear here are in the file detcoms and may be cut and pasted into your Maple or Matlab session. It might be easier to do so one command at a time. Maple As in previous notes, the Maple prompt, >, will be given but should not be typed. Also, returns should be made only at the end of a command. As with the previous uses, load the linear package with >with(linalg): and enter the matrix with >A1:=matrix([[1,1,1,1],[a,,c,d],[a^2,b^2,c^2,d^2], [a^4,b^4,c^4,d^4]]) The determinant is found with >det(A1); While true, this is not the best form, and is not the form in which the answer appears in the text. We can recover this form with >factor(%); where the percent , %, tells Maple to apply the command to the previous . To find the determinant of a larger matrix with numerical entries, enter >A2:=matrix([[1,1,1,1,1,1],[1,1,1,-1,-1,-1],[1,1,-1,-1,1,1], [1,-1,-1,1,-1,1],[1,-1,1,-1,1,1],[1,-1,-1,1,1,-1]]); being very careful with all the commas and brackets. (Remeber, if you want to break a line without entering a command, its Shift-Return.)Then, >det(A2); returns the desired answer. To solve the system given as 5(a) above, enter the matrices >B1:=matrix([[1,2,3],[2,-1,4],[0,-1,1]]); >C1:=matrix([[8],[7],[1]]); Sovling the system by multiplying by an inverse involves typing out the words as >D1:=multiply(inverse(B1),C1); Matlab

2 As before, the Matlab prompt >> will be given here but should not be typed. To enter a matrix with numerical values, the command is >>A=[111111;111-1-1-1;11-1-111; 1,-1-11-11;1-11-111;1-1-111-1] followed by >>det(A) To solve the system 5(a), enter the matrices as >>B=[123;2-14;0-11] >>C = [8;7;1] where in the last command, note that the semicolons mean that a column matrix has been entered. Solving the system is quite easy in Matlab: >D=B\C where the backslash \ means “multiply by the inverse of B on the left”.

3