COMPUTING SCIENCE

# Why W?

No, not *that* *W*. I won't be drawn into presidential
politics here. The *W* I want to discuss is something else
entirely: the Lambert *W* function, a mathematical
contrivance that has been getting a fair amount of attention lately.
The buzz began in the world of computer-algebra systems such as
Macsyma, Maple and Mathematica, but word of *W* has also been
spreading through journal articles, preprints, conference
presentations and Internet news groups. The *W* function even
has its own poster (see http://www.orcca.on.ca/LambertW).

The concept at the root of *W* can be traced back through
more than two centuries of the mathematical literature, but the
function itself has had a name only for the past 10 years or so. (A
few years longer if you count a name used within the Maple software
but otherwise unpublished.) When it comes to mathematical objects,
it turns out that names are more important than you might guess.

Without further ado, here is the definition of Lambert
*W*: It is the inverse function associated with the equation:

*We ^{W}* =

*x*.

What does that mean? Some readers of this column will grasp it
instantly, but I am not going to pretend that I am one of them. It
took me a while to figure out how *W* works, and even longer
to see why the concept might be considered interesting or important.
At the risk of inflicting severe tedium on those who are more adept
at algebra and analysis, I want to retrace my own path toward
understanding what *W* is all about. It's a fairly long and
wiggly path.

Single U and W

In trying to make sense of the expression *We ^{W}* ,
the first question is not "why

*W?"*but "why

*e*?" The

*e*in the formula is Euler's number, the second-most-famous constant in all of mathematics, often introduced as "the base of the natural logarithms"; but then the natural logarithms are usually defined as "logarithms taken to the base

*e*," which is not much help. Another way of defining

*e*, originally derived from the study of compound interest, avoids this circularity:

*e*is the limiting value of the expression (1+1/

*n*)

*as*

^{n}*n*tends to infinity. Thus we can approximate the value of

*e*by setting

*n*equal to some arbitrary, large number. With

*n*=1,000,000, for example, we get six correct digits of

*e*: 2.71828.

Now, with *e* in hand, consider an equation somewhat
simpler than the one for *W*; we might call it single-*U*:

*e ^{U}* =

*x*.

This equation defines the exponential function, also written
*exp(U)*. The function maps each given value of *U* to
a corresponding value of *x*, namely *e* raised to the
power *U*. If *U* is a positive integer, we can
calculate the function's value by simple arithmetic: Just multiply
*e* by itself *U* times. For nonintegral *U,*
the procedure is not quite so obvious but is still well-defined; the
left part of Figure 1 shows the elegant curve generated.

The equation *e ^{U}* =

*x*also defines an inverse function; we just need to read the equation backward. Whereas the forward function maps a value of

*U*to a value of

*x*, the inverse function takes a value of

*x*as input and returns the corresponding value of

*U*. In other words, the inverse function finds the power to which

*e*must be raised to yield a given value of

*x*. This is another well-known, textbook function: the natural logarithm, written

*log(x)*or

*ln(x)*. The

*log*function has the same graph as the exponential function but reflected across the diagonal, as shown in the right part of Figure 1.

Sometimes it's helpful to think of functions like these as if they
were machines. The *exp* function works like a meat grinder:
Dump a *U* into the input hopper, turn the crank, and out
comes an *x* equal to *e ^{U}* . The same
machine can calculate logarithms if we run numbers through it
backwards and turn the crank the other way, but there is an
important caveat: When the machine runs in reverse, some inputs can
jam the gears. For example, what output should the machine produce
if you ask it for the logarithm of 0 or -1? (If you have a
scientific calculator handy, see how a real machine answers these questions.)

The problem is that the logarithm function works only over a limited
domain. Exponentiation is defined over the entire real number line;
any real value of *U*, whether positive or negative, produces
a value of *exp(U)*, and that value is always a positive real
number. The inverse function is not so well-mannered: As the right
side of Figure 1 suggests, *log(x)* is defined only if
*x* is positive. This limitation can be sidestepped by
venturing off the real number line into the wilds of the complex
plane. If the value of *log(x)* is allowed to be a complex
number, with both a real and an imaginary part, then
*log*(-1) has a definite value: According to a famous formula
of Euler, it is equal to π *i*, where *i* is the
imaginary unit, the square root of -1. The *W* function is
also defined throughout the complex plane, but in this article I
shall confine myself to the straight and narrow path of real
numbers. However, see Figure 4.

One more simple fact about logarithms will be needed below. The
logarithm of the product of two numbers is equal to the sum of the
logarithms of the factors: *log(xy)=log(x)+log(y)*. Likewise
for quotients: *log(x/y)=log(x)-log(y)*. These relations were
the main reason for inventing logarithms in the first place: They
convert multiplication and division into the easier tasks of
addition and subtraction.

W Coming and Going

There is an obvious family resemblance between single-*U* and
*W*, between the equations *e ^{U}* =

*x*and

*We*=

^{W}*x*. In the case of the forward

*W*function, if we know how to calculate

*e*, then it's a trivial matter to calculate

^{W}*We*: just multiply by

^{W}*W*. The resulting curve is shown in the left part of Figure 2. In overall shape it looks much like the exponential curve, although for large

*W*it rises more steeply. Where

*e*and

^{W}*We*really part company is to the left of

^{W}*W*=0. Whereas

*e*is always positive,

^{W}*We*dips into negative territory, reaching a minimum at the point

^{W}*W*=-1,

*x*=-1/

*e*. As

*W*tends toward negative infinity, both

*e*and

^{W}*We*approach 0, but one from above and the other from below.

^{W}Taking the inverse of this function—solving
*We ^{W}* =

*x*for

*W*instead of for

*x*—finally brings us to the Lambert

*W*function. Just

*how*to solve for

*W*is a matter I'll return to below, but for now it's enough to flip the graph of the function about its diagonal, as in the right side of Figure 2; the inverse graph is drawn in more detail in Figure 3. Just as the forward function resembles the exponential curve, the inverse function appears similar to the logarithm. The curves for

*log(x)*and

*W(x)*cross at

*x=e*, where both are equal to 1. Where things get most interesting, again, is to the left of

*x*=0. Whereas

*log(x)*is undefined for any

*x*≤ 0,

*W(x)*continues to have a value down to

*x*=-1/

*e*, or about -0.37. Indeed, when

*x*lies in the range between -1/

*e*and 0,

*W(x)*has not just

*a*value but

*two*values. For example,

*W*(-0.2) could be equal to either -0.26 or -2.54. Plugging either of these

*W*values into the formula

*We*yields the

^{W}*x*value -0.2.

For a mathematical function, multiple values are an embarrassment of riches; a well-bred function is supposed to map each value in its domain to a single value in its range. But in practice multiple values are not uncommon, particularly with inverse functions. The square root is a familiar example: Whereas squaring 2 yields the unique result 4, the square root of 4 could be either +2 or -2. Some of the trigonometric functions are even worse. Every angle has just one sine, but the inverse function, the arc sine, wraps around to produce infinitely many values.

The problem with multivalued functions is knowing which value, or
branch, to choose. Most calculators and programming languages give
precedence to positive roots and to arc sine values between -90 and
+90 degrees, but there is no fundamental justification for these
choices. In the case of Lambert *W*, the part of the curve
with *W*>-1 has been labeled the "principal
branch," but again this is mainly a matter of convention. (In
the complex plane, *W* has infinitely many branches.)

