From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 964/CH7/EX7.8/7_8.sce | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 964/CH7/EX7.8/7_8.sce (limited to '964/CH7/EX7.8/7_8.sce') diff --git a/964/CH7/EX7.8/7_8.sce b/964/CH7/EX7.8/7_8.sce new file mode 100755 index 000000000..e0b7523ea --- /dev/null +++ b/964/CH7/EX7.8/7_8.sce @@ -0,0 +1,19 @@ +clc; +clear; +function y=f(x) + y=x-cos(x) +endfunction +x1=0; +if f(x1)<0 then + x2=x1+0.00001; + while f(x2)<0 + x2=x2+0.00001; + end +elseif x2=x1+0.00001; + while f(x2)>0 + x2=x2+0.00001; + end +else disp(x1,"The root is=") +end +x=x2-(x2-x1)*f(x2)/(f(x2)-f(x1)); +disp(x,"The root is=") \ No newline at end of file -- cgit