REGULAR FALSI METHOD

REGULAR FALSI METHOD

Of all the methods to find the root of a function f(x) = 0, the Regula Falsi method is the oldest one. Being a closed bracket method, it is similar in many ways to the bisection method. Here, the algorithm of regula falsi method has been presented along with its flowchart and features.

Regula falsi method is also known by the name of false position method. Interpolation is the approach of this method to find the root of nonlinear equations by finding new values for successive iterations. In this method, unlike the secant method, one interval always remains constant.

The overall programming effort has been made easy for this method with the simple and easy-to-understand algorithm and flowchart given below. The convergence is always guaranteed in this method and is of first order. The false position method may be slow, but it is found superior to the bisection method in many ways. The iterative formula used here is:

[highlight color=”yellow”]x = [x0*f(x1) – x1*f(x0)] / (f(x1) – f(x0))[/highlight]

Features of Regula Falsi Method:

  • No. of initial guesses – 2
  • Type – closed bracket
  • Convergence – linear
  • Rate of convergence – slow
  • Accuracy – good
  • Approach – interpolation
  • Programming effort – easy

Regula Falsi Method Algorithm:

  1. Start
  2. Read values of x0, x1 and e
    *Here x0 and x1 are the two initial guesses
    e is the degree of accuracy or the absolute error i.e. the stopping criteria*
  3. Computer function values f(x0) and f(x1)
  4. Check whether the product of f(x0) and f(x1) is negative or not.
    If it is positive take another initial guesses.
    If it is negative then goto step 5.
  5. Determine:
    x = [x0*f(x1) – x1*f(x0)] / (f(x1) – f(x0))
  6. Check whether the product of f(x1) and f(x) is negative or not.
    If it is negative, then assign x0 = x;
    If it is positive, assign x1 = x;
  7. Check whether the value of f(x) is greater than 0.00001 or not.
    If yes, goto step 5.
    If no, goto step 8.
    *Here the value 0.00001 is the desired degree of accuracy, and hence the stopping criteria.*
  8. Display the root as x.
  9. Stop

FLOWCHART OF REGULA FALSI METHOD:




C PROGRAM FOR REGULA FALSI METHOD:

#include<stdio.h>
#include<math.h>
float f(float x)
{
    return cos(x) - x*exp(x);
}
void regula (float *x, float x0, float x1, float fx0, float fx1, int *itr)
{
    *x = x0 - ((x1 - x0) / (fx1 - fx0))*fx0;
    ++(*itr);
    printf("Iteration no. %3d X = %7.5f \n", *itr, *x);
}
void main ()
{
int itr = 0, maxmitr;
    float x0,x1,x2,x3,allerr;
    printf("\nEnter the values of x0, x1, allowed error and maximum iterations:\n");
    scanf("%f %f %f %d", &x0, &x1, &allerr, &maxmitr);
    regula (&x2, x0, x1, f(x0), f(x1), &itr);
    do
    {
        if (f(x0)*f(x2) < 0)
            x1=x2;
        else
            x0=x2;
        regula (&x3, x0, x1, f(x0), f(x1), &itr);
        if (fabs(x3-x2) < allerr)
        {
            printf("After %d iterations, root = %6.4f\n", itr, x3);
            return 0;
        }
        x2=x3;
    }
    while (itr<maxmitr);
    printf("Solution does not converge or iterations not sufficient:\n");
    return 1;
}


Comments

Popular posts from this blog

Newton Raphson Method:Explanation, algorithm and flowchart

GAUSS ELIMINATION METHOD:EXPLANATION,ALGORITHM AND FLOWCHART

EULER METHOD:Explanation,algorithm,flowchart