How can I find the root of $f(x)=x^2-\cos(x) \qquad [0,2\pi]$ using Newton method?

192 Views Asked by At

Considering to apply the Newton method to find $f$ root, which is the initial value of $x_0$:

\begin{cases} x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)} \\ x_0=? \end{cases}


Study of the function $f$ on the interval $[0,2\pi]$:


$$f(0) \ f(2\pi)<0$$ $$f'(x)=2x+\sin(x)>0 \qquad \forall x \in [0,2\pi]$$


So: $$\exists! \qquad x^*\in [0,2\pi]: f(x^*)=0$$


Theorem of Newton method convergence: $$sign (x_0-x^*)=sign(f' f'')$$


$$f''(x)=2+\cos(x)$$ $$sign(f' f'')=1$$


$$x_0=2\pi$$

Is it correct?

Thanks!

2

There are 2 best solutions below

0
On BEST ANSWER

$x^2-\cos(x)$ is increasing and convex on $[0,2\pi]$, hence if you start Newton's iteration at the right of the only root you get a decreasing sequence converging to your root (with the chance to employ some steps of the secant method in-between to improve the convergence speed). Since $1^2-\cos(1)$ is positive but not that large, it is not a bad idea to start iterating at $x_0=1$.

With few iterations we get that the root is at $\approx 0.8241323123$.

0
On

You can try just about anything as $x_0$, and see where it leads you. $x_0 = 0$ would get you in trouble right away, as $f'(0) = 0$; $x_0$ too close to $0$ would also be bad because $f'(0)$ will be nearly $0$, leading to a very large $x_1$. $x_0 = \pi/4$ might be a good choice, because $f(\pi/4)$ is rather close to $0$.