diff options
Diffstat (limited to '50/CH7/EX7.11/ex_7_11.sce')
-rwxr-xr-x | 50/CH7/EX7.11/ex_7_11.sce | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/50/CH7/EX7.11/ex_7_11.sce b/50/CH7/EX7.11/ex_7_11.sce new file mode 100755 index 000000000..2e785541b --- /dev/null +++ b/50/CH7/EX7.11/ex_7_11.sce @@ -0,0 +1,32 @@ +// example 7.11
+// solve the boundary value problem u''=u'+1;
+// u(0)=1; u(x=1)=2(%e-1); h=1/3;
+
+
+// we know; u''=(u(j-1)-2*u(j)+u(j+1))/h^2;
+// we know; u'=(u(j+1)-u(j-1))/2h;
+
+// 1) second order method;
+ x=0:1/3:1;
+
+ u=[u0 u1 u2 u3 ];
+// hence;
+disp('(u(j-1)-2*u(j)+u(j+1))/h^2=((u(j+1)-u(j-1))/2h)+1') // for j=1,2;
+
+
+disp('for j=1 (7/6)*u0-2*u1+(5/6)*u2=(1/9)')
+
+disp('for j=2 (7/6)*u1-2*u2+(5/6)*u3=(1/9)')
+
+
+// hence eliminating u1!
+// solving for u1,u2,
+u0=1;
+u3=2*(%e-1);
+u1=1.454869;
+u2=2.225019;
+
+disp(x);
+disp(u);
+
+
|