# Using Newton-Raphson method, find the solution for $e^{\frac{x^2}{4vt}} = 1+\frac{x^2}{2vt}$

I need help with solving this difficult fluid dynamic expression. I have tried using rules of logs, symbolab algebra calculator and Wolfram Alpha calculator, and I have got no solution.

How would you solve the following expression USING the NEWTON-RAPHSON method for $$x$$? $$e^{\frac{x^2}{4vt}} = 1+\frac{x^2}{2vt}$$

When solving this USING the NEWTON-RAPHSON method, the solution is: $$x=2.2418\sqrt{vt}$$

I want to know how you could solve the first expression using the NEWTON-RAPHSON method to get the solution. So could someone please provide a step-by-step solution, by using this method please?

Note: This question was answered, however it was NOT answered using NEWTON-RAPHSON method. It was answered using the Lambert W function, which is a very long and complicated process as compared to the Newton-Raphson method.

Let $$u = \frac{x^2}{4 v t}$$ so that $$e^u - 1 - 2u = 0.$$

Defining $$g(u) = e^u - 1 - 2u,$$ we iterate $$u \mapsto u - \frac{g(u)}{g'(u)} ,$$ $$u \mapsto \frac{1 +(u-1)e^u}{e^u - 2}$$

? u = 1.25
%9 = 1.250000000000000000000000000
? u = ( 1 + (u-1) * exp(u)    ) / (exp(u)-2 )
%10 = 1.256479745141752637179209827
? u = ( 1 + (u-1) * exp(u)    ) / (exp(u)-2 )
%11 = 1.256431211361022818343348929
? u = ( 1 + (u-1) * exp(u)    ) / (exp(u)-2 )
%12 = 1.256431208626169685666336003
? u = ( 1 + (u-1) * exp(u)    ) / (exp(u)-2 )
%13 = 1.256431208626169676982737617
? u = ( 1 + (u-1) * exp(u)    ) / (exp(u)-2 )
%14 = 1.256431208626169676982737617
?


We find that $$\frac{x^2}{4vt} = 1.256431208626169676982737617$$ so $$x^2 = 5.025724834504678707930950466 \; vt$$ $$x = 2.241812845557068063953533471 \; \sqrt {vt}$$

• Thank you very much @Will – Alan Glenn Jan 3 at 22:45
• My final question is, when choosing the initial value 'u', do we always plot the '$u \mapsto u - \frac{g(u)}{g'(u)}$' expression and also plot the 'y=u' expression and wherever they intercept we choose that as the initial value of u? – Alan Glenn Jan 3 at 22:51
• @AlanGlenn I added in a picture of $y=e^u - 1 - 2u,$ and I do recommend graphing that. That is where I got the initial estimate 1.25, looking at that picture. – Will Jagy Jan 3 at 23:18

Well, we have:

$$\exp\left(\frac{x^2}{4\cdot\text{v}\cdot t}\right)=1+\frac{x^2}{2\cdot\text{v}\cdot t}\tag1$$

Now, we know that we can write:

$$\exp\left(\alpha\right)=\sum_{\text{n}=0}^\infty\frac{\alpha^\text{n}}{\text{n}!}=\frac{\alpha^0}{0!}+\frac{\alpha^1}{1!}+\frac{\alpha^2}{2!}+\dots=$$ $$1+\alpha+\frac{\alpha^2}{2}+\dots\tag2$$

So, for equation $$(1)$$ we can write:

$$1+\frac{x^2}{4\cdot\text{v}\cdot t}+\frac{1}{2}\cdot\left(\frac{x^2}{4\cdot\text{v}\cdot t}\right)^2+\dots=1+\frac{x^2}{2\cdot\text{v}\cdot t}\tag3$$

Using the aproximation of three terms we have:

$$1+\frac{x^2}{4\cdot\text{v}\cdot t}+\frac{1}{2}\cdot\left(\frac{x^2}{4\cdot\text{v}\cdot t}\right)^2\approx1+\frac{x^2}{2\cdot\text{v}\cdot t}\space\Longleftrightarrow\space$$ $$x\approx0\space\vee\space x\approx\pm2\sqrt{2}\cdot\sqrt{\text{v}\cdot\text{t}}\tag4$$

• That is the wrong answer. $2\sqrt{2}=2.828$ which is not the same as 2.2418. – Alan Glenn Jan 3 at 18:50
• @AlanGlenn It is not wrong! – Jan Jan 3 at 19:00

