The roots of equation 2x3-4x2 + 3x-6 = 0 between (- 10,10) are solved by dichotomy

The roots of equation 2x3-4x2 + 3x-6 = 0 between (- 10,10) are solved by dichotomy


nclude iostream>
using namespace std;
double p(double x)
{
return 2*x*x*x-4*x*x+3*x-6;
}
int main()
{
double a,b;
cin >> a >> b;
double fa = p(a),fb = p(b),fm;
do
{
fm = p((a+b)/2);
if(fm==0) break;
if(fm*fa0) b = (a+b)/2;
else if(fm*fb0) a = (a+b)/2;
}while(b-a>0.00001);
cout ((b+a)/2) endl;
}
------
Your revised:
#include stdio.h>
#include math.h>
int main()
{
float a=-10.0;
float b=10.0;
float fc,fa,fb,c;
c=(a+b)/2;
fc=2*pow(c,3)-4*pow(c,2)+3*c-6;
fa=2*pow(a,3)-4*pow(a,2)+3*a-6;
fb=2*pow(b,3)-4*pow(b,2)+3*b-6;
if (fc==0)
printf("the result is %lf.\n",c);
else
{
do
{
c=(a+b)/2;
if(fc==0) break;
if (fa*fc0)
else if(fb*fc0)
}
while (b-a>0.1e-6);
printf("the result is %lf.\n",c);
}
}
In addition, virtual machine group products group buying, super cheap
anonymous



Given that X-1 is a factor of the polynomial x ^ 3-3x + K, please decompose the polynomial


According to the meaning of the question, let x ^ 3-3x + k = (x-1) (X & # 178; + ax-k) = x & # 179; + (A-1) x & # 178; - (a + k) x + K (set according to the law of cross multiplication). By comparing the left and right coefficients, we can see that A-1 = 0, a = 1 - (a + k) = - 3K = 2, so the original polynomial is: X & # 179; - 3x + 2 = (x-1) (X & # 178; + X



How to calculate y = X3 + 3x2 + 3x + 2


y=x³+3x²+3x+2
=(x³+2x²)+(x²+2x)+(x+2)
=x²(x+2)+x(x+2)+(x+2)
=(x+2)(x²+x+1)