• Hints for Assignment 2:

    The 1-norm of a matrix ||A||1 is the maximal column sum of the absolute values in the matrix, i.e.,
    ||A||1 = maxj=1,...,n Sumi=1,...,n |aij|

    Problem 1: "with partial pivoting" means the same as "with pivoting". Show the entries of L, U, p after each step. Mark the pivot candidates and the selected pivot element, as in the example on p. 7 of the notes.
    Problem 2(a): You get 9 equations u1 = ( ... )/4 -h2 , ... , u9 = ( ... )/4 - h2 .
    Use [L1,U]=lu(A) to solve linear system (not chol as stated in problem)

    Problem 2(b): Complete the code membr.m so that A=membr(4) gives the same matrix which you got in (a). Do not use x=A\b, instead use [L1,U]=lu(A) (see below "How to solve a linear system in Matlab") to find the solution and an estimate for the condition number.

    Problem 3: The code linsys.m should look like this:
    function linsys(n)
    A = zeros(n,n);
    for i=1:n
      for j=1:n
      ...;
      end
    end
    x = ones(n,1); % column vector (1,...,1)
    b = A*x;
    % Use lu to compute solution xhat for matrix A, rhs vector b
    % print out xhat,
    % print out relative residual ||bhat - b||/||b||
    % print out estimated condition number, estimated unavoidable error
    % print out actual error ||xhat - x||/||x||
    % print out weighted residual ||bhat-b||/(||A||*||xhat||)

    Note that you should print out xhat (not x). Use lu and condestdec (as explained below). Use the estimated condition number times the machine epsilon for the estimated unavoidable error. To check if the result was computed in numerically stable way: Compute ||bhat - b||/(||A|| ||xhat||). If this is not much larger than the machine epsilon, then computation was numerically stable.