function A = dif2_inv ( n )
%
%  function A = dif2_inv ( n )
% 
%  DIF2_INV returns the inverse of the second difference matrix.
%
%  Modified:
%
%    14 February 2000
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
% 
%    Input, integer N, the order of the matrix.
%
%    Output, real A(N,N), the inverse of the second difference matrix.
% 
  A = zeros ( n, n );
 
  for i = 1 : n
    for j = 1 : n
      if ( j >= i ) 
        A(i,j) = ( i * ( n - j + 1 ) );
      else
        A(i,j) = ( j * ( n - i + 1 ) );
      end
    end
  end

  A = - A / ( n + 1 );

