Lambert W function: Difference between revisions
imported>Fredrik Johansson No edit summary |
mNo edit summary |
||
(26 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
The '''Lambert ''W'' function''' is used in mathematics to solve equations in which the unknown appears both | {{subpages}} | ||
[[File:LambertWmapT.png|right|400px|thumb|[[Complex map]] of the principal branch of the Lambert'''W''' function: | |||
<math>f\!=\!\mathrm{LambertW}(x\!+\!\mathrm{i} y)</math> in the <math>x,y</math> plane is shown with | |||
lines <math>u\!=\!\Re(f)\!=\!\mathrm{const}</math> and | |||
lines <math>v\!=\!\Im(f)\!=\!\mathrm{const}</math>]] | |||
The '''Lambert ''W'' function''' is used in mathematics to solve equations in which the unknown appears both outside and inside an [[exponential function]] or a [[logarithm]], such as <math>3x+2=e^x</math> or <math>x=\ln(4x)</math>. Such equations cannot otherwise, except in special cases, be solved explicitly in terms of algebraic operations, exponentials and logarithms. | |||
==Definition== | ==Definition== | ||
Line 6: | Line 12: | ||
:<math>z = W(z)e^{W(z)}\;</math> | :<math>z = W(z)e^{W(z)}\;</math> | ||
for any [[complex number]] <math>\scriptstyle z</math>. Equivalently, it may be defined as the [[inverse function]] of <math>f(w) = we^w</math>. | for any [[complex number]] <math>\scriptstyle z</math>. Equivalently, it may be defined as the [[inverse function]] of <math>f(w) = we^w</math>. Thus, the equation <math>C = we^w</math> is by definition solved by <math>\scriptstyle w = W(C)</math>. The multivaluedness of the Lambert ''W'' function means that there is generally more than one solution. The graph of the Lambert ''W'' function in the [[real number]]s looks as follows: | ||
{{Image|Lambertw.png|center|400px|}} | |||
The function has two real branches in the interval <math>-1/e < x < 0</math> which join at <math>x = -1/e</math>. Concretely, this means that the equation <math>x = w e^w</math> has two real solutions if <math>-1/e < x < 0</math>. For example, if <math>x = -0.15</math> (which is about half way between <math>-1/e</math> and 0), there is one solution <math>\scriptstyle w_0 \approx -0.17</math> that lies on the blue graph and another solution <math>\scriptstyle w_{-1} \approx -3.0</math> that lies on the dashed red graph. | The function has two real branches in the interval <math>-1/e < x < 0</math> which join at <math>x = -1/e</math>. Concretely, this means that the equation <math>x = w e^w</math> has two real solutions if <math>-1/e < x < 0</math>. For example, if <math>x = -0.15</math> (which is about half way between <math>-1/e</math> and 0), there is one solution <math>\scriptstyle w_0 \approx -0.17</math> that lies on the blue graph and another solution <math>\scriptstyle w_{-1} \approx -3.0</math> that lies on the dashed red graph. | ||
The single-valued function corresponding to the blue graph for <math>\scriptstyle -1/e\, \le \, x \,< \,\infty</math> is called the ''principal branch'' of the Lambert ''W'' function and is denoted by <math>W_0</math>. The single-valued function corresponding to the dashed red graph for <math>\scriptstyle -1/e \, \le \, x \, < \, 0</math> is called the ''negative branch'', denoted by <math>W_{-1}</math>. The negative branch | The single-valued function corresponding to the blue graph for <math>\scriptstyle -1/e\, \le \, x \,< \,\infty</math> is called the ''principal branch'' of the Lambert ''W'' function and is denoted by <math>W_0</math>. The single-valued function corresponding to the dashed red graph for <math>\scriptstyle -1/e \, \le \, x \, < \, 0</math> is called the ''negative branch'', denoted by <math>W_{-1}</math>. The negative branch goes to <math>\scriptstyle -\infty</math> as <math>\scriptstyle x \to 0</math> while the principal branch grows slowly but unboundedly as <math>\scriptstyle x \to \infty</math>. | ||
The behavior of the Lambert ''W'' function can be understood by comparing it to the natural logarithm, the inverse of <math>e^w</math>. For large negative or positive <math>w</math>, <math>e^w</math> and <math>we^w</math> grow similarly, so their respective inverse functions have similar [[asymptote]]s as well (except for the sign when <math>w</math> is negative). Multiplying the exponential by <math>w</math> deforms its graph around zero so that it is no longer [[monotone function|monotone]], and that is why the Lambert ''W'' function has two real branches: one for values on each side of the [[stationary point]]. The following pair of graphs shows the relation between the two exponential functions (left graph) and their inverse functions (right graph): | |||
{{Image|Lambert and log.png|center|550px|}} | |||
Like the complex logarithm, the Lambert ''W'' function has infinitely many complex branches; they are conventionally labeled <math>W_k</math> where <math>k</math> runs over all the integers. The details are discussed for instance in Corless ''et al''.<ref name="corless1">Corless, R. M., Gonnet, G. H., Hare, D. E. G., Jeffrey, D. J. & Knuth, D. E. (1996). "[http://www.cs.uwaterloo.ca/research/tr/1993/03/W.pdf On the Lambert W function]". ''Adv. Computational Maths.'' '''5''', 329–359</ref> | |||
Besides <math>W(-1/e) = -1</math>, the Lambert ''W'' function has the special values <math>W_0(0) = 0</math> and <math>W_0(e) = 1</math>. The value <math>\scriptstyle W_0(1) = 0.567143\ldots</math> is called the [[omega constant]]. | Besides <math>W(-1/e) = -1</math>, the Lambert ''W'' function has the special values <math>W_0(0) = 0</math> and <math>W_0(e) = 1</math>. The value <math>\scriptstyle W_0(1) = 0.567143\ldots</math> is called the [[omega constant]]. | ||
==Examples of use== | |||
The Lambert ''W'' function solves any equation of the form <math>C = x e^x</math> — we may call this the ''canonical form''. Many other types of equations can be solved in terms of the Lambert ''W'' function as well, by using the rules of exponentials and logarithms to rewrite them in the canonical form. For example, the equation <math>xb^x=a</math> is solved by <math>\scriptstyle x=W(a\ln b)/\ln b</math> and <math>a^x=x+b</math> is solved by | |||
:<math>x = \frac{-b-W(-a^{-b} \ln a)}{\ln a}.</math><ref name="corless1"/> | |||
Valluri ''et al.'' give the following example of an equation from physics that can be solved with the Lambert ''W'' function.<ref>Valluri, S. R., Jeffrey, D. R. & Corless, R. M. (2000). "[http://pubs.nrc-cnrc.gc.ca/cgi-bin/rp/rp2_abst_e?cjp_p00-065_78_ns_nf_cjp9-00 Some applications of the Lambert ''W'' function to physics]". ''Can. J. Phys.'' '''78''', 823–831</ref> [[Planck's law]] states that the radiation intensity <math>I</math> at [[wavelength]] <math>\lambda</math> from a [[black body]] at temperature <math>T</math> is given by | |||
:<math>I(\lambda, T) = \frac{8\pi h c/\lambda^5}{\exp(hc/\lambda k T)-1},</math> | |||
where <math>h</math> is [[Planck's constant]], <math>k</math> is [[Boltzmann's constant]] and <math>c</math> is the [[speed of light]]. Note that <math>\lambda</math> appears both inside and outside an exponential. Next, [[Wien's displacement law]] states that the maximum intensity is attained at the wavelength <math>\lambda_{max} = b/T</math> where <math>b</math> is a quantity called Wien's displacement constant. Using the Lambert ''W'' function, we can give an explicit formula for <math>b</math>. | |||
To derive Wien's displacement law, we wish to solve <math>\scriptstyle \partial I / \partial \lambda = 0</math>. If we calculate the [[partial derivative]], simplify, and perform the substitution <math>x=hc/\lambda k T</math>, we obtain the equation <math>(x-5)e^x = -5</math>. To write this in canonical form for application of the Lambert ''W'' function, we substitute <math>w = x-5</math> and multiply both sides of the resulting equation by <math>e^{-5}</math>. This leaves <math>w e^w = -5e^{-5}</math>, with the nonzero solution <math>w = W_0(-5e^{-5})</math>. Substituting back the expression for <math>x</math>, we obtain Wien's displacement law with the value for Wien's constant given explicitly by | |||
:<math>b = \frac{hc/k}{5+W_0(-5e^{-5})} = 2.893 \times 10^{-3} \, \mathrm{m} \, \mathrm{K}.</math> | |||
==Calculus== | ==Calculus== | ||
It is possible to do [[calculus]] with the Lambert ''W'' function much like with other [[elementary function]]s. Its properties can be derived from the familiar properties of exponentials and logarithms, although we have to use the theory of [[implicit function]]s since the Lambert ''W'' function is defined implicitly rather than by a direct formula. | |||
Let us first consider [[limit (mathematics)|limit]]ing behavior. When discussing the graph of the Lambert ''W'' function, we said that its asymptotes are "similar" to those of the natural logarithm, since the exponential in <math>we^w</math> dominates when <math>w</math> is large. A more precise statement is that | |||
:<math>\lim_{x\to\infty} \frac{W_0(x)}{\ln x} = 1.</math> | |||
By similar reasoning, the negative branch approaches the singularity at <math>x=0</math> logarithmically: | |||
:<math>\lim_{x\to 0^-} \frac{W_{-1}(x)}{\ln(-x)} = 1.</math> | |||
However, the ''absolute'' difference between the Lambert ''W'' function and the natural logarithm, <math>|\scriptstyle W(x)-\ln x|</math>, diverges to infinity as <math>x \to \infty</math>. It is possible to give a more complicated asymptotic formula for the Lambert ''W'' function that eliminates this difference, in the form of an [[infinite series]] | |||
:<math>W(x) = \ln(x) - \ln \ln(x) + \sum_{n=1}^\infty \frac{(-1)^n}{(\ln x)^n} c_n(x)</math> | |||
where | |||
:<math>c_n(x) = \sum_{m=1}^n (-1)^m \;s(n, \,n-m+1)\; \frac{(\ln \ln x)^m}{m!}</math> | |||
and <math>s(n, k)</math> denotes a [[Stirling number]] of the first kind. The series is [[absolutely convergent]] for sufficiently large <math>x</math>.<ref name="corless2">Corless, R., Jeffrey, D. & Knuth, D. E. (1997). "[http://citeseer.ist.psu.edu/391153.html A Sequence of Series for the Lambert ''W'' Function]", ISSAC: Proceedings of the ACM SIGSAM International Symposium on Symbolic and Algebraic Computation (formerly SYMSAM, SYMSAC, EUROSAM, EUROCAL) (also sometimes in cooperation with the Symbolic and Algebraic Manipulation Groupe in Europe (SAME))</ref> | |||
The [[Taylor series]] of the Lambert ''W'' function can be found by using the [[Lagrange inversion theorem]] to invert the series of <math>w e^w</math>. This way, we find that the principal branch of the Lambert ''W'' function has the Taylor series expansion | |||
:<math>W_0(x) = \sum_{n=1}^\infty \frac{(-n)^{n-1}}{n!}x^n = x - x^2 + \begin{matrix}\frac{3}{2}\end{matrix}x^3 - \begin{matrix}\frac{8}{3}\end{matrix}x^4 + \begin{matrix}\frac{125}{24}\end{matrix}x^5 - \cdots</math> | |||
around <math>x=0</math>. Due to the singularity at <math>x=-1/e</math>, and as can be proved with the [[ratio test]], the series converges for <math>|x|<1/e</math>. The Lambert ''W'' function further has the [[derivative]] | |||
:<math>W'(x) = \frac{1}{(1+W(x))\exp(W(x))}</math> | :<math>W'(x) = \frac{1}{(1+W(x))\exp(W(x))}</math> | ||
which is infinite at the branch point <math>x = -1/e</math>. | which is infinite at the branch point <math>x = -1/e</math>. The [[integral|indefinite integral]] is given by | ||
:<math>\int W(x) \,dx = x\left(W(x)-1+\frac{1}{W(x)}\right)+C.</math> | :<math>\int W(x) \,dx = x\left(W(x)-1+\frac{1}{W(x)}\right)+C.</math> | ||
It is also possible to find | It is also possible to find integrals of more complicated expressions containing the Lambert ''W'' function. See Corless ''et al''. for an overview.<ref name="corless1"/> | ||
==Numerical calculation== | |||
The value of <math>W(z)</math> can be calculated by using a regular [[root-finding algorithm]] to solve the equation <math>we^w-z=0</math> for <math>w</math>. Since the left-hand side has simple derivatives, [[Newton's method]] and [[Halley's method]] are both good choices. Halley's method amounts to iterating | |||
:<math>w_{k+1} = w_k - \frac{w_k e^{w_k}-z}{e^{w_k} (w_k+1) - \frac{(w_k+2)(w_k e^{w_k}-z)}{2w_k+2}}</math> | |||
for <math>k = 1, 2, \ldots</math>. The initial value <math>w_0</math> must be chosen carefully in order to end up on the correct branch. To calculate real values on the principal branch, any real number above <math>-1</math> will work, but faster convergence is obtained by taking the initial value from an interpolating function around 0 for small arguments and a few terms of the asymptotic series for large arguments. With a sufficiently accurate initial value, a few iterations of Halley's method will give a value that is correct to full precision in ordinary [[floating-point arithmetic]]. | |||
Of course, we could use standard root-finding techniques to solve equations without going through the trouble of rewriting them in terms of the Lambert ''W'' function. From the numerical point of view, the advantage of using the Lambert ''W'' function is that highly optimized implementations that have been tested for correctness are available; further, those implementations allow the user to select a complex branch of choice. | |||
==History and application== | ==History and application== | ||
Line 37: | Line 92: | ||
Equations of the kind that can be solved analytically with the Lambert ''W'' function are common in mathematics and science, yet the utility of such a function was not realized until recently. The Lambert ''W'' function was introduced in the 1980's as a function in the [[Maple (software)|Maple]] [[computer algebra system]], whose interface required an explicit notation for solutions of equations. The function's history highlights the importance of good mathematical notation: due to previously not being recognized as a function in its own right, it had not been studied systematically, despite its most important properties requiring only elementary [[complex analysis]]. An account of the function and its history that helped popularize it is given in a 1996 paper by R. M. Corless ''et al.'' (with [[Donald Knuth]] a notable co-author).<ref name="corless1"/> | Equations of the kind that can be solved analytically with the Lambert ''W'' function are common in mathematics and science, yet the utility of such a function was not realized until recently. The Lambert ''W'' function was introduced in the 1980's as a function in the [[Maple (software)|Maple]] [[computer algebra system]], whose interface required an explicit notation for solutions of equations. The function's history highlights the importance of good mathematical notation: due to previously not being recognized as a function in its own right, it had not been studied systematically, despite its most important properties requiring only elementary [[complex analysis]]. An account of the function and its history that helped popularize it is given in a 1996 paper by R. M. Corless ''et al.'' (with [[Donald Knuth]] a notable co-author).<ref name="corless1"/> | ||
The basic theory behind the Lambert ''W'' function was investigated in 1779 by [[Leonhard Euler]].<ref>Euler, L. (1779). "De serie Lambertina plurimisque eius insignibus proprietatibus". Originally published in ''Acta Academiae Scientarum Imperialis Petropolitinae'' 1779, 1783, | The basic theory behind the Lambert ''W'' function was investigated in 1779 by [[Leonhard Euler]].<ref>Euler, L. (1779). "De serie Lambertina plurimisque eius insignibus proprietatibus". Originally published in ''Acta Academiae Scientarum Imperialis Petropolitinae'' 1779, 1783, 29–51. Also in ''Opera Omnia'': Series 1, Volume 6, pp. 350 - 369. See [http://math.dartmouth.edu/~euler/pages/E532.html E532] in The Euler Archive for a scanned copy.</ref> The Maple developers chose the name of [[Johann Heinrich Lambert]] instead of Euler's since Euler had referenced work by Lambert in his paper, and possibly because "naming yet another function after Euler would not be useful".<ref name="corless2"/> | ||
Since its introduction, the Lambert ''W'' function has been applied to problems ranging from [[quantum physics]] to the [[complexity of algorithms]]. Cranmer<ref>Cranmer, S. R. (2004). "[http://www.citebase.org/abstract?id=oai:arXiv.org:astro-ph/0406176 New views of the solar wind with the Lambert ''W'' function]". ''Am. J. Phys.'' '''72''', 1397</ref> discusses the application of the Lambert ''W'' function in [[solar wind]] physics and writes in the conclusion: "The Lambert ''W'' function used in these solutions was defined and publicized only about a decade ago, but it has rapidly become a convenient tool for mathematical physicists. The elegance of explicit solutions to equations thought previously to be expressible only implicitly is clear, but there also are many practical benefits to having explicit solutions as well." | Since its introduction, the Lambert ''W'' function has been applied to problems ranging from [[quantum physics]] to [[population dynamics]] to the [[complexity of algorithms]]. Cranmer<ref>Cranmer, S. R. (2004). "[http://www.citebase.org/abstract?id=oai:arXiv.org:astro-ph/0406176 New views of the solar wind with the Lambert ''W'' function]". ''Am. J. Phys.'' '''72''', 1397</ref> discusses the application of the Lambert ''W'' function in [[solar wind]] physics and writes in the conclusion: "The Lambert ''W'' function used in these solutions was defined and publicized only about a decade ago, but it has rapidly become a convenient tool for mathematical physicists. The elegance of explicit solutions to equations thought previously to be expressible only implicitly is clear, but there also are many practical benefits to having explicit solutions as well." | ||
Since century 21, the Lambert W function is implemented as special function in the programming languages such as [[Mathematica]], [[Maple (software)|Maple]], [[Matlab]]. In [[Mathematica]], the call of this function with argumenr <math>z</math> may look as | |||
<math> \rm LambertW[z] </math> | |||
or | |||
<math> \rm LambertW[n,z]</math>. | |||
In the case of two arguments, the first indicates the number of branch; <math>n\!=\!0</math> corresponds to the principal branch shown in the [[complex map]] at the top. In [[Mathematica]], the name '''ProductLog''' is interpreted as an equivalent of the '''LambertW'''. For [[C++]], the expression of the principal branch through the [[Tania function]] can be used, <math>\mathrm{LambertW}(z)=\mathrm{Tania}(\ln(z)-1)</math>. | |||
==See also== | ==See also== | ||
* [[Implicit function]] | * [[Implicit function]] | ||
* [[Elementary | * [[Elementary function]] | ||
* [[Catalog of special functions]] | * [[Catalog of special functions]] | ||
Line 49: | Line 110: | ||
<references/> | <references/> | ||
<!-- also: [http://www.americanscientist.org/template/AssetDetail/assetid/40804?&print=yes Why W?] --> | <!-- also: [http://www.americanscientist.org/template/AssetDetail/assetid/40804?&print=yes Why W?] -->[[Category:Suggestion Bot Tag]] | ||
[[Category: | |||
Latest revision as of 16:00, 9 September 2024
The Lambert W function is used in mathematics to solve equations in which the unknown appears both outside and inside an exponential function or a logarithm, such as Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle 3x+2=e^x} or Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x=\ln(4x)} . Such equations cannot otherwise, except in special cases, be solved explicitly in terms of algebraic operations, exponentials and logarithms.
Definition
The Lambert W function is defined as the multivalued function Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle W} that satisfies
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle z = W(z)e^{W(z)}\;}
for any complex number Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \scriptstyle z} . Equivalently, it may be defined as the inverse function of Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle f(w) = we^w} . Thus, the equation Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle C = we^w} is by definition solved by Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \scriptstyle w = W(C)} . The multivaluedness of the Lambert W function means that there is generally more than one solution. The graph of the Lambert W function in the real numbers looks as follows:
The function has two real branches in the interval Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle -1/e < x < 0} which join at Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x = -1/e} . Concretely, this means that the equation Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x = w e^w} has two real solutions if Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle -1/e < x < 0} . For example, if Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x = -0.15} (which is about half way between Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle -1/e} and 0), there is one solution Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \scriptstyle w_0 \approx -0.17} that lies on the blue graph and another solution Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \scriptstyle w_{-1} \approx -3.0} that lies on the dashed red graph.
The single-valued function corresponding to the blue graph for Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \scriptstyle -1/e\, \le \, x \,< \,\infty} is called the principal branch of the Lambert W function and is denoted by Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle W_0} . The single-valued function corresponding to the dashed red graph for Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \scriptstyle -1/e \, \le \, x \, < \, 0} is called the negative branch, denoted by Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle W_{-1}} . The negative branch goes to Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \scriptstyle -\infty} as Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \scriptstyle x \to 0} while the principal branch grows slowly but unboundedly as Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \scriptstyle x \to \infty} .
The behavior of the Lambert W function can be understood by comparing it to the natural logarithm, the inverse of Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle e^w} . For large negative or positive Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle w} , Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle e^w} and Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle we^w} grow similarly, so their respective inverse functions have similar asymptotes as well (except for the sign when Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle w} is negative). Multiplying the exponential by Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle w} deforms its graph around zero so that it is no longer monotone, and that is why the Lambert W function has two real branches: one for values on each side of the stationary point. The following pair of graphs shows the relation between the two exponential functions (left graph) and their inverse functions (right graph):
Like the complex logarithm, the Lambert W function has infinitely many complex branches; they are conventionally labeled Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle W_k} where Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle k} runs over all the integers. The details are discussed for instance in Corless et al.[1]
Besides Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle W(-1/e) = -1} , the Lambert W function has the special values Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle W_0(0) = 0} and Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle W_0(e) = 1} . The value Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \scriptstyle W_0(1) = 0.567143\ldots} is called the omega constant.
Examples of use
The Lambert W function solves any equation of the form Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle C = x e^x} — we may call this the canonical form. Many other types of equations can be solved in terms of the Lambert W function as well, by using the rules of exponentials and logarithms to rewrite them in the canonical form. For example, the equation Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle xb^x=a} is solved by Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \scriptstyle x=W(a\ln b)/\ln b} and Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle a^x=x+b} is solved by
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x = \frac{-b-W(-a^{-b} \ln a)}{\ln a}.} [1]
Valluri et al. give the following example of an equation from physics that can be solved with the Lambert W function.[2] Planck's law states that the radiation intensity Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle I} at wavelength Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \lambda} from a black body at temperature Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle T} is given by
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle I(\lambda, T) = \frac{8\pi h c/\lambda^5}{\exp(hc/\lambda k T)-1},}
where Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle h} is Planck's constant, Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle k} is Boltzmann's constant and is the speed of light. Note that appears both inside and outside an exponential. Next, Wien's displacement law states that the maximum intensity is attained at the wavelength where Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle b} is a quantity called Wien's displacement constant. Using the Lambert W function, we can give an explicit formula for Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle b} .
To derive Wien's displacement law, we wish to solve Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \scriptstyle \partial I / \partial \lambda = 0} . If we calculate the partial derivative, simplify, and perform the substitution Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x=hc/\lambda k T} , we obtain the equation Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle (x-5)e^x = -5} . To write this in canonical form for application of the Lambert W function, we substitute Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle w = x-5} and multiply both sides of the resulting equation by Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle e^{-5}} . This leaves Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle w e^w = -5e^{-5}} , with the nonzero solution Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle w = W_0(-5e^{-5})} . Substituting back the expression for Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x} , we obtain Wien's displacement law with the value for Wien's constant given explicitly by
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle b = \frac{hc/k}{5+W_0(-5e^{-5})} = 2.893 \times 10^{-3} \, \mathrm{m} \, \mathrm{K}.}
Calculus
It is possible to do calculus with the Lambert W function much like with other elementary functions. Its properties can be derived from the familiar properties of exponentials and logarithms, although we have to use the theory of implicit functions since the Lambert W function is defined implicitly rather than by a direct formula.
Let us first consider limiting behavior. When discussing the graph of the Lambert W function, we said that its asymptotes are "similar" to those of the natural logarithm, since the exponential in Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle we^w} dominates when Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle w} is large. A more precise statement is that
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \lim_{x\to\infty} \frac{W_0(x)}{\ln x} = 1.}
By similar reasoning, the negative branch approaches the singularity at Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x=0} logarithmically:
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \lim_{x\to 0^-} \frac{W_{-1}(x)}{\ln(-x)} = 1.}
However, the absolute difference between the Lambert W function and the natural logarithm, Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle |\scriptstyle W(x)-\ln x|} , diverges to infinity as Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x \to \infty} . It is possible to give a more complicated asymptotic formula for the Lambert W function that eliminates this difference, in the form of an infinite series
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle W(x) = \ln(x) - \ln \ln(x) + \sum_{n=1}^\infty \frac{(-1)^n}{(\ln x)^n} c_n(x)}
where
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle c_n(x) = \sum_{m=1}^n (-1)^m \;s(n, \,n-m+1)\; \frac{(\ln \ln x)^m}{m!}}
and Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle s(n, k)} denotes a Stirling number of the first kind. The series is absolutely convergent for sufficiently large Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x} .[3]
The Taylor series of the Lambert W function can be found by using the Lagrange inversion theorem to invert the series of Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle w e^w} . This way, we find that the principal branch of the Lambert W function has the Taylor series expansion
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle W_0(x) = \sum_{n=1}^\infty \frac{(-n)^{n-1}}{n!}x^n = x - x^2 + \begin{matrix}\frac{3}{2}\end{matrix}x^3 - \begin{matrix}\frac{8}{3}\end{matrix}x^4 + \begin{matrix}\frac{125}{24}\end{matrix}x^5 - \cdots}
around Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x=0} . Due to the singularity at Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x=-1/e} , and as can be proved with the ratio test, the series converges for Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle |x|<1/e} . The Lambert W function further has the derivative
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle W'(x) = \frac{1}{(1+W(x))\exp(W(x))}}
which is infinite at the branch point Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x = -1/e} . The indefinite integral is given by
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \int W(x) \,dx = x\left(W(x)-1+\frac{1}{W(x)}\right)+C.}
It is also possible to find integrals of more complicated expressions containing the Lambert W function. See Corless et al. for an overview.[1]
Numerical calculation
The value of Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle W(z)} can be calculated by using a regular root-finding algorithm to solve the equation Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle we^w-z=0} for Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle w} . Since the left-hand side has simple derivatives, Newton's method and Halley's method are both good choices. Halley's method amounts to iterating
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle w_{k+1} = w_k - \frac{w_k e^{w_k}-z}{e^{w_k} (w_k+1) - \frac{(w_k+2)(w_k e^{w_k}-z)}{2w_k+2}}}
for Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle k = 1, 2, \ldots} . The initial value Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle w_0} must be chosen carefully in order to end up on the correct branch. To calculate real values on the principal branch, any real number above Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle -1} will work, but faster convergence is obtained by taking the initial value from an interpolating function around 0 for small arguments and a few terms of the asymptotic series for large arguments. With a sufficiently accurate initial value, a few iterations of Halley's method will give a value that is correct to full precision in ordinary floating-point arithmetic.
Of course, we could use standard root-finding techniques to solve equations without going through the trouble of rewriting them in terms of the Lambert W function. From the numerical point of view, the advantage of using the Lambert W function is that highly optimized implementations that have been tested for correctness are available; further, those implementations allow the user to select a complex branch of choice.
History and application
Equations of the kind that can be solved analytically with the Lambert W function are common in mathematics and science, yet the utility of such a function was not realized until recently. The Lambert W function was introduced in the 1980's as a function in the Maple computer algebra system, whose interface required an explicit notation for solutions of equations. The function's history highlights the importance of good mathematical notation: due to previously not being recognized as a function in its own right, it had not been studied systematically, despite its most important properties requiring only elementary complex analysis. An account of the function and its history that helped popularize it is given in a 1996 paper by R. M. Corless et al. (with Donald Knuth a notable co-author).[1]
The basic theory behind the Lambert W function was investigated in 1779 by Leonhard Euler.[4] The Maple developers chose the name of Johann Heinrich Lambert instead of Euler's since Euler had referenced work by Lambert in his paper, and possibly because "naming yet another function after Euler would not be useful".[3]
Since its introduction, the Lambert W function has been applied to problems ranging from quantum physics to population dynamics to the complexity of algorithms. Cranmer[5] discusses the application of the Lambert W function in solar wind physics and writes in the conclusion: "The Lambert W function used in these solutions was defined and publicized only about a decade ago, but it has rapidly become a convenient tool for mathematical physicists. The elegance of explicit solutions to equations thought previously to be expressible only implicitly is clear, but there also are many practical benefits to having explicit solutions as well."
Since century 21, the Lambert W function is implemented as special function in the programming languages such as Mathematica, Maple, Matlab. In Mathematica, the call of this function with argumenr Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle z} may look as Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \rm LambertW[z] } or Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \rm LambertW[n,z]} . In the case of two arguments, the first indicates the number of branch; Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle n\!=\!0} corresponds to the principal branch shown in the complex map at the top. In Mathematica, the name ProductLog is interpreted as an equivalent of the LambertW. For C++, the expression of the principal branch through the Tania function can be used, Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \mathrm{LambertW}(z)=\mathrm{Tania}(\ln(z)-1)} .
See also
References
- ↑ 1.0 1.1 1.2 1.3 Corless, R. M., Gonnet, G. H., Hare, D. E. G., Jeffrey, D. J. & Knuth, D. E. (1996). "On the Lambert W function". Adv. Computational Maths. 5, 329–359
- ↑ Valluri, S. R., Jeffrey, D. R. & Corless, R. M. (2000). "Some applications of the Lambert W function to physics". Can. J. Phys. 78, 823–831
- ↑ 3.0 3.1 Corless, R., Jeffrey, D. & Knuth, D. E. (1997). "A Sequence of Series for the Lambert W Function", ISSAC: Proceedings of the ACM SIGSAM International Symposium on Symbolic and Algebraic Computation (formerly SYMSAM, SYMSAC, EUROSAM, EUROCAL) (also sometimes in cooperation with the Symbolic and Algebraic Manipulation Groupe in Europe (SAME))
- ↑ Euler, L. (1779). "De serie Lambertina plurimisque eius insignibus proprietatibus". Originally published in Acta Academiae Scientarum Imperialis Petropolitinae 1779, 1783, 29–51. Also in Opera Omnia: Series 1, Volume 6, pp. 350 - 369. See E532 in The Euler Archive for a scanned copy.
- ↑ Cranmer, S. R. (2004). "New views of the solar wind with the Lambert W function". Am. J. Phys. 72, 1397