<<

Princeton Companion to Applied Proof 1

W W The 1 0 Robert M. Corless and David J. Jeffrey –e–1 1 Definition and Basic Properties z –1 1 2 3 For a given 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 ) 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 ), 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 ( 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 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 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 , 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

) 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 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 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 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. The solu- −v v tion in terms of W enables more convenient analysis z + v csc ve cot = 0 by allowing the use of known properties. is v = (Wk(z) − W (z))/(2i) for some pair of integers The second application we mention is nearly k and ; moreover, every such pair generates a solu- W frivolous. can be used to explore solutions of the tion. This bi-infinite family of solutions has accumu- y(t) = ay(t + ) so-called astrologer’s equation, ˙ 1 .In lation points of zeros near odd multiples of π, which y this equation, the rate of change of is supposed to in turn implies that the denominator in the above def- y be proportional to the value of one time unit into inite integral for W (z)/z has essential singularities at the future. Dependence on past times instead leads to v =±π. This example underlines the importance of delay differential equations, which of course are of seri- the fact that the branches of W are not trivially related. W ous interest in applications, and again is useful there Another equation of popular interest occurs in the in much the same way as for this frivolous problem. analysis of the limit of the recurrence relation Frivolity can be educational, however. Notice first a = zan that if eλt satisfies the equation, then λ = aeλ, and n+1 therefore λ =−Wk(−a). For the astrologer’s equation, starting with, say, a0 = 1. This sequence has a1 = y(t) z a = zz a = zzz any function that can be expressed as a finite lin- , 2 , 3 , and so on. If this limit −Wk(−a)t ear combination y(t) = k∈M cke for 0  t  converges, it does so to a solution of the equation 1 and some finite set M of integers then solves the a = za. By inspection, the limit that is of interest astrologer’s equation for all time. Thus, perfect know- is a =−W(− ln z)/ ln z. Somewhat surprisingly, this ledge of y(t) on the time 0  t  1 is sufficient recurrence relation—which defines the so-called tower to predict y(t) for all time. However, if the knowledge of exponentials—diverges for small enough z, even of y(t) is imperfect, even by an infinitesimal amount if z is real. Specifically, the recurrence converges for (omitting a single term εe−WK (−a)t , say, where K is some e−e  z  e1/e if z is real and diverges if z< − large integer), then since the real parts of −WK (−a) go e e = 0.0659880 .... This fact was known to Euler. The to infinity as K →∞by the first two terms of the log- detailed convergence properties for complex z were arithmic series for Wk given above, the “true” value of settled only relatively recently. Describing the regions y(t) can depart arbitrarily rapidly from the prediction. in the where the recurrence relation con- This seems completely in accord with our intuitions verges to an n-cycle is made possible by a transforma- about horoscopes. tion that is itself related to W :ifζ =−W(− ln z), then 4 Princeton Companion to Applied Mathematics Proof the iteration converges if |ζ| < 1, and also if ζ = eiθ for θ equal to some rational multiple of π, say mπ/k. Regions where the iteration converges to a k-cycle may touch the unit circle at those points.

4 Retrospective

The Lambert W function crept into the mathematics lit- erature unobtrusively, and it now seems natural there. There is even a matrix version of it, although the solu- tion of the matrix equation SeS = A is not always W (A). Hindsight can, as it so often does, identify the pres- ence of W in writings by Euler, Poisson, and Wright and in many applications. Its implementation in Maple in the early 1980s was a key step in its eventual popularity. Indeed, its recognition and naming supports Alfred North Whitehead’s opinion that:

By relieving the brain of all unnecessary work, a good notation sets it free to concentrate on more advanced problems.

Further Reading

Corless, R. M., G. H. Gonnet, D. E. G. Hare, D. J. Jeffrey, and D. E. Knuth. 1996. On the Lambert W function. Advances in Computational Mathematics 5(1):329–59. Knuth, D. E. 2000. Selected Papers on the Analysis of Algo- rithms. Palo Alto, CA: Stanford University Press. Knuth, D. E. 2003. Selected Papers on Discrete Mathematics. Stanford, CA: CSLI Publications. Lamb, T., and E. Pugh. 2004. Dark adaptation and the retinoid cycle of vision. Progress in Retinal and Eye Research 23(3):307–80. Olver, F. W. J., D. W. Lozier, R. F. Boisvert, and C. W. Clark, eds. 2010. NIST Handbook of Mathematical Func- tions. Cambridge: Cambridge University Press. (Electronic version available at http://dlmf.nist.gov.)