4

What is the general form of Lambert $W$-function to calculate any $x$ in $\mathbb R$?

I had problems solving for $x, x^2-e^x=0$. I reached $x=-2W(\frac12)$.

What does $W(\frac12)$ equal to?

Harsh Kumar
  • 2,924
Xygo
  • 121

3 Answers3

7

There is no "general form of the Lambert W-function". All you have is the definition, tables, power series, other numerical methods. It's like the trigonometric functions - no algebraic "formula".

From wikipedia:

The Lambert W relation cannot be expressed in terms of elementary functions.1

Nowadays the trig functions are so common that you don't tend to think of them as special in that way. The Lambert W-function seems to appear more and more often on this site. Perhaps some day people will view it as just another special function.

Ethan Bolker
  • 103,433
3

Short answer:

As Ethan Bolker said, in general the only way to do it is using a computer and approximation methods. When a computer evaluates $W(z)$, it generally uses an approximation method.

Longer answer:

One such approximation method is as follows. It's an iterative method, which means you pick a starting number as a guess, plug it into the formula, and a better guess comes out. Repeat until you get the desired precision.

Source: 1996: R.M. Corless, G.H. Gonnet, D.E.G Hare, D.J. Jeffrey and D.E. Knuth: On the Lambert W Function (Vol. 5: 329 – 359)

Quoted verbatim, except for changed formatting:

We return to the specific problem at hand that of computing a value of $W_k(z)$ for arbitrary integer $k$ and complex $z$ .

Taking full advantage of the features of iterative rootfinders outlined above we compared the efficiency of three methods, namely,

(1) Newton's method

(2) Halley's method

(3) the fourth order method described in [30] (as published this last method evaluates only the principal branch of $W$ at positive real arguments but it easily extends to all branches and to all complex arguments)

... The results showed quite consistently that method (2) is the optimal method ...

For the $W$ function, Halley's method takes the form:

$$w_{j+1} = w_j - \frac{w_j e^{w_j}-z}{e^{w_j}(w_j+1)-\frac{(w_j+2)w_je^{w_j}-z}{2w_j + 2}}$$

You can find more information about Newton's Method and Halley's method on Wikipedia. Let me know if you're confused about the notation, what $k$ means, or what a "branch" is.

If there's more than one solution to $x = We^W$, then you have to pick one in order for $W$ to be a function. For real numbers, $x=We^W$ has a unique solution $W$ for $x>0$, has two solutions for $-\frac 1 e \le x \le 0$ and no solution for $x < -\frac 1 e$. So we "cut off the branch" that gives us the second solution for $-\frac 1 e \le x \le 0$, and the remaining function is called the "principal branch".

Did
  • 284,245
GFauxPas
  • 5,097
0

A longish comment:

Even without actually knowing what the Lambert function is, you can get a reasonably good answer by knowing that $x$ is reasonably small (you know this since $x^2-e^x$ is monotonic, and checking the values at say $x=-1,0$).

If you expand $e^x$, and keep only up to the quadratic term, you have: $$x^2=1+x+x^2/2$$ Which gives: $$x= 1-\sqrt{1+2}\approx 0.73$$ Which is pretty close. You can then use Newton's method to refine if needed.