%  2nd order accuracy check for 
%  u'' = f,   u(0)=u(1)=0 

u = @(x) exp(sin(pi*x))-1;
f = @(x) (pi^2)*exp(sin(pi*x)).*(cos(pi*x).^2-sin(pi*x));

Nvec = 2.^(3:10)';
h    = 1./Nvec;

err = zeros(length(Nvec),1);

for i = 1:length(Nvec)
    N = Nvec(i);
    [vh,xh] = poiss1d_2P(f,N);
    err(i) = norm(u(xh)-vh,'inf');
end


format short e
disp(' ')
disp('       h           err         err/h^2 ')
disp('   -------------------------------------')
disp([h err err./(h.^2)])
format long e
disp(' ')


