summaryrefslogtreecommitdiff
path: root/1332/CH21/EX21.5
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /1332/CH21/EX21.5
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '1332/CH21/EX21.5')
-rwxr-xr-x1332/CH21/EX21.5/21_5.pdfbin0 -> 8909 bytes
-rwxr-xr-x1332/CH21/EX21.5/21_5.sce75
2 files changed, 75 insertions, 0 deletions
diff --git a/1332/CH21/EX21.5/21_5.pdf b/1332/CH21/EX21.5/21_5.pdf
new file mode 100755
index 000000000..32d7aba78
--- /dev/null
+++ b/1332/CH21/EX21.5/21_5.pdf
Binary files differ
diff --git a/1332/CH21/EX21.5/21_5.sce b/1332/CH21/EX21.5/21_5.sce
new file mode 100755
index 000000000..e05b0443c
--- /dev/null
+++ b/1332/CH21/EX21.5/21_5.sce
@@ -0,0 +1,75 @@
+//Example 21.5
+//Poissons Partial Differential Equation
+//Page no. 733
+clc;clear;close;
+
+s=["st","nd","rd"]
+for i=4:20
+ s(i)="th"
+end
+h=0.25;deff('y=f(x)','y=x^3');y=1;x=0;
+for i=1:6
+
+
+ if i~=6 then
+ printf('%g\t|',y)
+ y=y-h;
+ x=0;
+ for j=1:5
+ if i==1 | i==5 | j==5 then
+ P(i,j)=f(x)
+ else
+ P(i,j)=0
+ end
+ printf('%f\t',P(i,j))
+ x=x+h;
+ end
+ else
+ printf('---------------------------------------------------------------------------------\n\t')
+ x=0;
+ for j=1:5
+ printf(' %g\t\t',x)
+ x=x+h
+ end
+ end
+ printf('\n')
+end
+
+printf('\n\n\n')
+
+for l=0:17
+ y=1;
+ if l~=0 then
+ printf('After the %i%s Iteration : \n------------------------------------------------------\n %i',l,s(l),l)
+ for i=1:6
+ if i~=6 then
+ printf('\t%g',y)
+ y=y-h
+ for j=1:5
+ printf('\t%.3f',P(i,j))
+ end
+ else
+ x=0;
+ printf('\t')
+ for j=1:5
+ printf('\t%g',x)
+ x=x+h
+ end
+ end
+ printf('\n')
+ end
+ printf('------------------------------------------------------\n')
+end
+y=0;
+ for i=4:-1:2
+ y=y+h
+ for j=2:4
+ P1(i,j)=(P(i,j+1)+P(i,j-1)+P(i-1,j)+P(i+1,j)-h^2*y)/4
+ end
+ end
+ for i=4:-1:2
+ for j=2:4
+ P(i,j)=P1(i,j)
+ end
+ end
+end \ No newline at end of file