function A = laguerre_to_monomial_matrix ( n )

%*****************************************************************************80
%
%% laguerre_to_monomial_matrix() converts from Laguerre to monomial form.
%
%  Example:
%
%    N = 8 (each column must be divided by the factor below it.)
%
%      1      1      2      6     24    120    720   5040
%      .     -1     -4    -18    -96   -600  -4320 -35280
%      .      .      1      9     72    600   5400  52920
%      .      .      .      1    -16   -200  -2400 -29400
%      .      .      .      .      1     25    450   7350
%      .      .      .      .      .     -1    -36   -882
%      .      .      .      .      .      .      1     49
%      .      .      .      .      .      .      .     -1
%
%     /1     /1     /2     /6    /24   /120   /720  /5040
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    22 February 2024
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Milton Abramowitz, Irene Stegun,
%    Handbook of Mathematical Functions,
%    US Department of Commerce, 1964.
%
%  Input:
%
%    integer N: the order of the matrix.
%
%  Output:
%
%    real A(N,N): the matrix.
%
  A = zeros ( n, n );

  if ( n <= 0 )
    return
  end

  A(1,1) = 1.0;

  if ( n == 1 )
    return
  end

  A(1,2) = 1.0;
  A(2,2) = -1.0;

  if ( n == 2 )
    return
  end

  for j = 3 : n
    for i = 1 : n
      if ( i == 1 )
        A(i,j) = (  ( 2 * j - 3 ) * A(i,j-1) ...
                 +  (   - j + 2 ) * A(i,j-2) ) ...
                 /  (     j - 1 );
      else
        A(i,j) = (  ( 2 * j - 3 ) * A(i,j-1) ...
                 -  (         1 ) * A(i-1,j-1) ...
                 +  (   - j + 2 ) * A(i,j-2) ) ...
                 /  (     j - 1 );
      end
    end
  end

  return
end
