function q = line_integral ( p1, p2, n, f )

%*****************************************************************************80
%
%% line_integral() estimates integral ( p1 <= x <= p2 ) f(x) dx.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    29 July 2023
%
%  Author:
%
%    John Burkardt
%

%
%  Select N random points in the interval.
%
  x = p1(1) + ( p2(1) - p1(1) ) * rand ( n, 1 );
%
%  Estimate the integral.
%
  q = abs ( p2 - p1 ) * sum ( f(x) ) / n;

  return
end
