summaryrefslogtreecommitdiff
path: root/50/DEPENDENCIES/secant64.sce
blob: b65a9f3d5c1438d6b086c43ce49d1032bb0adae2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
function [x]=secant64(a,b,f,fp)
    N=100;             // define max. no. iterations to be performed
    PE=10^-15           // define tolerance for convergence
     for n=1:1:N       // initiating for loop
        x=(b*f(a)*fp(b)-a*f(b)*fp(a))/(f(a)*fp(b)-f(b)*fp(a));  
        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