function e = laguerre_monomial_quadrature ( n, x, w, p )

%*****************************************************************************80
%
%% laguerre_monomial_quadrature() applies Laguerre quadrature to a monomial.
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    08 June 2013
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the number of points in the rule.
%
%    real X(N), the quadrature points.
%
%    real W(N), the quadrature weights.
%
%    integer P, the exponent.
%
%  Output:
%
%    real E the quadrature error.
%

%
%  Get the exact value of the integral of the unscaled monomial.
%
  s = laguerre_integral ( p );

  v(1:n,1) = x(1:n) .^ p;
%
%  Compute the weighted sum.
%
  q = w' * v;
%
%  Absolute error for cases where exact integral is zero,
%  Relative error otherwise.
%
  if ( s == 0.0 )
    e = abs ( q );
  else
    e = abs ( q - s ) / abs ( s );
  end

  return
end

