simultaneous iteration fails for the 1d laplacian operator?

23 Views Asked by At

The code below is to use the simultaneous iteration method to calculate the eigenvalues of the 1d Laplacian operator. The exact eigenvalues are known analytically.

It is strange that there is no convergence even after 4000 iterations. Is it because of the degeneracy of the eigenvalues?

If the matrix $H $ is replaced by a random hermitian matrix, things are fine.

clear all; close all; clc; format long 

N = 5;
H = zeros(N, N);
for s = 1 : N - 1 
    H(s,s+1)= -1 ;
    H(s+1,s)= -1 ;
end

a = rand(N,N);
[Q,R]= qr(a);
for s = 1 : 4000
    Z = H * Q;
    [Q,R] = qr(Z);
    Q;
    M= Q'* (H * Q);
    ee = diag(M);
    ee = sort(ee);
end
dd = eig(H);

[ee,dd]'

The final display is

ans =

  -1.721891779167106  -0.388948551876656  -0.000000000000000   0.388948551876656   1.721891779167106
  -1.732050807568878  -1.000000000000000  -0.000000000000000   1.000000000000000   1.732050807568877
```