Lambert W Function

We at CatSynth return to the topic of mathematics for the first time in a while. In particular, we visit an obscure topic of personal significance. One day in high school I wrote down a seemingly simple equation:

2x = 1 / x

And set about trying to solve it. It certainly has a solution, as one can graph the functions 2x and 1/x and note their intersection:

In the graph above, the green curve is 2x and the black curve is 1/x. They intersect at an x coordinate equal to about 0.64. I actually moved to a variation:

ex = 1 / x

(somehow thinking that using e would make it simpler), and quickly approximated the solution as:

0.56714329…

While computing this number was relatively simple pressing buttons on a handheld calculator, describing it in a closed form proved elusive. Every so often, I would return to the equation, try to manipulate it algebraically or using calculus, but I was never able to do so.

Years later, in college, I found out that it was in fact impossible to solve algebraically, but that did not prevent mathematicians from naming both the constant 0.56714329… and the function necessary to compute it. Consider a function w(x)) such that:

w(x)ew(x) = x

The function w(x) is known as the Lambert W function, or “omega function”, and is named after 18th century mathematician Johann Heinrich Lambert. It is a non-analytical function, in that it cannot be expressed in a closed algebraic form, hence the difficulty I had attempting to solve my equation). However, one can see that w(1) is a solution for it. And w(1) [=] 0.56714329… is often called Lambert’s constant.

Although Lambert’s function does not have a closed-form expression, one can approximate it with a small computer program, such as this python program:

from math import e

def lambertW(x, prec=1E-12, maxiters=100):
    w = 0    

    for i in range(maxiters):
        we = w * e**w
        w1e = (w + 1) * e**w

        if prec > abs((x - we) / w1e):
            return w

        w -= (we - x) / (w1e - (w + 2) * (we - x) / (2*w + 2))

    raise ValueError("W doesn't converge fast enough for abs(z) = %f"

It was somewhat disappointing in the end to find out both that there was no closed form for the solution, and that the constant associated with the solution already had a name. But it was still interesting to learn about it, and to then apply it to other problems.

On that note, we conclude by showing that w(x) can also be used to solve the original equation:

2x = 1/x

can be rewritten as:

(ln2)xe(ln2)x = ln2

We can now use w(x) to solve the equation:

x = w(ln2) / ln2

which is approximately .6411857…

One thing I never tried in my youthful experimentations with this function was evaluate it with non-real complex numbers. While there are examples plotting w(z) on the complex plane, I would rather take some time to explore this myself.

I also have yet to find any applications to music or the visual arts, outside of literal usage in conceptual art pieces.