Yesterday, at work while calculating the most optimal parameters for a data structure, I arrived at this equation.

xe−x + (1 − e−x) ln (1 − e−x) = 0

This is a little clumsy to deal with. So, I cleaned it up by representing e−x as t. With e−x = t, we get

−t ln t + (1 − t) ln (1 − t) = 0
⇒ t ln t = (1 − t) ln (1 − t)

Obviously, t = 1 − t is one solution. Thus, t = ½. Are there more solutions? The answer turns out to be 'no'.


y = −t ln t + (1 − t) ln (1 − t)

x is real in this problem and so is t. ln t is undefined for t ≤ 0. Similarly, ln (1 − t) is undefined for t ≥ 0. So, we need to consider the open interval (0, 1) to see if there are any other solutions for t. Let us rewrite the equation in a neater form and see if we can somehow eliminate the possibility of other solutions in the open interval (0, 1).

t ln t = (1 − t) ln (1 − t)
⇒ ln tt = ln (1 − t)(1 − t)
⇒ tt = (1 − t)(1 − t)

For 0 < t < ½, t < (1 − t) ⇒ tt < (1 − t)t.
For ½ < t < 1, t > (1 − t) ⇒ tt > (1 − t)t.

So, we see that in the open interval (0, 1), except for ½ there is no other value for t such that tt = (1 − t)t. Hence, the solution to the equation is

t = ½
⇒ e−x = ½
⇒ −x = ln ½
⇒ x = ln 2


y = xe−x + (1 − e−x) ln (1 − e−x)

Two years ago, I once had to solve the following equation.

ln x − x0.03 = 0

There is no simple way to solve this equation. I had to resort to using the Lambert W function to solve this. To use this function, we need to bring our equation to w(x) ew(x) = k form where w(x) is a function of x. The solution of w(x) ew(x) = k is w(x) = W(k). Let us try it.

ln x − x0.03 = 0
⇒ ln x = e0.03 ln x
⇒ ln x ⋅ e−0.03 ln x = 1
⇒ −0.03 ln x ⋅ e−0.03 ln x = −0.03

So, if we have brought the equation in the w(x) ew(x) = k form with w(x) = −0.03 ln x and k = −0.03. Therefore, the solution is

−0.03 ln x = W(−0.03)
⇒ x = eW(−0.03) ⁄ 0.03


y = ln x − x0.03
The MacLaurin series for the Lambert W function is

W(k) = k − k2 + 32 ⋅ k383 ⋅ k4 + 1254 ⋅ k5 + …

Using this function, we get

x = e−0.03094 ⁄ 0.03 = 2.805 approximately

2 comments

Anonymous said:

just curious to know about this "at work while calculating the most optimal parameters."

Susam Pal said:

I am afraid, I can't discuss the details of my work here.

Post a comment

RSS