summaryrefslogtreecommitdiff
path: root/60/DEPENDENCIES/regulfalsi.sce
blob: a743b4a4ffc666a6f7e1d8b49596bc47c6e963f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
function [x]=regularfalsi(a,b,f)
    N=100;
    PE=10^-5;
    for n=2:1:N
        x=a-(a-b)*f(a)/(f(a)-f(b));
        disp(x)
        if abs(f(x))<=PE then break;
        elseif (f(a)*f(x)<0) then b=x;
            else a=x;
        end
    end
    disp(n," no. of ittirations =")
endfunction