This page will document applications of the Lambert W function that are too short to comprise individual presentations on this website.

Definition of the Function

Calculus of the Function

Solution of the Equation *y ^{x}* =

Solutions of Other Equations

Iterated Exponentiation

This function is defined implicitly as the inverse of the nonlinear transcendental equation

$W\left(z\right){e}^{W\left(z\right)}=z$

Since the function inverts this relation, one can immediately write

${W}^{-1}\left(z\right)=z{e}^{z}$

The Lambert function has an infinite number of complex branches, like the complex natural logarithm that approximates it. The principal branch is designated ${W}_{0}$ .

Slightly rearranging the defining equation,

$z={e}^{W+lnW}={e}^{W+lnW+2n\pi i}$

it is clear that the following relation holds between different branches of the Lambert function:

${W}_{n}+ln{W}_{n}={W}_{0}+ln{W}_{0}+2n\pi i$

This is analogous to how branches of the complex logarithm are related to one another.

An approximation to the function useful for numerical root finding is

$W\left(z\right)\approx lnz-lnlnz$

This approximation becomes exact asymptotically, which can be seen by putting it into the defining equation and letting the independent variable grow,

$\begin{array}{r}(lnz-lnlnz)\frac{z}{lnz}\approx z\\ 1-\frac{lnlnz}{lnz}\approx 1\\ \underset{z\to \infty}{lim}(1-\frac{lnlnz}{lnz})=\underset{z\to \infty}{lim}(1-\frac{1}{zlnz}\times z)=1\end{array}$

where the last step follows from applying l’Hôpital’s rule to the fraction.

Both the function and its inverse are supported in Math as fully complex functions.

The derivative of the function is found by differentiating the defining equation implicitly:

${W}^{\prime}{e}^{W}+{W}^{\prime}W{e}^{W}=1\phantom{\rule{2em}{0ex}}\to \phantom{\rule{2em}{0ex}}{W}^{\prime}=\frac{1}{{e}^{W}(1+W)}=\frac{1}{{e}^{W}+z}$

The integral of the function is surprisingly easy to evaluate because integration by parts of a polynomial against an exponential is trivial:

$\begin{array}{l}\int W\left(z\right)dz=\int W\phantom{\rule{.2em}{0ex}}d\left(W{e}^{W}\right)=\int {e}^{W}(W+{W}^{2})dW\\ \phantom{\int W\left(z\right)dz}={e}^{W}(W-1)+{e}^{W}({W}^{2}-2W+2)={e}^{W}({W}^{2}-W+1)\\ \phantom{\int W\left(z\right)dz}=zW-z+{e}^{W}=z(W-1+\frac{1}{W})\end{array}$

A power series about the origin can be found using Lagrange inversion. From the defining equation, the function is necessarily zero at the origin because the exponential function is nonzero positive for finite real argument. The inversion statement simplifies considerably:

$\begin{array}{l}W\left(z\right)=\sum _{k=1}^{\infty}\frac{{z}^{k}}{k!}\phantom{\rule{.3em}{0ex}}\underset{w\to 0}{lim}\frac{{d}^{k-1}}{d{w}^{k-1}}(\frac{w}{w{e}^{w}}{)}^{k}\\ \phantom{W\left(z\right)}=\sum _{k=1}^{\infty}\frac{{z}^{k}}{k!}\phantom{\rule{.3em}{0ex}}\underset{w\to 0}{lim}\frac{{d}^{k-1}}{d{w}^{k-1}}{e}^{-kw}\\ W\left(z\right)=\sum _{n=1}^{\infty}\frac{(-k{)}^{k-1}}{k!}\phantom{\rule{.2em}{0ex}}{z}^{k}\end{array}$

This approach is much simpler that explicit evaluation of derivatives for a Taylor series.

The radius of convergence of this series can be found using the ratio test, which takes the absolute value of the ratio of adjacent coefficients:

$\begin{array}{c}L=\underset{k\to \infty}{lim}\frac{(k+1{)}^{k}}{(k+1)!}\frac{k!}{{k}^{k-1}}=\underset{k\to \infty}{lim}\frac{k}{k+1}(1+\frac{1}{k}{)}^{k}=e\\ R=\frac{1}{e}\approx 0.367879\end{array}$

Since the radius of convergence is so small, numerical evaluation of the function via the power series is not practical. A better approach is Newton’s method, which is used in Math.

This equation clearly has a trivial solution $y=x$ . It also has a solution in terms of powers of two:

${2}^{4}={2}^{2}\xb7{2}^{2}={4}^{2}$

