The Lambert W Function 1 0 Robert M
Total Page:16
File Type:pdf, Size:1020Kb
Princeton Companion to Applied Mathematics Proof 1 W W The Lambert W Function 1 0 Robert M. Corless and David J. Jeffrey –e–1 1 Definition and Basic Properties z –1 1 2 3 For a given complex number z, the equation wew = z –1 has a countably infinite number of solutions, which are denoted by Wk(z) for integers k. Each choice of k speci- –2 fies a branch of the Lambert W function. By convention, only the branches k = 0 (called the principal branch) and k =−1 are real-valued for any z; the range of every other branch excludes the real axis, although the range –3 of W1(z) includes (−∞, −1/e] in its closure. Only W0(z) W–1 contains positive values in its range (see figure 1). When z =−1/e (the only nonzero branch point), there is a –4 w double root w =−1 of the basic equation we = z. Figure 1 Real branches of the Lambert W function. The The conventional choice of branches assigns solid line is the principal branch W0; the dashed line is W−1, which is the only other branch that takes real values. The W (− / ) = W (− / ) =− 0 1 e −1 1 e 1 small filled circle at the branch point corresponds to the 2 one in figure 2. and implies that W1(−1/e−iε ) =−1+O(ε) is arbitrar- ily close to −1, because the conventional branch choice means that the point −1 is on the border between these The Wright ω function helps to solve the equation three branches. Each branch is a single-valued com- y + ln y = z. We have that if z = t ± iπ for t<−1, then plex function, analytic away from the branch point and y = ω(z).Ifz = t − iπ for t<−1, then there is no branch cuts. solution to the equation; if z = t + iπ for t<−1, then The set of all branches is often referred to, loosely, as there are two solutions: ω(z) and ω(z − 2πi). the Lambert W “function”; but of course W is multival- ued. Depending on context, the symbol W(z) can refer 1.1 Derivatives to the principal branch (k = 0) or to some unspecified Implicit differentiation yields branch. Numerical computation of any branch of W is −W(z) typically carried out by Newton’s method or a variant W (z) = e /(1 + W(z)) W (r iθ) k r θ thereof. Images of k e for various , , and are as long as W(z) =−1. The derivative can be simplified shown in figure 2. to the rational differential equation In contrast to more commonly encountered multi- dW W branched functions, such as the inverse sine or cosine, = dz z(1 + W) the branches of W are not linearly related. However, by if, in addition, z = 0. Higher derivatives follow natu- rephrasing things slightly, in terms of the unwinding rally. number z − ln(ez) K(z) := 2πi 1.2 Integrals and the related single-valued function Integrals containing W(x)can often be performed ana- z ω(z) := WK(z)(e ), lytically by the change of variable w = W(x), used in an inverse fashion: x = wew . Thus, which is called the Wright ω function, we do have the somewhat simple relationship between branches that sin W(x)dx = (1 + w)ew sin w dw, Wk(z) = ω(lnk z), where lnk z denotes ln z + 2πik and and integration using usual methods gives ln z is the principal branch of the logarithm, having −π< ( z) π 1 ( + w) w w − 1 w w w, Im ln . 2 1 e sin 2 e cos 2 Princeton Companion to Applied Mathematics Proof Euler knew that this series converges for −1/e <z 3 1/e. The nearest singularity is the branch point z = −1/e. 2 W can also be expanded in series about the branch point. The series at the branch point can be expressed 1 most cleanly using the tree function T(z) =−W(−z), ) ) W ω W z rather than or , but keeping with we have ( k 0 2 W −1−z /2 n n ( W0(−e ) =− (−1) anz , n Im 0 –1 −1−z2/2 n W−1(−e ) =− anz , n0 –2 where the an are given by a0 = a1 = 1 and n−1 –3 1 an = an− − kakan+ −k . (n + 1)a 1 1 1 k=2 –3 –2 –1 0 1 2 3 These give an interesting variation on Stirling’s formula Re (Wk (z ) ) for the asymptotics of n!. Euler’s integral z Figure 2 Images of circles and rays in the -plane under the ∞ z → W (z) −1 n −t maps k . The circle with radius e maps to a curve n! = t e dt that goes through the branch point, as does the ray along 0 the negative real axis. This graph was produced in Maple t = n x+iy is split at the maximum of the integrand ( ) by numerical evaluation of ω(x + iy) = WK( y)(e ) first i and each integral is transformed using the substitu- for a selection of fixed x and varying y, and then for a t =−nW (− −1−z2/2) k = selection of fixed y and varying x. These two sets produce tions k e , where 0 is used for orthogonal curves as images of horizontal and vertical lines t n and k =−1 otherwise. The integrands then 2 in x and y under ω, or, equivalently, images of circles with simplify to tne−t = nne−ne−nz /2 and the differentials r = x θ = y W constant e and rays with constant under . dt are obtained as series from the above expansions. Term-by-term integration leads to which eventually gives n+1 k+1/2 n 2 1 n! ∼ (2k + 1)a k+ Γ(k+ ), x en 2 1 n 2 2 sin W(x)dx = x + sin W(x) k0 W(x) − x cos W(x)+ C. where Γ is the gamma function. Asymptotic series for z →∞have been known since More interestingly, there are many definite integrals for W(z), including one for the principal branch that is due de Bruijn’s work in the 1960s. He also proved that to Poisson and is listed in the famous table of integrals the asymptotic series are actually convergent for large z W (z) ∼ (z)− by D. Bierens de Haan. The following integral, which enough . The series begin as follows: k lnk ( (z)) + o( z) is of relatively recent construction and which is valid ln lnk ln lnk . Somewhat surprisingly, these for z not in (−∞, −1/e], can be computed with spectral series can be reversed to give a simple (though appar- accuracy by the trapezoidal rule: ently useless) expansion for the logarithm in terms of W W(z) π ( − v v)2 + v2 compositions of : = 1 1 cot v. −v v d z 2π −π z + v csc ve cot ln z = W(z)+ W(W(z))+ W(W(W(z)))+··· 1.3 Series and Generating Functions + W (N)(z) + ln W (N)(z) Euler was the first to notice, using a series due to Lam- for a suitably restricted domain in z. The series W (N) bert, that what we now call the Lambert function has obtained by omitting the term ln W (z) is not con- z = a convergent series expansion around 0: vergent as N →∞, but for fixed N if we let z →∞ (−n)n−1 W(z) = zn. the approximation improves, although only tediously n! n1 slowly. Princeton Companion to Applied Mathematics Proof 3 2 Applications Returning to serious applications, we note that the tree function T(z) has huge combinatorial significance Because W is a so-called implicitly elementary func- for all kinds of enumeration. Many instances can be tion, meaning it is defined as an implicit solution of found in Knuth’s selected papers, for example. Addi- an equation containing only elementary functions, it tionally, a key reference to the tree function is a note can be considered an “answer” rather than a question. by Borel in Comptes Rendus de l’Académie des Sciences That it solves a simple rational differential equation (volume 214, 1942; reprinted in his Œuvres). The gen- means that it occurs in a wide range of mathematical erating function for probabilities of the time between models. Out of many applications, we mention just two periods when a queue is empty, given Poisson arrivals favorites. and service time σ ,isT(σe−σ z)/σ . First, a serious application. W occurs in a chemi- cal kinetics model of how the human eye adapts to 3 Solution of Equations darkness after exposure to bright light: a phenomenon known as bleaching. The model differential equation is Several equations containing algebraic quantities d KmOp(t) together with logarithms or exponentials can be manip- Op(t) = , w dt τ(Km + Op(t)) ulated into either the form y + ln y = z or we = z, W and its solution in terms of W is and hence solved in terms of the Lambert function. However, it appears that not every exponential polyno- B B/K −t/τ Op(t) = KmW e m , Km mial equation—or even most of them—can be solved in this way. We point out one equation, here, that starts where the constant B is the initial value of Op(0): with a nested exponential and can be solved in terms that is, the amount of initial bleaching. The constants of branch differences of W : a solution of Km and τ are determined by experiment.