W—What Is It Good For?

The Lambert *W* function may make a pretty curve, but what's
it good for? Why should anyone care? By mixing up a few symbols we
could generate an endless variety of function definitions. What
makes this one stand out from all the rest?

If you ask the same question of more familiar functions such as
*exp* and *log* and square root, the answer is that
those functions are tools useful in solving broad classes of
mathematical problems. With just the four basic operations of
arithmetic, you can represent the solution of any linear equation.
Adding square roots to the toolbox allows you to solve quadratic
equations as well. Expanding the kit to include the trigonometric,
exponential and logarithmic functions brings still more problems
within reach. All of these well-known functions, and perhaps a few
more, are classified as "elementary." The exact membership
of this category is not written in stone, but it excludes more
specialized tools such as Bessel functions.

A few years ago, a brief, unsigned editorial in *Focus*, the
newsletter of the Mathematical Association of America, asked:
"Time for a new elementary function?" The function
proposed for promotion to the core set was Lambert *W*.
Whether *W* ultimately attains such canonical status will
depend on whether the mathematical community at large finds it
sufficiently useful, which won't be clear for some years. In the
meantime, I can list a few applications of *W* discovered so far.

One place where *W* turns up in pure mathematics
is the "power tower," the infinitely iterated exponential

For large *x*, this expression soars off to infinity faster
than we can follow it, but Euler showed that the tower converges to
a finite value in the domain between *x* =
*e ^{-e}* (about 0.07) and

*x*=

