PHYCS 3730/6720 Lab Exercise

Reading and references:


Here we examine the power and inverse power methods with Maple and we look at the more elegant way to define arrays in C++. The answer file is lab15.

We are looking for the eigenvalues and eigenvectors of the matrix

       3  1 -2  1
       1  8 -1  0
      -2 -1  3 -1       
       1  0 -1  8

Exercise 1. Finding the eigenvalues and eigenvectors using Maple

Set up the matrix (call it a, remembering to use with(linalg) first. The command you want is eigenvectors(a). Make sure you understand the Maple output. What is the meaning of the ,1 that appears after each eigenvalue?

In your answer file, make a table showing each eigenvalue and the corresponding eigenvector.


Exercise 2. Power method

Use the power method for finding the largest eigenvalue and the corresponding eigenvector. For definiteness, start with the vector x = (1.,1.,1.,1.). Here are the steps:
  1. Multiply y = a x. The command you want is y := evalm(a &* x);. It is more convenient to use evalf(evalm(a &* x));.
  2. Read off the largest element of the vector y. Divide y by this element and call the result x. Note, this can be done by using the command x := evalf(evalm(y/y[2]));.
  3. Repeat steps 1 and 2, observing how the value of the largest element and the trial vector x converges. Does the eigenvector agree with the one found by Maple? (You may need to adjust the normalization to see agreement.)

In your answer file, show a few of your Maple steps and give your answer for the eigenvector and eigenvalue.


Exercise 3. Inverse power method

Repeat the previous exercise, but use the inverse of the matrix instead to get the smallest (in magnitude) eigenvalue and corresponding eigenvector. (This is the method we discussed in class to get the eigenvalue closest to 0.)

Answer in the same way as Exercise 2.