Why does $r=e^{-r}/0.05$ diverge with iteration?

392 Views Asked by At

I have the following nonlinear equation which I want to solve (the answer is about 2.205):

$r=e^{-r}/0.05$

I'd like to understand why the equation above will only converge (using iteration) if I put it in the following form:

$r=-\ln(r*0.05)$

I'm in an engineering program and I've noticed other equations which involve logs where iteration works to find an answer. I think I can use iteration when the equation involves logs, but I'd like to be sure.

To be clear, when I refer to iteration I mean:

  1. Making a guess for the value of r.
  2. Subbing into the RHS and computing.
  3. Use the found value and sub into the RHS again.
  4. Continue until value converges.
4

There are 4 best solutions below

3
On BEST ANSWER

You can think of your method of iteration as follows. Imagine that you're plotting the RHS and the LHS as two separate functions, $f(r) = r$ and $g(r) = e^{-r} / 0.05$. The solution for $r = e^{-r}/0.05$, graphically, is all values of $r$ where $f$ and $g$ intersect on a plot with $r$ on the $x$-axis.

The iteration process then looks something like this: Exponential Form of Iteration

Once you transform the equation, you end up with an iteration process that looks like this: Log form of the equation

As you can see, the rate at which the equation is changing plays a big role in whether it converges or not. In general, if a function $f(r)$ changes at some rate $f'(r)$, then $\ln(f(r))$ changes much more slowly at $\frac{d}{dr}\ln(f(r)) = \frac{1}{f(r)} \cdot f'(r)$.

If you want a much more reliable, but still relatively each method to implement, consider using Newton's Method

EDIT: Here's how to solve the non-linear equation using Newton's method.

For Newton's, you want an equation of the form $f(r) = 0$. Here, we have $f(r) = e^{-r}/0.05 - r$, which implies that $f'(r) = -e^{-r}/0.05 - 1$. Given some initial guess $r_0$, the next guess in the iteration is gotten by: $$ r_{i + 1} = r_i - \frac{f(r_i)}{f'(r_i)} $$ Using Newton's method, here's what my iterations look like: \begin{array}{c | c} i & r_i\\ \hline 0 & 1 \\ 1 & 1.7607 \\ 2 & 2.1387 \\ 3 & 2.2035 \\ 4 & 2.2050 \\ 5 & 2.2050 \\ \end{array}

0
On

This is mostly because, if you set $f(r)=e^{-r}/0.05$, and $r_0$ is the solution, $r_0\approx 2.05$, you have $f'(r_0)=-e^{-r}/0.05=-r_0\approx -2.05$ and $|f'(r_0)|\gt 1$.

Now note how the function $f$ behaves in the neigbourhood of $r_0$: $f(r)-f(r_0)=(r-r_0)f'(\xi)$ (mean value theorem), where $\xi$ is between $r$ and $r_0$, so the "distance" between $f(r)$ and $f(r_0)$ equals the "distance" of $r$ to $r_0$ multiplied by something close to $f'(r_0)$, which is greater than $1$ in module. In other words, the iteration "expands" the small intervals around $r_0$.

Go to the inverse function $f^{-1}(r)=-\log(0.05r)$ and the derivative is the reciprocal of the derivative we got before, i.e. it is $((f^{-1})'(r_0)=-\frac{1}{r_0}\approx -\frac{1}{2.05}$, and this is $\lt 1$ in module. By the same logic, we conclude that $f^{-1}$ is a contraction of small intervals around $r_0$. It is intuitively clear (and can be proven strictly) that, at least when you start in one such small interval, your sequence will converge.

3
On

If the slopes are too great at the point of intersection, iteration will not converge to the point of intersection.

Consider this picture.

enter image description here

In order for this itterative method to converge the slope of your function must be between $+1$ and $-1$ at the point of intersection.

But when you manipulate the equation

$r = -\ln (0.05r)$ now you have a function with a flat enough slope.

3
On

You have several graphical answers ready. I will instead of an answer offer a fix for the problem by smoothing the iteration. Smoothing is a very useful concept in very many areas of applied mathematics.

Consider an iteration with memory $$r_{n+1} = 0.5r_n + 0.5 \exp(-r_n)/0.05$$Which remembers 50% of the previous value and only adds 50% of the new value.

enter image description here

While first hopping to 4 we get a quite quick convergence when starting at $r_1=1$.