# Thread: newton method

1. ## newton method

Please tell me how to do this.

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

2. Originally Posted by kwivo
Please tell me how to do this.

Use Newton's method to find the absolute maximum value of the function f(x) = xcos(x), 0 ≤ x, correct to six decimal places.
it seems to me i've seen this problem before. you're not double posting, are you?

anyway, here goes. i'll start you off.

so remember, for the absolute max, we want to find the largest value for the function on the interval we are considering. now this value may occur at the endpoints, or it may occur at a local maximum within the interval, so let's check those.

$f(x) = x \cos x$ for $0 \le x \le \pi$

$\Rightarrow f'(x) = \cos x - x \sin x$, $0 \le x \le \pi$

(1) check the value of the function at the end points

$f(0) = 0$

and

$f(\pi) = - \pi$

(2) check the value of the function at the critical points

for the critical points, set $f'(x) = 0$

$\Rightarrow \cos x - x \sin x = 0$

now this is relatively hard to solve, here is where we will need Newton's method, to find the critical point.

recall that Newton's method says that if we are given an approximation $x_n$ for the zero of a function, we can get a better approximation $x_{n + 1}$ by way of the formula:

$x_{n + 1} = x_n - \frac {f(x_n)}{f'(x_n)}$ .....................(1)

now, take your first guess to be 1. thus you have $x_1 = 1$

so you will find the second approximation, $x_2$, by:

$x_2 = 1 - \frac {f(1)}{f'(1)}$

now calculate $x_2$. when you get $x_2$, plug it in for $x_n$ in (1) to get the third approximation $x_3$, that is, find:

$x_3 = x_2 - \frac {f(x_2)}{f'(x_2)}$

continue to do this until you realize that your value for $x_n$ has the first 6 decimal places constant. then take that to be the critical point. then, calculate the value of the function at that point. then pick the absolute max.

(note, think of $x$ to be in radians)

3. No I'm not double posting. I introduced a friend to this site for help, so he might have posted a similar question...

Why did you choose 1 to be the first guess?

4. Originally Posted by kwivo
No I'm not double posting. I introduced a friend to this site for help, so he might have posted a similar question...

Why did you choose 1 to be the first guess?
just a guess. the interval was not that large here, so it's not like i can be way off. also, f'(1) was relatively close to zero (it was something like -0.3), so i chose that.