function [H]=InvHilb(n)
H=[];
//InvHilb Inverse Hilbert matrix.
//   InvHilb(n) is the inverse of the n by n matrix with elements
//   1/(i+j-1), which is a famous example of a badly conditioned
//   matrix.  The result is exact for n less than about 15.
//   See also Hilb.
//   
//   In Scilab is InvHilb(n)=testmatrix('hilb',n)
//
//   Reference:
//   Forsythe, G. E. and C. B. Moler,
//   Computer Solution of Linear Algebraic Systems,
//   Prentice-Hall, 1967, Chapter 19.
//   (FB Bibliothek Informatik, Signatur FOR g2 67:1)
// 
 
p = n;
H = zeros(n,n);
for i = 1:n
  if i>1 then
    p = (n-i+1)*p*(n+i-1)/((i-1)^2);
  end
  r = p*p;
  H(i,i) = r/(2*i-1);
  for j = i+1:n
    r = -(n-j+1)*r*(n+j-1)/((j-1)^2);
    H(i,j) = r/(i+j-1);
    H(j,i) = r/(i+j-1);
  end
end
