------------- Problem 4 ---------------- Applying Rayleih quotient algorithm to With A = [2 1 1; 1 2 1; 1 1 2]; x0 = [1; -1; 2]; and printing at the end of the loop (see p63 of notes) the eigenvalue and eigenvector and the difference between two succesive eigenvalue iterates ---------------------------------------- i= 0 la=1.6666667e+00 err= x= 0.408248290463863 -0.408248290463863 0.816496580927726 i= 1 la=1.0683761e+00 err=5.9829060e-01 x= -0.065372045046061 0.849836585598797 -0.522976360368491 i= 2 la=1.0000381e+00 err=6.8338005e-02 x= 0.156358879152925 -0.769455347348119 0.619265992403447 i= 3 la=1.0000000e+00 err=3.8063029e-05 Done in 3 iterations eigenvalue = 1.0000000e+00 eigenvector = -0.154303323868882 0.771516775903129 -0.617213373755831 ------------- Problem 5 ---------------- Applying QR algorithm with deflation as stated in the HW to the matrix A = [2 -1 0; -1 2 -1; 0 -1 2]; and printing the updated A at every iteration after the update A(1:m,1:m) = RQ + mu*I ________________________________________ **** iteration 1 1.000000000000000 0.707106781186547 -0.000000000000000 0.707106781186547 2.000000000000000 -0.707106781186547 0 -0.707106781186547 3.000000000000000 **** iteration 2 0.693997690565051 0.375974484550621 0.000000000000000 0.375974484550621 1.892417374123494 -0.030396964933976 0 -0.030396964933976 3.413584935311455 **** iteration 3 0.614479590481565 0.199386431066825 -0.000000000000000 0.199386431066825 1.971306847145480 -0.000000447976474 0 -0.000000447976474 3.414213562372954 **** iteration 4 0.585786437626907 0.000000000000000 -0.000000000000000 -0.000000000000000 2.000000000000139 0 0 0 3.414213562372954 done in 4 iterations The approximate eigenvalues are 0.585786437626907 2.000000000000139 3.414213562372954