diff options
Diffstat (limited to '60/DEPENDENCIES/secantm.sce')
-rwxr-xr-x | 60/DEPENDENCIES/secantm.sce | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/60/DEPENDENCIES/secantm.sce b/60/DEPENDENCIES/secantm.sce new file mode 100755 index 000000000..fa0f84e78 --- /dev/null +++ b/60/DEPENDENCIES/secantm.sce @@ -0,0 +1,13 @@ +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)); + disp(x) + 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 |