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 --- 50/DEPENDENCIES/Vsecant.sce | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 50/DEPENDENCIES/Vsecant.sce (limited to '50/DEPENDENCIES/Vsecant.sce') 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 -- cgit