Hello.
Can somebody help me with this:
Using Bisection method find one real root for
f(x)=x^9-x^7+2x^2-1 xE [0;1]

I have to write a program in c++ witch founds me the root.
Again sorry for the bad english

2
Contributors
4
Replies
6
Views
9 Years
Discussion Span
Last Post by Rotvailera

sorry but to tell you the truth I don't understand anything.its imposslible for me to do it.

this is what i can do :( but it is very ugly and it doesn't work.can someone fix it and make it good arranged and beauty.Please help me.

f(x)=x^9-x^7+2x^2-1 for x e [0;1]

CODE :

double F( double x){return x*x*x*x*x*x*x*x*x -x*x*x*x*x*x*x + 2*x*x - 1;}

double L = -100 , R = 100;
for(int i = 0; i < 1000; i++) // to make a 1000 steps
{
double Mid = (L + R) / 2;
double current_value = F(Mid );
if( current_value== 0 ) cout<<"root is: " <<Mid;
if (current_value < 0 ) L = mid;
else if (current_value> 0 ) R = mid;
}

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.