# Newton-Raphson method

1. Jul 11, 2007

### Schrodinger's Dog

1. The problem statement, all variables and given/known data

Using the Newton Raphson formula to calculate a solution for

$$x^2-8cos(x)$$

2. Relevant equations

$$x_n+1=x_n-\frac{f(x_n)}{f'(x_n)}(n=0,1,2,3)$$

3. The attempt at a solution

I get

$$x_n-\frac{x^2-8cos(x)}{2x+8sin(x)}$$

Fine but how do I chose an initial term $x_0=?$ the book does not tell me why it has chosen the initial term in its singular example, and since it appears to be random or arbitrary :uhh:

Last edited: Jul 11, 2007
2. Jul 11, 2007

### J77

I think the initial guess is just that... a guess.

However, it can be an educated guess -- eg. from a previously computed value if a parameter is allowed to vary, or in your case from looking at the intersection of the graphs $$x^2$$ and $$8\cos(x)$$

Graphs are also good to see if a solution exists!

Last edited: Jul 11, 2007
3. Jul 11, 2007

### Integral

Staff Emeritus
I would just pick a number between 0 and 2$\pi$.

Or you could try graphing the original function, use the graph to find some approximate roots.

Newtons method is pretty robust, in can bring in a wild guess quickly.

4. Jul 11, 2007

### joshd

Plot y=f(x) on a graph, and pick an integer starting point near to the root. The method will then usually converge, but it doesn't always work, eg, when it crosses asymptotes etc.

5. Jul 11, 2007

### Schrodinger's Dog

Wow that was a quick answer, thanks. I don't know how your supposed to just divine that at random; sometimes I wish text books would actually show what they have done in detail, after all I bloody have to or they dock marks generally the course material is excellent but every now and again they expect you to be psychic

I suppose it would logically make sense the answer would be between this range.

Ill try $\pi$ see what I get.

EDIT.

I used 2 and got the answer 2.0859345838069 after 5 iterations. Thanks guys, this agrees with the answer I expected

Last edited: Jul 11, 2007
6. Jul 11, 2007

### caslav.ilic

It doesn't tell because it can't -- choosing the initial point is the sore spot of Newton's method, giving rise to many other methods which precisely try to circumvent that problem.

For the Newton method to provably converge to a solution, the first derivative of the function has to be positive (or negative) and monotonically decreasing (or increasing) all the way between the initial guess and that solution.

So, one way to choose initial point is to look at the graph and pick a point from which the function "nicely" slopes down to zero.

Hm, if the function is as stated orginally, $$x^2 - 8\cos x$$, then the solution near to 2 should be about 1.343.

--
Chusslove Illich (Часлав Илић)

7. Jul 11, 2007

### Schrodinger's Dog

Don't worry about it I was doing a different question there, and you weren't to know that yes for the original problem I get that also.

to be honest they don't even give any pointers as you have just done ie looking for a value that slopes to zero from the graph, so your pretty much in the dark, obviously people are expected to know what they are looking for, but I didn't.

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook