using LinearAlgebra A=rand(5,5) .- 0.5 println("A random matrix:") display(A) println("\nThe eigenvalues are:") display(eigvals(A)) AA=copy(A) for k=1:10000 global AA z=qr(AA) AA=z.R*z.Q end println("\nThe QR algorithm might lead to blocks which") println("correspond to complex conjugate eigenvalues") display(AA) # shifted version AA=copy(A) for k=1:10000 global AA z=qr(AA-0.5im*I) AA=z.R*z.Q+0.5im*I end println("\nShifting by an imaginary offset hopefully gives") println("all the eigenvalues on the diagonal") display(AA) println("\nHere is just the diagonal") display(diag(AA))