1
$\begingroup$

Question says to find both intersections between $f(x) = sin(x)$ and $h(x) = cos(x)$ using Newton-Raphson. The interval is [0,5]. To illustrate, here is a chart:

enter image description here

What I've done was:

$f(x) = sin(x) - cos(x)$

and

$f'(x) = cos(x) + sin(x)$

Taking $x_0 = 1$ I'm having the Newton-Raphson not converging, while I was expecting it going to 0.8, it's going way above 3.802915 with 2 iterations.

I'm assuming that my function is not right, but I can't see what I'm doing wrong.

Any tips?

Update:

Iteration table of my attempt:

| n   |  Xn           |  Xn+1      |
| 0   |  1            |  1.965689  |
| 1   |  1.965689     |  2.899324  |
| 2   |  2.899324     |  3.802915  |
$\endgroup$
6
  • $\begingroup$ What did you get after one iteration? $\endgroup$ – André Nicolas Sep 5 '15 at 0:17
  • $\begingroup$ @AndréNicolas First iteration already pointed to 1.965689. That would be n = 0. n = 1 pointed to 2.899324 and 3.802915 to n = 2. $\endgroup$ – Fabiano Araujo Sep 5 '15 at 0:23
  • $\begingroup$ Do a number of iterations (at least 5) starting at 0 to 2 by ,1 and see what happens. $\endgroup$ – marty cohen Sep 5 '15 at 0:29
  • 2
    $\begingroup$ Then there may be an error in the setup. The iteration is $x_{n+1}=x_n -\frac{f(x_n)}{f'(x_n)}$. We have that $f(1)$ is positive, so if $x_0=1$, $x_1$ will be less than $1$. Is your calculator set to radian mode? If you are in degree mode, of course there will be trouble! $\endgroup$ – André Nicolas Sep 5 '15 at 0:30
  • $\begingroup$ You're right @AndréNicolas. Calculator was set to degree mode. Ops! $\endgroup$ – Fabiano Araujo Sep 5 '15 at 0:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.