# Math Help - Newton-Raphson

1. ## Newton-Raphson

This is the entire problem...

Use 2 repetitions of the Newton-Raphson algorithm to find the value of x near zero for which e^x=2cosx. (answer to 3 decimal places)

What I've done so far...

e^x=2cosx
x=ln(2cosx)
f'(x)=-tanx

xo=0

x1=0-(ln(2cos0)/(-tan0))

.....this is where I get stuck b/c my calculator says ERROR since I can't divide by 0. What am I doing wrong???

2. Originally Posted by Foxtenn5
This is the entire problem...

Use 2 repetitions of the Newton-Raphson algorithm to find the value of x near zero for which e^x=2cosx. (answer to 3 decimal places)

What I've done so far...

e^x=2cosx
x=ln(2cosx)
f'(x)=-tanx

xo=0

x1=0-(ln(2cos0)/(-tan0))

.....this is where I get stuck b/c my calculator says ERROR since I can't divide by 0. What am I doing wrong???
Do as many methods as you need to to get this

$f_{n+1}=x_n+\frac{f(x_n)}{f'(x_n)}$

We are trying to find the intersection or in other words the zeros of the difference of the two equations?

So we have $e^{x}=2\cos(x)\Rightarrow{e^{x}-2\cos(x)=0}$

We have out equal to zero...therefore our function is $e^{x}-2\cos(x)$

3. ## Is this how to do it?

e^x-2cosx
f'(x)=e^x+2sinx

Xo=0 (?)

X1=0-((e^0-2cos0)/(e^0+2sin0))=1

X2=1-((e^1-2cos1)/(e^1+2sin1))=0.627904

I ended up with 0.628, but this doesn't seem to be the exact zero.

4. Originally Posted by Foxtenn5
e^x-2cosx
f'(x)=e^x+2sinx

Xo=0 (?)

X1=0-((e^0-2cos0)/(e^0+2sin0))=1

X2=1-((e^1-2cos1)/(e^1+2sin1))=0.627904

I ended up with 0.628, but this doesn't seem to be the exact zero.
Yes...this is a good approximation...that is what this is...just an approximation..the actual answer is .539...but to get that you would have to do a few more iterations...this is good enough for what you were asked to do...good job

5. Originally Posted by Mathstud28
Do as many methods as you need to to get this

$f_{n+1}=x_n+\frac{f(x_n)}{f'(x_n)}$

We are trying to find the intersection or in other words the zeros of the difference of the two equations?

So we have $e^{x}=2\cos(x)\Rightarrow{e^{x}-2\cos(x)=0}$

We have out equal to zero...therefore our function is $e^{x}-2\cos(x)$
NR gives the itteration:

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

Then five iterations give:

Code:
>x0=0
0
>x1=x0-(exp(x0)-2*cos(x0))/(exp(x0)+2*sin(x0))
1
>x1=x1-(exp(x1)-2*cos(x1))/(exp(x1)+2*sin(x1))
0.627904
>x1=x1-(exp(x1)-2*cos(x1))/(exp(x1)+2*sin(x1))
0.544207
>x1=x1-(exp(x1)-2*cos(x1))/(exp(x1)+2*sin(x1))
0.539797
>x1=x1-(exp(x1)-2*cos(x1))/(exp(x1)+2*sin(x1))
0.539785
So after 2 iterations you have a relativly poor approximation, you realy need more iterations

RonL