summaryrefslogtreecommitdiff
path: root/1670/CH3
diff options
context:
space:
mode:
Diffstat (limited to '1670/CH3')
-rwxr-xr-x1670/CH3/EX3.1/3_1.sce9
-rwxr-xr-x1670/CH3/EX3.10/3_10.sce56
-rwxr-xr-x1670/CH3/EX3.11/3_11.sce56
-rwxr-xr-x1670/CH3/EX3.12/3_12.sce56
-rwxr-xr-x1670/CH3/EX3.13/3_13.sce48
-rwxr-xr-x1670/CH3/EX3.14/3_14.sce48
-rwxr-xr-x1670/CH3/EX3.15/3_15.sce52
-rwxr-xr-x1670/CH3/EX3.16/3_16.sce17
-rwxr-xr-x1670/CH3/EX3.17/3_17.sce16
-rwxr-xr-x1670/CH3/EX3.18/3_18.sce16
-rwxr-xr-x1670/CH3/EX3.19/3_19.sce16
-rwxr-xr-x1670/CH3/EX3.2/3_2.sce36
-rwxr-xr-x1670/CH3/EX3.20/3_20.sce16
-rwxr-xr-x1670/CH3/EX3.21/3_21.sce48
-rwxr-xr-x1670/CH3/EX3.22/3_22.sce48
-rwxr-xr-x1670/CH3/EX3.23/3_23.sce48
-rwxr-xr-x1670/CH3/EX3.3/3_3.sce45
-rwxr-xr-x1670/CH3/EX3.4/3_4.sce36
-rwxr-xr-x1670/CH3/EX3.5/3_5.sce38
-rwxr-xr-x1670/CH3/EX3.6/3_6.sce38
-rwxr-xr-x1670/CH3/EX3.7/3_7.sce38
-rwxr-xr-x1670/CH3/EX3.8/3_8.sce56
-rwxr-xr-x1670/CH3/EX3.9/3_9.sce48
23 files changed, 885 insertions, 0 deletions
diff --git a/1670/CH3/EX3.1/3_1.sce b/1670/CH3/EX3.1/3_1.sce
new file mode 100755
index 000000000..b932372bf
--- /dev/null
+++ b/1670/CH3/EX3.1/3_1.sce
@@ -0,0 +1,9 @@
+//Example 3.1
+//Direct Method
+//Page no. 3.1
+clc;clear;close;
+
+A=[1,1,2;1,2,3;2,3,1]; //Parameter Matrix
+B=[1;1;2]
+C=inv(A)*B;
+disp(C,"Solution Matrix = ") \ No newline at end of file
diff --git a/1670/CH3/EX3.10/3_10.sce b/1670/CH3/EX3.10/3_10.sce
new file mode 100755
index 000000000..5c707aadf
--- /dev/null
+++ b/1670/CH3/EX3.10/3_10.sce
@@ -0,0 +1,56 @@
+//Example 3.10
+//Triangularization Method
+//Page no. 62
+clc;clear;close;
+
+A=[2,4,-6;1,5,3;1,3,2];
+B=[-4;10;5];
+printf('A can be factorizaed as follows:\n')
+printf('\tL\t\t *\t\tU\t\t =\t\tA')
+U(2,1)=0;U(3,1)=0;U(3,2)=0;
+L(1,2)=0;L(1,3)=0;L(2,3)=0;
+for i=1:3
+ L(i,i)=1
+end
+for i=1:3
+ U(1,i)=A(1,i)
+end
+L(2,1)=1/U(1,1);
+for i=2:3
+ U(2,i)=A(2,i)-U(1,i)*L(2,1);
+end
+L(3,1)=1/U(1,1);
+L(3,2)=(A(3,2)-U(1,2)*L(3,1))/U(2,2);
+U(3,3)=A(3,3)-U(1,3)*L(3,1)-U(2,3)*L(3,2);
+printf('\n')
+for i=1:3
+ for j=1:3
+ printf('%.2f\t',L(i,j))
+ end
+
+ if(i==2)
+ printf(' * ')
+ else
+ printf('\t')
+ end
+
+ for j=1:3
+ printf('%.2f\t',U(i,j))
+ end
+ if(i==2)
+ printf(' = ')
+ else
+ printf('\t')
+ end
+ for j=1:3
+ printf('%.2f\t',A(i,j))
+ end
+ printf('\n')
+end
+printf('\nY=U*X')
+ Y=inv(L)*B
+ X=inv(U)*Y
+printf('\n\nX=')
+for i=1:3
+ printf('\n %i',X(i,1))
+end \ No newline at end of file
diff --git a/1670/CH3/EX3.11/3_11.sce b/1670/CH3/EX3.11/3_11.sce
new file mode 100755
index 000000000..cd43b2052
--- /dev/null
+++ b/1670/CH3/EX3.11/3_11.sce
@@ -0,0 +1,56 @@
+//Example 3.11
+//Triangularization Method
+//Page no. 63
+clc;clear;close;
+
+A=[1,3,8;1,4,3;1,3,4];
+B=[4;-2;1];
+printf('A can be factorizaed as follows:\n')
+printf('\tL\t\t *\t\tU\t\t =\t\tA')
+U(2,1)=0;U(3,1)=0;U(3,2)=0;
+L(1,2)=0;L(1,3)=0;L(2,3)=0;
+for i=1:3
+ L(i,i)=1
+end
+for i=1:3
+ U(1,i)=A(1,i)
+end
+L(2,1)=1/U(1,1);
+for i=2:3
+ U(2,i)=A(2,i)-U(1,i)*L(2,1);
+end
+L(3,1)=1/U(1,1);
+L(3,2)=(A(3,2)-U(1,2)*L(3,1))/U(2,2);
+U(3,3)=A(3,3)-U(1,3)*L(3,1)-U(2,3)*L(3,2);
+printf('\n')
+for i=1:3
+ for j=1:3
+ printf('%.2f\t',L(i,j))
+ end
+
+ if(i==2)
+ printf(' * ')
+ else
+ printf('\t')
+ end
+
+ for j=1:3
+ printf('%.2f\t',U(i,j))
+ end
+ if(i==2)
+ printf(' = ')
+ else
+ printf('\t')
+ end
+ for j=1:3
+ printf('%.2f\t',A(i,j))
+ end
+ printf('\n')
+end
+printf('\nY=U*X')
+ Y=inv(L)*B
+ X=inv(U)*Y
+printf('\n\nX=')
+for i=1:3
+ printf('\n %.2f',X(i,1))
+end \ No newline at end of file
diff --git a/1670/CH3/EX3.12/3_12.sce b/1670/CH3/EX3.12/3_12.sce
new file mode 100755
index 000000000..9ca063351
--- /dev/null
+++ b/1670/CH3/EX3.12/3_12.sce
@@ -0,0 +1,56 @@
+//Example 3.12
+//Triangularization Method
+//Page no. 63
+clc;clear;close;
+
+A=[4,-1,2;-1,5,3;2,3,6];
+B=[12;10;18];
+printf('A can be factorizaed as follows:\n')
+printf('\tL\t\t *\t\tU\t\t =\t\tA')
+U(2,1)=0;U(3,1)=0;U(3,2)=0;
+L(1,2)=0;L(1,3)=0;L(2,3)=0;
+for i=1:3
+ L(i,i)=1
+end
+for i=1:3
+ U(1,i)=A(1,i)
+end
+L(2,1)=1/U(1,1);
+for i=2:3
+ U(2,i)=A(2,i)-U(1,i)*L(2,1);
+end
+L(3,1)=1/U(1,1);
+L(3,2)=(A(3,2)-U(1,2)*L(3,1))/U(2,2);
+U(3,3)=A(3,3)-U(1,3)*L(3,1)-U(2,3)*L(3,2);
+printf('\n')
+for i=1:3
+ for j=1:3
+ printf('%.2f\t',L(i,j))
+ end
+
+ if(i==2)
+ printf(' * ')
+ else
+ printf('\t')
+ end
+
+ for j=1:3
+ printf('%.2f\t',U(i,j))
+ end
+ if(i==2)
+ printf(' = ')
+ else
+ printf('\t')
+ end
+ for j=1:3
+ printf('%.2f\t',A(i,j))
+ end
+ printf('\n')
+end
+printf('\nY=U*X')
+ Y=inv(L)*B
+ X=inv(U)*Y
+printf('\n\nX=')
+for i=1:3
+ printf('\n %.2f',X(i,1))
+end \ No newline at end of file
diff --git a/1670/CH3/EX3.13/3_13.sce b/1670/CH3/EX3.13/3_13.sce
new file mode 100755
index 000000000..3b089c210
--- /dev/null
+++ b/1670/CH3/EX3.13/3_13.sce
@@ -0,0 +1,48 @@
+//Example 3.13
+//Crout Method
+//Page no. 67
+clc;clear;close;
+
+A=[1,2,3,1;3,1,1,0;2,1,1,0]
+for i=1:3
+ for j=1:4
+ if j==1 then
+ M(i,j)=A(i,j)
+ elseif i==1
+ M(i,j)=A(i,j)/A(1,1)
+ elseif j==2
+ M(i,j)=A(i,j)-M(1,j)*M(i,j-1)
+ elseif i==2
+ M(i,j)=(A(i,j)-M(i,1)*M(i-1,j))/M(i,2)
+ elseif j==3
+ M(i,j)=A(i,j)-(M(i,j-2)*M(i-2,j)+M(i,j-1)*M(i-1,j))
+ else
+ M(i,j)=(A(i,j)-(M(i,j-3)*M(i-2,j)+M(i,j-2)*M(i-1,j)))/M(i,j-1)
+ end
+ end
+end
+disp(M,'M = ')
+for i=1:3
+ for j=1:4
+ if j~=4 then
+ U1(i,j)=M(i,j)
+ else
+ Y(i,1)=M(i,j)
+ end
+ end
+end
+U=eye(3,3)
+for i=1:3
+ for j=1:3
+ if j>i then
+ U(i,j)=U1(i,j)
+ end
+ end
+end
+disp(U,'U = ')
+disp(Y,'Y = ')
+X=inv(U)*Y
+printf('\n\nHence, the solution is : \t')
+for i=1:3
+ printf('x%i = %i\t\t',i,X(i))
+end \ No newline at end of file
diff --git a/1670/CH3/EX3.14/3_14.sce b/1670/CH3/EX3.14/3_14.sce
new file mode 100755
index 000000000..9234ca063
--- /dev/null
+++ b/1670/CH3/EX3.14/3_14.sce
@@ -0,0 +1,48 @@
+//Example 3.14
+//Crout Method
+//Page no. 68
+clc;clear;close;
+
+A=[2,1,4,12;8,-3,2,20;4,11,-1,33]
+for i=1:3
+ for j=1:4
+ if j==1 then
+ M(i,j)=A(i,j)
+ elseif i==1
+ M(i,j)=A(i,j)/A(1,1)
+ elseif j==2
+ M(i,j)=A(i,j)-M(1,j)*M(i,j-1)
+ elseif i==2
+ M(i,j)=(A(i,j)-M(i,1)*M(i-1,j))/M(i,2)
+ elseif j==3
+ M(i,j)=A(i,j)-(M(i,j-2)*M(i-2,j)+M(i,j-1)*M(i-1,j))
+ else
+ M(i,j)=(A(i,j)-(M(i,j-3)*M(i-2,j)+M(i,j-2)*M(i-1,j)))/M(i,j-1)
+ end
+ end
+end
+disp(M,'M = ')
+for i=1:3
+ for j=1:4
+ if j~=4 then
+ U1(i,j)=M(i,j)
+ else
+ Y(i,1)=M(i,j)
+ end
+ end
+end
+U=eye(3,3)
+for i=1:3
+ for j=1:3
+ if j>i then
+ U(i,j)=U1(i,j)
+ end
+ end
+end
+disp(U,'U = ')
+disp(Y,'Y = ')
+X=inv(U)*Y
+printf('\n\nHence, the solution is : \t')
+for i=1:3
+ printf('x%i = %i\t\t',i,X(i))
+end \ No newline at end of file
diff --git a/1670/CH3/EX3.15/3_15.sce b/1670/CH3/EX3.15/3_15.sce
new file mode 100755
index 000000000..8a2e3aaea
--- /dev/null
+++ b/1670/CH3/EX3.15/3_15.sce
@@ -0,0 +1,52 @@
+//Example 3.15
+//Crout Method
+//Page no. 69
+clc;clear;close;
+
+A=[1,2,-12,8,27;5,4,7,-2,4;-3,7,9,5,11;6,-12,-8,3,49]
+for i=1:4
+ for j=1:5
+ if j==1 then
+ M(i,j)=A(i,j)
+ elseif i==1
+ M(i,j)=A(i,j)/A(1,1)
+ elseif j==2
+ M(i,j)=A(i,j)-M(1,j)*M(i,j-1)
+ elseif i==2
+ M(i,j)=(A(i,j)-M(i,1)*M(i-1,j))/M(i,2)
+ elseif j==3
+ M(i,j)=A(i,j)-(M(i,j-2)*M(1,j)+M(i,j-1)*M(2,j))
+ elseif i==3
+ M(i,j)=(A(i,j)-(M(i,1)*M(i-2,j)+M(i,2)*M(i-1,j)))/M(i,3)
+ elseif j==4
+ M(i,j)=A(i,j)-(M(i,j-2)*M(i-2,j)+M(i,j-1)*M(i-1,j)+M(i,j-3)*M(i-3,j))
+ else
+ M(i,j)=(A(i,j)-(M(i,j-2)*M(i-1,j)+M(i,j-3)*M(i-2,j)+M(i,j-4)*M(i-3,j)))/M(i,j-1)
+ end
+ end
+end
+disp(M,'M = ')
+for i=1:4
+ for j=1:5
+ if j~=5 then
+ U1(i,j)=M(i,j)
+ else
+ Y(i,1)=M(i,j)
+ end
+ end
+end
+U=eye(4,4)
+for i=1:4
+ for j=1:4
+ if j>i then
+ U(i,j)=U1(i,j)
+ end
+ end
+end
+disp(U,'U = ')
+disp(Y,'Y = ')
+X=inv(U)*Y
+printf('\n\nHence, the solution is : \t')
+for i=1:4
+ printf('x%i = %i \t',i,X(i))
+end \ No newline at end of file
diff --git a/1670/CH3/EX3.16/3_16.sce b/1670/CH3/EX3.16/3_16.sce
new file mode 100755
index 000000000..d9ec058ab
--- /dev/null
+++ b/1670/CH3/EX3.16/3_16.sce
@@ -0,0 +1,17 @@
+//Example 3.16
+//Jacobi Method
+//Page no. 72
+clc;clear;close;
+
+x0=0;y0=0;z0=0;
+deff('x=f1(y,z)','x=(y-z+10)/5')
+deff('y=f2(x,z)','y=(-2*x+z+11)/8')
+deff('z=f3(x,y)','z=(x-y+3)/4')
+for i=1:13
+ x1=f1(y0,z0);
+ y1=f2(x0,z0);
+ z1=f3(x0,y0);
+ printf('\tx(%i) = %g\n\n\ty(%i) = %g\n\n\tz(%i) = %g\n\n\n\n',i,x1,i,y1,i,z1)
+ x0=x1;y0=y1;z0=z1;
+end
+printf('Thus we find that solution converges to %g,%g and %g',x0,y0,z0) \ No newline at end of file
diff --git a/1670/CH3/EX3.17/3_17.sce b/1670/CH3/EX3.17/3_17.sce
new file mode 100755
index 000000000..f16181e6b
--- /dev/null
+++ b/1670/CH3/EX3.17/3_17.sce
@@ -0,0 +1,16 @@
+//Example 3.17
+//Gauss Seidel Method
+//Page no. 73
+clc;clear;close;
+
+x0=0;y0=0;z0=0;
+deff('x=f1(y,z)','x=(y-z+10)/5')
+deff('y=f2(x,z)','y=(-2*x+z+11)/8')
+deff('z=f3(x,y)','z=(x-y+3)/4')
+for i=1:8
+ x0=f1(y0,z0);
+ y0=f2(x0,z0);
+ z0=f3(x0,y0);
+ printf('\tx(%i) = %g\n\n\ty(%i) = %g\n\n\tz(%i) = %g\n\n\n\n',i,x0,i,y0,i,z0)
+end
+printf('Thus we find that solution converges to %g, %g and %g',x0,y0,z0) \ No newline at end of file
diff --git a/1670/CH3/EX3.18/3_18.sce b/1670/CH3/EX3.18/3_18.sce
new file mode 100755
index 000000000..51713057d
--- /dev/null
+++ b/1670/CH3/EX3.18/3_18.sce
@@ -0,0 +1,16 @@
+//Example 3.18
+//Gauss Seidel Method
+//Page no. 74
+clc;clear;close;
+
+x0=0;y0=0;z0=0;
+deff('x=f1(y,z)','x=(110-y-z)/54')
+deff('y=f2(x,z)','y=(72-2*x-6*z)/15')
+deff('z=f3(x,y)','z=(85+x-6*y)/27')
+for i=1:5
+ x0=f1(y0,z0);
+ y0=f2(x0,z0);
+ z0=f3(x0,y0);
+ printf('\tx(%i) = %g\n\n\ty(%i) = %g\n\n\tz(%i) = %g\n\n\n\n',i,x0,i,y0,i,z0)
+end
+printf('Thus we find that solution converges to %.3f, %.3f and %.3f',x0,y0,z0) \ No newline at end of file
diff --git a/1670/CH3/EX3.19/3_19.sce b/1670/CH3/EX3.19/3_19.sce
new file mode 100755
index 000000000..c142dcff2
--- /dev/null
+++ b/1670/CH3/EX3.19/3_19.sce
@@ -0,0 +1,16 @@
+//Example 3.19
+//Gauss Seidel Method
+//Page no. 75
+clc;clear;close;
+
+x0=0;y0=0;z0=0;
+deff('x=f1(y,z)','x=(32-4*y+z)/28')
+deff('y=f2(x,z)','y=(35-2*x-4*z)/17')
+deff('z=f3(x,y)','z=(24-x-3*y)/10')
+for i=1:6
+ x0=f1(y0,z0);
+ y0=f2(x0,z0);
+ z0=f3(x0,y0);
+ printf('\tx(%i) = %g\n\n\ty(%i) = %g\n\n\tz(%i) = %g\n\n\n\n',i,x0,i,y0,i,z0)
+end
+printf('Thus we find that solution converges to %.4f, %.4f and %.4f',x0,y0,z0) \ No newline at end of file
diff --git a/1670/CH3/EX3.2/3_2.sce b/1670/CH3/EX3.2/3_2.sce
new file mode 100755
index 000000000..aae2b5970
--- /dev/null
+++ b/1670/CH3/EX3.2/3_2.sce
@@ -0,0 +1,36 @@
+//Example 3.2
+//Gaussian Elimination Method
+//Page no. 54
+clc;clear;close;
+
+A=[2,4,-6,-4;1,5,3,10;1,3,2,5]; //augmented matrix
+
+//triangularization
+for i=1:3
+ for j=1:4
+ if i==1 then
+ B(i,j)=A(i,j)
+ elseif i==2
+ B(i,j)=A(i,j)-A(i,1)*A(i-1,j)/A(1,1)
+ B(i+1,j)=A(i+1,j)-A(i+1,1)*A(i-1,j)/A(1,1)
+ elseif i==3
+ if j==1 then
+ A=B
+ end
+ B(i,j)=B(i,j)-A(i,2)*B(i-1,j)/B(2,2)
+ end
+ end
+end
+disp(A,'Augmented Matrix=')
+disp(B,'Triangulated Matrix=')
+//back substitution
+x(3)=B(3,4)/B(3,3);
+printf('\nx(3)= %i\n',x(3))
+for i=2:-1:1
+ k=0
+ for j=i+1:3
+ k=k+B(i,j)*x(j)
+ end
+ x(i)=(1/B(i,i))*(B(i,4)-k)
+ printf('\nx(%i)= %i\n',i,x(i))
+end
diff --git a/1670/CH3/EX3.20/3_20.sce b/1670/CH3/EX3.20/3_20.sce
new file mode 100755
index 000000000..5f8f0db43
--- /dev/null
+++ b/1670/CH3/EX3.20/3_20.sce
@@ -0,0 +1,16 @@
+//Example 3.20
+//Gauss Seidel Method
+//Page no. 75
+clc;clear;close;
+
+x0=0;y0=0;z0=0;
+deff('x=f1(y,z)','x=(17-y+2*z)/20')
+deff('y=f2(x,z)','y=(-18-3*x+z)/20')
+deff('z=f3(x,y)','z=(25-3*x+3*y)/20')
+for i=1:3
+ x0=f1(y0,z0);
+ y0=f2(x0,z0);
+ z0=f3(x0,y0);
+ printf('\tx(%i) = %g\n\n\ty(%i) = %g\n\n\tz(%i) = %g\n\n\n\n',i,x0,i,y0,i,z0)
+end
+printf('Thus we find that solution converges to %.1g, %.1g and %.1g',x0,y0,z0) \ No newline at end of file
diff --git a/1670/CH3/EX3.21/3_21.sce b/1670/CH3/EX3.21/3_21.sce
new file mode 100755
index 000000000..335c80b6b
--- /dev/null
+++ b/1670/CH3/EX3.21/3_21.sce
@@ -0,0 +1,48 @@
+//Example 3.21
+//Relaxation Method
+//Page no. 79
+clc;clear;close;
+
+A=[10,-2,-2,-6;-1,10,-2,-7;-1,-1,10,-8]
+deff('y=R(i,x,y,z)','y=A(i,1)*x+A(i,2)*y+A(i,3)*z+A(i,4)')
+printf('dx\tdy\tdz\tdR1\tdR2\tdR3\n---------------------------------------------')
+I=eye(3,3)
+for i=1:3
+ printf('\n')
+ for j=1:3
+ printf(' %g\t',I(i,j))
+ end
+ for j=1:3
+ printf('%g\t',A(j,i))
+ end
+end
+printf('\n\n\n\n\n xi\tyi\tzi\tR1\tR2\tR3\n---------------------------------------------\n')
+I1=[0,0,0;0,0,1;0,1,0;1,0,0]
+for i=1:4
+ for j=1:3
+ l=0;
+ for k=1:i
+ l=l+I1(k,j)
+ end
+ I(i,j)=l
+ end
+end
+X=eye(1,6)-eye(1,6)
+for i=1:4
+ printf('\n')
+ for j=1:3
+ printf(' %g\t',I1(i,j))
+ X(j)=X(j)+I1(i,j)
+ end
+ for j=1:3
+ printf('%g\t',R(j,I(i,1),I(i,2),I(i,3)))
+ if i==4 then
+ X(j+3)=X(j+3)+R(j,I(i,1),I(i,2),I(i,3))
+ end
+ end
+end
+printf('\n---------------------------------------------\n')
+for i=1:6
+ printf(' %g\t',X(i))
+end
+printf('\n\n\nHence the solution is \n\t x = %g\n\t y = %g\n\t z = %g',X(1),X(2),X(3)) \ No newline at end of file
diff --git a/1670/CH3/EX3.22/3_22.sce b/1670/CH3/EX3.22/3_22.sce
new file mode 100755
index 000000000..a5e56ba09
--- /dev/null
+++ b/1670/CH3/EX3.22/3_22.sce
@@ -0,0 +1,48 @@
+//Example 3.22
+//Relaxation Method
+//Page no. 80
+clc;clear;close;
+
+A=[10,-2,1,-12;1,9,-1,-10;2,-1,11,-20]
+deff('y=R(i,x,y,z)','y=A(i,1)*x+A(i,2)*y+A(i,3)*z+A(i,4)')
+printf('dx\tdy\tdz\tdR1\tdR2\tR3\n---------------------------------------------')
+I=eye(3,3)
+for i=1:3
+ printf('\n')
+ for j=1:3
+ printf(' %g\t',I(i,j))
+ end
+ for j=1:3
+ printf('%g\t',A(j,i))
+ end
+end
+printf('\n\n\n\n\n xi\tyi\tzi\tR1\tR2\tR3\n---------------------------------------------\n')
+I1=[0,0,0;0,0,2;0,1,0;1,0,0;0,0,-0.3;0.2,0,0;0,0.2,0;0,-0.03,0;-0.016,0,0;0,0,0.009]
+for i=1:10
+ for j=1:3
+ l=0;
+ for k=1:i
+ l=l+I1(k,j)
+ end
+ I(i,j)=l
+ end
+end
+X=eye(1,6)-eye(1,6)
+for i=1:10
+ printf('\n')
+ for j=1:3
+ printf(' %g\t',I1(i,j))
+ X(j)=X(j)+I1(i,j)
+ end
+ for j=1:3
+ printf('%g\t',R(j,I(i,1),I(i,2),I(i,3)))
+ if i==10 then
+ X(j+3)=X(j+3)+R(j,I(i,1),I(i,2),I(i,3))
+ end
+ end
+end
+printf('\n---------------------------------------------\n')
+for i=1:6
+ printf(' %g\t',X(i))
+end
+printf('\n\n\nHence the solution is \n\t x = %g\n\t y = %g\n\t z = %g',X(1),X(2),X(3)) \ No newline at end of file
diff --git a/1670/CH3/EX3.23/3_23.sce b/1670/CH3/EX3.23/3_23.sce
new file mode 100755
index 000000000..38977f5d3
--- /dev/null
+++ b/1670/CH3/EX3.23/3_23.sce
@@ -0,0 +1,48 @@
+//Example 3.23
+//Relaxation Method
+//Page no. 81
+clc;clear;close;
+
+A=[10,-2,-3,-205;-2,10,-2,-154;-2,-1,10,-120]
+deff('y=R(i,x,y,z)','y=A(i,1)*x+A(i,2)*y+A(i,3)*z+A(i,4)')
+printf('dx\tdy\tdz\tdR1\tdR2\tdR3\n---------------------------------------------')
+I=eye(3,3)
+for i=1:3
+ printf('\n')
+ for j=1:3
+ printf(' %g\t',I(i,j))
+ end
+ for j=1:3
+ printf('%g\t',A(j,i))
+ end
+end
+printf('\n\n\n\n\n xi\tyi\tzi\tR1\tR2\tR3\n---------------------------------------------\n')
+I1=[0,0,0;20,0,0;0,19,0;0,0,18;10,0,0;0,6,0;0,0,2;2,0,0;0,0,1;0,1,0]
+for i=1:10
+ for j=1:3
+ l=0;
+ for k=1:i
+ l=l+I1(k,j)
+ end
+ I(i,j)=l
+ end
+end
+X=eye(1,6)-eye(1,6)
+for i=1:10
+ printf('\n')
+ for j=1:3
+ printf(' %g\t',I1(i,j))
+ X(j)=X(j)+I1(i,j)
+ end
+ for j=1:3
+ printf('%g\t',R(j,I(i,1),I(i,2),I(i,3)))
+ if i==10 then
+ X(j+3)=X(j+3)+R(j,I(i,1),I(i,2),I(i,3))
+ end
+ end
+end
+printf('\n---------------------------------------------\n')
+for i=1:6
+ printf(' %g\t',X(i))
+end
+printf('\n\n\nHence the solution is \n\t x = %g\n\t y = %g\n\t z = %g',X(1),X(2),X(3)) \ No newline at end of file
diff --git a/1670/CH3/EX3.3/3_3.sce b/1670/CH3/EX3.3/3_3.sce
new file mode 100755
index 000000000..28ee908ff
--- /dev/null
+++ b/1670/CH3/EX3.3/3_3.sce
@@ -0,0 +1,45 @@
+//Example 3.3
+//Gaussian Elimination Method
+//Page no. 54
+clc;clear;close;
+
+A=[10,-7,3,5,6;-6,8,-1,-4,5;3,1,4,11,2;5,-9,-2,4,7]; //augmented matrix
+disp(A,'Augmented Matrix=')
+C=A;
+//triangularization
+for i=1:4
+ for j=1:5
+ if i==1 then
+ B(i,j)=A(i,j)
+ elseif i==2
+ B(i,j)=A(i,j)-A(i,1)*A(i-1,j)/A(1,1)
+ B(i+1,j)=A(i+1,j)-A(i+1,1)*A(i-1,j)/A(1,1)
+ B(i+2,j)=A(i+2,j)-A(i+2,1)*A(i-1,j)/A(1,1)
+ elseif i==3
+ if j==1 then
+ C=B
+ else
+ B(i,j)=B(i,j)-C(i,2)*B(i-1,j)/B(2,2)
+ B(i+1,j)=C(i+1,j)-C(i+1,2)*C(i-1,j)/C(2,2)
+ end
+ else
+ if j==1 then
+ C=B
+ end
+ B(i,j)=B(i,j)-C(i,3)*B(i-1,j)/B(3,3)
+ end
+ end
+end
+
+disp(B,'Triangulated Matrix=')
+//back substitution
+x(4)=B(4,5)/B(4,4);
+printf('\nx(4) = %.0f\n',x(4))
+for i=3:-1:1
+ k=0
+ for j=i+1:4
+ k=k+B(i,j)*x(j)
+ end
+ x(i)=(1/B(i,i))*(B(i,5)-k)
+ printf('\nx(%i) = %.0f\n',i,x(i))
+end
diff --git a/1670/CH3/EX3.4/3_4.sce b/1670/CH3/EX3.4/3_4.sce
new file mode 100755
index 000000000..dda8574e1
--- /dev/null
+++ b/1670/CH3/EX3.4/3_4.sce
@@ -0,0 +1,36 @@
+//Example 3.4
+//Gaussian Elimination Method
+//Page no. 55
+clc;clear;close;
+
+A=[2,1,1,10;3,2,3,18;1,4,9,16]; //augmented matrix
+disp(A,'Augmented Matrix=')
+//triangularization
+for i=1:3
+ for j=1:4
+ if i==1 then
+ B(i,j)=A(i,j)
+ elseif i==2
+ B(i,j)=A(i,j)-A(i,1)*A(i-1,j)/A(1,1)
+ B(i+1,j)=A(i+1,j)-A(i+1,1)*A(i-1,j)/A(1,1)
+ elseif i==3
+ if j==1 then
+ A=B
+ end
+ B(i,j)=B(i,j)-A(i,2)*B(i-1,j)/B(2,2)
+ end
+ end
+end
+
+disp(B,'Triangulated Matrix=')
+//back substitution
+x(3)=B(3,4)/B(3,3);
+printf('\nx(3)= %i\n',x(3))
+for i=2:-1:1
+ k=0
+ for j=i+1:3
+ k=k+B(i,j)*x(j)
+ end
+ x(i)=(1/B(i,i))*(B(i,4)-k)
+ printf('\nx(%i)= %i\n',i,x(i))
+end
diff --git a/1670/CH3/EX3.5/3_5.sce b/1670/CH3/EX3.5/3_5.sce
new file mode 100755
index 000000000..bb3d8ff98
--- /dev/null
+++ b/1670/CH3/EX3.5/3_5.sce
@@ -0,0 +1,38 @@
+//Example 3.5
+//Gauss-Jordan Method
+//Page no. 57
+
+clc;clear;close;
+
+A=[1,2,1,8;2,3,4,20;4,3,2,16]; //augmented matrix
+
+for i=1:3
+ j=i
+ while (A(i,i)==0 & j<=3)
+ for k=1:4
+ B(1,k)=A(j+1,k)
+ A(j+1,k)=A(i,k)
+ A(i,k)=B(1,k)
+ end
+ disp(A)
+ j=j+1
+ end
+ for k=4:-1:i
+ A(i,k)=A(i,k)/A(i,i)
+ end
+ disp(A)
+ for k=1:3
+ if(k~=i) then
+ l=A(k,i)/A(i,i)
+ for m=i:4
+ A(k,m)=A(k,m)-l*A(i,m)
+ end
+ end
+
+ end
+ disp(A)
+end
+
+for i=1:3
+ printf('\nx(%i) = %g\n',i,A(i,4))
+end \ No newline at end of file
diff --git a/1670/CH3/EX3.6/3_6.sce b/1670/CH3/EX3.6/3_6.sce
new file mode 100755
index 000000000..0c16f5324
--- /dev/null
+++ b/1670/CH3/EX3.6/3_6.sce
@@ -0,0 +1,38 @@
+//Example 3.6
+//Gauss-Jordan Method
+//Page no. 57
+
+clc;clear;close;
+
+A=[10,1,1,12;1,10,1,12;1,1,10,12]; //augmented matrix
+
+for i=1:3
+ j=i
+ while (A(i,i)==0 & j<=3)
+ for k=1:4
+ B(1,k)=A(j+1,k)
+ A(j+1,k)=A(i,k)
+ A(i,k)=B(1,k)
+ end
+ disp(A)
+ j=j+1
+ end
+ for k=4:-1:i
+ A(i,k)=A(i,k)/A(i,i)
+ end
+ disp(A)
+ for k=1:3
+ if(k~=i) then
+ l=A(k,i)/A(i,i)
+ for m=i:4
+ A(k,m)=A(k,m)-l*A(i,m)
+ end
+ end
+
+ end
+ disp(A)
+end
+
+for i=1:3
+ printf('\nx(%i) = %g\n',i,A(i,4))
+end \ No newline at end of file
diff --git a/1670/CH3/EX3.7/3_7.sce b/1670/CH3/EX3.7/3_7.sce
new file mode 100755
index 000000000..299562f0b
--- /dev/null
+++ b/1670/CH3/EX3.7/3_7.sce
@@ -0,0 +1,38 @@
+//Example 3.7
+//Gauss-Jordan Method
+//Page no. 58
+
+clc;clear;close;
+
+A=[1,1,1,9;2,-3,4,13;3,4,5,40]; //augmented matrix
+
+for i=1:3
+ j=i
+ while (A(i,i)==0 & j<=3)
+ for k=1:4
+ B(1,k)=A(j+1,k)
+ A(j+1,k)=A(i,k)
+ A(i,k)=B(1,k)
+ end
+ disp(A)
+ j=j+1
+ end
+ for k=4:-1:i
+ A(i,k)=A(i,k)/A(i,i)
+ end
+ disp(A)
+ for k=1:3
+ if(k~=i) then
+ l=A(k,i)/A(i,i)
+ for m=i:4
+ A(k,m)=A(k,m)-l*A(i,m)
+ end
+ end
+
+ end
+ disp(A)
+end
+
+for i=1:3
+ printf('\nx(%i) = %g\n',i,A(i,4))
+end \ No newline at end of file
diff --git a/1670/CH3/EX3.8/3_8.sce b/1670/CH3/EX3.8/3_8.sce
new file mode 100755
index 000000000..e6af734ef
--- /dev/null
+++ b/1670/CH3/EX3.8/3_8.sce
@@ -0,0 +1,56 @@
+//Example 3.8
+//Triangularization Method
+//Page no. 60
+clc;clear;close;
+
+A=[1,2,3;2,5,2;3,1,5];
+B=[14;18;20];
+printf('A can be factorizaed as follows:\n')
+printf('\tL\t\t *\t\tU\t\t =\t\tA')
+U(2,1)=0;U(3,1)=0;U(3,2)=0;
+L(1,2)=0;L(1,3)=0;L(2,3)=0;
+for i=1:3
+ L(i,i)=1
+end
+for i=1:3
+ U(1,i)=A(1,i)
+end
+L(2,1)=A(1,2)/U(1,1);
+for i=2:3
+ U(2,i)=A(2,i)-U(1,i)*L(2,1);
+end
+L(3,1)=A(1,3)/U(1,1);
+L(3,2)=(A(3,2)-U(1,2)*L(3,1))/U(2,2);
+U(3,3)=A(3,3)-U(1,3)*L(3,1)-U(2,3)*L(3,2);
+printf('\n')
+for i=1:3
+ for j=1:3
+ printf('%.2f\t',L(i,j))
+ end
+
+ if(i==2)
+ printf(' * ')
+ else
+ printf('\t')
+ end
+
+ for j=1:3
+ printf('%.2f\t',U(i,j))
+ end
+ if(i==2)
+ printf(' = ')
+ else
+ printf('\t')
+ end
+ for j=1:3
+ printf('%.2f\t',A(i,j))
+ end
+ printf('\n')
+end
+printf('\nY=U*X')
+ Y=inv(L)*B
+ X=inv(U)*Y
+printf('\n\nX=')
+for i=1:3
+ printf('\n %i',X(i,1))
+end \ No newline at end of file
diff --git a/1670/CH3/EX3.9/3_9.sce b/1670/CH3/EX3.9/3_9.sce
new file mode 100755
index 000000000..22e6c7d3c
--- /dev/null
+++ b/1670/CH3/EX3.9/3_9.sce
@@ -0,0 +1,48 @@
+//Example 3.9
+//Triangularization Method
+//Page no. 61
+clc;clear;close;
+
+A=[1,2,3;2,5,2;3,1,5];
+B=[14;18;20];
+printf('A =\n')
+
+U(2,1)=0;U(3,1)=0;U(3,2)=0;
+L(1,2)=0;L(1,3)=0;L(2,3)=0;
+for i=1:3
+ L(i,i)=1
+end
+for i=1:3
+ U(1,i)=A(1,i)
+end
+L(2,1)=A(1,2)/U(1,1);
+for i=2:3
+ U(2,i)=A(2,i)-U(1,i)*L(2,1);
+end
+L(3,1)=A(1,3)/U(1,1);
+L(3,2)=(A(3,2)-U(1,2)*L(3,1))/U(2,2);
+U(3,3)=A(3,3)-U(1,3)*L(3,1)-U(2,3)*L(3,2);
+printf('\n')
+for i=1:3
+ for j=1:3
+ printf('%.2f\t',L(i,j))
+ end
+
+ if(i==2)
+ printf(' * ')
+ else
+ printf('\t')
+ end
+
+ for j=1:3
+ printf('%.2f\t',U(i,j))
+ end
+ printf('\n')
+end
+
+ Y=inv(L)*B
+ X=inv(U)*Y
+printf('\n\nX=')
+for i=1:3
+ printf('\n %i',X(i,1))
+end \ No newline at end of file