diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /243/CH6/EX6.7 | |
download | Scilab-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-x | 243/CH6/EX6.7/6_07.sce | 22 |
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 |