Preface


The Lambert special function is the topic of this section.

Return to computing page for the first course APMA0330
Return to computing page for the second course APMA0340
Return to Mathematica tutorial for the first course APMA0330
Return to Mathematica tutorial for the second course APMA0340
Return to the main page for the first course APMA0330
Return to the main page for the second course APMA0340
Return to Part VII of the course APMA0340
Introduction to Linear Algebra with Mathematica

Lambert Functions


The Lambert W function, also called the omega function or product logarithm, is a set of branches of the inverse relation of the function \( f(z) = z\, e^z , \) where ez is the exponential function, and z is any complex number. In other words

\begin{equation} \label{EqLambert.1} W\,e^W =x . \end{equation}
 Johann Lambert

The function W is called after the Swiss polymath Johann Heinrich Lambert (1728--1777) who found in 1758 series representation of the root for the equation \( y = q + y^m . \) Later his long time friend Leonhard Euler (1707--1783) solve more symmetric equation \( y^{\alpha} - y^{\beta} = \nu \left( \alpha - \beta \right) y^{\alpha + \beta} . \) Lambert is credited with the first proof that π is irrational by using a generalized continued fraction for the function tan x. He was the first mathematician to address the general properties of map projections. Lambert invented the first practical hygrometer.

Many years later in 1980th, a group of scientists (Gaston H. Gonnet, Robert M. Corless, Donald Knuth, and David Jeffrey) used the Lambert function in their research; shortly Donald Knuth from Stanford University suggested to call it the Lambert W function.

The Lambert W function in neither odd nor even. It is defined on the interval \( \left( - e^{-1}, \infty \right) \) and range from minus infinity to plus infinity. There are countably many branches of the W function, denoted by Wk(z), for integer k∈ℤ. A point A with coordinates \( \left( - e^{-1}, -1 \right) \) divides the graph into two branches that share the same vertical tangent line. The upper branch, usually denoted as W0, is called the main (or principal) branch because it goes through the origin. The lower branch W-1 has the inflection point at \( \left( - 2\,e^{-2}, -2 \right) \) and vertical asymptote at x = 0.

In general, for a given complex z, the defining equation will have an infinite number of solutions and is therefore a multivalued analytic function. Its principal branch is denoted by W0(z); other branches are labeled with Wk(z), k ∈ ℤ. However, only two of them are real-valued functions that correspond k = 0 and k = −1. So one real solution of the defining Lambert equation is W0(x) or simply W(x) for −1/ex < ∞, while the secondary real branch satisfying W(x) ≤ −1 is denoted by W-1(x), −1/ex < 0.

Mathematica has a special command to evaluate and plot the Lambert W function: ProductLog[x] for the principal branch and ProductLog[k, x] for k-th branch.

 Authors of Lambert function:
Gaston Gonnet, Rob Corless, Don Knuth, and David Jeffrey.
      Now we plot the Lambert principal branch W0(x) and the next to it branch W-1(x).
k0 = Plot[ProductLog[x], {x, -1/E, 1}, PlotStyle -> Thickness[0.01], PlotRange -> {-5, 0.6}];
km1 = Plot[ProductLog[-1, x], {x, -1/E, -0.01}, PlotStyle -> {Thick, Red, Dashed}, PlotRange -> {-5, 0.6}];
Show[k0, km1, AspectRatio -> 1]
       Plots of the principal branch (in blue) and W-1 in red.            Mathematica code

For other indices k ≠ 0, -1, the branches Wk of the Lambert function are complex-valued. The following identities follow from the definition:

