%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % this is an octave test file % call it with the command % % $ octave octave_test.m % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% A = [1,1;2,3] det_A = det(A) B = inv(A) b = [4;5] x = A\b O = A*x - b %%%%%%%%%%%%%%%%% exercise sheet III, exo 3 A=[3,2,-1;-2,-1,0;4,3,-1] M=[0, -1, -2; 0, 0, 2; 1, -1, -3] MI=inv(M) MI*A*M P=[ -1, 0.5, 1; -1, -1, 0; 0, 0.5, 0] PI=inv(P) ERG= P*A*PI det(A) det (M) det(P) det(A') rank(A) lambda = eig(A) [V, lambda2] = eig(A) %norm(A, 2) traceA = trace(A) %expm(A) %logm(A) %sqrtm(A) %%%%%%%%%%%%%%% an example for lacking precision in calculation: result should be zero V*lambda2*inv(V) - A %%%%%%%%%%%%%% III / 3 printf("sheet III, exo 2\n") A = [1,0,1;1,1,2;0,1,1] B = [1,0,1;0,1,0;0,0,1] det_A = det(A) det_B = det(B) rank_A = rank(A) rank_B = rank(B) C = [1,1;1,-1] D = [0,1;1,0] det_C = det(C) det_D = det(D) rank_C = rank(C) rank_D = rank(D) %%%%%%%%%%%%% III / 7 7_A = [1, 5, -1;2, -2, -2; 3, -3, 4] 7_B = [3, 7, -1, 1;2, -2, 1, 1; 1, 1, -4, 0; -1, 1, -2, 3]