% Script Pathos.m % pathological matrices for GE with partial pivoting % uses toeplitz to construct the matrices format short e; n = 60; A = toeplitz([1 -ones(1,n-1)],[1 zeros(1,n-1)]); A(:,30) = 1; x_exact = rand(n,1); b = A*x_exact; % create rhs so that x_exact is exact solution x = A\b; relerr = (x_exact-x)./x norm(relerr,inf) max(abs(relerr)) % same as inf norm!