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


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

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

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

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

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

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


err(1:6)./err(2:7)
Err(1:6)./Err(2:7)

