Please, help me about the bisection method in C +?
Obtain the local minimize of the function f(x) = X^5-5X^3-20*X+5 on [-3,O] and [0,3] by bisection method >> and run it in a loop
help me++++
#include "conio.h"
#include "iostream"
#include "math.h"
using namespace std;
&
& double f (double x)
{
double y;
y=pow(x,5)-5*pow(x,3)-20*x+5;
&
return(y);
}
&
&
int main()
{
& double a;
& double b;
& double e=0.000001;
& double x;
& double y,i,k;
& k=0.000000001;
& e=1;
& a=-3;
& b=0;
& while(fabs(e)>k){
& if(f(a)<f(b))
& b=(b+a)/2;
& else
& a=(b+a)/2; &
& e=(b-a) ;
& }
cout<<"[-3;0]\n"<<"Min& Y= "<<f(a)<<"& X= "<<a<<endl;
&
& a=0;
& b=3.0;
&
&
& for(;;)
& {
double x1=(a+b)/2-e/2;
double x2=(a+b)/2+e/2;
& if(f(x2)>f(x1))
b=x2;
& else
a=x1;
& double l=b-a;
& if(l<0.002)
break;
}
x=(a+b)/2;
double min=f(x);
cout<<"[0;3]\n"<<"Min& Y= "<<f(x)<<"& X= "<<x<<endl;
& _getch();
return 0;
}