There is additionally a solution that is not obvious. First take a logarithm of both sides of the equation,

$\frac{lny}{y}=\frac{lnx}{x}$

then note the following inverse function value:

${W}^{-1}(-lny)=-\frac{lny}{y}$

This means one can write

$y=exp[-W(-\frac{lnx}{x}\left)\right]$

without much algebraic manipulation. The two continuous solutions look like this:

The portion in red comes from the principal branch ${W}_{0}$ of the Lambert function, while the portion in magenta requires the branch ${W}_{-1}$ . The two solutions meet at $x=e$ where

$y=exp[-W(-\frac{1}{e}\left)\right]=exp[-(-1\left)\right]=e$

on both of the branches involved.

Another way to represent the nonobvious solution is via a parametrization. Setting $y=ux$ , the equation becomes

$(ux{)}^{x}={x}^{ux}=({x}^{u}{)}^{x}\phantom{\rule{2em}{0ex}}\to \phantom{\rule{2em}{0ex}}\begin{array}{l}x={u}^{1/(u-1)}\\ y={u}^{u/(u-1)}\end{array}$

It is straightforward to insert this parametrization in the previous solution to verify that it is correct.

Other bases in the defining equation are handled rather easily:

$\begin{array}{l}x{b}^{x}=a=x{e}^{xlnb}\\ x=\frac{W(alnb)}{lnb}\end{array}$

A doubly exponentiated variable can be solved with an intermediate exponential $x={e}^{y}$ :

$\begin{array}{c}ln[\phantom{\rule{.5em}{0ex}}{x}^{{x}^{a}}=b\phantom{\rule{.5em}{0ex}}]\\ {x}^{a}lnx=lnb\\ y{e}^{ay}=lnb\\ x=exp\left[\frac{W(alnb)}{a}\right]\end{array}$

A linear combination of a variable and its exponential can handled with an intermediate linear variable

$\begin{array}{c}{a}^{x}+x=b\\ {a}^{b}{e}^{-ylna}=y\\ x=b-\frac{W({a}^{b}lna)}{lna}\end{array}$

An additional constant factor on the linear term adds a denominator to the intermediate variable, altering the solution to

$\begin{array}{c}{a}^{x}+cx=b\\ {a}^{b/c}{e}^{-(y/c)lna}=y\\ x=\frac{b}{c}-\frac{W\left(\frac{{a}^{b/c}lna}{c}\right)}{lna}\end{array}$

The particular branch has not be specified in these solutions since any branch serves as a solution. This is because the dependent variable appears in entire functions. This is not true of the next equation.

Taking a logarithm of both sides of the following transcendental equation indicates that is is soluble by the Lambert function:

$\begin{array}{c}exp[\phantom{\rule{.5em}{0ex}}lnx+ax=b\phantom{\rule{.5em}{0ex}}]\\ x{e}^{ax}={e}^{b}\\ x=\frac{W\left(a{e}^{b}\right)}{a}\end{array}$

Numerical evaluation of this expression followed by substitution in the original equation indicates that it is not satisfied by just any branch. The necessary branch can be determined using the relation above between different branches:

$\begin{array}{c}lnax+ax=b+lna\\ {W}_{0}\left(a{e}^{b}\right)+ln{W}_{0}\left(a{e}^{b}\right)+2n\pi i=b+lna\\ n=\frac{b+lna-{W}_{0}\left(a{e}^{b}\right)-ln{W}_{0}\left(a{e}^{b}\right)}{2\pi i}\end{array}$

Then the correct solution to the original equation is

$lnx+ax=b\phantom{\rule{2em}{0ex}}\to \phantom{\rule{2em}{0ex}}x=\frac{{W}_{n}\left(a{e}^{b}\right)}{a}$

with *n* as indicated.

Iterated exponentiation is defined by the expression

$f\left(z\right)={z}^{{z}^{{z}^{{z}^{\u22f0}}}}$

whenever it converges: for real numbers that occurs for ${e}^{-e}\le z\le {e}^{1/e}$ . The expression can be evaluated with the Lambert function by rearranging into the latter’s defining equation:

$\begin{array}{c}f\left(z\right)={z}^{f\left(z\right)}={e}^{flnz}\\ -flnz\phantom{\rule{.3em}{0ex}}{e}^{-flnz}=-lnz\\ f\left(z\right)=-\frac{W(-lnz)}{lnz}\end{array}$

And here’s how this function looks on the specified interval, using the principal branch of the Lambert function:

*Uploaded 2020.11.27 — Updated 2022.11.24*
analyticphysics.com