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:

$\displaystyle 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:

$\displaystyle 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

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

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

$\displaystyle f(0)=e^0+2^0-10=1+1-10=-8,$ and $\displaystyle 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 $\displaystyle c,\;0<c<5,$ for which $\displaystyle f(c)=0.$

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

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

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

So Newton-Raphson gives the formula

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

$\displaystyle =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 $\displaystyle (0,5),$ so let us take a guess and try $\displaystyle x_1=2.5$ as a starting point. Now we iterate:

$\displaystyle \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, $\displaystyle a^x$ the derivative of it is $\displaystyle 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
$\displaystyle f(x) = 2^x$ you can re-write the RHS to:

$\displaystyle 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

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

$\displaystyle =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 $\displaystyle (0,5),$ so let us take a guess and try $\displaystyle x_1=2.5$ as a starting point. Now we iterate:

$\displaystyle \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:

$\displaystyle 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 $\displaystyle \boxed{\text{ANS}}$ - key the calculation is very easy.

Type:

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

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

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

Now the new result is written into the $\displaystyle \boxed{\text{ANS}}$ and you only have to press the $\displaystyle \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 $\displaystyle \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.