Lambert's W function
Encyclopedia : L : LA : LAM : Lambert's W function
In mathematics, Lambert's W function, named after Johann Heinrich Lambert, also called the Omega function or product log, is the inverse function of [f(w) = w e^w\,] where ew is the exponential function and w is any complex number. Lambert's function is usually denoted W(z). For every complex number z, we have
- [z = W(z)e^\,]
[ −1/e, 0). If we restrict to real arguments x ≥ −1/e and demand w ≥ −1, then a single-valued function W0(x) is defined, whose graph is shown. We have W0(0) = 0 and W0(−1/e) = −1.The Lambert W function cannot be expressed in terms of elementary functions. It is useful in combinatorics, for instance in the enumeration of trees. It can be used to solve various equations involving exponentials and also occurs in the solution of time-delayed differential equations, such as y'(t) = a y(t − 1).
By implicit differentiation, one can show that W satisfies the differential equation
- [z(1+W)frac=Wquadmathrmzneq -1/e]
- [W_0 (x) = sum_^infty frac} x^n = x - x^2 + fracx^3 - fracx^4 + fracx^5 - cdots]
] ; this holomorphic function defines the principal branch of the Lambert W function.Many equations involving exponentials can be solved using the W function. The general strategy is to move all instances of the unknown to one side of the equation and make it look like x ex, at which point the W function provides the solution. For instance, to solve the equation 2t = 5t, we divide by 2t to get 1 = 5t e−ln(2)t, then divide by 5 and multiply by −ln(2) to get −ln(2)/5 = −ln(2)t e−ln(2)t. Now application of the W function yields −ln(2)t = W(−ln(2)/5), i.e. t = −W(−ln(2)/5) / ln(2).
Similar techniques show that
- [x^x=z]
- [x=\frac]
- [x=\exp\left(W(\log(z))\right).]
- [z^}} \!]
- [c=\frac]
The function W(x), and many expressions involving W(x), can be integrated using the substitution w = W(x), i.e. x = w ew:
- [\int W(x)\, dx =x \left( W(x) - 1 + \frac \right) + C]
Special values
- [W\left(-\frac\right) = \frac]
- [W\left(-\right) = -1]
- [W\left(-\frac\right)= -\log 2]
- [W(0) = 0\,]
- [W(e) = 1\,]
- [W(1) = \Omega\,] (the Omega constant)
Evaluation algorithm
The W function may be evaluated using the recurrence relation
- [w_=w_j-\frac-z}(w_j+1)-\frac-z)}}]
import math
This computes the principal branch for [x>1/e]. It could be improved by giving better initial estimates.class Error(Exception): pass
def lambertW(x, prec=1e-12): w = 0 for i in xrange(100): wTimesExpW = w*math.exp(w) wPlusOneTimesExpW = (w+1)*math.exp(w) if prec>abs((x-wTimesExpW)/wPlusOneTimesExpW): break w = w-(wTimesExpW-x)/( wPlusOneTimesExpW-(w+2)*(wTimesExpW-x)/(2*w+2)) else: raise Error, "W doesn't converge fast enough for %f"%x return w
The following closed form approximation may be used by itself when less accuracy is needed, or to give an excellent initial estimate to the above code, which then may need only a few iterations:
double desy_lambert_W(double x) return log(x - 4.0) - (1.0 - 1.0/log(x)) * log(log(x)); }
(from http://www.desy.de/~t00fri/qcdins/texhtml/lambertw/)References and external links
- [Corless et al. "On the Lambert W function" Adv. Computational Maths. 5, 329 - 359 (1996)] (PostScript)
- [Chapeau-Blondeau, F. and Monir, A: "Evaluation of the Lambert W Function and Application to Generation of Generalized Gaussian Noise With Exponent 1/2", IEEE Trans. Signal Processing, 50(9), 2002]
- [MathWorld - Lambert W-Function]
- [Lambert function] from Wolfram's function site.
- [Francis et al. "Quantitative General Theory for Periodic Breathing" Circulation 102 (18): 2214. (2000).] Use of Lambert function to solve delay-differential dynamics in human disease.
- [Extreme Mathematics.] Monographs on the Lambert W function, its numerical approximation and generalizations for W-like inverses of transcendental forms with repeated exponential towers.
- [Computing the Lambert Wfunction]
From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.
