function q = trapezoid ( a, b, f )

  x1 = a;
  w1 = ( b - a ) / 2.0;

  x2 = b;
  w2 = ( b - a ) / 2.0;

  q = w1 * f ( x1 ) + w2 * f ( x2 );

  return
end
