TransWikia.com

Problems with solutions involving Lambert W function of transcendental equation

Mathematica Asked by florin on January 31, 2021

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]

3 Answers

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

enter image description here

We can find out that for any $0leq 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}}]}]

enter image description here

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

Answered by Artes on January 31, 2021

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]

enter image description here

Verifying that this satisfies eqn2

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

(* True *)

The solution for x is then

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

enter image description here

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]] &

enter image description here

Answered by Bob Hanlon on January 31, 2021

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

results 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.

Answered by Steffen Jaeschke on January 31, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP