
fprintf ( 1, '\n' );
fprintf ( 1, 'hump_adapt:\n' );
fprintf ( 1, '  Use adaptive trapezoid integration to estimate\n' );
fprintf ( 1, '  the integral of hump(x) from 0 to 2.\n' );
fprintf ( 1, '\n' );

a = 0.0;
b = 2.0;
tol = 0.01;
h_min = 0.000001;
n_max = 1000;
%
%  In interval of width h, try to achieve error less than tol*h/(b-a).
%
[ q, n ] = trap_adapt ( @(x)hump(x), a, b, tol, h_min, n_max );

i = hump_int ( a, b );

fprintf ( 1, '\n' );
fprintf ( 1, '  Number of subintervals = %d\n', n );
fprintf ( 1, '  Integral estimate = %g\n', q );
fprintf ( 1, '  Exact integral =    %g\n', i );
fprintf ( 1, '  Error =             %g\n', abs ( i - q ) );
fprintf ( 1, '  Error tolerance =   %g\n', tol );


