function exercise2d2
  a = [2 3 5 10 15 25 50 100 250 999 ]';
  %a = [2 3 5 10 15 25 ]';

  %n=30
  %a = ones(n,1)
  %a(1) = 2
  %for i=2:n
  %  a(i) = a(i) + a(i-1)
  %end
  
  disp(['dimension   condition number (CN)    CN(H) CN(Precond)  error in maximum norm']);
  fprintf('-----------------------------------------------------------------------------\n')
  
  for i=1:size(a,1)
    
    [H,h] = Hilbert(a(i));
    
    xo = CG(H,h);
    cor = ones(size(H,1),1);
    no = norm(cor-xo,'inf');

    % symmetric Gauss-Seidel
    [ P1, P2 ] = Precondition(H);
    
    
    xgs = CGPre(H,h,P2);
    ngs = norm(cor-xgs,'inf');
    
    
    % Jacobi-Iteration
    %P = D^{-1}
    Pj = inv(diag(diag(H)));
    xj = CGPre(H,h,Pj);
    nj = norm(cor-xj,'inf');
    
    % Add Diagonal Matrix
    Peye = 0.00001*eye(size(H,1),size(H,1));
    xeye = CGPre(H,h,Peye);
    neye = norm(cor-xeye,'inf');


    fprintf('%3d -> (normal) %25.2f  %10.2f  %1.20f\n',a(i), cond(H),             1,  no   )
    fprintf('%3d -> (Jacobi) %25.2f  %10.2f  %1.20f\n',a(i), cond(Pj*H),   cond(Pj),  nj   )
    fprintf('%3d -> (MGS)    %25.2f  %10.2f  %1.20f\n',a(i), cond(P2*H),   cond(P2),  ngs  )
    fprintf('%3d -> (eye)    %25.2f  %10.2f  %1.20f\n',a(i), cond(Peye*H),        1,  neye )
    fprintf('-----------------------------------------------------------------------------\n')
  end  