function ShowAdapts()
% Illustrates AdaptQNC for a range of tol values and a range of
% underlying NC rules. Uses the humps function for an integrand
% and displays information about the function evaluations.

global FunEvals
close all
x = linspace(0,1,100);
y = humps(x);
plot(x,y)
clc
disp(' m tol f-evals')
disp('-------------------------------------------')
for m=3:2:9
for tol = [.01 .001 .0001 .00001 .000001]
plot(x,y)
hold on
FunEvals = 0;
num0 = AdaptQNC(@SpecHumps,0,1,m,tol);
xlabel(sprintf('m = %2d tol = %10.6f f-Evals = %3.0f ',m,tol,FunEvals),'fontsize',14)
hold off
fprintf('%2d %10.6f %5d\n',m,tol,FunEvals)
pause
end
disp(' ')
end

function y = SpecHumps(x)
% Yields humps(x) where x is an n-vector.
% FunEvals is an initialized global scalar that is increased by length(x).

global FunEvals ;
y = 1 ./ ((x-.3).^2 + .01) + 1 ./ ((x-.9).^2 + .04) - 6;
hold on
plot(x,y,'*')
hold off
FunEvals = FunEvals + length(x);