# Math Help - Newton's Method question.

1. ## Newton's Method question.

I don't know which initial xsub1 value works best for the problem below, can anyone help me? In other words, how would one start the problem?

Use Newton's method to find the absolute maximum value of the function f(x) = x sin x, 0 ≤ x ≤ pi, correct to six decimal places.

I took the derivative of the function and got sin x+xcosx. Then I took the derivative again and called the new function g(x) and got 2cosx-xsinx.

Thanks for your help and effort

2. Originally Posted by ioke09
I don't know which initial xsub1 value works best for the problem below, can anyone help me? In other words, how would one start the problem?

Use Newton's method to find the absolute maximum value of the function f(x) = x sin x, 0 ≤ x ≤ pi, correct to six decimal places.

I took the derivative of the function and got sin x+xcosx. Then I took the derivative again and called the new function g(x) and got 2cosx-xsinx.

Thanks for your help and effort
You need to solve for sinx+xcosx=0.
(the 2nd derivative being <0 verifies that the turning point is a local maximum,
however you need to ensure the point you choose is to the right of the 2nd derivative =0).

Sinx=0 if x=0 or ${\pi}$

Both sinx and x are positive or zero from x=0 to ${\pi}$

hence the graph rises to a maximum and falls to zero.

You could simply choose x=2 as an alternative to $\frac{\pi}{2}$

3. Would this be how you would start the next step? I'm not sure how to do Newton's method with trig functions.

xsub1= 2

xsub2= xsub1 - f(xsub1)/f'(xsub1)=

4. Originally Posted by ioke09
Would this be how you would start the next step? I'm not sure how to do Newton's method with trig functions.

xsub1= 2

xsub2= xsub1 - f(xsub1)/f'(xsub1)=
Yes,

once you have your initial function set up as f(x)=0,
the Newton-Raphson method will "home in" on the zero,
where the graph crosses the x-axis.

So you take the first derivative and use the iterative formula
as you would for non-trigonometric functions also.

However, because the function may cross the x-axis repeatedly,
it is important that you be quite careful in your choice of initial approximation
to the root of f(x)=0, to avoid jumping to a different part of the graph
on the subsequent iterations.

5. Originally Posted by ioke09
I don't know which initial xsub1 value works best for the problem below, can anyone help me? In other words, how would one start the problem?

Use Newton's method to find the absolute maximum value of the function f(x) = x sin x, 0 ≤ x ≤ pi, correct to six decimal places.

I took the derivative of the function and got sin x+xcosx. Then I took the derivative again and called the new function g(x) and got 2cosx-xsinx.

Thanks for your help and effort
The maximum corresponds to the solution of the equation $f^{'} (x)= x\ \cos x + \sin x =0$ and the Newton Raphson method allows You to find with the iterations...

$\displaystyle \Delta_{n} = x_{n+1} - x_{n} = - \frac{f^{'} (x_{n})}{f^{''} (x_{n})} = \varphi (x_{n})$ (1)

... starting from an appropriate value $x_{1}$. The function $\displaystyle \varphi(x)= \frac{x\ \cos x+ \sin x}{x\ \sin x - 2\ \cos x}$ is illustrated here...

There is only one 'attractive fixed point' for $x_{0} \sim 2$ but the initial point $x_{1}$ must be selected with care if You want the convergence. Pratically the condition for convergence is done by $|\varphi (x_{1})| < |2\ (x_{0} - x)|$ as indicated by the 'red line' in the figure...

Kind regards

$\chi$ $\sigma$

6. I chose xsub1=2, but the function never really converges as I don't get iterations with the same exact result rounded to a few decimal places.

Does anyone know if a better number to pick is something greater than pi/2?

7. Originally Posted by ioke09
I chose xsub1=2, but the function never really converges as I don't get iterations with the same exact result rounded to a few decimal places.

Does anyone know if a better number to pick is something greater than pi/2?
Did you get $x_2=2.029\;?$

8. Originally Posted by ioke09
I chose xsub1=2, but the function never really converges as I don't get iterations with the same exact result rounded to a few decimal places.

Does anyone know if a better number to pick is something greater than pi/2?
According to my computer the sequence obtained be recursive relation...

$\displaystyle x_{n+1} = x_{n} + \frac{x_{n}\ \cos x_{n} + \sin x_{n}}{x_{n}\ \sin x_{n} - 2\ \cos x_{n}}$ (1)

... starting from $x_{1}=2$ is...

$x_{1} = 2$

$x_{2} = 2.02904828059...$

$x_{3} = 2.02875786608...$

$x_{4} = 2.02875783811...$

... and for n>4 the result, in 12 decimals, is always the same...

Kind regards

$\chi$ $\sigma$