function l = laguerre_polynomial ( order, x )

%*****************************************************************************80
%
%% laguerre_polynomial() evaluates Laguerre polynomials up to a given order.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    09 May 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 polynomial to be computed.
%
%    real X, the point at which polynomials are evaluated.
%
%  Output:
%
%    real L(1:ORDER+1), the value of the Laguerre polynomials
%    of orders 0 through ORDER at X.
%
  if ( order < 0 )
    l = [];
%
%  Set the recursion coefficients.
%
  elseif ( 0 <= order )

    l(1:order+1) = 0.0;

    l(1) = 1.0;

    if ( 1 <= order )
      l(2) = 1.0 - x;
    end

    for i = 2 : order
      l(i+1) = ( ( 2 * i - 1 - x ) * l(i) - ( i - 1 ) * l(i-1) ) / i;
    end

  end

  return
end

