COMPUTING SCIENCE
Why W?
Brian Hayes
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 WeW =
x? As noted above, the forward version is easy: just
evaluate eW and then multiply by 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
eW = x/W. Then, taking the logarithm of
both sides produces log(eW) = log(x/W).
On the left hand side, the logarithm of eW is
simply 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.
» Post Comment