Returns the root of the equation 2x3-4x2 + 3x = 0 near (-10, 10) by means of the Bipartite method. (This method first finds a, B, and causes the negative signs of f (a) and F (B, it indicates that there must be zero points in the range (a, B), and then evaluate f [(A + B)/2]. Now suppose F (a) <0, F (B> 0, a <B. If f [(a + B) 2] = 0, the point is zero. If f [(A + B) /2] <0, then there is a zero point in the range (A + B)/2, B), then calculate the function value of the midpoint in the range according to the above method, by reducing the zero point of f (x) to half of all cells, the two endpoints of the interval gradually approach the zero point of the function to obtain the approximate value of the zero point, this value is the root of the equation ).
# Include "stdio. H"
# Include "conio. H"
# Include "math. H"
Void main ()
{
Double X, FX, fa, FB, A =-10, B = 10, Z = 0.0001;
Fa = 2 * a * A-4 * a * A + 3 *;
Fb = 2 * B * B-4 * B + 3 * B;
If (FA * FB <0)
{
Do
{
X = (a + B)/2;
FX = 2 * x * X-4 * x + 3 * X;
If (FX <0)
{
A = X;
Fa = 2 * a * A-4 * a * A + 3 *;
}
Else
{
B = X;
Fb = 2 * B * B-4 * B + 3 * B;
}
} While (FABS (Fa-FB)> Z );
Printf ("the root is: % lf \ n", X );
}
Getch ();
}