# Problems with solutions involving Lambert W function of transcendental equation

Solve and Reduce fail here with rational parameter l, but succeed when I plug in a value

Assuming[ l ∈ Rationals && l > 0,
Solve[x  Exp[-2/(x)] == (x - 1) - 1 /(2 l), x, Reals]]

% /. l -> 15/31

{{x -> 122/(60 + 61 ProductLog[-1, -60/(61 E^(60/61))])}}


Can I coax her to produce an answer which depends on the parameter? It turns out the equation can be solved by a series of substitutions, yielding $$x=\frac{d}{f + W_L(- f e^{-f})},\; d= 7- 2 l,\; f= \frac{2d\;l}{2 l+1}$$

It should be possible to convince Mathematica do release me from this chore :)

Edit two hours later:) Thanks for previous answers, but I'm still missing something. I found from papers like this one that I can reduce my equation to a canonic form

eq = (z - f) Exp[z] == -f


It is now a trivial case which can be solved by substitution $$z-f=y$$, but I want Mathematica to do all work.

Solve[eq, z, Method -> Reduce]
Solve[eq && z != 0, z, Method -> Reduce]
Solve[eq && z != 0 && z ∈ Reals, z, Method -> Reduce]
Solve[eq && z != 0 && z ∈ Reals && f ∈ Reals, z,
Method -> Reduce]
Solve[eq && z != 0, z, Method -> Reduce] /. C[1] -> 0


First Solve gets all cases; second removes some, but I still have the branch chooser C[1]. third time I say I want real roots, and I am reminded that f maybe complex. forth time I get an error

Solve::nsmet: This system cannot be solved with the methods available to Solve.


So, fifth time I give up, erase the two last assumptions, and decide to "talk simple" to Mathematica with C[1] -> 0 OK...

Still, it is a pity that f ∈ Reals did not succed, like it does when I choose f from the start

    Solve[(eq /. f -> 5/2) && z != 0 && z ∈ Reals, z, Method -> Reduce]

• The solution is x == 2/((4 l)/(2 l + 1) + ProductLog[-1, -((4 l)/(1 + 2 l)) E^(-((4 l)/(1 + 2 l)))]) but I cannot coax Mathematica to yield it either. Aug 12, 2020 at 9:37
• Note that the assumptions are not used in your code since Solve does not use the option Assumptions. The assumptions should be included in the Solve as constraints. In cases where Solve produces a result (which it does not here), including Simplify or FullSimplify in the Assuming would then make use of the assumptions. Aug 12, 2020 at 12:20
• There are several issues when solving equations symbolically, and one has to do some experimental work. Don't expect you will obtain results strictly from scratch to the point you want. This is not possible now nethier in future will be. Unless there is a well defined goal to achieve. Now I cannot see what you really expect. Examine carefully What is the difference between Reduce and Solve? or if you make your statement more prcecise I will point out another helpful post. Aug 12, 2020 at 16:31

Solve with the Method->Reduce is actually Reduce.

a) the built-in does not work with the restriction x in Reals. b) the built-in does not work with the restriction l positive. c) the formulation variation between Assumption and &&-logic is just to prefer the recommendation in the documentation of Solve.

ClearAll[x, ll]
Solve[x Exp[-2/(x)] == (x - 1) - 1/(2 ll) &&
Element[ll, Rationals], x, Method -> Reduce]


{{x -> ConditionalExpression[-(I/(2 \[Pi] C[1])),
C[1] \[Element] Integers && ll == -(1/2)]}, {x ->
ConditionalExpression[1/(I \[Pi] + 2 I \[Pi] C[1]),
C[1] \[Element] Integers && ll == -(1/2)]}, {x ->
ConditionalExpression[(2 (1 + 2 ll))/(
4 ll + ProductLog[C[
1], -((4 E^(-((4 ll)/(1 + 2 ll))) ll)/(1 + 2 ll))] +
2 ll ProductLog[C[
1], -((4 E^(-((4 ll)/(1 + 2 ll))) ll)/(1 + 2 ll))]),
ll \[Element] Rationals]}}


And the substitution:

% /. ll -> 15/31


{{x -> Undefined}, {x -> Undefined}, {x -> 122/(
31 (60/31 + 61/31 ProductLog[C[1], -(60/(61 E^(60/61)))]))}}