\[ \ln W(x) = \ln x - W(x) , \]
\[ W(x)\, \exp \left\{ W \left[ \exp W(x) \right] \right\} W \left[ \exp W(x) \right] = x . \]
The Lambert function satisfies the separable differential equation
\[ W' (x) = \frac{W(x)}{x \left[ 1 + W(x) \right]} = \frac{\exp \left\{ -W(x) \right\}}{1 + W(x)}. \]
There are many differential equations having solutions represented through the Lambert W function. For example, the initial value problem
\[ y' = \alpha \, y^2 \left( \beta - y \right) , \qquad y(0) = y_0, \]
has the explicit solution
\[ y(x) = \frac{\beta}{1 + W \left( u\, \exp (u - 2 \alpha \beta x) \right)} , \qquad\mbox{where} \quad u = \frac{\beta}{y_0} -1 . \]
Mathematica allows one to find power series approximations:
Series[ProductLog[z], {z, 0, 8}]
Out[1]= \( z - z^2 + \frac{3}{2}\, z^3 - \frac{8}{3}\, z^4 + \frac{125}{24}\, z^5 - \frac{54}{5}\, z^6 + \frac{16807}{720}\, z^7 - \frac{16384}{315}\, z^8 \)
Series[Log[ProductLog[z]] - Log[z], {z, 0, 8}]
Out[1]= \( -z + z^2 \frac{3}{2}\, z^3 + \frac{8}{3}\, z^4 - \frac{125}{24}\, z^5 + \frac{54}{5}\, z^6 \)
From Lagrange Inversion Theorem, it follows
\[ W_0 (x) = \sum_{n\ge 1} \frac{(-n)^{n-1}}{n!} \, x^n . \]

The Lambert function has many applications that are documented in the reference sources.

Example: Consider an RC-circuit having a resistance linearly proportional to the temperature:

\begin{eqnarray*} R(t) &=& R_0 \left( 1 + \eta \left[ T(t) - T_0 \right] \right) = R_0 + \zeta R_0 \, c^{-1} Q(t) \\ &=& R_0 + \frac{\zeta\,R_0}{c} \, \int_0^t I^2 (\tau )\,R(\tau )\,{\text d}\tau , \end{eqnarray*}
where ζ is a constant coefficient, R0 is the initial resistence, and c is the capacitence. Here Q is the amount of heat due to current I in the wire. Upon differentiating, we get the initial value problem
\[ \begin{cases} \frac{{\text d}}{{\text d}t} \left( R\,I \right) + C^{-1} I &= 0 , \\ \frac{{\text d}\,R}{{\text d}t} - \frac{\zeta\,R_0}{c}\, R\,I^2 &=0 , \end{cases} \qquad R(0) = R_0 , \quad I(0) = I_0 , \]
where \( I_0 = U_0 / R_0 \) as is the initial current and U0 is the initial voltage at the capacitor.

In dimensionless variables, the above system becomes

\[ \begin{cases} \left( 1 - \beta \right) \frac{{\text d}}{{\text d}\tau} \left( x\,y \right) + y &= 0 , \\ \left( 1 - \beta \right) \frac{{\text d}\,x}{{\text d}\tau} - \frac{2\beta}{1- \beta}\, x\,y^2 &=0 , \end{cases} \qquad x(0) = 1 , \quad y(0) = 1 , \]
where
\[ x(t) = R_0^{-1} R(t) , \quad y(t) = I_0^{-1} I(t) = \frac{R_0}{U_0}\, I(t) , \quad \tau = \frac{1}{C\,R_{\infty}} , \]
and
\[ \beta = \frac{\zeta \,Q_{\max}}{c + \zeta \,Q_{\max}} = \frac{\zeta \Delta T_{\max}}{1 + \zeta \Delta T_{\max}} = \frac{R_{\infty} - R_0}{R_{\infty}} , \]
and \( Q_{\max} = \frac{1}{2}\,C\,U_0^2 \) is the amount of heat at the resistor. The resistance varies from R0 to \( R_{\infty} . \)

To solve the above system of differential equations, we introduce a new variable

\[ \vartheta (\tau ) = \exp \left\{ - \frac{2}{1-\beta}\,\int_0^{\tau} \frac{{text d} s}{x(s)} \right\} . \]
Since
\[ \left( 1 - \beta \right) \frac{{\text d}}{{\text d}\tau} = \left( 1 - \beta \right) \frac{{\text d}\vartheta}{{\text d}\tau}\, \frac{{\text d}}{{\text d}\vartheta} = - \frac{2\vartheta}{x} \, \frac{{\text d}}{{\text d}\vartheta} , \]
the system of equations becomes
\[ \left.\begin{aligned} 2\vartheta \,\frac{{\text d}}{{\text d}\vartheta} \left( xy \right) - \left( xy \right) &=0 , \\ \vartheta \,\frac{{\text d}x}{{\text d}\vartheta} + \frac{\beta}{1-\beta} \left( xy \right)^2 &=0 , \end{aligned}\right\rbrace \qquad x(1) =1, \quad y(1) =1. \]
Obviously, the first equation has the solution
\[ x(\vartheta )\,y(\vartheta ) = \sqrt{\vartheta} , \]
and the second one
\[ x(\vartheta ) = \frac{1-\beta \vartheta}{1-\beta} . \]
Then
\[ y(\vartheta ) = \frac{\left( 1-\beta \right) \sqrt{\vartheta}}{1-\beta \vartheta} . \]
The differentiation of the new variable with respect to τ gives
\[ \frac{{\text d}\vartheta}{{\text d}\tau} = - \frac{2\vartheta}{\left( 1- \beta \right) x} . \]
This yields the initial value problem
\[ \frac{{\text d}\vartheta}{{\text d}\tau} + \frac{2\vartheta}{1- \beta \vartheta } =0, \qquad \vartheta (0) =1. \]
Setting \( \eta = \beta \,\vartheta (\tau ) , \) we obtain
\[ \left( 1 - \eta \right) \frac{{\text d}\eta}{{\text d}\tau} + 2\,\eta =0, \qquad \eta (0) = \beta . \]
Its solution is expressed through the Lambert W function:
\[ \eta (\tau ) = -W \left[ -\beta \,\exp \left( -2\tau - \beta \right) \right] . \]

Example: Let a=<1,3,-4> and b=<-1,1,-2> be two vectors. Find \( {\bf a}\cdot ({\bf a}\times {\bf b}), \) where \( {\bf a}\cdot {\bf b} \) is dot product, and \( {\bf a}\times {\bf b} \) is cross product of two vectors. Input variables are vecors a and b. Function will calculate the cross product of a and b, and then calculate the dot product of that value and a. Notice that any input values for a and b will result in zero sum.

a={1,3,-4}
b={-1,1,-2}
c=a.Cross[a,b]
{0,0,0}
{-1,1,-2}
0

 

  1. Corless, R.M., Gonnet, G.H., Hare, D.E.G., Jeffrey, D.J., and Knuth, D.E., (1996). "On the Lambert W function," Advances in Computational Mathematics, 1996, Vol. 5: pp. 329–359. doi:10.1007/BF02124750
  2. Dobrushkin, V.A., Methods in Algorithmic Analysis, CRC Press, Boca Raton, 2010.
  3. Dubinov, A.E., Dubinova, I.D., and Saǐkov, S.K., (2006). The Lambert W Function and Its Applications to Mathematical Problems of Physics (in Russian). RFNC-VNIIEF. Sarov, Russia. 169p.
  4. Jeffrey, D.J., Hare, D.E.G., and Corless, R.M., Unwinding the branches of the Lambert W function, The Mathematical Scientist, 1966, Vol. 21, No. 1, p. 1--2.
  5. Lambert, J.H., Observationes variae in mathesin puram, Acta Helveticae physico-mathematico-anatomico-botanico-medica, Band III, 128–168, 1758. http://www.kuttaka.org/~JHL/L1758c.pdf
  6. Ontario Research Centre for Computer Algebra, 2004. The Lambert W function—Poster. Available from: http://www.orcca.on.ca/LambertW/
  7. Parker, F.D., Integrals of inverse functions, American Mathematical Monthly, 1955, Vol. 62, No. 6, 439--440.
  8. Valluri, S.R., Jeffrey, D.J., and Corless, R.M., Some applications of the Lambert W function to physics, Canadian Journal of Physics, Vol. 78, 823--831, 2000.
  9. https://en.wikipedia.org/wiki/Lambert_W_function

 

Return to Mathematica page

Return to the main page (APMA0340)
Return to the Part 1 Matrix Algebra
Return to the Part 2 Linear Systems of Ordinary Differential Equations
Return to the Part 3 Non-linear Systems of Ordinary Differential Equations
Return to the Part 4 Numerical Methods
Return to the Part 5 Fourier Series
Return to the Part 6 Partial Differential Equations
Return to the Part 7 Special Functions