function A = laguerre_inverse ( n )

%*****************************************************************************80
%
%% laguerre_inverse() converts from monomial to Laguerre form.
%
%  Example:
%
%    N = 9
%
%        1       1       2       6      24     120     720    5040    40320
%        .      -1      -4     -18     -96    -600   -4320  -35280  -322560
%        .       .       2      18     144    1200   10800  105840  1128960
%        .       .       .      -6     -96   -1200  -14400 -176400 -2257920
%        .       .       .       .      24     600   10800  176400  2822400
%        .       .       .       .       .    -120   -4320 -105840 -2257920
%        .       .       .       .       .       .     720   35280  1128960
%        .       .       .       .       .       .       .   -5040  -322560
%        .       .       .       .       .       .       .       .    40320
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    22 February 2024
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N: the order of A.
%
%  Output:
%
%    real A(N,N): the matrix.
%
  A = zeros ( n, n );

  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) = ( j - 1 ) * ( A(i,j-1)              );
      else
        A(i,j) = ( j - 1 ) * ( A(i,j-1) - A(i-1,j-1) );
      end
    end
  end

  return
end
