function value = r8poly_integral ( d, c, a, b )

%*****************************************************************************80
%
%% r8poly_integral() returns the definite integral of a polynomial P over [A,B].
%
%  Discussion:
%
%    The power sum form of a polynomial is:
%
%      p(x) = c(0) + c(1) * x + ... + c(n-1) * x^(n-1) + c(n) * x^(n)
%
%    Because MATLAB doesn't allow 0 indexing, we use an adjusted formula:
%
%      p(x) = c(1) + c(2) * x + ... + c(n) * x^(n-1) + c(n+1) * x^(n)
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    20 October 2019
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer D: the degree of the polynomial.
%
%    real C(1:D+1): the coefficients of the polynomial.
%
%    real A, B: the endpoints of the interval.
%
%  Output:
%
%    real VALUE: the integral value.
%
  c = c(:);
  ca = r8poly_ant_value ( d, c, a );
  cb = r8poly_ant_value ( d, c, b );
  value = cb - ca;

  return
end

