%% hump_trap applies a sequence of trapezoid rules to the hump() function.
%
a = 0.0;
b = 2.0;

for nlog = 0 : 10
  n = 2 ^ nlog;
  x = linspace ( a, b, n + 1 );
  q = 0.5 * hump ( x(1) );
  for i = 2 : n
    q = q + hump ( x(i) );
  end
  q = q + 0.5 * hump ( x(n+1) );
  q = ( b - a ) * q / n;
  e = hump_int ( a, b ) - q;
  fprintf ( 1, '  %4d  %20.16g  %10.4g\n', n, q, e );
end

