Tweet
#include<stdio.h>
#include<math.h>
float f(float x)
{
return (x*x*x-5*x+1);
}
main()
{
printf("\nProgram to implement regula-falsi method (x^3-5x+1=0) :\n");
float x,a,b;
printf("\nEnter a , b : ");
scanf("%f%f",&a,&b);
printf("\nTable : ");
printf("\n\n\ta[i]\t\tb[i]\t\tx[i+1]\n");
do
{
x=b-((b-a)/(f(b)-f(a)))*f(b);
if(f(b)*f(x)<0)
b=x;
else
a=x;
printf("\n\t%f\t%f\t%f",a,b,x);
}while(fabs(b-a)>=0.000001);
printf("\nThe required root is : %f\n",x);
}
Regula - Falsi Method
Posted by
LAHAUL SETH
~
Regula - Falsi Method
2012-01-03T09:40:00+05:30
LAHAUL SETH
Numerical Methods
|
Programming in C
|
Comments
Regula - Falsi Method
2012-01-03T09:40:00+05:30
LAHAUL SETH
Numerical Methods
|
Programming in C
|