Home > Back-end >  Newton iteration method for multivariate approximation equation root
Newton iteration method for multivariate approximation equation root

Time:09-21

Problems. The Newton iteration method for ax ^ 3 + bx cx + d=0 ^ 2 + in 1 near the root, their input by the user (coefficient)

Because this method itself is math problems do not discuss here also do not need to discuss, to enter the theme of our programming,

Remember this formula: x=x0 (x0) - f/f '(x0). We make the x1=f (x0), x2=f' (x0), so to write clear and concise,

Steps: (1) any near 1 to find a real number as the initial value of x0, such problem, we take x=1, let x0=x, namely x0=1.

(2) with the initial value x0 into the equation to calculate f (x0) and f '(x0). And the x1 and x2;

(3) into the core formula to calculate the x=x0 (x0) - f/f '(x0) the value of the

(4) are replaced with new x the original x0, preparing for the next iteration,

(5) if | x - x0 | & gt; E=1-5; Is to continue the iteration, otherwise turn (6).

(6) the x which is far equation ax ^ 3 + bx cx + d=0 ^ 2 + the root of the output,

HTML code is as follows: (after VS2008 and correct testing input output: 1, 2, 3, 4-1.65)

#include

#include

Double getRes (double a, b double, double c, double d) {

Doublex=1, x0, x1, x2,

Do {

X0=x;

X1=a * * * x x x + b * x * x * x + c + d.

X2=3 * a * b * x * x + 2 * x + c;

X=x0 - x1 and x2;

} while (fabs (x - x0) & gt; E=1-5);

return x;

}

Int main () {

Doublea, b, c, d;

The scanf (" % % lf, lf and lf %, % lf ", & amp; A, & amp; B, & amp; C., & amp; D);

Printf (" x=% 2 lf \ n ", getRes (a, b, c, d));

return 0;

}

CodePudding user response:

Baidu search relevant keywords,

CodePudding user response:

There should be four solutions

CodePudding user response:

The
reference 4 floor & lt; Span style="color: # 4788 c7" & gt; JL_Xie & lt;/span> Response:
it should have four solution
& lt; Br/& gt; Three, said was wrong
  • Related