Last active
August 29, 2015 14:21
-
-
Save yask123/556b564c08bc5e169530 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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