clear all

f=inline('2/(1+x^2)','x'); % f=@(x) 2/(1+x^2);
a=-1; b=1; tol=1e-6;

% f=@(x) exp(-x^2);
% a=0; b=1; tol=1e-6;

[Q,k]=trap_comp(f,a,b,tol);
fprintf('trap:     Q=%19.15f    fcount=%5d\n', Q,k)

[Q,k]=simp_comp(f,a,b,tol);
fprintf('simp:     Q=%19.15f    fcount=%5d\n', Q,k)

[Q,k]=simp38_comp(f,a,b,tol);
fprintf('simp38:   Q=%19.15f    fcount=%5d\n', Q,k)

[Q,k]=mid_comp(f,a,b,tol);
fprintf('mid:      Q=%19.15f    fcount=%5d\n', Q,k)

[Q,k]=openNC2_comp(f,a,b,tol);
fprintf('openNC2:  Q=%19.15f    fcount=%5d\n', Q,k)
