% Matlab diary from cs110a class #4, Jan 10 2005. % % This is what I typed in class. % % Type it into Matlab yourself to % reproduce the output I showed. 1 + eps ans - 1 e = 2/3 * eps 1 + e ans - 1 e = 1/3 * eps 1 + e ans-1 clc A = [1 2 3 ; 4 5 6 ; 7 8 9] P = [1 0 0 ; 0 0 1 ; 0 1 0] P * A A * P A(1,3) A A( [2 3] , [1 3] ) A( [2 3] , : ) A(:,:) A P*A A ( [1 3 2] , :) p = [1 3 2] p P A = rand(7) format short A A = hilb(7) A = 1 ./ hilb(7) I = eye(7) help randperm p = randperm(7) A A(p,:) P = I(p,:) P*A A(p,:) clc b = rand(4,1) A = rand(4) x = A \ b A*x - b [L, U, P] = lu(A) P*A - L*U