1. ## Newton Raphson

Any help with this would be greatly appreciated... I haven't been using maths since I finished high school but have a maths test to do tomorrow as part of an interview. Here is a sample question, and I have no idea where to begin with it!

Provide reasoning that the equation:

10 = exp(-2x) + 2^x

has at least one solution in the range 0 <x < 5

Use the Newton Raphson technique to find an approximate solution to the equation.

The Newton Raphson formula provided is:

$
x_2 = x_1 - f(x_1) / f '(x_1)
$

2. The method is quite easy actually, it can just be tedious because you have to do many iterations of the calculation to get a good approximation. The basic idea is that you make an initial guess of the zero, which is x_0 , or x_1 from your post. Then you use that guess to find a closer guess, x_2. Now use x_2 as your guess and you'll get x_3, etc. etc. It can take 20-30 iterations for some functions and 10ish for others, really depends on how close you want to get.

3. Originally Posted by tangehayes
Any help with this would be greatly appreciated... I haven't been using maths since I finished high school but have a maths test to do tomorrow as part of an interview. Here is a sample question, and I have no idea where to begin with it!

Provide reasoning that the equation:

10 = exp(-2x) + 2^x

has at least one solution in the range 0 <x < 5
This part, at least, is easy. If x= 0, exp(-2(0))+ 2^0= 1+ 1= 2. If x= 5, exp(-2(5))+ 2^5= exp(-10)+ 32= 32+ some positive number. Since f(x)= exp(-2x)+ 2^x is the sum of continuous functions, it is continuous itself so, since 10 is between 2 and 32, there must be some x, between 0 and 5 so that exp(-2x)+ 2^x= 10.

Use the Newton Raphson technique to find an approximate solution to the equation.

The Newton Raphson formula provided is:

$
x_2 = x_1 - f(x_1) / f '(x_1)
$
Good! f(x)= exp(-2x)+ 2^x so f'(x)= -2exp(-2x)+ ln(2) 2^x. The rest is arithmetic.

4. Originally Posted by tangehayes
Any help with this would be greatly appreciated... I haven't been using maths since I finished high school but have a maths test to do tomorrow as part of an interview. Here is a sample question, and I have no idea where to begin with it!
Out of curiosity, what kind of job is it? If you don't mind my asking, that is.

Provide reasoning that the equation:

10 = exp(-2x) + 2^x

has at least one solution in the range 0 <x < 5
Rewrite it as

$e^{-2x}+2^x-10=0.$

Call the left-hand expression $f.$ Then $f(x)$ is everywhere continuous, so we may apply the intermediate value theorem.

$f(0)=e^0+2^0-10=1+1-10=-8,$ and $f(5)=e^{-10}+2^5-10=\frac1{e^{10}}+32-10=\frac1{e^{10}}+22,$

which is positive. Since 0 lies between those two values, there must be some value $c,\;0 for which $f(c)=0.$

Use the Newton Raphson technique to find an approximate solution to the equation.
First let's differentiate $f$ to get

$f'(x)=\frac d{dx}\left[e^{-2x}+2^x-10\right]$

$=-2e^{-2x}+(\ln2)2^x.$

So Newton-Raphson gives the formula

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

$=x_n-\frac{e^{-2x_n}+2^{x_n}-10}{-2e^{-2x_n}+(\ln2)2^{x_n}}$

We know there is a zero somewhere in $(0,5),$ so let us take a guess and try $x_1=2.5$ as a starting point. Now we iterate:

$\begin{tabular}{c|c}
x_n&x_{n+1}\\\hline
2.5&3.60975\\
3.60975&3.34869\\
3.34869&3.32199\\
3.32199&3.32175\\
3.32175&3.32174
\end{tabular}$

This should be pretty close.

5. Thanks for that - its very hepful.

I'm just a little confused as to one part of the differentiation. I'm not sure how you are getting the (ln2)2^x when differentiating 2^x - I thought that would have differentiated to 2??

math]

=-2e^{-2x}+(\ln2)2^x.
[/tex]

The interview is for a software engineering role in financial services by the way!

6. Whenever you have the form of a constant to a power, $a^x$ the derivative of it is $a^x*\ln(a)*dx$

7. Originally Posted by tangehayes
...

I'm just a little confused as to one part of the differentiation. I'm not sure how you are getting the (ln2)2^x when differentiating 2^x
...
If
$f(x) = 2^x$ you can re-write the RHS to:

$f(x)=\left(e^{\ln(2)}\right)^x = e^{\ln(2)\cdot x}$

Use the chain rule to differentiate this function and you'll get the formula Jameson has posted.

8. Originally Posted by Reckoner
...
So Newton-Raphson gives the formula

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

$=x_n-\frac{e^{-2x_n}+2^{x_n}-10}{-2e^{-2x_n}+(\ln2)2^{x_n}}$

We know there is a zero somewhere in $(0,5),$ so let us take a guess and try $x_1=2.5$ as a starting point. Now we iterate:

$\begin{tabular}{c|c}
x_n&x_{n+1}\\\hline
2.5&3.60975\\
3.60975&3.34869\\
3.34869&3.32199\\
3.32199&3.32175\\
3.32175&3.32174
\end{tabular}$

This should be pretty close.
Originally Posted by tangehayes
...

Use the Newton Raphson technique to find an approximate solution to the equation.

The Newton Raphson formula provided is:

$
x_2 = x_1 - f(x_1) / f '(x_1)
$
From Reckoner's post you could assume that you have a lot of typing to do. But there is a short cut. If and only if your calculator has a $\boxed{\text{ANS}}$ - key the calculation is very easy.

Type:

2.5 $\boxed{\text{=}}$

Type $\boxed{\text{ANS}}$ instead of $x_n$ in Reckoner's term:

$\boxed{\text{ANS}}$ - ((e^(-2* $\boxed{\text{ANS}}$) + 2^ $\boxed{\text{ANS}}$ - 10) / (-2*e^(-2* $\boxed{\text{ANS}}$)+ln(2)*2^ $\boxed{\text{ANS}}$)) $\boxed{\text{=}}$

Now the new result is written into the $\boxed{\text{ANS}}$ and you only have to press the $\boxed{\text{=}}$ - key until two consecutive results are equal.

9. Originally Posted by earboth
From Reckoner's post you could assume that you have a lot of typing to do. But there is a short cut. If and only if your calculator has a $\boxed{\text{ANS}}$ - key the calculation is very easy.
That's exactly how I did it on my end--I just copied and pasted the values! Thanks for pointing that out, as entering in all of those digits repeatedly could become quite tedious.