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/CH9 | |
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/CH9')
-rwxr-xr-x | 964/CH9/EX9.1/9_1.jpeg | bin | 0 -> 31652 bytes | |||
-rwxr-xr-x | 964/CH9/EX9.1/9_1.sce | 25 | ||||
-rwxr-xr-x | 964/CH9/EX9.10/9_10.sce | 27 | ||||
-rwxr-xr-x | 964/CH9/EX9.11/9_11.sce | 8 | ||||
-rwxr-xr-x | 964/CH9/EX9.12/9_12.sce | 21 | ||||
-rwxr-xr-x | 964/CH9/EX9.2/9_2.sce | 14 | ||||
-rwxr-xr-x | 964/CH9/EX9.3/9_3.sce | 24 | ||||
-rwxr-xr-x | 964/CH9/EX9.4/9_4.sce | 15 | ||||
-rwxr-xr-x | 964/CH9/EX9.5/9_5.sce | 27 | ||||
-rwxr-xr-x | 964/CH9/EX9.6/9_6.sce | 19 | ||||
-rwxr-xr-x | 964/CH9/EX9.7/9_7.sce | 17 | ||||
-rwxr-xr-x | 964/CH9/EX9.8/9_8.sce | 16 | ||||
-rwxr-xr-x | 964/CH9/EX9.9/9_9.sce | 10 |
13 files changed, 223 insertions, 0 deletions
diff --git a/964/CH9/EX9.1/9_1.jpeg b/964/CH9/EX9.1/9_1.jpeg Binary files differnew file mode 100755 index 000000000..5d78b7da2 --- /dev/null +++ b/964/CH9/EX9.1/9_1.jpeg diff --git a/964/CH9/EX9.1/9_1.sce b/964/CH9/EX9.1/9_1.sce new file mode 100755 index 000000000..aafd15660 --- /dev/null +++ b/964/CH9/EX9.1/9_1.sce @@ -0,0 +1,25 @@ +clc;
+clear;
+//the equations are:
+//3*x1 + 2*x2=18 and -x1 + 2*x2=2
+
+//equation 1 becomes,
+//x2=-(3/2)*x1 + 9
+//equation 2 becomes,
+//x2=-(1/2)*x1 + 1
+
+//plotting equation 1
+for x1=1:6
+ x2(x1)=-(3/2)*x1 + 9;
+end
+x1=[1 2 3 4 5 6];
+//plotting equation 2
+for x3=1:6
+ x4(x3)=(1/2)*x3 + 1;
+end
+x3=[1 2 3 4 5 6];
+plot(x1,x2)
+plot(x3,x4)
+xtitle("x2 vs x1","x1","x2")
+//the lines meet at x1=4 amd x2=3
+disp(3,"x2=","and",4,"x1=","The lines meet at=")
\ No newline at end of file diff --git a/964/CH9/EX9.10/9_10.sce b/964/CH9/EX9.10/9_10.sce new file mode 100755 index 000000000..1e5b015d2 --- /dev/null +++ b/964/CH9/EX9.10/9_10.sce @@ -0,0 +1,27 @@ +//clc()
+//2*x1 + 10000*x2 = 10000
+//x1 + x2 = 2
+x1 = 1;
+x2 = 1;
+disp("without scaling, applying forward elimination")
+//x1 is too small and can be neglected
+x21 = 10000/10000;
+x11 = 0;
+e1 = (x1 - x11)*100/x1;
+disp(x21,"x2 = ")
+disp(x11,"x1 = ")
+disp(e1,"error for x1 = ")
+disp("with scaling")
+//0.00002*x1 + x2 = 1
+//now x1 is neglected because of the co efficient
+x22 = 1;
+x12 = 2 - x1;
+disp(x12,"x1 = ")
+disp(x22,"x2 = ")
+//using original co efficient
+//x1 can be neglected
+disp("pivot and retaining original coefficients")
+x22 = 10000/10000;
+x12 = 2 - x1;
+disp(x12,"x1 = ")
+disp(x22,"x2 = ")
diff --git a/964/CH9/EX9.11/9_11.sce b/964/CH9/EX9.11/9_11.sce new file mode 100755 index 000000000..ca6d71017 --- /dev/null +++ b/964/CH9/EX9.11/9_11.sce @@ -0,0 +1,8 @@ +clc;
+clear;
+a=[70 1 0;60 -1 1;40 0 -1];
+b=[636;518;307];
+x=abs(linsolve(a,b));
+disp("m/s^2",x(1,1),"a=")
+disp("N",x(2,1),"T=")
+disp("N",x(3,1),"R=")
diff --git a/964/CH9/EX9.12/9_12.sce b/964/CH9/EX9.12/9_12.sce new file mode 100755 index 000000000..9cf03f03d --- /dev/null +++ b/964/CH9/EX9.12/9_12.sce @@ -0,0 +1,21 @@ +//clc()
+//3*x1 - 0.1*x2 - 0.2*x3 = 7.85
+//0.1*x1 + 7*x2 - 0.3*x3 = -19.3
+//0.3*x1 - 0.2*x2 + 10*x3 = 71.4
+// this can be written in matrix form as
+A = [3,-0.1,-0.2,7.85;0.1,7,-0.3,-19.3;0.3,-0.2,10,71.4];
+disp(A,"Equation in matrix form can be written as")
+X = A(1,:) / det(A(1,1));
+Y = A(2,:) - 0.1*X;
+Z = A(3,:) - 0.3*X;
+Y = Y/det(Y(1,2));
+X = X - Y * det(X(1,2));
+Z = Z - Y * det(Z(1,2));
+Z = Z/det(Z(1,3));
+X = X - Z*det(X(1,3));
+Y = Y - Z*det(Y(1,3));
+A = [X;Y;Z];
+disp(A,"final matrix = ")
+disp(det(A(1,4)),"x1 = ")
+disp(det(A(2,4)),"x2 = ")
+disp(det(A(3,4)),"x3 = ")
diff --git a/964/CH9/EX9.2/9_2.sce b/964/CH9/EX9.2/9_2.sce new file mode 100755 index 000000000..2ab76fbcc --- /dev/null +++ b/964/CH9/EX9.2/9_2.sce @@ -0,0 +1,14 @@ +clc;
+clear;
+//For fig9.1
+a=[3 2;-1 2];
+disp(determ(a),"The value of determinant for system repesented in fig 9.1 =")
+//For fig9.2 (a)
+a=[-0.5 1;-0.5 1];
+disp(determ(a),"The value of determinant for system repesented in fig 9.2 (a) =")
+//For fig9.2 (b)
+a=[-0.5 1;-1 2];
+disp(determ(a),"The value of determinant for system repesented in fig 9.2 (b) =")
+//For fig9.2 (c)
+a=[-0.5 1;-2.3/5 1];
+disp(determ(a),"The value of determinant for system repesented in fig 9.2 (c) =")
\ No newline at end of file diff --git a/964/CH9/EX9.3/9_3.sce b/964/CH9/EX9.3/9_3.sce new file mode 100755 index 000000000..7f3ba6b98 --- /dev/null +++ b/964/CH9/EX9.3/9_3.sce @@ -0,0 +1,24 @@ +clc;
+clear;
+//the matrix or the system
+b1=-0.01;
+b2=0.67;
+b3=-0.44;
+a=[0.3 0.52 1;0.5 1 1.9;0.1 0.3 0.5];
+a1=[a(2,2) a(2,3);a(3,2) a(3,3)];
+A1=determ(a1);
+a2=[a(2,1) a(2,3);a(3,1) a(3,3)];
+A2=determ(a2);
+a3=[a(2,1) a(2,2);a(3,1) a(3,2)];
+A3=determ(a3);
+D=a(1,1)*A1-a(1,2)*A2+a(1,3)*A3;
+p=[b1 0.52 1;b2 1 1.9;b3 0.3 0.5];
+q=[0.3 b1 1;0.5 b2 1.9;0.1 b3 0.5];
+r=[0.3 0.52 b1;0.5 1 b2;0.1 0.3 b3];
+x1=det(p)/D;
+x2=det(q)/D;
+x3=det(r)/D;
+disp("The values are:")
+disp(x1,"x1=")
+disp(x2,"x2=")
+disp(x3,"x3=")
\ No newline at end of file diff --git a/964/CH9/EX9.4/9_4.sce b/964/CH9/EX9.4/9_4.sce new file mode 100755 index 000000000..49c3507c8 --- /dev/null +++ b/964/CH9/EX9.4/9_4.sce @@ -0,0 +1,15 @@ +clc;
+clear;
+//the equations are:
+//3*x1+2*x2=18
+//-x1+2*x2=2
+a11=3;
+a12=2;
+b1=18;
+a21=-1;
+a22=2;
+b2=2;
+x1=(b1*a22-a12*b2)/(a11*a22-a12*a21);
+x2=(b2*a11-a21*b1)/(a11*a22-a12*a21);
+disp(x1,"x1=")
+disp(x2,"x2=")
\ No newline at end of file diff --git a/964/CH9/EX9.5/9_5.sce b/964/CH9/EX9.5/9_5.sce new file mode 100755 index 000000000..b73d7fd3d --- /dev/null +++ b/964/CH9/EX9.5/9_5.sce @@ -0,0 +1,27 @@ +clc;
+clear;
+n=3;
+b(1)=7.85;
+b(2)=-19.3;
+b(3)=71.4;
+a=[3 -0.1 -0.2;0.1 7 -0.3;0.3 -0.2 10];
+for k=1:n-1
+ for i=k+1:n
+ fact=a(i,k)/a(k,k);
+ for j=k+1:n
+ a(i,j)=a(i,j)-fact*(a(k,j));
+ end
+ b(i)=b(i)-fact*b(k);
+ end
+end
+x(n)=b(n)/a(n,n);
+for i=n-1:-1:1
+ s=b(i);
+ for j=i+1:n
+ s=s-a(i,j)*x(j)
+ end
+ x(i)=b(i)/a(i,i);
+end
+disp(x(1),"x1=")
+disp(x(2),"x2=")
+disp(x(3),"x3=")
diff --git a/964/CH9/EX9.6/9_6.sce b/964/CH9/EX9.6/9_6.sce new file mode 100755 index 000000000..d11ea141b --- /dev/null +++ b/964/CH9/EX9.6/9_6.sce @@ -0,0 +1,19 @@ +clc;
+clear;
+a11=1;
+a12=2;
+b1=10;
+a21=1.1;
+a22=2;
+b2=10.4;
+x1=(b1*a22-a12*b2)/(a11*a22-a12*a21);
+x2=(b2*a11-a21*b1)/(a11*a22-a12*a21);
+disp("For the original system:")
+disp(x1,"x1=")
+disp(x2,"x2=")
+a21=1.05;
+x1=(b1*a22-a12*b2)/(a11*a22-a12*a21);
+x2=(b2*a11-a21*b1)/(a11*a22-a12*a21);
+disp("For the new system:")
+disp(x1,"x1=")
+disp(x2,"x2=")
\ No newline at end of file diff --git a/964/CH9/EX9.7/9_7.sce b/964/CH9/EX9.7/9_7.sce new file mode 100755 index 000000000..766c84031 --- /dev/null +++ b/964/CH9/EX9.7/9_7.sce @@ -0,0 +1,17 @@ +clc;
+clear;
+//part a
+a=[3 2;-1 2];
+b1=18;
+b2=2;
+disp(determ(a),"The determinant for part(a)=")
+//part b
+a=[1 2;1.1 2];
+b1=10;
+b2=10.4;
+disp(determ(a),"The determinant for part(b)=")
+//part c
+a1=a*10;
+b1=100;
+b2=104;
+disp(determ(a1),"The determinant for part(c)=")
\ No newline at end of file diff --git a/964/CH9/EX9.8/9_8.sce b/964/CH9/EX9.8/9_8.sce new file mode 100755 index 000000000..7819d1ea9 --- /dev/null +++ b/964/CH9/EX9.8/9_8.sce @@ -0,0 +1,16 @@ +clc;
+clear;
+//part a
+a=[1 0.667;-0.5 1];
+b1=6;
+b2=1;
+disp(determ(a),"The determinant for part(a)=")
+//part b
+a=[0.5 1;0.55 1];
+b1=5;
+b2=5.2;
+disp(determ(a),"The determinant for part(b)=")
+//part c
+b1=5;
+b2=5.2;
+disp(determ(a),"The determinant for part(c)=")
\ No newline at end of file diff --git a/964/CH9/EX9.9/9_9.sce b/964/CH9/EX9.9/9_9.sce new file mode 100755 index 000000000..fc82eb8ef --- /dev/null +++ b/964/CH9/EX9.9/9_9.sce @@ -0,0 +1,10 @@ +//clc()
+//0.0003*x1 + 3*x2 = 2.0001
+//1*x1 + 1*x2 = 1
+a11 = 0.000;
+//multiplying first equation by 1/0.0003, we get, x1 + 10000*x2 = 6667
+x2 = (6667-1)/(10000-1);
+x1 = 6667 - 10000*x2;
+disp(x2,"x2 = ")
+disp(x1,"x1 = ")
+disp("The error varies depending on the no. of significant figures used")
|