# Eigenvalues of an upper Hessenberg matrix

I'm interested in calculating the roots of an 11th degree polynom. To do so, I calculated the 10x10 companion matrix which eigenvalues are the roots of the polynom. Now, the eigenvalues could be real or complex and in my code, I just need real ones. Is there a way to find the real eigenvalues only of an upper Hessenberg matrix (companion matrix) using iterations of the QR algorithm?

I tried this: Let A be our upper Hessenberg matrix

M=A
for i=1:100
[Q,R]=qr(M);
M=R*Q;
end


diag(M) will converge to eig(A) if A is symmetric, if not real eigenvalues exist but complex ones dosen't. I just need real eigenvalues but how to distinguish in diag(M) values that the entry correspond to a real eigenvalue?

• Sure, just start applying the $QR$ algorithm. It'll converge fairly nicely if you start with something upper-hessenberg. – Omnomnomnom Jun 30 '15 at 0:35

Second, the QR algorithm as you've written it converges extremely slowly compared to state-of-the-art implicitly shifted Hessenberg QR. If you use eig() in Matlab, it will use the faster algorithm and almost certainly be faster than your qr in a loop.