




help hilb
 HILB   Hilbert matrix.
    H = HILB(N) is the N-by-N matrix with elements 1/(i+j-1), which is a
    famous example of a badly conditioned matrix. The INVHILB function
    calculates the exact inverse.
 
    H = HILB(N,CLASSNAME) returns a matrix of class CLASSNAME, which can be
    either 'single' or 'double' (the default).
 
    HILB is also a good example of efficient MATLAB programming
    style, where conventional FOR or DO loops are replaced by
    vectorized statements. 
 
    Example:
 
    HILB(3) is
 
           1.0000    0.5000    0.3333
           0.5000    0.3333    0.2500
           0.3333    0.2500    0.2000
 
    See also INVHILB.

    Documentation for hilb
       doc hilb


hilb(5)
ans =
    1.0000    0.5000    0.3333    0.2500    0.2000
    0.5000    0.3333    0.2500    0.2000    0.1667
    0.3333    0.2500    0.2000    0.1667    0.1429
    0.2500    0.2000    0.1667    0.1429    0.1250
    0.2000    0.1667    0.1429    0.1250    0.1111
1/(2+3-1)
ans =
    0.2500



H = hilb(10);


n = 10;
b = H * ones(n,1);


b
b =
    2.9290
    2.0199
    1.6032
    1.3468
    1.1682
    1.0349
    0.9307
    0.8467
    0.7773
    0.7188
x = H\b
x =
    1.0000
    1.0000
    1.0000
    1.0000
    0.9999
    1.0003
    0.9995
    1.0005
    0.9997
    1.0001
format long
x 
x =
   0.999999998539232
   1.000000125552971
   0.999997335989664
   1.000024147559337
   0.999885089622136
   1.000315283940447
   0.999483543573684
   1.000498414679537
   0.999738644658403
   1.000057416869900
b(n) = b(n) + 1.e-10;
H \b
{Unrecognized function or variable 'H'.} 
x = H\b
x =
   0.999907630642973
   1.008313266607924
   0.817107709967934
   2.706997904312792
  -7.321627608144969
  24.300587347518292
 -37.834354745389966
  39.041852662995488
 -19.209750727601122
   5.491058930698837
b = H * ones(n,1);



b(n) = b(n) + 1.e-12;
x = H\b
x =
   0.999999074880779
   1.000083255117629
   0.998168480339104
   1.017093506102586
   0.916671810391314
   1.233312830876943
   0.611153783527620
   1.380903510285918
   0.797648238343520
   1.044966434805615
cond(H)
ans =
     1.602502816811318e+13


A = hilb(12);
cond(A)
ans =
     1.621163904747500e+16
diary off
