Returns the root of the equation 2 × 3-4 × 2 + 3x = 0 near (-10, 10 ).

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.