−2π Branch k= −1 note that the rst several terms may be computed very sim-
ply in a computer algebra system by the commands (here
−3π
Branch k= −2
written in Maple for convenience)
−4π
> series(w*exp(w)-z, w);
z + w + w + 12 w + 61 w + 24
1 w + O(w ) :
−5π
2 3 4 5 6
Figure 1: The ranges for the branches of the W function. > solve(", w);
Closure information is not indicated on the gure. Branches
are closed on their top boundaries. This means in particu- z z + 32 z 83 z + 125
2 3
24 z + O(z )
4 5 6
dynamical and combinatorial applications. so in our case, by using our known Pk (s) we get
In the interests of true standardization, we suggest that n
W (z) = ( nn)! zn :
X 1
any CAS implementing the function satisfying (1) use the (6)
name LambertW (with arguments z or k,z) and the branch n
cuts and closures of [5]. For documentation and for use in
1
papers we recommend the notations W (z) and Wk (z). The ratio test establishes that this series converges if
We recognize that some designers may wish instead (or in jzj < 1=e.
addition) to implement the function satisfying (2), because We might instead try to derive the Taylor series directly,
the minus signs in the series (6) below are a distraction since a formula for the n-th derivative of W for n 1 is
in combinatorial applications. Use of a dierent name and known [5, p. 340]. The formula is
notation is perhaps justied in this case; we suggest T (z), dn W (x) = exp( nW (x))pn(W (x)) ;
Tk (z) (with the branches dened by Tk (z) = Wk ( z)), dxn (1 + W (x)) n (7) 2 1
1.3 Complex branches of W However, nding pn (0) from this recurrence is more dif-
cult than the previous derivation. The initial polyno-
A detailed discussion of the complex branches of W can mial is p (w) = 1. The next few polynomials are, by
1
be found in [5]. The branches are denoted Wk (z) (the Maple, p (w) = 2 w, p (w) = 9 + 8 w + 2 w , p (w) =
2 3
2
4
exact Maple V Release 4 syntax is LambertW(k,z)) with 64 36 w 79 w 6 w , and p (w) = 974 w + 625 +
2 3
5
W (z) being the principal branch, satisfying W (0) = 0 and 622 w + 192 w + 24 w . A simple consequence of the re-
2 3 4
W (x) > 0 for x > 0. The only other branch to have real
values is W (x) which takes on values in ( 1; 1] for series of W about x = a has rational coecients, apart from
0
x 2 [ 1=e; 0). The ranges of the branches are indicated the factor annwhich occurs if a 6= 0. This uses the fact that
1
2
2.1 Some series for T (z) = W ( z) The number of mappings from f1; 2; : : : ; ng into itself
We have immediately that having exactly k component cycles is the coecient of yk in
tn (y) where tn (y) is the tree polynomial of order n (see [16])
X nn and is generated by
zn
1
T (z) =
n! (9)
n 1 =
X
t n ( y ) zn : (21)
(1 T (z))y n n!
1
(10) (22)
1
n 0 y! y
0
(cf. [14, exercise 2.3.4.4{29]). In particular, for integer k we These series and others may be found in [16], where they
have are used to analyze a recurrence related to trees.
X n k n Finally, note that using equation (13) with
T (z)k = k n (n 1) n !(n k + 1)z : (11) g(n) = Q(1; 2; 3 ; : : : ; n) 2
n
= F 1; 2; 11 n ; n
1
n!
3
The equation
1 2 2 3 3
n
(13)
1
y + ln y = z (24)
This follows on substitution of equation (11) and rearrang- often occurs in applications. Its solution in terms of W is
ing. Since Q(1; 2; 3; : : : ; n) = n, an immediate consequence (ignoring branches for the moment) y = W (exp z), which in
is some ways is a nicer function than W (z). For one thing, its
1 = X nn zn : (14) derivatives are slightly simpler, and without much diculty
1 T (z) n n! 0
one can establish by induction that for n 1
Similarly, Q(2 1 ; 3 2 ; 4 3 ; : : : ; n) = 2n and hence
2 2 2 2 dn W (ez ) = qn (W (ez )) ; (25)
dzn (1 + W (ez )) n 2 1
T (z) = X nn zn : (15)
+1
complex x. +1
Let Q(n) = Q(1; 1; 1; : : : ; n) be Ramanujan's function Discovering formulas (25{26) in the rst place is another
matter, of course, and it is here that computation of the rst
Q(n) = 1 + n n 1 + n n 1 n n 2 + : (17) several derivatives can point the way.
Then > alias( w = LambertW( exp(z) ) );
> seq( normal(diff( w, z$n)), n=1..5);
X nn Q(n)z n
ln 1 1T (z) =
1
n! (18)
n
X nn Q(n)z n
1
[ 1 +w w ; (1 +ww) ; w ((1 +1 + 2 w) ;
w)
T (z) = (19)
3 5
(1 T (z)) n
2
n! w (1 8 w + 6 w ) ; 2
1
(1 + w) 7
(20)
+1
w ( 1 + 22 w 58 w + 24 w ) ] 2 3
(1 T (z)) n
4
n! 1 (1 + w) 9
3
As before, when w = W (exp a) is rational the Taylor Getting Maple to evaluate this integral requires explicit use
series for W (exp z) about z = a has rational coecients. of changevar and assumptions on s. The requisite substi-
For example, this occurs when a = 1, giving tution is w = W (exp(1 + z)) so dz = (1 + w)dw=w and
exp z = w exp(w 1).
1 (z 1)
W (ez ) = 1 + 12 (z 1) + 16 1
192 (z 1)
2 3
The eect of the Laplace transform, as can be veried
1 13 with Watson's lemma [1], is to convert an exponential gen-
erating function into an ordinary generating function (in
3072 (z 1) + 61440 (z 1) + O((z 1) ) : (28)
4 5 6
gives the asymptotics of qn (1). Since we can evaluate the Laplace transform of W (exp z)
it is no surprise that we can evaluate the Mellin transform
2.3 Branches in equation (24) of W (z). The result is
Theorem: The unique solution of y + ln y = z is Z 1
M (W (z)) = xs W (x) dx 1
we see that if y is a solution, then y = Wk (exp z) for some k. sumptions are necessary to get Maple to evaluate this trans-
To go in the other direction, we use the relation form.
Wk (z) + ln Wk (z) = ln z + 2ik (30) 3 Series about the branch point
unless k = 1 and z 2 [ 1=e; 0), when W (z) + p
If we put p = 2(ez + 1) in W exp W = z, and expand in
1
` 0
have that
Wk (ez ) + ln Wk (ez ) = z + 2i (K(z) + k) (32) This series is well-known and has many combinatorial ap-
plications (see for example [16]). It converges for jpj < 2 = . 1 2
unless k = 1 and exp z 2 [ 1=e; 0), in which case we The coecients may be computed by the following recur-
replace k by 0 on the right hand side of (32). Thus we rence relations, which were communicated to us by Don
have that Wk (exp z) + ln Wk (exp z) = z if and only if Coppersmith.
k = K(z), unless k = 1, as claimed. It is easy to see
that both k = 1 and k = 0 work if z = t + i for some
k = kk + 11 k + k
t 2 ( 1; 1] as claimed, and because the unwinding num- 1 1 1
k k
1
k
bers for z = t + i(2m + 1) are all dierent from 0 if m 6= 0, 2 2 4 2 2 +1 1
j
in terms of a (very) multi-valued function Wk , using another
=2
4
> op({solve(series(subs(w=-1+u, z=-exp(-1) and the series for T is the same but with alternating signs.
0
2 t 32 t + 11
2
36 2 t 135 4320
3 4 5 k 0
(37) a = 1 (46)
n!
1
2n n !
an = (n +11)a an
X 1
The connection between series at the branch point for W The rst few terms are v = T (e z2 = ) = 1 2
n! = nn e +1 n (ue u )n du +
1
(ve v )n dv : (38) 1
281 163879
1515591000 z + 2172751257600 z
0 1 10 11
v = T 1
e 1 z=2 2
; (40) 3.2 Other branch point series
The relation between W and W near the branch point
1 0
use the T notation to keep minus signs to a minimum. We being the solution to
now expand the expression in brackets about z = 0 (it is
more convenient to use the series for du and dv directly, as (1 + )e = (1 )e : (50)
was done in [19], than to rearrange the geometric series for
1=(1 T ) in (41)), integrate term by term, and arrive at the In terms of T , the solutions are
asymptotic expansion for n! in the form 8
k = < T (1 )e (1 )
n! = nn e n (2k + 1)a k n2
X 0
+1
(k + 1=2) (42)
+1 2
1+= (51)
: T (1 )e
2 +1
(1 )
k 0
1
T (e 1 2
)= (43) but T does not simplify, whilst if < 0 then T simplies
1 1
n 0 0
5
for the root that does not simplify. Using the dierential We also make use of r-associated Stirling subset numbers
equation (we use only the case r = 2), which are generated by
d = 1
d 1 (1 + ) ; (52) r 1 k
1 (ez
X z m zn :
Xn n o
it is easy to derive the recurrence relation k =0
k ! ) = m!
n
m r n! 0
(61)
" #
n Finally, we need the second-order Eulerian numbers. As
cn = n +1 1 2 + cj (1 jcn
X 1
W (z) = pepcosech p
0 (56) + (2n 1 k) k 1 : (64)
W (z) = pe cosech p
1
p (57)
and expands these in series containing Bernoulli numbers. 4.2 The fundamental relation
The connection with Karamata's work is that If we start with W (z) exp(W (z)) = z, then by putting
p = ( + )=2 ; (58) W (z) = ln z ln ln z + u (which denes u for any z 6= 0,
but which makes particularly good sense if z is large) we get
though it is not clear at this writing if this gives us any new
information. (ln z ln ln z + u) lnzz eu = z (65)
and since z 6= 0 we may divide both sides by z, and put
4 Series about Innity = 1= ln z and = ln ln z= ln z to get
We collect and present the previously known series for 1 + u = e u : (66)
W (z) about innity, which go back to de Bruijn [8] and
to Comtet [4]. We then show that these known series are This is what we call the fundamental relation, and we will
members of an innite family of series (some of these were see some of its consequences in what follows. Note that this
exhibited in [5, 11]), and show that they are valid as z ! 0 same equation, mutatis mutandis, arises if we replace Wk (z)
as well as for z ! 1. Finally we exhibit some new se- by lnk z ln lnk z + u k , where lnk (z) = ln(z) + 2ik is the
( )
ries, including an expansion for W ( exp(it)) in terms of notation introduced in [12] for the k-th logarithm branch.
W () and it which separates the real and imaginary parts
of W ( exp(it)). 4.3 de Bruijn and Comtet's expansion
4.1 Stirling and Eulerian numbers de Bruijn solved the fundamental equation (66) in series to
show that the asymptotic expansion of W (x) for large x is
To x notation, we summarize
with generating functions. in fact convergent [8]. Comtet later identied the coe-
Stirling cycle numbers mn are generated (for example) cients explicitly as Stirling numbers [4]. The result is (ex-
by [10] plicitly adding branch information which Comtet did not
use, and specically excluding the case where k = 1 and
X h i n
n z : z 2 [ 1=e; 0) where another expansion holds)
lnm (1 + z) = m! ( 1)n m m n!
+
(59)
n 0
Wk (z) = lnk (z) ln lnk (z)
n+m n m
c`m (ln lnk (z` ))m ;
The numbers ( 1) XX
m are also called Stirling numbers + (67)
of the rst kind. See [15] for a discussion of the advantages ` m (lnk z) +
6
These series were further developed and rearranged inn v while the numerator is degree n 1, and because the
in [11] using the new variable = 1=(1 + ) to get p terms grow more slowly). Thus this series again gives
the correct asymptotics. These observations were used in
Wk (z) = lnk z ln lnk z (69) section 4.3 to extend Comtet's series to arbitrary branches
X m m
of W .
( 1)p m p m p + mp 1
X1
+ + 1 +
; The following Maple session shows the rst few terms of
m1
m ! p
=0 2 this new series (75).
> basic := 1 - tau + sigma*u - exp(-u)
and a further series which we will discuss below.
basic := 1 + u e u ( )
solution is
u = W ( 1 e = ) 1 :
(1 )
(70) > series(",u);
W (z) = W 1 e = (1 )
(71) > solve(",u):
> series(v + p + ",p):
which really only rewrites z using the new variables.
After some thought, we nd that if, instead of follow- > W(z) = map(normal,");
ing de Bruijn and using the variables and , we use the
variables v = 1= and p = =, giving W (z) = v + 1 +v v p + 12 (1 +v v) p 16 v ((1 1++v)2 v) p
3
2
5
3
W (z) = W ln ze z e
ln ln ln z
= W (vev ep ) ; (72) 1 v (6 v 8 v + 1) p
2
+ 24 (1 + v)
4
We will also need the unwinding number for W , namely the 1 v (24 v 58 v + 22 v 1) p + O(p )
3 2
120 (1 + v) 9
W` (vev ) = v + 2iU` (v) : (73) This is a truncation of (75) and as predicted it contains
second-order Eulerian numbers.
One can show that U` (v) = K(v + ln v) + ` + O(1=v) is
asymptotically an integer. Moreover, if v is in the range of 4.5 Convergence
W` , then U` (v) = 0.
Finally, we must extend the formula for the n-th deriva- The series (75) converges, as a series in p, for all jpj less
tive of W (exp z) to the following: than the distance to the singularity at v exp(v + p^) = 1=e.
Because exp(2ik) = 1, we have to nd the nearest such
dn W (aeaebz ) = bn qn (W (aea)) : singularity. The logarithmic singularity at z = 0 has been
(74) moved to p = 1.
dzn
z =0
(1 + W (aea)) n 2 1
7
In the case n ! 1, one can show that vn ! W (z) if and we will have W (z) = W (v exp(v + p)) so we may
jW (z)j > 1, while vn ! W (z) in jW (z)j < 1 if n ! 1. use (75). This gives us many interesting new series for W ,
In fact this iteration turns out to be completely equiva- but it also gives us a family of iterative formulas for W ,
lent to the well-studied exponential iteration dening which can be of arbitrary order, as follows. We choose k = 0
because we want p ! 0.
zz
z
W` (z) = (1 +qkv(vn++2i
X 2iU` (vn )) pkn
+1
for W (z). We may add a further innity of series by us- number of digits used.
ing dierent branches for ln, by putting v m = lnm (z) and ( )
4.9 Rearrangements
p m = ln lnm (z). It is this sequence of series that gives
0
( )
n m 1 =1
+ 1 m!
being a series of polynomials in ln(z=e). This gives
and
W (z) = 1 + 12 ln( ze ) + 161 ln( z )
e
1 z
192 ln( e ) (81)
2 3
Wk (z) = lnk z ln lnk z L
m
which is really just (75) with z = 1 exp(1) exp(ln(z) 1). +
X 1
L m m X p+m 11
( 1)p m : + 1
1 (1 z ) z ( 2 e + e ) +
3 3
(82)
2
is rapid.
6 e (1 + ze )
3 5
nz
X n 0
6 0 we can put
For any v = where the polynomials Cn are computable by C = 1,
Cn0 (x) = (b c + n)Cn (x) Cn0 (x) and Cn (0) = 0 for
0
p = ln vezv + 2ik ; (84) n > 0.
+1
8
More generally, for any b and c and any power series 6 A Final Pair of Expansions
X
G(x) = ai xi (90) The iterations (76{77) may be used to show that W (z) can
i be written as
0
W (z) = z (98)
with a 6= 0, the following expansion holds:
0
exp z
z
1 b c b X An (ln ln z )
exp
ebW z ( )
W (z)cG
W (z) = z ln z n lnn z (91)
exp
z
...
0
or
where the polynomials An are computable by A = a , z
A0n (x) = (b c + n)An (x) A0n (x) and An (0) = an .
0 0
W (z) = ln (99)
ln zz
+1
and clearly all the odd terms are purely imaginary and the [3] Caratheodory, C. Theory of Functions of a Complex
even terms are real. Variable. Chelsea, 1954.
5 Innite Products [4] Comtet, L. Advanced Combinatorics. Reidel, 1974.
From the relation W (z) = z exp( W (z)) it is easy to see [5] Corless, R. M., Gonnet, G. H., Hare, D. E. G.,
that any series for W (z) may be trivially transformed into Jeffrey, D. J., and Knuth, D. E. \On the Lambert
an innite product. For example, from the series (6) we have W function". Advances in Computational Mathematics
5 (1996), 329{359.
n
exp( ( nn)! zn )
Y 1
9
[12] Jeffrey, D. J., Hare, D. E. G., and Corless,
R. M. \Unwinding the branches of the Lambert W
function". Mathematical Scientist 21 (1996), 1{7.
[13] Karamata, J. \Sur quelques problemes poses par Ra-
manujan". J. Indian Math. Soc. 24 (1960), 343{365.
[14] Knuth, D. E. The Art of Computer Programming,
2nd edition, vol. I. Addison-Wesley, 1973.
[15] Knuth, D. E. \Two notes on notation". American
Mathematical Monthly 99 (1992), 403{422.
[16] Knuth, D. E., and Pittel, B. \A recurrence related
to trees". Proc. Amer. Math. Soc. 105 (1989), 335{349.
[17] Labelle, G. \Sur l'inversion et l'iteration continue des
series formelles". European Journal of Combinatorics
1 (1980), 113{138.
[18] Lauwerier, H. A. \The asymptotic expansion
of the statistical distribution of N. V. Smirnov".
Z. Wahrscheinlichkeitstheorie 2 (1963), 61{68.
[19] Marsaglia, G., and Marsaglia, J. C. \A new
derivation of Stirling's approximation to n!". Ameri-
can Mathematical Monthly 97 (1990), 826{829.
[20] Murnaghan, F. D. \Airey's converging factor". Proc.
Nat. Acad. Sci. USA 69 (1972), 440{441.
[21] Salvy, B. \Fast computation of some asymptotic func-
tional inverses". Journal of Symbolic Computation 17
(1994), 227{236.
10