As usual start Maple and load all the linear algebra programs using "with(LinearAlgebra); " Check the solution from Thursday's class by defining a plot as follows: > with(plots): b:=k->3*(-4)^k+73*3^k - 29*2^k; > thurs:=proc(n) local l: l:=[seq(k,k=0..n)]: print(b(n)); pointplot(l,[seq(b(k),k=l)]); end proc; > thurs(7); Now do > thurs(8); and see how the value of b(k) increases and then oscillates with k going up above 13. Show that the eigenvalues and eigenvectors of the underlying matrix are as expected: > B:=<<1,1,0>|<14,0,1>|<-24,0,0>>; > (e,P):=Eigenvectors(B); Verify that the diagonalisation formula gives B > Multiply(Multiply(P,DiagonalMatrix(e)),MatrixInverse(P)); and now form the matrix which is B to the power k > Bk:=Multiply(Multiply(P,DiagonalMatrix()),MatrixInverse(P)); Now Multiply Bk by the initial values given: > v:=<589,149,47> and note that the bottom line of this product is the formula given for b(k) As we did in class, find a different vector v whose solution will have (-4)^k multiplied by 0. Can you find values which start off positive for the first few values but eventually stay negative? This one line program creates a n by n matrix with determinant +1 or -1: > randdet1:=proc(n) local P; P:=<0>: while abs(Determinant(P))<>1 do P:=RandomMatrix(n,n,generator=rand(-5..6)); od: RETURN(P); end proc; (note that this is one long line of code, remember to copy it all at once) Let us use this to create a matrix with integer entries with chosen eigenvalues a, b and c; choose two of them to be different positive integers and one to be negative. > randomise(1000*time[real]()):Q:=randdet1(3); > Determinant(Q); > De:=DiagonalMatrix(); > M:=Multiply(Multiply(Q,De),MatrixInverse(Q)); Verify using > Eigenvectors(M); that M has the properties that you want. Maple can create the kth power of a matrix automatically: > Mk:=MatrixPower(M,k); > Dk:=MatrixPower(De,k); Note that the second matrix is simple and diagonal unlike the first. Check that when you use k=2 you get the same as multiplying each matrix > Multiply(M,M); > subs(k=2,Mk); > Multiply(De,De); > subs(k=2,Dk); Multiply Q and a diagonal matrix of the powers of the eigenvalues, and the inverse of Q to get Bk, the kth power of B as follows: > Bk:=Multiply(Multiply(Q,Dk),MatrixInverse(Q)); This should be something like Mk, but might be a bit different in some ways. You can see they are the same using > simplify(Mk-Bk); Check that Bk gives the expected matrices for small values of k such as k=1, 0 and -1. Define J to be the two by two matrix underlying the twin recurrences: a(n+1)= 7*a(n) + 12*b(n) and b(n+1)= 8*a(n) + 3*b(n) > J:=<<7,8>|<12,3>>; If a(0)=5 and b(0)=7, determine a(1), a(2) and a(3) and b(1), b(2) and b(3) by using (for k=1, 2, and 3) > abk:=Multiply(MatrixPower(J,k),<5,7>); and then altering this line as appropriate > subs(k=0,abk); What ratio is a(n)/b(n) approaching as n gets larger? Pick another random pair of positive values for a(0) and b(0) in abk and verify that the solutions approach the same ratio as k increases. Now pick b(0) = - a(0) for some value for a(0) and see what the solutions are for a(n) and b(n) Notice the appearance of these different ratios are in the eigenvectors of J: > Eigenvectors(J); Create a matrix A which has one eigenvalue of absolute value less than 1 and one equal to 1 and find the initial values p and q such that the values approach zero and to which values all other p and q head towards: > Multiply(MatrixPower(J,k),); Let E be this upper triangular (all zeros below the diagonal) matrix: > E:=<<4,0,0,0>|<0,-1,0,0>|<0,3,-1,0>|<0,0,0,-1>>; Show that its eigenvalues are just the entries on the diagonal, and see how many eigenvectors it has. Experiment to find which entries of E can be changed to increase or decrease the number of eigenvectors. Now create a random invertible 4x4 matrix R > R:=randdet1(4); and verify that this matrix F has the same eigenvalues and multiplicities as E: > F:=Multiply(Multiply(R,E),MatrixInverse(R)); Now use the above idea to create a 4x4 matrix G with two eigenvalues of multiplicity 2 and only two eigenvectors and ensure that G has no zeros in its entries. If you finish early, try to create a 4x4 integer entry matrix with no real eigenvalues.