I am struggling to find a closed form solution to the following equation: $$ \ln\left(1+knxe^{\left(-kx\right)}\right)-ne^{\left(-kx\right)}=0 $$ for some constants $k>0$ and $n>0$. I have been looking into the Lambert W function but don't see how this would help here. Is it necessary to resort to linearization of the logarithm or some other sort of approximation method? I am mostly just interested in the dependence of $x$ on $k$.
Finding Closed form solution
234 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 3 best solutions below
On
Starting from @Jean Marie'answer $$ \dfrac{e^X-1}{X}=k\implies X=-W_{-1}\left(-\frac{1}{k}e^{-\frac 1k}\right)-\frac{1}{k}$$ from which $$x=-\frac{1}{k}\log \left(\frac{X}{n}\right)$$ produces nice and interesting plots (have a look here for $n=2$)
Edit
For a shortcut analysis, we could use the bounds
$$-1-\sqrt{2u}-u < W_{-1}(-e^{-(u+1)}) < -1-\sqrt{2u}-\frac{2}{3}u$$ This means that we have $$X>1+\frac{2}{3} \left(\frac{1}{k}+\log (k)-1\right)+ \sqrt{2\left(\frac{1}{k}+\log (k)-1\right)}$$ $$X<\frac{1}{k}+\log (k)+\sqrt{2\left(\frac{1}{k}+\log(k)-1\right)}$$ So, if Lambert function cannot be used, Newton method will converge like a charm starting at the midpoint of the range. Trying for $k=12345$,we should have $10.718 <x< 13.525$ and Newton iterates will be $$\left( \begin{array}{cc} m & X_m \\ 0 & 12.121495 \\ 1 & 11.919031 \\ 2 & 11.897543 \\ 3 & 11.897327 \end{array} \right)$$
We also have $$\frac{dX}{dk}=\frac 1k\Bigg[1+\frac{1-k}{k \left(W_{-1}\left(-\frac{e^{-1/k}}{k}\right)+1\right)}\Bigg]$$ and for large values of $k$, $\frac{dX}{dk}\sim\frac 1k$. For example, for $k=12345$, the second term in brackets is $0.092$.
In any manner, we can write $$\frac{dX}{dk}=\frac{X^2}{e^X (X-1)+1}$$
We can also use the expansion $$W_{-1}(t)\approx L_1-L_2+\frac{L_2}{L_1}+\cdots$$ where $L_1=\log(-t)$ and $L_2=\log(-L_1)$. This would give $$X=-\frac{1}{k}-\log \left(\frac{e^{-1/k}}{k}\right)+\log \left(-\log \left(\frac{e^{-1/k}}{k}\right)\right)-\frac{\log \left(-\log \left(\frac{e^{-1/k}}{k}\right)\right)}{\log \left(\frac{e^{-1/k}}{k}\right)}$$ For $k=12345$, this would give $X=11.902$ which is not bad, in particular if you want to perform sensitivity analysis.
Comment
After @g.kov's answer and @Jean Marie's new answer, to make the story short, using $X=k x$, what we need to solve for $X$ is $$n=-\frac{e^X \Big[X \,W_{-1}\left(-\frac{1}{X}e^{-\frac 1X}\right)+1\Big]}{X}$$ which cannot be inversed.
However, taking logarithms, for $X \geq 1.17$ (corresponding to $n=0$), we almost face a straight line and this explains why @g.kov's solution is so efficient.
Using series developed around $x=2$ plus series reversion, the simple model (all numbers have been made rational) $$x_{\text{est}}=\frac{906}{875}+\frac{221 }{1098}t+\frac{154 }{1247}t^2-\frac{27 }{2875}t^3+\frac{1}{3629}t^4 \quad \text{where} \quad t=\log(n)$$ seems to be decent. Repeating @g.kov calculations $$\left( \begin{array}{cc} n & x_{\text{est}} \\ 10^1 & 2.04674 \\ 10^2 & 3.78813 \\ 10^3 & 5.85056 \\ 10^4 & 8.01087 \\ 10^5 & 10.2318 \\ 10^6 & 12.6621 \end{array} \right)$$
With this estimate, one iteration of Newton method should be sufficient.
On
\begin{align} \ln(1+knxe^{-kx})-ne^{-kx}&=0 \tag{1}\label{1} \end{align}
Let's introduce an aggregate variable $x_k=k\,x$ and consider
\begin{align} f(x_k,n)&=\ln(1+nx_k\exp(-x_k)) -n\exp(-x_k) \tag{2}\label{2} ,\\ f'(x_k,n)&= \frac{n\exp(-x_k)(2-x_k+n x_k\exp(-x_k))}{1+n x_k\exp(-x_k)} \tag{3}\label{3} ,\\ f''(x_k,n)&= -\frac{n\exp(-x_k)(3+2 n x_k \exp(-x_k)-x_k+n^2 x_k^2\exp(-x_k)^2+n\exp(-x_k))}{(1+n x_k\exp(-x_k))^2} \tag{4}\label{4} . \end{align}
Unfortunately, this can not be solved for $x_k$ in terms of the Lambert W function, but we can iteratively use for example, Halley's method for approximation using $x_k=1$ as initial value:
For the given value of $n$ \begin{align} x_k&=1 ,\\ x_k&=F(x_k,n) ,\\ \text{where }\quad F(x_k,n)&= x_k-\frac{2f(x_k,n)f'(x_k,n)}{2f'(x_k,n)^2-f(x_k,n)f''(x_k,n)} . \end{align}
For $n=1$: $ \begin{array}{rl} \text{Iteration}& x_k\\ \hline 1& 1.170357771616290002056344708\\ 2& 1.172153694350020764084170876\\ 3& 1.172153696769533591767696701\\ 4& 1.172153696769533591767696707\\ 5& 1.172153696769533591767696707\\ \hline\\ \end{array} $
For $n=10$: $ \begin{array}{rl} \text{Iteration}& x_k\\ \hline 1& 1.896366323616900540896745045\\ 2& 2.044347353344615923536047462\\ 3& 2.045237598213555140104218752\\ 4& 2.045237598430951013724790276\\ 5& 2.045237598430951013724790276\\ \hline\\ \end{array} $
For $n=100$: $ \begin{array}{rl} \text{Iteration}& x_k\\ \hline 1& 2.676977597093520446314198800\\ 2& 3.629306932322634358319376213\\ 3& 3.790023265351929630735197416\\ 4& 3.790989232408695901053075975\\ 5& 3.790989232643263891789079366\\ 6& 3.790989232643263891789079366\\ \hline\\ \end{array} $
For $n=1000$: $ \begin{array}{rl} \text{Iteration}& x_k\\ \hline 1& 2.941848594014437575855059309\\ 2& 4.651983547563005304454022320\\ 3& 5.665615157569268469752834587\\ 4& 5.847794768505345583727809014\\ 5& 5.849066417464094283959333857\\ 6& 5.849066417949455069142805365\\ 7& 5.849066417949455069142805365\\ \hline\\ \end{array} $
For $n=10000$: $ \begin{array}{rl} \text{Iteration}& x_k\\ \hline 1& 2.991631201381196147711654450\\ 2& 4.942216194436636574135415079\\ 3& 6.691925964200960456959570754\\ 4& 7.786972044834279373241962071\\ 5& 8.009206466615856546298611367\\ 6& 8.011339418770442765821907078\\ 7& 8.011339420912492089580072226\\ 8& 8.011339420912492089580072229\\ 9& 8.011339420912492089580072229\\ \hline\\ \end{array} $
For $n=100000$: $ \begin{array}{rl} \text{Iteration}& x_k\\ \hline 1& 2.998911543369285847644408551\\ 2& 4.992053906966172133262219200\\ 3& 6.951670083373696539811777384\\ 4& 8.741555799151739748099970904\\ 5& 9.933088113195797374388449924\\ 6& 10.21577347847871911617793661\\ 7& 10.21987561633406160992976994\\ 8& 10.21987563082686304449920262\\ 9& 10.21987563082686304449920326\\ 10& 10.21987563082686304449920326\\ \hline\\ \end{array} $
For $n=1000000$: $ \begin{array}{rl} \text{Iteration}& x_k\\ \hline 1& 2.999866095952775328866377519\\ 2& 4.998993967002682999509147359\\ 3& 6.993540469412135171118119836\\ 4& 8.961178487137984763660861946\\ 5& 10.78839772824291465235044375\\ 6& 12.08213177637762149050692645\\ 7& 12.44519713978354747687507392\\ 8& 12.45338766190809257143884486\\ 9& 12.45338777270351446760823256\\ 10& 12.45338777270351446760850828\\ 11& 12.45338777270351446760850828\\ \hline\\ \end{array} $
Edit
And you can still get use of the Lambert W function: the condition for the argument of $\ln(1+knxe^{-kx})$ to be valid is $xk>-\operatorname{W}(\tfrac1n)$ and you have a lower boundary $x>-\tfrac1k \operatorname{W}(\tfrac1n)$, which for large $n$ tends to zero from the left.


Setting $X=kx$, and $Y=n$, we get the implicit equation:
$$\operatorname{ln}(1+XYe^{-X})=Ye^{-X}$$
Matlab gives a plot (black line) in complete agreement with the plot by @g.cov.
Then I have attempted to fit a "simple" function chosen among the classical fitting functions, and found by trial and error a rather good agreement by taking (red curve):
$$Y=0.328 X^2e^{0.774 X}$$
otherwise said:
$$n\approx 0.328 (kx)^2e^{0.774 kx}$$
As you are interested by the dependence between $x$ and $k$ for a given $n$, you can study, for different values of $n$ the implicit curves given by (1). This is what I have done here for values of $n=2^k, \ k=0 \cdots 20$ (the closest to the origin is for $n=1$).