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 --- 149/CH24/EX24.4/ques4.sce | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 149/CH24/EX24.4/ques4.sce (limited to '149/CH24/EX24.4') diff --git a/149/CH24/EX24.4/ques4.sce b/149/CH24/EX24.4/ques4.sce new file mode 100755 index 000000000..2544a0e32 --- /dev/null +++ b/149/CH24/EX24.4/ques4.sce @@ -0,0 +1,25 @@ +//ques 2 +disp('f(x)=x*log(x)-1.2'); +function y=f(x) + y=x*log10(x)-1.2; +endfunction + +disp('we are required to find the roots of f(x) by the method of false position'); +disp('f(2)=-ve and f(3)=+ve so s root lie between 2 and 3'); +disp('finding the roots by false position method'); + +l=2; +m=3; +for i=1:3 + k=l-(m-l)*f(l)/(f(m)-f(l)); + if(f(k)<0) + l=k; + else + m=k; + end +end +//fprintf('The roots of the equation is %g',k) +disp('The root of the equation is :'); +disp(k); + + \ No newline at end of file -- cgit