function linsyspractice
A=[1 2 1; 1 1 -1; 2 -1 2]
b=[1; 0; 1];
x=A\b
disp('Press any key to continue')
pause
B=[1 2 1; 1 0 -1; 2 -1 0]
x=B\b
disp('Press any key to continue')
pause
d1=det(B);
fprintf('Determinant= %e\n',d1)
disp('Press any key to continue')
pause
C=[1 2 1; 1 0 -1; 2 2 0]
d1=det(C);
fprintf('Determinant= %e\n',d1)
disp('Press any key to continue')
pause
C\b
disp('Press any key to continue')
pause
c1=cond(B);
fprintf('Condition #= %e\n',c1)
c1=cond(C);
fprintf('Condition #= %e\n',c1)
D=[1 2 1; 1 0 -1; 2 2 1e-5]
c1=cond(D);
fprintf('Condition #= %e\n',c1)
disp('Press any key to continue')
pause
c3=cond(hilb(3));
c5=cond(hilb(5));
c7=cond(hilb(7));
fprintf('Condition number for 3x3 Hilbert= %e\n',c3)
fprintf('Condition number for 5x5 Hilbert= %e\n',c5)
fprintf('Condition number for 7x7 Hilbert= %e\n',c7)
%
function h=hilb(Hsize)
for i=1:Hsize
    for j=1:Hsize
        hilbmat(i,j)=1/(i+j-1);
    end
end
h=hilbmat;
