How to solve with Lambert $W$

327 Views Asked by At

I was reading on product log and came upon a website which discusses how to solve equations in the form of $we^w=k$.

Given I have the equation:

$$5+a-6e^{\frac a2}=0$$

How do I solve for $a$ using the Lambert $W$ function? The website contains some tips:

So the pattern is to manipulate the equation into $ze^z=k$ where $k$ does not contain the variable. From there, $W(k) = z$, and we can solve it because the variable is in $z$

I can rewrite the equation above into something below, such that the RHS does not contain $a$:

$$a-6e^{\frac a2}=-5$$

However, I am stuck in transforming the LHS into the form $ze^z$. Wolfram tells me that the answer should be: $$a=-2W_n\Big(-\frac{3}{e^{\frac52}}\Big)-5 \ \ \mathbb{for} \ n \in \ \mathbb{Z}$$

Additionally, what is the significance of $n$ in $W_n$? How is it used?

3

There are 3 best solutions below

2
On BEST ANSWER

Let $-2x = 5+a$ which gives $$ -2x=6e^{\frac {-5-2x}{2}} = 6e^{\frac {-5}{2}}e^{-x} $$ or $$ xe^{x}= -3e^{\frac {-5}{2}} $$ which is solved by $$x=W\Big(-\frac{3}{e^{\frac52}}\Big)$$ and retransformed into $$a=-5 - 2W\Big(-\frac{3}{e^{\frac52}}\Big)$$

The $n$ in $W_n$ indices the branch of $W$, i.e. there are several solutions. An illustration is here (from Wikipedia)

1
On

General Method

For the sake of curious, and for further applications.

Consider an equation of the form

$$p^x = ax + b$$

Through the substitution $x = -t - \frac{b}{a}$ you can rewrite it as

$$ta^t = z$$

Of course with and if $p \neq 0$, $p > 0$ and $a\neq 0$.

That being said, and you have directly the solution in terms of Lambert function:

$$t = \frac{W(z\ln(a))}{\ln(a)}$$

Other cases

$$x^x = t ~~~~~~~~~~~ \text{has solution} ~~~~~~~ x = \frac{t}{W(t)}$$

Without Substitution

$$p^x = ax + b ~~~~~~~~~~~ \text{has solution} ~~~~~~~ x = \frac{W\left(-\frac{\ln(p)}{a}p^{-b/a}\right)}{\ln(p)} - \frac{b}{a}$$

More on W Function

  • $$W(x) \approx \ln(x) - \ln(\ln(x)) + o(1)$$

  • $$W(x) = \sum_{k = 1}^{+\infty} \frac{(-1)^{k-1}}{k!}x^k$$

0
On

$$5+a-6e^{a/2}=0$$ Let $x=-\frac{5+a}{2} \quad\to\quad a=-2x-5$ $$-2x=6e^{-x-5/2}$$ $$-2xe^{5/2}=6e^{-x}$$ $$xe^x=-3e^{-5/2}= -\frac{3}{e^{5/2}}$$ From the definition of the Lambert's W function https://en.wikipedia.org/wiki/Lambert_W_function : $$x=W\left(-\frac{3}{e^{5/2}}\right)$$ This function is multi valuated. Formally the two real branches are named $W_0$ and $W_{-1}$. See the above referenced paper. $$a=-2W_n\left(-\frac{3}{e^{5/2}}\right)-5$$ $n=0$ and $n=-1$

As a consequence, on the real domain they are two roots : $$a\simeq -4.30168 \quad \text{and}\quad a\simeq -0.637368$$ The above values are computed thanks to numerical calculus. You can use the Lambert's W function implemented in math softwares, or directly thanks to iterative method of numerical calculus such as Newton-Raphson.