Can someone explain me how to solve the equation $\frac{x-n}{x+n} = e^{-x}$, where $n$ is a non-zero natural number ? Unfortunately, I have not even an idea how to start. Any hint is much appreciated.
Many thanks in advance.
Can someone explain me how to solve the equation $\frac{x-n}{x+n} = e^{-x}$, where $n$ is a non-zero natural number ? Unfortunately, I have not even an idea how to start. Any hint is much appreciated.
Many thanks in advance.
On
HINT.-No way to calculate in closed form by elementary means. You have to try with numerical methodes. You have in particular for a possible approximation $$1+x+\frac{x^2}{2!}+\cdots+\frac{x^k}{k!}+\cdots =e^x=\frac{x+n}{x-n}$$ $$\frac{1}{x-n}=-\left(\frac 1n+\frac{x}{n^2}+\frac{x^2}{n^3}+\frac{x^3}{n^4}+\frac{x^4}{n^5}+\frac{x^5}{n^6}+O(x^6)\right)$$
On
The solution of $$ e^{-x}=\frac{x-n}{x+n} $$ is given in terms of the generalized Lambert function (have a look at equation $(4)$ in the linked paper). It is far to be elementary and numerical methods would be required. This implies the need of a "reasonable" starting guess.
As @egreg wrote, consider that you look for the zero of function $$f(x)=x+\log(x-n)-\log(x+n)$$ As @greg showed, the solution is in $(n,n+1)$. Using Newton method with $x_0=n+1$, by Darboux theorem, we shall face a terrible overshoot of the solution since $f(n+1)>0$ and $f''(n+1)=-\frac{4 n (n+1)}{(2 n+1)^2}<0$ (leading to $x < n$ !).
So, we need to find a "good" $\epsilon$ in order to use as a starting point $x_0=n+\epsilon$.
Since we have $$f(n+\epsilon)=n+\epsilon +\log (\epsilon )-\log (2 n+\epsilon )$$ considering that $\epsilon \ll n$, expand as a Taylor series to get $$f(n+\epsilon)= n-\log (2 n)+\log (\epsilon )+\left(1-\frac{1}{2 n}\right) \epsilon +O\left(\epsilon ^2\right)$$ and solving gives $$\epsilon=\frac{2 n }{2 n-1}W\left(e^{-n} (2 n-1)\right)\implies \color{red}{x_0=n+\frac{2 n }{2 n-1}W\left(e^{-n} (2 n-1)\right)}$$ where $W(.)$ is Lambert function.
A few results
$$\left( \begin{array}{ccc} n & x_0 & \text{exact solution} \\ 1 & 1.5569290855221475902 & 1.5434046384182084480 \\ 2 & 2.4007960217011828146 & 2.3993572805154676678 \\ 3 & 3.2437999725426341949 & 3.2436373501994747685 \\ 4 & 4.1306917549758086791 & 4.1306762779494094562 \\ 5 & 5.0636292967436328932 & 5.0636280836365866688 \\ 6 & 6.0289656341356739002 & 6.0289655520675456145 \\ 7 & 7.0126176449103654054 & 7.0126176398482880782 \\ 8 & 8.0053405956558708651 & 8.0053405953599105687 \\ 9 & 9.0022167307112449573 & 9.0022167306944716050 \\ 10 & 10.000907216368752247 & 10.000907216367819733 \\ 11 & 11.000367308611718037 & 11.000367308611666862 \\ 12 & 12.000147440262153382 & 12.000147440262150601 \\ 13 & 13.000058765243955099 & 13.000058765243954949 \\ 14 & 14.000023282281423855 & 14.000023282281423847 \\ 15 & \color{blue}{15.000009176988204818} & \color{blue}{15.000009176988204818} \end{array} \right)$$ Since the argument of Lambert function starts to be very small and we know that, for small $t$, $W(t) \sim t$, a good approximation of $x_0$ is $$x_0\sim n(1+2e^{-n})$$ For a better approximation, we could use $W(t)\sim \frac t {1+t}$ and get $$x_0\sim n\left(1+\frac{2}{2 n-1+e^n} \right)$$
Now, you can perform one or two iterations of Newton method to get $$x_{n+1}=x_n-\left(1+\frac{2 n}{(n-2) n-x_n^2}\right) (x_n+\log (x_n-n)-\log (x_n+n))$$
A few results using $x_1$ and $x_2$ $$\left( \begin{array}{cccc} n & x_1 & x_2 & \text{exact solution} \\ 1 & 1.5432858263540818229 & 1.5434046290949198066 & 1.5434046384182084480 \\ 2 & 2.3993553204786489793 & 2.3993572805118222783 & 2.3993572805154676678 \\ 3 & 3.2436373052287912731 & 3.2436373501994713284 & 3.2436373501994747685 \\ 4 & 4.1306762771273694914 & 4.1306762779494094538 & 4.1306762779494094562 \\ 5 & 5.0636280836256496653 & \color{blue}{5.0636280836365866688} & \color{blue}{5.0636280836365866688} \\ 6 & 6.0289655520674323612 & 6.0289655520675456145 & 6.0289655520675456145 \\ 7 & 7.0126176398482870746 & 7.0126176398482880782 & 7.0126176398482880782 \\ 8 &\color{blue}{ 8.0053405953599105687} & 8.0053405953599105768 & \color{blue}{8.0053405953599105687} \end{array} \right)$$
As a starting point, $x_1$ seems to be perfect since numerical analysis reveals that $f(x_1) <0$ and, by Darboux theorem, Newton method will converge without any overshoot of the solution in a very small number of iterations.
Edit
A further numerical analysis reveals that, at least for $1 \leq n \leq 18$ (for $n>18$ start serious underflow/overflow problems) $$f(x_0) \sim e^{-(2n+1)}$$
On
As @Jam mentions in the comments, this is similar to equations for which the Lambert W-function would be applicable, but a bit too complex - and it is in fact equations like this that are suggested to motivate a generalized Lambert W-function which, in this case, is pretty much equivalent to your equation: namely
$$W\left(\begin{matrix}a \\ b\end{matrix}; x\right) := \left[x \mapsto e^x \left(\frac{x - a}{x - b}\right)\right]^{-1}$$
inverts $x \mapsto e^x \frac{x - a}{x - b}$ just as $W$ inverts $x \mapsto e^x x$. Thus the solution of your equation is almost directly and immediately given as
$$x = W\left(\begin{matrix}n \\ -n\end{matrix}; 1\right)$$
As said, though, this may not be so satisfying - but it is the inability to capture the solutions of some equations with our existing corpus of special functions that motivates the coinage of new ones to begin with, and is why it always grows with time. The paper in which this generalization is discussed, viz. Jam's link,
https://arxiv.org/pdf/1408.3999.pdf
also gives a series expansion:
$$W\left(\begin{matrix}t \\ s\end{matrix}; a\right) = t - T \sum_{k=1}^{\infty} \frac{L'_k(kT)}{k} e^{-kt} a^k$$
where $T := t - s$ and I've renamed the index variable to not clash with $n$. Here $L'_k$ is the derivative of the $k$th Laguerre polynomial, and so with $t = n$ and $s = -n$, you get $T = 2n$ so
$$\begin{align} x = W\left(\begin{matrix}n \\ -n\end{matrix}; 1\right) &= n - 2n \sum_{k=1}^{\infty} \frac{L'_k(2nk)}{k} e^{-kn}\end{align}$$
While I don't yet have a convergence proof, numerical experimentation at least suggests the right-hand series does actually converge at these parameters, though very poorly. For example, when $n = 1$, 1000 terms gives only on the order of $10^{-5}$ accuracy,
$$x = W \left(\begin{matrix}1 \\ -1\end{matrix}; 1\right) \approx 1.54340$$
. Convergence at higher values of $n$, e.g. $n = 2$, is not really better. But the series does at least provide a representation for the solution, and if we were to implement the generalized Lambert function in software, we would likely use the series to bootstrap a fast Newton's method procedure, similar to the usual methods for evaluating the usual Lambert function.
You can observe that a solution must satisfy $x>n$. So we can consider the equivalent equation $$ \log(x+n)-\log(x-n)=x $$ so we can study the function $f(x)=\log(x+n)-\log(x-n)-x$. We can note that $$ \lim_{x\to n}f(x)=\infty,\qquad \lim_{x\to\infty}f(x)=-\infty $$ Also $$ f'(x)=\frac{1}{x+n}-\frac{1}{x-n}-1=\frac{n^2-2n-x^2}{x^2-n^2} $$ Since $x^2>n^2$, we obtain that the derivative is negative. Hence the equation has a single solution.
Note that $f(n+1)=\log(2n+1)-(n+1)<0$, so the single solution is in $(n,n+1)$.
Indeed, if $g(t)=\log(2t+1)-(t+1)$, we have $$ g'(t)=\dfrac{2}{2t+1}-1=\frac{1-2t}{1+2t} $$ which is negative for $t>1/2$ and $g(1/2)=\log2-\frac{3}{2}<0$.