From 7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Tue, 10 Oct 2017 12:27:19 +0530 Subject: initial commit / add all books --- 260/CH13/EX13.5/13_5.sce | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 260/CH13/EX13.5/13_5.sce (limited to '260/CH13/EX13.5') diff --git a/260/CH13/EX13.5/13_5.sce b/260/CH13/EX13.5/13_5.sce new file mode 100644 index 000000000..789721088 --- /dev/null +++ b/260/CH13/EX13.5/13_5.sce @@ -0,0 +1,34 @@ +//Eg-13.5 +//pg-530 + +clear +clc + +y(1) = 1; +x(1) = 0; +h = 0.1; + +deff('out = func(in1,in2)','out = in1^0.5 + in2^0.5') + +for(i = 2:11) + + x(i) = 0.1+(i-2)*0.1; + +end + +for(i = 1:10) + yb(i+1) = y(i) + h*func(x(i),y(i)); + y(i+1) = y(i) + h/2*(func(x(i),y(i)) + func(x(i+1),yb(i+1))); + bb(i+1) = y(i) + h/2*func(x(i),y(i)); + b(i+1) = y(i) + h*func(x(i)+h/2,bb(i+1)); +end + + + +printf(' x yMP yPC\n') + +for(i = 2:11) + printf('%f %f %f\n',x(i),b(i),y(i)) +end + +printf('The third column presents the results obtained from the method used in Eg-13_4') \ No newline at end of file -- cgit