function q = monte_carlo ( n, a, b, f )

  x = a + ( b - a ) * rand ( n, 1 );
  q = ( b - a ) * ( 1.0 / n ) * sum ( f ( x ) );

  return
end
