Hello.
First sorry for bad english.
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.
Please help me.
Again sorry for the bad english

Recommended Answers

All 4 Replies

sorry but to tell you the truth I don't understand anything.its imposslible for me to do it.
please help me.i need the code.please :(

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;
}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.