[Math] Solving $\sin x = x^3-2x^2+1$ using Newton’s Method

calculusnumerical methods

Given $2$ equations:
$$\text{1) }\ y= \sin (x),\ \ \ \text{2) }\ y= x^3-2x^2+1.$$
I was told to look a graph online, and then solve using newton's method. After looking it up, I realized that there are $3$ separate intervals in which you had to solve on.

I set $\sin (x)$=$3x^2-2x^2+1$. Then I moved $\sin(x)$ over, getting $x^3-2x^2+1-\sin(x)=0$, with the interval $[0,1]$.
Then, I set up, and used Newton's equation.
$$x_{n+1}=x_n-{x_n^3-2x_n^2+1-\sin(x_n)\over 3x_n^2-4x_n-\cos(x_n)}.$$
After making a common denominator and simplifying more, I got:
$$x_{n+1}= {2x_n^3-2x_n^2-\cos(x_n^2)+\sin(x_n)-1\over 3x_n^2-4x_n-\cos(x_n)}.$$
After doing Newton's method on my calculator, the values keep jumping around. I started with $x_1=1$. The real answer is about $.568$. When using newtons method, for $x_2$, I got $.294$… and $x_3 \sim .935$ and $x_4 \sim .3514$…

The numbers keep jumping around. I'm confused what I did wrong. Did I do the wrong range, or am I plugging it into my calculator wrong, or is my equations wrong?

Best Answer

I did not not understand why, starting with $x_0=1$, you have problem $$f(x)=x^3-2 x^2+1-\sin (x)$$ $$f'(x)=3 x^2-4 x-\cos (x)$$ $$x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}=\frac{2 x_n^3-2 x_n^2+\sin (x_n)-x_n \cos (x_n)-1}{3 x_n^2-4 x_n-\cos (x_n)}$$ So, the iterates are $$\left( \begin{array}{cc} n & x_n \\ 0 & 1 \\ 1 & 0.5798249292 \\ 2 & 0.5765888390 \\ 3 & 0.5765861544 \end{array} \right)$$

In fact, your first formula is totally correct but "after making a common denominator and simplifying more", there is a "small" mistake : $x_n \cos(x_n)$ is not $\cos(x_n^2)$.