% test the discrete Laplacian, Neumann boundary conditions, ghost point
% approach
clear
L=1;
N = 8;
M = NeumannMatrix3(N,L);
v = sort(eig(M));
err(1) = v(N)+pi^2;
lambda(1) = v(N);
Err(1) = v(N-1)+4*pi^2;


N = 16;
M = NeumannMatrix3(N,L);
v = sort(eig(M));
lambda(2) = v(N);
err(2) = v(N)+pi^2;
Err(2) = v(N-1)+4*pi^2;

N = 32;
M = NeumannMatrix3(N,L);
v = sort(eig(M));
lambda(3) = v(N);
err(3) = v(N)+pi^2;
Err(3) = v(N-1)+4*pi^2;

N = 64;
M = NeumannMatrix3(N,L);
v = sort(eig(M));
lambda(4) = v(N);
err(4) = v(N)+pi^2;
Err(4) = v(N-1)+4*pi^2;

N = 128;
M = NeumannMatrix3(N,L);
v = sort(eig(M));
lambda(5) = v(N);
err(5) = v(N)+pi^2;
Err(5) = v(N-1)+4*pi^2;

N = 256;
M = NeumannMatrix3(N,L);
v = sort(eig(M));
lambda(6) = v(N);
err(6) = v(N)+pi^2;
Err(6) = v(N-1)+4*pi^2;

N = 512;
M = NeumannMatrix3(N,L);
v = sort(eig(M));
lambda(7) = v(N);
err(7) = v(N)+pi^2
Err(7) = v(N-1)+4*pi^2

err(1:6)./err(2:7)
Err(1:6)./Err(2:7)
(lambda(1:5)-lambda(2:6))./(lambda(2:6)-lambda(3:7))
