function [ xtab, weight ] = laguerre_quadrature_rule ( order )

%*****************************************************************************80
%
%% laguerre_quadrature_rule() computes a Gauss-Laguerre quadrature rule.
%
%  Discussion:
%
%    If the integral to approximate is:
%
%      Integral ( 0 <= X < +oo ) EXP ( - X ) * F(X) dX
%
%    then the quadrature rule is:
%
%      Sum ( 1 <= I <= ORDER ) WEIGHT(I) * F ( XTAB(I) )
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    20 February 2008
%
%  Author:
%
%    FORTRAN77 original version by Arthur Stroud, Don Secrest
%    MATLAB version by John Burkardt
%
%  Reference:
%
%    Arthur Stroud, Don Secrest,
%    Gaussian Quadrature Formulas,
%    Prentice Hall, 1966,
%    LC: QA299.4G3S7.
%
%  Input:
%
%    integer ORDER, the order of the quadrature rule to be computed.
%    ORDER must be at least 1.
%
%  Output:
%
%    real XTAB(ORDER), the Gauss-Laguerre abscissas.
%
%    real WEIGHT(ORDER), the Gauss-Laguerre weights.
%

%
%  Set the recursion coefficients.
%
  for i = 1 : order
    b(i) = 2 * i - 1;
  end

  for i = 1 : order
    c(i) = ( i - 1 ) * ( i - 1 );
  end

  cc = prod ( c(2:order) );

  for i = 1 : order
%
%  Compute an estimate for the root.
%
    if ( i == 1 )

      x = 3.0 / ( 1.0 + 2.4 * order );

    elseif ( i == 2 )

      x = x + 15.0 / ( 1.0 + 2.5 * order );

    else

      r1 = ( 1.0 + 2.55 * ( i - 2 ) ) / ( 1.9 * ( i - 2 ) );

      x = x + r1 * ( x - xtab(i-2) );

    end
%
%  Use iteration to find the root.
%
    [ x, dp2, p1 ] = laguerre_root ( x, order, b, c );
%
%  Set the abscissa and weight.
%
    xtab(i) = x;
    weight(i) = ( cc / dp2 ) / p1;

  end

  return
end

