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/Vsecant.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/Vsecant.sce')
-rwxr-xr-x | 50/DEPENDENCIES/Vsecant.sce | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/50/DEPENDENCIES/Vsecant.sce b/50/DEPENDENCIES/Vsecant.sce new file mode 100755 index 000000000..a44c89157 --- /dev/null +++ b/50/DEPENDENCIES/Vsecant.sce @@ -0,0 +1,12 @@ +function [x]=secant(a,b,f)
+ N=100; // define max. no. iterations to be performed
+ PE=10^-4 // define tolerance for convergence
+ for n=1:1:N // initiating for loop
+ x=a-(a-b)*f(a)/(f(a)-f(b));
+ if abs(f(x))<=PE then break; //checking for the required condition
+ else a=b;
+ b=x;
+ end
+ end
+ disp(n," no. of iterations =") //
+endfunction
\ No newline at end of file |