+0

# Hi, again, exam time. Newton Raphson method

0
622
17
+1314

Q: x cos(x) - 1/x.

Thanks, where did I go wrong?

Additionally, this site both in structure (scheme) and naviagtion where messaging and old posts are involved has discouraged me from using the site. I'd have rathered that the anonymous posting went from the site and that it remained the same as it was. I cannot easily see my posts from the profile or menu (top right), and when searching you cannot go to your last comment you must go to the original post which could be some time ago in last posts. And the white scheme is a bit drab, and makes things hard on the eyes visually. Might be the font and size.

Stu  May 30, 2014

#12
+90023
+5

Let me see if I can help you with this...here's what Alan is saying...

Let's "guess" that the "zero" of the function is "4.005"

The "method," in simple terms, is just this:

(Our guess) - (Our Guess put into the function)/ (Our guess put into the derivative) = (The next "guess")

So we have

(4.005)- [4.005cos(4.005) - (1/4.005)]/[ cos(4.005)-(4.005)sin(4.005) + (1/(4.005)2] = (The next "guess")

Now.......if the "next guess" happens to be 4.005, we have found the "zero." If not, we put this "next guess" into the "formula" and evaluate that.  Notice that, when Alan put 4.005 in, he got back 5.16612. That's not equal to 4.055, so we put 5.16612 in the mill and it cranks out 4.76159. Still no "match" from the previous "guess".....

So he puts 4.76159 into the mill and gets back 4.75661...still no match.....then, he puts 4.75661 into the "formula" and gets back 4.7566....AHA!!......we're on to something!! Notice that this "new" answer is really close to the last one!!

Just to be sure, he puts this "new" answer ("guess") into the formula once more and gets out (wait for it)........4.7566.....note this matches the last "answer," so we've found the "zero.'

See how that works??

(Sometimes - particularly if I have a graph of the function - I find it easier just to evaluate the function at various values just to see if I can find something "close" to zero. This is sometimes less cumbersome than Newton's Method - if you can make some good "guesses.")

Hope i've been of some help!!

CPhill  Jun 1, 2014
#1
+1314
0

I put in the missing bracket but it still is wrong.

Stu  May 30, 2014
#2
+1314
0

Answer given is 5.166r solved to the 1st degree of accuracy.

Stu  May 30, 2014
#3
+890
+5

I don't recognise your calculation as Newton-Raphson. Where does that ln come from ?

If f(x)=x.cos(x)-1/x, then f '(x)=cos(x)-x.sin(x)+1/(x^2), (angles in radians).

Then x(n+1)=x(n)-f(x(n))/f '(x(n)).

Bertie  May 30, 2014
#4
+1314
0

$${f}{\left({\mathtt{x}}\right)} = {\mathtt{x}}{\mathtt{\,\times\,}}\underset{\,\,\,\,^{{360^\circ}}}{{cos}}{\left({\mathtt{x}}\right)}{\mathtt{\,-\,}}{\frac{{\mathtt{1}}}{{\mathtt{x}}}}$$

Stu  May 30, 2014
#5
+27056
+5

If you are trying to find a zero of xcos(x)-1/x you should note that there are an infinite number of them - see the graph below.

There is no solution at 5.166 radians!

$${\mathtt{5.166}}{\mathtt{\,\times\,}}\underset{\,\,\,\,^{{360^\circ}}}{{cos}}{\left({\frac{{\mathtt{5.166}}{\mathtt{\,\times\,}}{\mathtt{180}}}{{\mathtt{\pi}}}}\right)}{\mathtt{\,-\,}}{\frac{{\mathtt{1}}}{{\mathtt{5.166}}}} = {\mathtt{2.070\: \!241\: \!313\: \!464\: \!202\: \!4}}$$

Alan  May 30, 2014
#6
+1314
0

I want to solve it, with 4.005rad to get the answer 5.166 rad. But my answer was wrong. I dont undestand your meanings, of putting the 5.266 into the question. How did you get it. Is that the second step of the formula or just proof?

Stu  May 31, 2014
#7
+1314
0

I found my error in the 1/x when i made it lnx. I have reworked it to make -(1/x) = derivative: 1/x^2 which should be right. I hope. Is that the only error I made?

Stu  May 31, 2014
#8
+1314
0

I tried again from the start. I stil lcan't get it and don't know what i need to do different/ what im doing wrong. I took the derivative/product rule or all  value. What's missing?

Stu  May 31, 2014
#9
+27056
+5

1.  The point of putting 5.166 radians into the function was to show that the result was not zero.  In other words, 5.166 is not a root of the function (a "root" is a value that makes the function equal to zero).

2. The Newton-Raphson method requires iteration.  That is, you take the result that appears from your initial guess for x and you put it back into the formula to get another guess.  You then take the result of that and keep repeating the process until the output x is the same as the input x.  You have then converged on a solution.  Perhaps the image below might help.

You can see that 5.166 is just the result of the first iteration when you use 4.005 as an initial guess.

You have used 4.005° inside the sin and cos functions, but you must have 4.005 radians.  Also you should have a 4.005 multiplying the sin term in the denominator (for the first iteration only, of course.  It should be the latest estimate of x for the other iterations).

Alan  May 31, 2014
#10
+1314
0

I believe m last answer was right in radians, though i forgot it initially and had that in degrees. If it is right what does the comment mean, "Also you should have a 4.005 multiplying the sin term in the denominator (for the first iteration only, of course." So was my answer not the correct form?

Stu  Jun 1, 2014
#11
+1314
0

I tried again this morning -  I got the answer 4.6877..... But it is wrong. Where is my mistake this time. That was in radians on wolfram alpha.

Stu  Jun 1, 2014
#12
+90023
+5

Let me see if I can help you with this...here's what Alan is saying...

Let's "guess" that the "zero" of the function is "4.005"

The "method," in simple terms, is just this:

(Our guess) - (Our Guess put into the function)/ (Our guess put into the derivative) = (The next "guess")

So we have

(4.005)- [4.005cos(4.005) - (1/4.005)]/[ cos(4.005)-(4.005)sin(4.005) + (1/(4.005)2] = (The next "guess")

Now.......if the "next guess" happens to be 4.005, we have found the "zero." If not, we put this "next guess" into the "formula" and evaluate that.  Notice that, when Alan put 4.005 in, he got back 5.16612. That's not equal to 4.055, so we put 5.16612 in the mill and it cranks out 4.76159. Still no "match" from the previous "guess".....

So he puts 4.76159 into the mill and gets back 4.75661...still no match.....then, he puts 4.75661 into the "formula" and gets back 4.7566....AHA!!......we're on to something!! Notice that this "new" answer is really close to the last one!!

Just to be sure, he puts this "new" answer ("guess") into the formula once more and gets out (wait for it)........4.7566.....note this matches the last "answer," so we've found the "zero.'

See how that works??

(Sometimes - particularly if I have a graph of the function - I find it easier just to evaluate the function at various values just to see if I can find something "close" to zero. This is sometimes less cumbersome than Newton's Method - if you can make some good "guesses.")

Hope i've been of some help!!

CPhill  Jun 1, 2014
#13
+90023
0

Stu...your answer is "wrong" because 4.005 ISN'T a zero....look at my previous post...it's a pretty detailed explanation of the proceedure - in simple terms....

CPhill  Jun 1, 2014
#14
+1314
0

we are asked to find the 1st solution only with the guess 4.005rad and the answer to get is 5.166rad. Although my maths isn't getting that answer i believe it is going wrong somewhere in solving the formula. The anser is 5.166 because i got this once. But im not getting it every time. I do not need to solve more degrees of accuracy to get the 5.166 radian answer. It is the answer for the x0 + 1= 1
As seen in alans answer his first solution is 5.166 although mine is not this answer. I am trying only to find where is my mistake, or have the way to input it, and way the equation final step should look, / identify my mistake to get the right answer.)

Stu  Jun 1, 2014
#15
+1314
0

in radian my answer is 4.54 regularly. There is something i have missed.

Stu  Jun 1, 2014
#16
+27056
0

Look very carefully at your denominator Stu.  here is a copy of your last posted attempt:

The sin term should be multiplied by 4.005. You have added 4.005 to it.

Alan  Jun 1, 2014
#17
+1314
0

Aha, spot on. That would be what Im looking for. Thanks.

It was mentioned earlier but i didn't understand why or see why. I get it now, a part of the product rule, and totally overlooked. Cheers.

Stu  Jun 1, 2014