C Program For Regula Falsi Method

Regula Falsi method or the method of false position or false position method is a numerical method for solving an equation in one unknown. It is quite similar to the bisection method algorithm and is one of the oldest approaches. It was developed because the bisection method converges at a fairly slow speed. In simple terms, the method is the trial and error technique of using test (“false”) values for the variable and then adjusting the test value according to the outcome.

Formula of Regula Falsi Method

Formula of Regula Falsi Method

Regula Falsi Method Solved Example

Regula Falsi Method Solved Example
Regula Falsi Method Solved Example
Regula Falsi Method Solved Example

C Program

//Regula Falsi Method
//This code is written by Souvik Ghosh
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
//define your function here
float f(float x){
    return ((x*x*x)+3*x-5);
}
//main function
void main(){
    float a,b,c,e;
    int n=0;
    //inputs
    printf("Please enter the lower guess\n");
    scanf("%f",&a);
    printf("Please enter the upper guess\n");
    scanf("%f",&b);
    printf("Please enter the tolerable error\n");
    scanf("%f",&e);
    printf("\niteration\t\ta\t\tf(a)\t\tb\t\tf(b)\t\tc\t\tf(c)\n");
    do{
            //formula
            c=a-(f(a)*(b-a))/(f(b)-f(a));
            n++;
            printf("\n%d\t\t%0.4f\t\t%0.4f\t\t%0.4f\t\t%0.4f\t\t%0.4f\t\t%0.4f\n",n,a,f(a),b,f(b),c,f(c));
            if((f(a)*f(c))<0)
                b=c;
            else
                a=c;
    }while(fabs(f(c))>=e);//terminating condition
    printf("The root is: %0.4f\n",c);

    }

Output Terminal

Regula Falsi Method C Program Output

Related Posts

Artificial Intelligence Suggestions

Unlock Success in Your MAKAUT Semester Exam with These Empowering Artificial Intelligence Suggestions! Elevate Your Learning Experience and Excel with Confidence.

Mixed Signal Design Suggestions

Unlock Success in Your MAKAUT Semester Exam with These Empowering Mixed Signal Design Suggestions! Elevate Your Learning Experience and Excel with Confidence.

Fiber Optic Communication Suggestions

Unlock Success in Your MAKAUT Semester Exam with These Empowering Fiber Optic Communication Suggestions! Elevate Your Learning Experience and Excel with Confidence.

Cyber Security Suggestions

Unlock Success in Your MAKAUT Semester Exam with These Empowering Cyber Security Suggestions! Elevate Your Learning Experience and Excel with Confidence.

MAKAUT 7th Semester Examination Questions – 2023

Mobile Communication and Networks (PE-EC701C) Neural Network and Fuzzy Logic Control (PE-EC702C/PEROB701B) Principles of Management (HS-HU701)

CSS Cheatsheet

Transform your web design game with my CSS cheatsheet! Master the art of styling, dive into essential properties and selectors, and create visually stunning websites effortlessly. Whether…

Leave a Reply

Your email address will not be published. Required fields are marked *