First express this in terms of a single variable: letting $$s = x/\sqrt{vt}$$, the equation becomes $$e^{s^2/4} = 1 + s^2/2$$ Now with $$f(s) = \exp(s^2/4) - (1 + s^2/2)$$, $$f'(s) = s \exp(s^2/4)/2 - s$$, and the Newton iteration is $$s_{n+1} = s_n - \frac{f(s_n)}{f'(s_n)}$$ Note that $$s=0$$ is also a solution, so you don't want to start too close to that. Starting with, say, $$s_0 = 2$$, you just iterate until the numbers get close enough to each other.

$$s_1 = 2 - f(2)/f'(2) = 2.392211192$$

$$s_2 = 2.392211192 - f(2.392211192)/f'(2.392211192) = 2.269512712$$

etc.

I find that $$s_5$$ and $$s_6$$ differ only in the $$9$$'th decimal place.

We put $$0 \le y=x^2/(4vt)$$ and look for the non-negative zeros of the function $$f(y)$$ $$\left\{ \matrix{ f(y) = e^{\,y} - 2y - 1 = 0 \hfill \cr f'(y) = e^{\,y} - 2\quad \Rightarrow \quad \min f(y):\;y = \ln 2 \hfill \cr 0 < f''(y) = e^{\,y} \hfill \cr} \right.$$

Clearly, $$f(y)$$ is convex, has a negative minimum at $$y=ln2$$, thus it has two zeros.
One of them is at $$y=0$$ and the other will be past the minimum.
Since for $$ln2 < y$$ the function is increasing we can apply Newton-Raphson method to find the second zero, provided that the starting point $$y_0$$ be to the right of the minimum.

We can choose $$y_0=2$$ for instance, and then start the recursion \eqalign{ & {{f(y_0 )} \over {y_1 - y_0 }} = f'(y_0 )\quad \Rightarrow \quad \cr & \Rightarrow \quad y_1 = y_0 + {{f(y_0 )} \over {f'(y_0 )}} = y_0 + {{e^{\,y_0 } - 2y_0 - 1} \over {e^{\,y_0 } - 2}}\quad \Rightarrow \cr & \Rightarrow \quad y_{n + 1} = y_n + {{e^{\,y_{\,n} } - 2y_n - 1} \over {e^{\,y_{\,n} } - 2}} \cr}

Of course, once found a satisfactory value for $$y$$, you can easily convert it back to $$x$$

Just as Will Jagy did, let$$u = \frac{x^2}{4 v t}$$ to make the equation $$e^u - 1 - 2u = 0$$.

So, let consider that you look for the zero's of function $$f(u)=e^u - 1 - 2u$$ for which $$f'(u)=e^u - 2 \qquad \text{and} \qquad f''(u)=e^u > \,\,\forall u$$

The first derivative cancels when $$u=\log(2)$$. You can get an estimate of the root builiding the Taylor series at this point. This would give $$e^u - 1 - 2u =(1-2 \log (2))+(u-\log (2))^2+O\left((u-\log (2))^3\right)$$ Ignoring the gigher order terms, you then have as an estimate $$u_0=\log(2)+\sqrt{2 \log (2)-1}\approx 1.31467$$ With this estimate, you can now use Newton method $$u_{n+1}=u_n-\frac{f(u_n)}{f'(u_n)}=\frac{e^{u_n} (u_n-1)+1}{e^{u_n}-2}$$ and get, for twelve significant figures, the following iterates $$\left( \begin{array}{cc} n & u_n \\ 0 & 1.31467301359 \\ 1 & 1.26002526328 \\ 2 & 1.25644611685 \\ 3 & 1.25643120888 \\ 4 & 1.25643120863 \end{array} \right)$$

One of the important points when you use Newton method is to get a "reasonable" estimates.

You will notice in the table that, at no time, we overshoot the solution because we started at a point whe $$f(x_0) \times f''(x_0) > 0$$ (Darboux theorem).

Starting instead with $$x_0=1$$, the iterates would have been $$\left( \begin{array}{cc} n & u_n \\ 0 & 1.00000000000 \\ 1 & \color{red}{1.39221119118} \\ 2 & 1.27395717022 \\ 3 & 1.25677778598 \\ 4 & 1.25643134800 \\ 5 & 1.25643120863 \end{array} \right)$$