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 /50/DEPENDENCIES/Vnewton.sce | |
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 '50/DEPENDENCIES/Vnewton.sce')
-rwxr-xr-x | 50/DEPENDENCIES/Vnewton.sce | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/50/DEPENDENCIES/Vnewton.sce b/50/DEPENDENCIES/Vnewton.sce new file mode 100755 index 000000000..f0fb337be --- /dev/null +++ b/50/DEPENDENCIES/Vnewton.sce @@ -0,0 +1,17 @@ +
+function x=newton(x,f,fp)
+ R=100;
+ PE=10^-8;
+ maxval=10^4;
+
+ for n=1:1:R
+ x=x-f(x)/fp(x);
+ if abs(f(x))<=PE then break
+ end
+ if (abs(f(x))>maxval) then error('Solution diverges');
+ abort
+ break
+ end
+ end
+ disp(n," no. of iterations =")
+endfunction
\ No newline at end of file |