Scilab Program for Regula Falsi Method

Scilab Program For Regula-Falsi / False Position Method

Here is the source code of Scilab program for Regula-Falsi / False Position Method.

deff('y=f(x)','y=x^3-1'); // Define the function 

a=0;b=2; //Determining the initial values such that f(x1)f(x2) < 0

i=1; // set counter to 1;

while(i<=15) //up to 15 iteration
    c=(a*f(b)-b*f(a))/(f(b)-f(a)); // False position formula
    
    if (f(a)*f(c)<0) then
        b=c;
    else
        a=c;
    end
    i=i+1;
    [c,f(c)]
end


/* Output of above code:-
ans  =

   0.25  -0.984375

 ans  =

   0.4657534  -0.8989659

 ans  =

   0.640363  -0.7374097

 ans  =

   0.7699425  -0.5435693

 ans  =

   0.8585771  -0.3670959

 ans  =

   0.9154532  -0.2328002

 ans  =

   0.9503612  -0.1416466

 ans  =

   0.9711796  -0.0839932

 ans  =

   0.9833781  -0.0490414

 ans  =

   0.9904509  -0.0283745

 ans  =

   0.9945266  -0.0163304

 ans  =

   0.9968668  -0.00937

 ans  =

   0.9982078  -0.0053669

 ans  =

   0.9989753  -0.0030709

 ans  =

   0.9994143  -0.0017562

*/

Conclusion from Scilab Program for False Position Method

As we increase the number of iterations we get more accurate values of root.