function [A]=hw6_2_17(n) % notice the pattern in A A=zeros(n); for i=1:n for j=1:n A(i,j)=n-max(i,j)+1; end end evals=sort(eig(A)); % the book really messed up here these are the WRONG eigenvalues for this matrix! % $20 to the first person who can find an exact formula for them! i=[1:n]'; lambda=sort(.5*(1-cos((2*i-1)*pi/(2*n+1)))); disp('smallest evals, numerical then exact') disp(evals(1)) disp(lambda(1)) disp('largest evals, numerical then exact') disp(evals(n)) disp(lambda(n))