Skip to content

Instantly share code, notes, and snippets.

@yask123
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save yask123/556b564c08bc5e169530 to your computer and use it in GitHub Desktop.

Select an option

Save yask123/556b564c08bc5e169530 to your computer and use it in GitHub Desktop.
#include <stdio.h>
double f(double x)
{
return (x*x*x - 2*x -5);
}
int main()
{
int i;
// By regula falsi
double x0,x1,x3;
x0=2;
x1=3;
for(i=0;i<3;i++)
{
x3 =x0 - (( x0 - x1 )/(f(x0)-f(x1)))*f(x0);
x0=x1;
x1=x3;
}
printf("%lf",x3);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment