diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /964/CH10 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '964/CH10')
-rwxr-xr-x | 964/CH10/EX10.1/10_1.sce | 18 | ||||
-rwxr-xr-x | 964/CH10/EX10.2/10_2.sce | 5 | ||||
-rwxr-xr-x | 964/CH10/EX10.3/10_3.sce | 20 | ||||
-rwxr-xr-x | 964/CH10/EX10.4/10_4.sce | 52 |
4 files changed, 95 insertions, 0 deletions
diff --git a/964/CH10/EX10.1/10_1.sce b/964/CH10/EX10.1/10_1.sce new file mode 100755 index 000000000..4b3098a26 --- /dev/null +++ b/964/CH10/EX10.1/10_1.sce @@ -0,0 +1,18 @@ +//clc()
+A = [3,-0.1,-0.2;0.1,7,-0.3;0.3,-0.2,10];
+U = A;
+disp(A,"A =")
+m = det(U(1,1));
+n = det(U(2,1));
+a = n/m;
+U(2,:) = U(2,:) - U(1,:) / (m/n);
+n = det(U(3,1));
+b = n/m;
+U(3,:) = U(3,:) - U(1,:) / (m/n);
+m = det(U(2,2));
+n = det(U(3,2));
+c = n/m;
+U(3,:) = U(3,:) - U(2,:) / (m/n);
+disp(U,"U = ")
+L = [1,0,0;a,1,0;b,c,1];
+disp(L,"L calculated based on gauss elimination method = ")
diff --git a/964/CH10/EX10.2/10_2.sce b/964/CH10/EX10.2/10_2.sce new file mode 100755 index 000000000..82d021622 --- /dev/null +++ b/964/CH10/EX10.2/10_2.sce @@ -0,0 +1,5 @@ +//clc()
+A = [3,-0.1,-0.2;0.1,7,-0.3;0.3,-0.2,10];
+B = [7.85;-19.3;71.4];
+X = inv(A) * B;
+disp(X,"X = ")
diff --git a/964/CH10/EX10.3/10_3.sce b/964/CH10/EX10.3/10_3.sce new file mode 100755 index 000000000..496772087 --- /dev/null +++ b/964/CH10/EX10.3/10_3.sce @@ -0,0 +1,20 @@ +//clc()
+A = [3,-0.1,-0.2;0.1,7,-0.3;0.3,-0.2,10];
+//B = inv(A)
+L = [1,0,0;0.033333,1,0;0.1,-0.02713,1];
+U = [3,-0.1,-0.2;0,7.0033,-0.293333;0,0,10.012];
+for i =1:3
+ if i==1 then
+ m = [1;0;0];
+ else
+ if i==2 then
+ m = [0;1;0];
+ else
+ m = [0;0;1];
+ end
+ end
+ d = inv(L) * m;
+ x = inv(U) * d;
+ B(:,i) = x
+end
+disp(B)
diff --git a/964/CH10/EX10.4/10_4.sce b/964/CH10/EX10.4/10_4.sce new file mode 100755 index 000000000..35bc81853 --- /dev/null +++ b/964/CH10/EX10.4/10_4.sce @@ -0,0 +1,52 @@ +//clc()
+A = [1,1/2,1/3;1/2,1/3,1/4;1/3,1/4,1/5];
+n = det(A(2,1));
+A(2,:) = A(2,:)/n;
+n = det(A(3,1));
+A(3,:) = A(3,:)/n;
+B = inv(A);
+disp(A,"A = ")
+for j = 1:3
+ a = 0;
+for i = 1:3
+ m(i) = det(A(j,i));
+ su(j) = a + m(i);
+ a = su(j);
+end
+end
+if su(1) < su(2) then
+ if su(2) < su(3) then
+ z = su(3);
+ else
+ z = su(2);
+ end
+else
+ if su(1) < su(3) then
+ z = su(3);
+ else
+ z = su(1);
+ end
+end
+for j = 1:3
+ a = 0;
+for i = 1:3
+ m(i) = det(B(j,i));
+ sm(j) = a + abs(m(i));
+ a = sm(j);
+end
+end
+if sm(1) < sm(2) then
+ if sm(2) < sm(3) then
+ y = sm(3);
+ else
+ y = sm(2);
+ end
+else
+ if sm(1) < sm(3) then
+ y = sm(3);
+ else
+ y = sm(1);
+ end
+end
+C = z*y;
+disp(C,"Condition number for the matrix =")
|