Lambert W Function Calculator

Compute the Lambert W function with its two real branches W_0 and W_(-1), Halley iterative method, solution of x·e^x = y and applications in physics and CS.

Calculation parameters
Scegli il ramo o l'applicazione della funzione W.
Argomento. Per W_0: x >= -1/e ≈ -0,3679. Per W_(-1): -1/e <= x < 0.
Per risolvere x · e^x = y, con x come incognita.
Was this calculator useful?

The Lambert W function

The Lambert W function, also known as the omega function or product log, is a special function defined as the inverse of f(x) = x · ex:

W(x) · eW(x) = x

Studied by Swiss mathematician Johann Heinrich Lambert (1758) in a paper on transcendental equations, then by Euler (1779), it was long considered a theoretical curiosity. Since the 1990s, thanks to work by Corless, Gonnet, Hare, Jeffrey, and Knuth (1996), it has been rediscovered for its many applications in physics, chemistry, combinatorics, algorithmic theory and biology. Today it is implemented in Mathematica (ProductLog), Matlab (lambertw), Python (scipy.special.lambertw), Julia (LambertW.jl).

The two real branches

The equation w · ew = x has different characteristics depending on x:

  • For x > 0: single positive real solution. This is the principal branch W0(x).
  • For -1/e < x < 0: two real solutions. The larger, in (-1, 0), is W0(x); the smaller, in (-infinity, -1), is W-1(x).
  • For x = -1/e: double solution W = -1.
  • For x < -1/e: no real solution (complex plane needed).

The constant -1/e ≈ -0.3679 is the limiting value where the two branches meet. The graph of y = x·ex has global minimum at x = -1, y = -1/e; the two solutions of w·ew = y correspond to the two pre-images of y for y > -1/e.

The four modes

  1. Principal branch W0: computation for x >= -1/e using Halley's method (cubic convergence, 5-10 iterations for 14 digits).
  2. Branch W-1: computation for -1/e <= x < 0, with values in (-infinity, -1].
  3. Solve x · ex = y: given y, find x via W(y). Closed-form solution for all transcendental equations involving ex.
  4. Applications: lists concrete problems (physics, chemistry, combinatorics, algorithms) where Lambert W is the exact solution.

Halley's method

To compute W(x) numerically, the calculator uses Halley's method (1694), faster than Newton. Given f(w) = 0:

wn+1 = wn - f(wn) / (f'(wn) - f(wn) · f''(wn) / (2 · f'(wn)))

For f(w) = w·ew - x: f'(w) = ew(1 + w), f''(w) = ew(2 + w). Cubic convergence: each iteration roughly triples correct digits. With a good initial guess, 5 iterations suffice for IEEE 754 double precision (15-16 digits).

Notable values

  • W0(0) = 0: trivial case.
  • W0(1) = Omega ≈ 0.5671432904097839: the Omega constant, solution of Omega · eOmega = 1. Unique solution of e-Omega = Omega.
  • W0(e) = 1: since 1 · e1 = e.
  • W0(-1/e) = W-1(-1/e) = -1: branching point.
  • Asymptotic: W0(x) ~ ln(x) - ln(ln(x)) for x → infinity.

Physics applications

  • Wien's law: peak emission wavelength of a blackbody satisfies lambdamax · T = hc / (k · (5 + W0(-5 · e-5))) ≈ 2.8977·10-3 m·K. The constant 2.898 comes exactly from W.
  • Fluid drag: bodies falling with linear drag satisfy v(t) = vterm(1 - e-t/tau); time to reach a fraction is expressed by W.
  • Shockley diode: forward voltage at fixed current: V = VT · W(I · R / (Is · VT)).
  • Chaotic orbits: Koopman dynamics with nonlinear operators use W to estimate periodic orbits.
  • General relativity: Schwarzschild metric in Kruskal-Szekeres coordinates involves W.

Combinatorics and computer science applications

  • Number of labelled trees: Cayley's formula: the number of trees on n labelled vertices is nn-2; the generating function T(x) = ∑ nn-1 xn/n! satisfies T(x) = x · eT(x), so T(x) = -W(-x).
  • Rooted trees: the number of rooted trees on n labelled vertices is nn-1; relation via W.
  • Algorithmic complexity: randomised sorting times, hash tables with chaining, B-trees involve log x / log log x, quantities related to W.
  • Poisson branching processes: count-ray distributions satisfy transcendental equations solvable via W.
  • M/M/1 queueing theory: asymptotic waiting times involve W for explicit resolution.

The Omega constant

The value W0(1) = Omega ≈ 0.5671432904097839 is the Omega constant, one of the most elegant yet least-known mathematical constants. It is the unique real number satisfying Omega · eOmega = 1, equivalently Omega = e-Omega. Like π and e, Omega is transcendental (Mahler 1953): not a root of any polynomial with rational coefficients.

Updated July 2026

Frequently Asked Questions

What is the Lambert W function?

It is the inverse function of f(x) = x e^x: by definition W(x) e^W(x) = x. Studied by Lambert (1758) and Euler (1779) and rediscovered in the 1990s, it lets you solve in closed form transcendental equations where the unknown appears both inside and outside an exponential. It is implemented in Mathematica, Matlab and SciPy.

What are the two real branches?

For x >= 0 there is a single real solution, the principal branch W_0(x) with values in [-1, +infinity). For -1/e < x < 0 there are two real solutions: W_0 in (-1, 0) and W_(-1) in (-infinity, -1). At x = -1/e the two branches meet with W = -1, and for x < -1/e there are no real solutions.

What modes does the calculator offer?

Four: the principal branch W_0(x), the secondary branch W_(-1)(x), solving the equation x e^x = y with branch analysis, and an overview of applications. Values are computed with Halley's method, which has cubic convergence and is very fast.

How is W computed numerically?

With iterative methods such as Halley's, which from a good initial estimate refines the solution of w e^w = x with cubic convergence: each iteration triples the number of correct digits. A few iterations suffice to reach double-precision accuracy (about 15 digits).

What is the Omega constant?

It is the value Omega = W_0(1) about 0.5671432904, the unique real solution of Omega e^Omega = 1, equivalent to Omega = e^(-Omega). It is quickly obtained by iterating x = e^(-x). It is a transcendental number (Mahler, 1953) and, like pi and e, one of the most elegant constants in mathematics.

What equations does the W function solve?

All equations where the unknown appears inside and outside an exponential or logarithm, otherwise unsolvable in elementary form: x e^x = c, x^x = c, a^x = b x, x + ln x = c. W turns them into closed-form solutions, just as the square root solves x^2 = c.

Where is it used in physics?

In Wien's law for the blackbody emission peak, in the time to reach a fraction of terminal velocity in fall with friction, in the Shockley model for diodes, in Michaelis-Menten enzyme kinetics, in delay differential equations and in celestial mechanics.

What is its connection to combinatorics?

The generating function of rooted labeled trees on n nodes, T(x), satisfies T = x e^T, so T(x) = -W(-x). The coefficient of x^n/n! in this series is n^(n-1), which counts rooted trees (unrooted trees are n^(n-2), Cayley's formula). W also appears in M/M/1 queues and hash tables.

Comments (0)

No comments yet. Be the first!