This result is different. There is a free c1 parameter.

Solve[eq, z, Method -> Reduce]
Solve[eq && z != 0, z, Method -> Reduce]
Solve[eq && z != 0 && Element[z, Reals], z, Method -> Reduce]
Solve[eq && z != 0, z, Reals, Method -> Reduce]
Solve[eq && z != 0 && Element[z, Reals] && Element[f, Reals], z,
Method -> Reduce]
Solve[eq && z != 0 && Element[f, Reals], z, Reals, Method -> Reduce]
Solve[eq && z != 0, {z, f}, Reals, Method -> Reduce]
Solve[eq && z != 0, z, Method -> Reduce] /. C[1] -> 0


Solve prefers the condition of the domain in the later argument list and not in the logics of the equations set. Solve prefers more freedom to restrictions. The more general the solution defined in the equations is the better the results. The option Method->Reduce employs actually the built-in Reduce instead of Solve.

I created some inputs for examples. My outputs are different. I use V12.0.0.

• @Steppen Jaeschke Thanks for the comments. Could I have your input examples? The outputs do not matter since I had anyway a more general equation, which I solved by hand (using substitutions). As an interesting Mathematica problem, the more general problems in the article arxiv.org/pdf/1408.3999.pdf cannot be solved by us by hand, but they should be a fair task for Mathematica Aug 13, 2020 at 8:00

Both Reduce and Solve do what they should (see e.g. What is the difference between Reduce and Solve?) even though they might be always better. Reduce may deal with various transcendental functions, however it is not refined enough to work e.g. with elliptic functions, see e.g. 1 and 2. Nevertheless it works well here yielding a bit involved result (we use y instead of l to avoid possible confusion with 1):

Reduce[x  Exp[-2/(x)] == (x - 1) - 1/(2y), x] // TraditionalForm


We can find out that for any $$0\leq y \leq \frac{1}{2}$$ solution is complex. However one observes that it might work here, although it doesn't

Solve[ x  Exp[-2/(x)] == (x - 1) - 1 /(2y) && (y > 0 && y != 1/2) && x ∈ Reals,
x, MaxExtraConditions->All]


since the output is expected to be real and unique, see

Plot[ ReIm[1/(-2x Exp[-2/x]+ 2x - 2)], {x, -4, 4}, Evaluated -> True,
PlotStyle -> Thick, PlotRange-> {-3,3}, AspectRatio -> Automatic,
Epilog->{ Dashed, Thick, Red, Line[{{1.255,-3},{1.255,3}}],
Cyan, Line[{{-4,1/2},{4,1/2}}]}]


On the other hand one might make Solve yield slightly restricted result with Method -> Reduce, e.g.:

sol = FullSimplify[ x/. First @ Solve[ x Exp[-2/(x)] == (x - 1) - 1/(2y), x,
Method -> Reduce] /. C[1] -> 0]

(2 + 4y)/(4y + (1 + 2y) ProductLog[-4y/(E^((4y)/(1 + 2y)) (1 + 2y))])

ay = Limit[ sol, y -> -Infinity]
N @ %

2/(2 + ProductLog[-2/E^2])
1.255

eqn = x Exp[-2/(x)] == (x - 1) - 1/(2 l);


Let x == 2/y && y != 0

eqn2 = eqn /. x -> 2/y // FullSimplify[#, y != 0] &

(* 4 + E^y (-4 + (2 + 1/l) y) == 0 *)

soly = Assuming[l > 0 && y != 0,
Solve[eqn2 && y != 0, y, Method -> Reduce][[1]] // Simplify]


Verifying that this satisfies eqn2

eqn2 /. soly // Simplify[#, Element[C[1], Integers]] &

(* True *)


The solution for x is then

solx = (x -> 2/y) /. soly


eqn /. solx // Simplify[#, Element[C[1], Integers]] &

(* True *)


For C[1] == -1 this is the same result as that provided by Roman in his comment.

EDIT:

Real solutions require that C[1] be either -1 or 0

fd = FunctionDomain[{x /. solx, Element[C[1], Integers]}, l] //
Simplify[#, Element[C[1], Integers]] &


• It appears that you've provided (almost) an equivalent answer. Aug 12, 2020 at 13:13