*e*(about 1.44). Within this realm, the value to which the infinite tower converges is

^{1/e}*W(-log(x))/-log(x)*.

*W* has another cameo role in the "omega constant,"
which is a distant of cousin of the golden ratio. The latter
constant, with a value of about 1.618, is a solution of the
quadratic equation 1/*x*= *x*-1. The omega constant is
the solution of an exponential variant of this equation, to wit:
1/*e ^{x}* =

*x*. And what is the value of that solution? It is

*W*(1), equal to about 0.567143.

Of more practical import, *W* also appears in solutions to a
large family of equations known as delay differential equations,
which describe situations where the present rate of change in some
quantity depends on the value of the quantity at an earlier moment.
Behavior of this kind can be found in population dynamics, in
economics, in control theory and even in the bathroom shower, where
the temperature of the water now depends on the setting of the
mixing valve a few moments ago. Many delay differential equations
can be solved in terms of *W*; in some cases the two branches
of the *W* function correspond to distinct physical solutions.

A recent article by Edward W. Packel and David S. Yuen of Lake
Forest College applies the *W* function to the classical
problem of describing the motion of a ballistic projectile in the
presence of air resistance. In a vacuum, as Galileo knew, the
ballistic path is a parabola, and the maximum range is attained when
the projectile is launched at an angle of 45 degrees. Air resistance
warps the symmetry of the curve and greatly complicates its
mathematical description. Packel and Yuen show that the projectile's
range can be given in terms of a *W* function, although the
expression is still forbiddingly complex. (They remark:
"Honesty compels us to admit at this point that the idea for
using Lambert *W* to find a closed-form solution was really
Mathematica's and not ours.")

Still another example comes from electrical engineering, where T. C.
Banwell of Telcordia Technologies and A. Jayakumar of Anadigics show
that a *W* function describes the relation between voltage,
current and resistance in a diode. In a simple resistor, this
relation is given by Ohm's law, *I=V/R*, where *I* is
the current, *V* the voltage and *R* the resistance.
In a diode, however, the relation is nonlinear: Although current
still depends on voltage and resistance, the resistance in turn
depends on current and voltage. Banwell and Jayakumar note that no
explicit formula for the diode current can be constructed from the
elementary functions, but adding *W* to the repertory allows
a solution.

Other applications of *W* have been discovered in statistical
mechanics, quantum chemistry, combinatorics, enzyme kinetics, the
physiology of vision, the engineering of thin films, hydrology and
the analysis of algorithms.

Evaluating W

It's all very well to express the solutions of problems in terms of
*W*, but then how do we find the value of the resulting
function? In the case of logarithms and trigonometric functions, the
standard method for many years was to look up the answer in a big
printed table; now we push the appropriate button on a calculator.
For *W*, however, there are no published tables, and so far
no scientific calculator has a built-in Lambert *W* key.
Several computer algebra systems know how to evaluate the *W*
function, but if you don't have access to such software, you're on
your own.

Suppose we already know how to calculate exponentials and
logarithms; can we then solve the equation *We ^{W}* =

*x*? As noted above, the forward version is easy: just evaluate

*e*and then multiply by

^{W}*W*. At first glance, the inverse function looks like it might be wrestled to submission by a similar tactic. If we can solve for

*x*by calculating an exponential and then multiplying, can't we solve for

*W*by dividing and then taking a logarithm?

Dividing both sides of the equation by *W* gives
*e ^{W}* =

*x/W*. Then, taking the logarithm of both sides produces

*log(e*=

^{W})*log(x/W)*. On the left hand side, the logarithm of

*e*is simply

^{W}*W*. On the right hand side we can rewrite the logarithm of a quotient as the difference of two logarithms, and so we wind up with this equation:

*W = log(x) - log(W).*

We have succeeded in getting *W* off by itself on the left
side, but unfortunately there's still a *log(W)* on the
right. Thus we don't have a closed-form solution, a formula that
would allow us to plug in an *x* and immediately get back the
corresponding *W*. This failure is not merely a result of my
ineptitude; no algebraic wizardry will yield a finite closed-form solution.

On the other hand, the equation above is not totally worthless. If
we have a guess about the value of *W*, then we can plug it
into the right hand side of the equation to get an even better
guess, then repeat the process until we're satisfied with the
accuracy of the approximation. For some values of
*x*—well away from 0—this simple iterative scheme
converges quickly on the correct result. The algorithms used in
computer-algebra software are more efficient, accurate and robust,
but they still rely on successive approximations.

Whence and Whither W?

The modern history of Lambert *W* began in the 1980s, when a
version of the function was built into the Maple computer-algebra
system and given the name *W*. Why *W*? An earlier
publication by F. N. Fritsch, R. E. Shafer and W. P. Crowley of the
Lawrence Livermore Laboratory had written the defining equation as
*we ^{w}* =

*x*. The Maple routine was written by Gaston H. Gonnet of the Institut für Wissenschaftliches Rechnen in Zurich, who adopted the letter

*w*but because of typographic conventions in Maple had to capitalize it.

A few years later Robert M. Corless and David J. Jeffrey of the
University of Western Ontario launched a discussion of *W*
and its applications in what has turned out to be a long series of
journal articles and less-formal publications. The most influential
paper, issued as a preprint in 1993 but not published until 1996,
was written by Corless and Jeffrey in collaboration with Gonnet,
David E. G. Hare of the University of Waterloo and Donald E. Knuth
of Stanford University. This was the paper that named the function
in honor of the 18th-century savant Johann Heinrich Lambert.

Lambert, who wrote on everything from cartography to photometry to
philosophy, never published a word on the function that now bears
his name. It was his eminent colleague Leonhard Euler who first
described a variant of the *W* function in a paper published
in 1779, two years after Lambert's death. So why isn't it called the
Euler *W* function? For one thing, Euler gave credit to
Lambert for the earliest work on the subject. Perhaps more to the
point, Corless, Jeffrey and Knuth note that "naming yet another
function after Euler would not be useful."

In the years between Euler and Maple, the *W* function did
not disappear entirely. The Dutch mathematician N. G. de Bruijn
analyzed the equation in 1958, and the British mathematician E. M.
Wright wrote on the subject at about the same time. In the 1970s and
80s there were several more contributions, including that of
Fritsch, Shafer and Crowley. Nevertheless, the literature remained
widely scattered and obscure until the function acquired a name. In
a 1993 article, Corless, Gonnet, Hare and Jeffrey remark: "For
a function, getting your own name is rather like Pinocchio getting
to be a real boy."

Some of the recent publications on *W* go beyond mere
explication of mathematics; they carry a whiff of evangelical
fervor. Those for whom *W* is a favorite function want to see
it elevated to the canon of standard textbook functions, alongside
log and sine and square root. I am reminded of another kind of
canonization—a campaign for the recognition of a local saint,
with testimonials to good works and miracles performed.

The advocates of *W* do make a strong case. In a 2002 paper,
Corless and Jeffrey argue that *W* is in some sense the
smallest step beyond the present set of elementary functions.
"The Lambert *W* function is the simplest example of the
root of an exponential polynomial; and exponential polynomials are
the next simplest class of functions after polynomials."

But the elevation of *W* has not won universal assent. R.
William Gosper, Jr., has suggested that a better choice might be the
square of *W*, that is, *We ^{W2}* =

*x*, which eliminates the multivalued branching on the real line. (In a play on "Lambert

*W*," Gosper calls this the Dilbert lambda function.) And Dan Kalman of American University has suggested a formulation based on

*e*=

^{W}/W*c*, with an inverse function he calls

*glog*.

Woo Woo Woo

My own misgivings about Lambert *W* pertain not to the
function itself but to the name. Again: Why *W*? Over the
years, English-speaking people have inflicted far too many
*W*s on the rest of the world, from the Wicked Witch of the
West to the *W* boson to the World Wide Web. (Again I forgo
comment on the current occupant of the White House.) We purse our
lips painfully to pronounce doubleyou, doubleyou, doubleyou. With 26
letters to choose from, why do we keep fixing upon the only letter
in the English alphabet with a polysyllabic name? (I acknowledge
that I have made matters worse by writing this column, in which
every sentence of the text includes at least one instance of the
letter *w*.)

It's not too late to right the wrong. On a bus in Italy—a
country that doesn't even have a *w* in its
*alfabeto*—I overheard a fragment of a conversation:
Someone was reading a URL and pronounced the first part "woo
woo woo." It's a shrewd accommodation to linguistic
wimperialism. We should all adopt it. Let us keep the letter but
change the way we say it. Whether it's Lambert *W* or George
W. or www, it's woo all the way.

**Acknowledgments**

*For assistance with this article I offer warm thanks to Jonathan M. Borwein, David W. Cantrell, Robert M. Corless, David J. Jeffrey and Tim Royappa.*

© Brian Hayes

EMAIL TO A FRIEND :