Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

As a small part of a much bigger project, I need to be able to approximate the numerical output of the Lambert W function. I have found decent approximations (good up to at least 4 decimal places), for W for inputs on $[3,\infty)$ and $[0,3)$. I thought this was going to be sufficient, but it turns out much of the input to the function will have to be below zero. What is a good (and not too complicated) approximation of W for negative input? Keep in mind I'm a programmer, not a mathematician.

share|improve this question
    
Might as well link to the two questions about approximating the Lambert function at $z=0$ and at $z=\infty$... –  J. M. Jul 23 '11 at 2:49
add comment

1 Answer

up vote 6 down vote accepted

Assuming you're going for the principal branch, you'll want the expansion of the Lambert function $W(z)$ about the branch point $z=-e^{-1}$:

$$W(z)=-1+t-\frac{t^2}{3}+\frac{11}{72}t^3+\dots$$

where $t=\sqrt{2ez+2}$. If you require more terms, section 3 of this paper mentions the (complicated!) recurrence required to generate the coefficients of this series, as well as the adjustments you need to make if what you require is the "lower" branch $W_{-1}(z)$ (hint: you futz with the square root).

Alternatively, Winitzki gives in his paper a convenient approximation for the principal branch for arguments near the branch point:

$$W(z)\approx\frac{ez}{1+\left((e-1)^{-1}-\frac1{\sqrt{2}}+\frac1{\sqrt{2ez+2}}\right)^{-1}}$$


Here's a graphical side-by side comparison of three approximants over the interval $(-e^{-1},0)$. The plots are of functions of the form $f(z)-W(z)$, where $f(z)$ is one of the following: the first five terms of the branch point series, a $(3,2)$ Padé approximant constructed from the series,

$$W(z)\approx\frac{-1+\frac16 t+\frac{257}{720}t^2+\frac{13}{720}t^3}{1+\frac56 t+\frac{103}{720}t^2}, \qquad t=\sqrt{2ez+2}$$

and the Winitzki approximant:

Lambert function approximants over (-1/e,0)

share|improve this answer
    
Thanks! Just so I understand the math, the first approximation you list here is taken from the series expansion of the function, correct? –  Graham Jul 25 '11 at 16:07
    
Yes @Graham, it's the series about the branch point. Just generate as many terms of the series as needed, or construct a Padé approximant from it. –  J. M. Jul 27 '11 at 1:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.