summaryrefslogtreecommitdiff
path: root/243/CH6/EX6.7
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /243/CH6/EX6.7
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 '243/CH6/EX6.7')
-rwxr-xr-x243/CH6/EX6.7/6_07.sce22
1 files changed, 22 insertions, 0 deletions
diff --git a/243/CH6/EX6.7/6_07.sce b/243/CH6/EX6.7/6_07.sce
new file mode 100755
index 000000000..43c5c261b
--- /dev/null
+++ b/243/CH6/EX6.7/6_07.sce
@@ -0,0 +1,22 @@
+//Example No. 6_07
+//Root of the Equation using Newton Raphson Method
+//Pg No. 147
+clear ; close ; clc ;
+
+//Coefficients of polynomial in increasing order of power of x
+A = [ 2 -3 1];
+fx = poly(A,'x','c');
+dfx = derivat(fx);
+
+x(1) = 0 ;
+for i = 1:10
+ f(i) = horner(fx,x(i));
+ if f(i)~= 0 then
+ df(i) = horner(dfx,x(i));
+ x(i+1) = x(i) - f(i)/df(i) ;
+ printf('x%i = %f\n',i+1,x(i+1));
+ else
+ printf('Since f(%f) = 0, the root closer to the point x = 0 is %f \n',x(i),x(i) );
+ break
+ end
+end \ No newline at end of file