!rm temp.txt
clear all
diary temp.txt
echo on
n=3;
disp('generate random A')
A=round(3*randn(n))
pause
det(A)
pause
disp('multiply row 1 by 2')
B=A;B(1,:)=2*A(1,:)
pause
[det(A) det(B)]
pause
disp('add 3*row2 to row1')
C=A;C(1,:)=C(1,:)+3*C(2,:)
[det(A) det(C)]
pause
disp('find inverse of A')
Ainv=cofactor(A)'/det(A)
Ainv*A
pause
disp('generate random b RHS')
b=round(3*randn(n,1));
disp('solve using \ ')
xm=A\b
pause
disp('solve using Cramer''s method')
x=zeros(n,1);
for j=1:n,
	Dj=A;Dj(:,j)=b
	x(j)=det(Dj)/det(A)
	pause
end
[xm x]
echo off
diary off
