diff options
Diffstat (limited to '1332/CH20')
-rwxr-xr-x | 1332/CH20/EX20.1/20_1.pdf | bin | 0 -> 6226 bytes | |||
-rwxr-xr-x | 1332/CH20/EX20.1/20_1.sce | 19 | ||||
-rwxr-xr-x | 1332/CH20/EX20.2/20_2.pdf | bin | 0 -> 6075 bytes | |||
-rwxr-xr-x | 1332/CH20/EX20.2/20_2.sce | 34 | ||||
-rwxr-xr-x | 1332/CH20/EX20.3/20_3.pdf | bin | 0 -> 6500 bytes | |||
-rwxr-xr-x | 1332/CH20/EX20.3/20_3.sce | 35 | ||||
-rwxr-xr-x | 1332/CH20/EX20.4/20_4.pdf | bin | 0 -> 6297 bytes | |||
-rwxr-xr-x | 1332/CH20/EX20.4/20_4.sce | 36 | ||||
-rwxr-xr-x | 1332/CH20/EX20.5/20_5.pdf | bin | 0 -> 6525 bytes | |||
-rwxr-xr-x | 1332/CH20/EX20.5/20_5.sce | 35 | ||||
-rwxr-xr-x | 1332/CH20/EX20.6/20_6.pdf | bin | 0 -> 7317 bytes | |||
-rwxr-xr-x | 1332/CH20/EX20.6/20_6.sce | 47 | ||||
-rwxr-xr-x | 1332/CH20/EX20.7/20_7.pdf | bin | 0 -> 6367 bytes | |||
-rwxr-xr-x | 1332/CH20/EX20.7/20_7.sce | 28 | ||||
-rwxr-xr-x | 1332/CH20/EX20.8/20_8.pdf | bin | 0 -> 6529 bytes | |||
-rwxr-xr-x | 1332/CH20/EX20.8/20_8.sce | 58 |
16 files changed, 292 insertions, 0 deletions
diff --git a/1332/CH20/EX20.1/20_1.pdf b/1332/CH20/EX20.1/20_1.pdf Binary files differnew file mode 100755 index 000000000..e9c8204f9 --- /dev/null +++ b/1332/CH20/EX20.1/20_1.pdf diff --git a/1332/CH20/EX20.1/20_1.sce b/1332/CH20/EX20.1/20_1.sce new file mode 100755 index 000000000..ba5d7e975 --- /dev/null +++ b/1332/CH20/EX20.1/20_1.sce @@ -0,0 +1,19 @@ +//Example 20.1
+//Direct Method
+//Page no. 682
+clc;clear;close;
+h=1/3;
+A=[-4,1,1,0;1,-4,0,1;1,0,-4,1;0,1,1,-4]
+x=0;
+for i=1:4
+ x=x+h
+ if i==4 then
+ B(i,1)=0
+ else
+ B(i,1)=-1*sin(x*%pi)^2
+ end
+end
+disp(A,'A =')
+disp(B,'B =')
+U=inv(A)*B
+disp(U,'U =')
\ No newline at end of file diff --git a/1332/CH20/EX20.2/20_2.pdf b/1332/CH20/EX20.2/20_2.pdf Binary files differnew file mode 100755 index 000000000..d146384db --- /dev/null +++ b/1332/CH20/EX20.2/20_2.pdf diff --git a/1332/CH20/EX20.2/20_2.sce b/1332/CH20/EX20.2/20_2.sce new file mode 100755 index 000000000..e843444e6 --- /dev/null +++ b/1332/CH20/EX20.2/20_2.sce @@ -0,0 +1,34 @@ +//Example 20.2
+//Five Point Formula
+//Page no. 683
+clc;clear;close;
+
+A=[-4,1,1,0;1,0,-4,1;1,-4,0,1;0,1,1,-4];
+B=[-25;-150;-25;-150];
+u1=inv(A)*B;
+j=0;k=1
+for i=1:4
+ j=j+1;
+ printf('\nu%i%i = %g\n',k,j,u1(i))
+ if i==2 then
+ j=0;k=2
+ end
+end
+printf('\n\n U = \n')
+for i=1:4
+ printf('\n')
+ for j=1:4
+ if j==1 then
+ u(i,j)=0
+ elseif j==4
+ u(i,j)=100
+ elseif (i==1 | i==4) & j==2
+ u(i,j)=25
+ elseif i==1 | i==4
+ u(i,j)=u(i,j-1)*2
+ else
+ u(i,j)=u1((j-1)*2-i+2)
+ end
+ printf('\t%g\t',u(i,j))
+ end
+end
\ No newline at end of file diff --git a/1332/CH20/EX20.3/20_3.pdf b/1332/CH20/EX20.3/20_3.pdf Binary files differnew file mode 100755 index 000000000..c791134a1 --- /dev/null +++ b/1332/CH20/EX20.3/20_3.pdf diff --git a/1332/CH20/EX20.3/20_3.sce b/1332/CH20/EX20.3/20_3.sce new file mode 100755 index 000000000..5f5f2c893 --- /dev/null +++ b/1332/CH20/EX20.3/20_3.sce @@ -0,0 +1,35 @@ +//Example 20.3
+//Finite Difference Method
+//Page no. 685
+clc;clear;close;
+
+printf('Itr\t\t U11\t\t U21\t\t U12\t\t U22\n-----------------------------------------------------------------------\n')
+for i=1:4
+ for j=1:4
+ if j==1 then
+ u(i,j)=0
+ elseif j==4
+ u(i,j)=100
+ elseif (i==1 | i==4) & j==2
+ u(i,j)=25
+ elseif i==1 | i==4
+ u(i,j)=u(i,j-1)*2
+ else
+ u(i,j)=0
+ end
+ end
+end
+for k=0:17
+ printf(' %i\t\t%.3f\t\t%.3f\t\t%.3f\t\t%.3f\n',k,u(3,2),u(3,3),u(2,2),u(2,3))
+ for i=3:-1:2
+ for j=2:3
+ u1(i,j)=(u(i,j+1)+u(i,j-1)+u(i-1,j)+u(i+1,j))/4
+ end
+ end
+ for i=3:-1:2
+ for j=2:3
+ u(i,j)=u1(i,j)
+ end
+ end
+end
+disp(u,'U = ')
\ No newline at end of file diff --git a/1332/CH20/EX20.4/20_4.pdf b/1332/CH20/EX20.4/20_4.pdf Binary files differnew file mode 100755 index 000000000..eb3eeb564 --- /dev/null +++ b/1332/CH20/EX20.4/20_4.pdf diff --git a/1332/CH20/EX20.4/20_4.sce b/1332/CH20/EX20.4/20_4.sce new file mode 100755 index 000000000..d333541f9 --- /dev/null +++ b/1332/CH20/EX20.4/20_4.sce @@ -0,0 +1,36 @@ +//Example 20.4
+//Seven Point Formula
+//Page no. 686
+clc;clear;close;
+printf('Itr\t\t U111\t\t U211\t\t U121\t\t U221\n-----------------------------------------------------------------------\n')
+for i=1:4
+ for j=1:4
+ for k=3:-1:1
+ if k==3 then
+ u(i,j,k)=100
+ elseif (i==1 | i==4 | j==1 | j==4) & k==2
+ u(i,j,k)=300
+ elseif k==2
+ u(i,j,k)=0
+ elseif (i==1 | i==4 | j==1 | j==4) & k==1
+ u(i,j,k)=500
+ else
+ u(i,j,k)=700
+ end
+ end
+ end
+end
+k=2
+for l=0:14
+ printf(' %i\t\t%.3f\t\t%.3f\t\t%.3f\t\t%.3f\n',l,u(3,2,2),u(3,3,2),u(2,2,2),u(2,3,2))
+ for i=3:-1:2
+ for j=2:3
+ u1(i,j)=(u(i,j+1,k)+u(i,j-1,k)+u(i-1,j,k)+u(i+1,j,k)+u(i,j,k+1)+u(i,j,k-1))/6
+ end
+ end
+ for i=3:-1:2
+ for j=2:3
+ u(i,j,2)=u1(i,j)
+ end
+ end
+end
\ No newline at end of file diff --git a/1332/CH20/EX20.5/20_5.pdf b/1332/CH20/EX20.5/20_5.pdf Binary files differnew file mode 100755 index 000000000..74b004a29 --- /dev/null +++ b/1332/CH20/EX20.5/20_5.pdf diff --git a/1332/CH20/EX20.5/20_5.sce b/1332/CH20/EX20.5/20_5.sce new file mode 100755 index 000000000..bd9675796 --- /dev/null +++ b/1332/CH20/EX20.5/20_5.sce @@ -0,0 +1,35 @@ +//Example 20.5
+//Nine Point Formula
+//Page no. 688
+clc;clear;close;
+
+printf('Itr\t\t U11\t\t U12\t\t U21\t\t U22\n-----------------------------------------------------------------------\n')
+for i=1:4
+ for j=1:4
+ if j==1 then
+ u(i,j)=0
+ elseif j==4
+ u(i,j)=100
+ elseif (i==1 | i==4) & j==2
+ u(i,j)=25
+ elseif i==1 | i==4
+ u(i,j)=u(i,j-1)*2
+ else
+ u(i,j)=0
+ end
+ end
+end
+for k=0:17
+ printf(' %i\t\t%.3f\t\t%.3f\t\t%.3f\t\t%.3f\n',k,u(3,2),u(2,2),u(3,3),u(2,3))
+ for i=3:-1:2
+ for j=2:3
+ u1(i,j)=(u(i+1,j-1)+u(i-1,j-1)+u(i+1,j+1)+u(i-1,j+1)+4*(u(i,j+1)+u(i,j-1)+u(i-1,j)+u(i+1,j)))/20
+ end
+ end
+ for i=3:-1:2
+ for j=2:3
+ u(i,j)=u1(i,j)
+ end
+ end
+end
+disp(u,'The Solution of the System is = ')
\ No newline at end of file diff --git a/1332/CH20/EX20.6/20_6.pdf b/1332/CH20/EX20.6/20_6.pdf Binary files differnew file mode 100755 index 000000000..f49102b60 --- /dev/null +++ b/1332/CH20/EX20.6/20_6.pdf diff --git a/1332/CH20/EX20.6/20_6.sce b/1332/CH20/EX20.6/20_6.sce new file mode 100755 index 000000000..e3d56f63c --- /dev/null +++ b/1332/CH20/EX20.6/20_6.sce @@ -0,0 +1,47 @@ +//Example 20.6
+//Five Point Formula
+//Page no. 689
+clc;clear;close;
+
+h=0.25;k=0.25;y=1;x=0;
+deff('x=f(y)','x=y^3')
+
+for i=1:5
+ x=0;
+ printf('\n%g\t|',y)
+ for j=1:5
+ if (i==1 | i==5)
+ u(i,j)=f(x)
+ elseif j==5
+ u(i,j)=f(x)
+ else
+ u(i,j)=0
+ end
+ x=x+k;
+ printf('%f\t',u(i,j))
+ end
+ y=y-h
+end
+printf('\n\t-------------------------------------------------------------------------\n')
+x=0;
+ for j=1:5
+ printf('\t %g\t',x)
+ x=x+k
+ end
+printf('\n\n\n Itr\t U11\t U12\t U13\t U21\t U22\t U23\t U31\t U32\t U33\n-------------------------------------------------------------------------------\n')
+
+for l=0:20
+ y=0;
+ printf(' %i\t%.3f\t%.3f\t%.3f\t%.3f\t%.3f\t%.3f\t%.3f\t%.3f\t%.3f\n',l,u(4,2),u(4,3),u(4,4),u(3,2),u(3,3),u(3,4),u(2,2),u(2,3),u(2,4))
+ for i=4:-1:2
+ y=y+k
+ for j=2:4
+ u1(i,j)=(u(i,j+1)+u(i,j-1)+u(i-1,j)+u(i+1,j)-h^2*y)/4
+ end
+ end
+ for i=4:-1:2
+ for j=2:4
+ u(i,j)=u1(i,j)
+ end
+ end
+end
\ No newline at end of file diff --git a/1332/CH20/EX20.7/20_7.pdf b/1332/CH20/EX20.7/20_7.pdf Binary files differnew file mode 100755 index 000000000..5fea7a9d4 --- /dev/null +++ b/1332/CH20/EX20.7/20_7.pdf diff --git a/1332/CH20/EX20.7/20_7.sce b/1332/CH20/EX20.7/20_7.sce new file mode 100755 index 000000000..7a68d0158 --- /dev/null +++ b/1332/CH20/EX20.7/20_7.sce @@ -0,0 +1,28 @@ +//Example 20.7
+//Laplace Distribution
+//Page no. 694
+clc;clear;close;
+
+dr=3;r0=4;dth=%pi/4;
+deff('y=f(u1,u2,u3,u4)','y=(u1+u3+(dr*(u3-u1))/(2*r0)+(u2+u4)*(dr/(r0*dth))^2)/(2*(1+(dr/(r0*dth))^2))') //laplace distribution
+for i=1:8
+ U(i)=0;
+end
+printf('Itr\t U1\t U2\t U3\t U4\t U5\t U6\t U7\t U8\n-----------------------------------------------------------------------')
+for l=0:15
+ printf('\n %i',l)
+ for i=1:8
+ if i==1 then
+ u1(i)=f(100,U(8),40,U(i+1))
+ elseif i==8
+ u1(i)=f(100,U(i-1),40,U(1))
+ else
+ u1(i)=f(100,U(i-1),40,U(i+1))
+ end
+
+ end
+ for i=1:8
+ U(i)=u1(i)
+ printf('\t%.3f',U(i))
+ end
+end
\ No newline at end of file diff --git a/1332/CH20/EX20.8/20_8.pdf b/1332/CH20/EX20.8/20_8.pdf Binary files differnew file mode 100755 index 000000000..73d74ff45 --- /dev/null +++ b/1332/CH20/EX20.8/20_8.pdf diff --git a/1332/CH20/EX20.8/20_8.sce b/1332/CH20/EX20.8/20_8.sce new file mode 100755 index 000000000..a4df9c2ea --- /dev/null +++ b/1332/CH20/EX20.8/20_8.sce @@ -0,0 +1,58 @@ +//Example 20.8
+//Spherical Coordinate System
+//Page no. 697
+clc;clear;close;
+deff('y=cot(x)','y=1/tan(x)')
+dr=5;r0=50;dth=%pi/4;dfi=%pi/4;N=-10;Z=60;Nb=0;Zt=70;
+deff('y=f(u1,u2,u3,u4,u5,u6,th0)','y=((u1+u3)/dr^2+(u3-u1)/(r0*dr)+(u2+u4)/(r0*dth)^2+(u2*cot(th0)/(r0^2*dth)+(u5+u6)/(r0*sin(th0)*dfi)^2))/(2/dr^2+2/(r0*dth)^2+cot(th0)/(r0^2*dth)+2/(r0*sin(th0)*dfi)^2)') //laplace distribution in spherical coordinate
+T1=40;T2=20;H1=35;H2=10;B1=5;B2=0;t1=240;t2=180;b1=100;b2=80;h1=210;h2=150
+printf('\n----------------------------------------------------------------------------\n')
+s=["T","H","B","t","h","b"];
+for i=1:8
+ if i<4 | i>6 then
+ T(1,i)=T1;
+ H(1,i)=H1;
+ B(1,i)=B1;
+ b(1,i)=b1;
+ t(1,i)=t1;
+ h(1,i)=h1;
+ else
+ T(1,i)=T2;
+ H(1,i)=H2;
+ b(1,i)=b2;
+ B(1,i)=B2;
+ t(1,i)=t2;
+ h(1,i)=h2;
+ end
+end
+h(1)=0;h(2)=0;
+Al=[T;H;B;t;h;b]
+for i=1:6
+ if i==1 then
+ printf('Temperature Distribution in Outer Sphere\n')
+ printf('----------------------------------------------------------------------------\n')
+ end
+ if i==4 then
+ printf('\nTemperature Distribution in Inner Sphere\n')
+ printf('----------------------------------------------------------------------------\n')
+ end
+ printf('\nPoint : ')
+ for j=1:8
+ printf('\t%s%i',s(i),j)
+ end
+ printf('\nTemperature : ')
+ for j=1:8
+ if (j==1 | j==2) & i==5 then
+ printf('\t%s',"?")
+ else
+ printf('\t%i',Al(i,j))
+ end
+ end
+ printf('\n----------------------------------------------------------------------------')
+end
+th0=10^-30
+Uh1=f(1000,Al(5,8),Al(2,1),Al(5,2),Al(6,1),Al(4,1),th0)
+disp(Uh1,'Uh1 = ')
+th0=%pi/4;
+Uh2=f(1000,Uh1,Al(2,2),Al(5,3),Al(6,2),Al(4,2),th0)
+disp(Uh2,'Uh2 = ')
\ No newline at end of file |