The Lambert function

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.


lambertW(k, x)


For integer k, the values represent the solutions of the equation yey = x.

lambertW is the inverse function of .

In the complex plane, the equation yey = x has a countably infinite number of solutions. They are represented by lambertW(k, x) with k ranging over the integers.

For all real x ≥ 0, the equation has exactly one real solution. It is represented by y=lambertW(x) or, equivalently, y=lambertW(0, x).

For all real x in the range -exp(-1) < x < 0, there are exactly two real solutions. The larger one is represented by y=lambertW(x), the smaller one by y=lambertW(-1, x).

Exactly one real solution lambertW(0, -exp(-1))= lambertW(-1, -exp(-1))= -1 exists for .

For , lambertW(k, x) takes no real value.

The values lambertW(-1, 0)=- infinity and lambertW(0, 0)=0 are implemented. Further, the result y is returned for some exact arguments of the form . For floating-point arguments a floating-point value is returned. For all other arguments, unevaluated function calls are returned.

The float attributes are kernel functions, i.e., floating-point evaluation is fast.

Environment Interactions

When called with a floating-point argument, the function is sensitive to the environment variable DIGITS which determines the numerical working precision.


Example 1

We demonstrate some calls with exact and symbolic input data:

lambertW(-3), lambertW(-1, -5/2), lambertW(1/2),
lambertW(5, I), lambertW(3, 1 + I), lambertW(-1, x + 1)

Some exact values are found:

lambertW(-1, -exp(-1)), lambertW(-1, -2*exp(-2)), 
lambertW(-1, -3/2*exp(-3/2)), lambertW(exp(1)), 
lambertW(2*exp(2)), lambertW(5/2*exp(5/2)),
lambertW(1, (3+4*I)*exp(3+4*I))

Floating point values are computed for floating-point arguments:

lambertW(-1, -0.3), lambertW(2000.0)

lambertW(-3, -0.277), lambertW(1, 2345.6)

Example 2

The functions diff, float, and series handle expressions involving the Lambert function:

diff(lambertW(k, x), x)

float(ln(3 + lambertW(sqrt(PI))))

series(lambertW(x), x = 0);
series(lambertW(x), x = -1/exp(1), 3);
series(lambertW(-1, x), x = -1/exp(1), 3);



An arithmetical expression, the "argument"


An arithmetical expression representing an integer, the "branch"

Return Values

Arithmetical expression.


R.M. Corless, D.J. Jeffrey and D.E. Knuth: "A sequence of Series for the Lambert W Function", in: Proceedings of ISSAC'97, Maui, Hawaii. W.W. Kuechlin (ed.). New York: ACM, pp. 197-204, 1997.

Was this topic helpful?