function p1
  test_condition_predictions('a)', [1,2;1.001,2],[3;3.001],[1;1],[3;0]);
  test_condition_predictions('b)', [2.01,1.99;1.99,2.01],[4;4],[1;1],[2;0]);
  test_condition_predictions('c)', [1,-1,-1;0,1,-1;0,0,1],[0;2;0],[2;2;0],[1.9;2.1;-0.1])
  test_condition_predictions('d)', hilb(3), [1;7/12;13/30],[1;-2;3],[1.02;-1.96;2.94])
end
function test_condition_predictions(title, A, b, x, xtilde)
  norm_A = norm_inf(A);
  assert(abs(norm_A - norm(A, Inf))<1e-15);

  norm_A_inv = norm_inf(inv(A));


  fprintf('-------------------------------------------------\n');
  disp(title)
  fprintf('-------------------------------------------------\n');
  A

  cond_A = norm_A * norm_A_inv

  residual = A*xtilde-b;
  rel_error = norm(x - xtilde, Inf)/norm(x, Inf)
  relative_residual = norm(residual, Inf) / norm(b, Inf)
  error_bound = cond_A * relative_residual

end
function result = norm_inf(A)
  [m,n] = size(A);
  result = 0;
  for i = 1:m
    result = max(result, sum(abs(A(i,1:n))));
  end
end
function assert(v)
  if (v == 0)
    error('Assertion failed.')
  end
end
