summaryrefslogtreecommitdiff
path: root/3293/CH5/EX5.6/Ex5_6.sce
blob: 59dcb9a748e148a1c7e854bb7b6840c0c9fbe429 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//page 158
//Example 5.6
clc;
clear;
close;
disp('Given Matrix:');
A = [1 -1 2 3; 2 2 0 2; 4 1 -1 -1;1 2 3 0];
disp(A,'A = ');
disp('After, Subtracting muliples of row 1 from rows 2 3 4');
disp('R2 = R2 - 2*R1');
A(2,:) = A(2,:) - 2 * A(1,:);
disp('R3 = R3 - 4*R1');
A(3,:) = A(3,:) - 4 * A(1,:);
disp('R4 = R4 - R1');
A(4,:) = A(4,:) - A(1,:);
disp(A,'A = ');
T = A;                  //Temporary matrix to store A
disp('We obtain the same determinant as before.');
disp('Now, applying some more row transformations as:');
disp('R3 = R3 - 5/4 * R2');
T(3,:) = T(3,:) - 5/4 * T(2,:);
disp('R4 = R4 - 3/4 * R2');
T(4,:) = T(4,:) - 3/4 * T(2,:);
B = T;
disp('We get B as:');
disp(B,'B = ');
disp('Now,determinant of A and B will be same');
disp(det(B),'det A = det B = '); 
//end