Home > Back-end >  The Newton iteration method solving high order equation and transcendental equation, the novice
The Newton iteration method solving high order equation and transcendental equation, the novice

Time:10-03



Using iterative method
Solution of x * sin (x)=1

And the

41 + x x ^ ^ 3 + 1=0 the root of the near - 1

I used the xn + 1=xn - f (xn)/f '(xn) formula

This is x * sin (x)=1 code
 # include & lt; stdio.h> 
# include & lt; Math. H>
Eps 1 e - 6 # define

Int main (void)
{
Float x0, x1;

X0=2.0;
X1=(1 + x0 x0 * * cos (x0))/(sin (x0) + x0 * cos (x0));

Do
{
X0=x1;
X1=(1 + x0 x0 * * cos (x0))/(sin (x0) + x0 * cos (x0));
} while (fabs (x0 - x1) & gt; Eps);

Printf (" % f ", the x1);

return 0;
}


The result is not stand
1.114157 back to equationAnd the initial value is 2 when the result is 9.317243, back to the established equation is not
Initial value change results every time changed?


This is 41 + x x ^ ^ 3 + 1=0 code

 # include & lt; stdio.h> 
# include & lt; Math. H>
Eps 1 e - 6 # define



Int main (void)
{
Float x0, x1;

X0=2.0;
X1=x0 - ((x0, 41) + (pow pow (x0, 3) + 1)/(x0, 40) + 3 * (pow pow (x0, 2)));

Do
{
X0=x1;
X1=x0 - ((x0, 41) + (pow pow (x0, 3) + 1)/(x0, 40) + 3 * (pow pow (x0, 2)));

} while (fabs (x1 - (1)) & gt; Eps);

Printf (" % f \ n ", the x1);


return 0;
}




The result is 1. # IND00 is said to be zero divisor as??


Consult everybody!!!!!!!!!! Thank you very much!!!!!!

CodePudding user response:

Fyi:
//in C language programming, and the 2 ^ ^=x x 10 solution of this equation, 
# include & lt; Math. H>
# include & lt; stdio.h>
Double x, e;
Void main () {
X=1.0;
E=0.001;
While (1) {
While (1) {
If (pow (2.0 x) & lt; Pow (10.0), x) {
X +=e;
} else {
break;
}
}
E/=10.0;
If (e<1 e - 15) break;
While (1) {
If (pow (2.0 x) & gt; Pow (10.0), x) {
X=e;
} else {
break;
}
}
E/=10.0;
If (e<1 e - 15) break;
}
Printf (" % +. 14 g \ n ", x);

X=1.0;
E=0.001;
While (1) {
While (1) {
If (pow (2.0 x) & gt; Pow (10.0), x) {
X +=e;
} else {
break;
}
}
E/=10.0;
If (e<1 e - 15) break;
While (1) {
If (pow (2.0 x) & lt; Pow (10.0), x) {
X=e;
} else {
break;
}
}
E/=10.0;
If (e<1 e - 15) break;
}
Printf (" % +. 14 g \ n ", x);
}

CodePudding user response:

There are innumerable solution of the equation you can draw a picture to look at, Newton iterative method is dependent on the initial value, different initial conditions, convergence range would lead to convergence results are different, 1.114157 and 9.317243 above is right, should be you back arc and Angle conversion,
  • Related