function a = lotkin_inverse ( n )

%*****************************************************************************80
%
%% LOTKIN_INVERSE returns the inverse of the LOTKIN matrix.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    15 October 2007
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the order of A.
%
%  Output:
%
%    real A(N,N), the matrix.
%
  a = zeros ( n, n );

  for i = 1 : n
    for j = 1 : n

      if ( j == 1 )

        a(i,j) = (-1)^( n - i ) * nchoosek ( n+i-1, i-1 ) * nchoosek ( n, i );

      else

        a(i,j) = (-1)^(i-j+1) * i * nchoosek ( i+j-1, j-1 ) ...
          * nchoosek ( i+j-2, j-2 ) * nchoosek ( n+i-1, i+j-1 ) ...
          * nchoosek ( n+j-1, i+j-1 );

      end

    end
  end

  return
end
