Common methods of solving nonlinear equations

Official method

For the unary quadratic equation of the general form: \ (AX + BX + C ^ 2 = 0 \)

Two real numbers can be used to find the formula Ved equation \ (X = \ {FRAC -b + \ sqrt {^ B}. 2A 2-4ac}} {\) , the sum of two \ (x_1 + x_2 = - \ {B} {a FRAC} \) , the product of two \ (x_1 = x_2 * \ FRAC {C} {a} \) , if Δ <0, the resulting unequal two imaginary roots \ ( = X \ FRAC {-b + I \ sqrt {4ac-B ^ {2}}}. 2A \) , cubic equations Cartan formulas and Sheng Jingong formula.

Half approximation

Of a quadratic equation f (x) for a given interval [a, b], if f (a) <0, f (b)> 0, can be approximated in the following way:

  1. If \ (F (\ FRAC {A + B} {2}) = 0 \) , then \ (\ frac {a + b } {2} \) is zero;
  2. If \ (F (\ FRAC {A + B} {2}) <0 \) , the zero in the interval \ ([\ frac {a + b} {2}, b] \) , the Order \ (a = \ FRAC {A + B} {2} \) , continue from step 1 start determination;
  3. If \ (F (\ FRAC {A + B} {2})> 0 \) , the zero in the interval \ ([a, \ frac { a + b} {2}] \) , the Order \ (b = \ FRAC {A + B} {2} \) , continue from step 1 start determination.

Typically in the range of zero as long as the accuracy of approximation would allow the process may be ended binary approximation. Dichotomy limitation is the inability to re-calculate the complex roots and roots.

Newton iterative method

Newton's Principia Mathematica iteration method

Newton iterative method

The x-axis to find the point \ (x_0 \) , through the point \ (x_0 \) perpendicular to the x-axis perpendicular to do, post \ (F (x) \) at point \ (F (x_0) \) , then another \ (f (x_0) \) points do tangent function, to obtain the intersection of the tangent with the x-axis is referred to as \ (. 1 + n-X_ {} \) , has been the cycle continues, eventually the root approximation obtained:

\[x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}\]

This method can also be used to square root of the value, such as the requirement \ (\ sqrt c \) value, a function can be configured \ (F (X) = X ^ 2 -C \) , find the root of this function, i.e., the right is get the value of $ \ sqrt c $ a. Using the formula,

\[设x_n = t,则 x_{n+1} = t - \frac{t^2 - c}{2t} = \frac{t+\frac{c}{t}}{2}\]

The resulting \ (x_ {n + 1} \) as a new t, into the formula, until the error is less than a certain value, and then returns the answer, t is the square root of the resulting value. T = c can make the initial, easy to calculate. Code for this function is as follows:

public static double sqrt(double c) {
    if(c < 0)
        return Double.NaN;
    double err = 1e-15;
    double t = c;
    while(Math.abs(t-c/t) > err*t)
        t = (c/t+t) / 2.0;
    return t;
}

Guess you like

Origin www.cnblogs.com/itero/p/11007397.html