Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
01-16-2024, 12:06 PM (This post was last modified: 01-16-2024 12:08 PM by Gil.)
Post: #1
 Gil Senior Member Posts: 637 Joined: Oct 2019
Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
For my HP50G LambertW program, I was making comparisons with Wolfram Alpha.

In Wolfram Alpha:
LambertW(-100)=3.2+2.5i
LambertW(-100)=3.2+2.7i
LambertW(-1E6)=11.4+2.9i
LambertW(-1E9)=17. 8+2.98i
LambertW(-1E15)=31.1+3.04i
LambertW(-1E30)=64.9+3.09i
LambertW(-1E30000)=69066.4+3.1415i
LambertW(-1E3000000000)=6.9E9 +3.141592653i
...

Two observations, as real x tends to go to very large negative values :
1) we see that the real part (of LambertW0) seems to —> +infinity;
2) we see that the imaginary part (of LambertW0) seems to —> pi.

My questions
If 2) is true, it means that lim IM(W0) =pi≠0, when x —> -infinity.
Then, can we say, considering the above, that lim W0(-infinity) = -infinity, as does write Wolfram Alpha, leaving out the imaginar part?

Or W0(-infinity) = -infinity+pi*i... = -infinity?
Or, more generally:
if lim "A" = C, when x-> B,
& C=±infinity +i×(constant K),
can we say that the limit C=±infinity,
leaving out the imaginary part (the constant K)
(the latter, K, being "peanuts" relatively to the ± infinity of the real part)?

Gil
01-16-2024, 02:01 PM (This post was last modified: 01-16-2024 02:13 PM by Gil.)
Post: #2
 Gil Senior Member Posts: 637 Joined: Oct 2019
RE: Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
With Wolfram Alpha
LambertW (k=any value, z=(any real value ±i*infinity) = infinity.

Now it seems that lim LambertW, k free, for z=a+ib & with a=±infinity, b=±infinity, gives equally infinity.

Could anyone, if possible a "math guy", confirm it?

My questions are related of course to HP programs, as I want to implement an output in my Lambert HP50G function for any real or complex "numbers, including the ± infinity input cases, the outputs of which I wish to treat as follows :

Wk=0±1...(oo+ib): 'oo'
Wk=0±1...(a+ioo): 'oo'
Wk=0±1...(±oo±ioo): 'oo'

with oo being the infinity sign.

Thanks again for your insight.
01-16-2024, 03:40 PM
Post: #3
 Gil Senior Member Posts: 637 Joined: Oct 2019
RE: Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
Wolfram Alpha

LambertW (-infinity) = (infinity)

But (infinity) * EXP (infinity) can't be equal to -infinity

Can Wolfram Alpha be wrong?
01-16-2024, 05:16 PM (This post was last modified: 01-16-2024 05:26 PM by Nigel (UK).)
Post: #4
 Nigel (UK) Senior Member Posts: 524 Joined: Dec 2013
RE: Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
(01-16-2024 03:40 PM)Gil Wrote:  Wolfram Alpha

LambertW (-infinity) = (infinity)

But (infinity) * EXP (infinity) can't be equal to -infinity

Can Wolfram Alpha be wrong?

Not in this case (although in general I’m sure it can be!). $$\exp(+\infty+{\rm i}\pi)$$ is indeed $$-\infty$$ because $$\exp({\rm i}\pi)=-1$$. So far as I can see you’ve already said something like this a couple of posts ago, so maybe I’m not understanding what you are asking?

Nigel (UK)
01-16-2024, 06:11 PM
Post: #5
 Gil Senior Member Posts: 637 Joined: Oct 2019
RE: Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
As I said,
LambertW (0,-infinity) = (infinity) with Wolfram Alpha.

I think it is impossible, as the (given answer -= infinity) * EXP (given answer =infinity) can't be equal to -infinity

Can Wolfram Alpha be wrong?

Instead, the answer seems rather to be (infinity+i*pi).
Then (infinity+i*pi) × exp(infinity) × cos (pi) =
Infinity × -1= -infinity.

But infinity + i*pi = infinity + number = infinity...

In a way, Wolfram may correct.

Question, what most "reasonable" output should I give for W0(-infinity), W0(±i×infinity), W0(±infinity±i×infinity)?
01-16-2024, 07:36 PM
Post: #6
 Albert Chan Senior Member Posts: 2,702 Joined: Jul 2018
RE: Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
(01-16-2024 06:11 PM)Gil Wrote:  Instead, the answer seems rather to be (infinity+i*pi).
Then (infinity+i*pi) × exp(infinity) × cos (pi) =
Infinity × -1= -infinity.

(∞ + pi*I) * -∞ = -∞ - ∞*I

Still does not get back -∞, unless ... (∞ + pi*I) = ∞ ?

(∞ + pi*I) * -∞ = ∞ * -∞ = -∞

But then, we are just picking and choosing!

We start with saying W(-∞) = ∞ + pi*I ≠ ∞
But to make it roundtrip, we had to simplify (∞ + pi*I) = ∞

We may turn it around, and say ∞ = ∞ + (any finite number, real or complex)

∞ * e^∞ = ∞ * e^(∞+θ*i) = ∞ * e^∞ * cis(θ) = ∞ * cis(θ)

--> W(∞ * cis(θ)) = ∞      // infinity is weird!
01-16-2024, 09:34 PM (This post was last modified: 01-16-2024 09:36 PM by Gil.)
Post: #7
 Gil Senior Member Posts: 637 Joined: Oct 2019
RE: Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
Nice summarised presentation, Albert.

For me, the answer given by Wolfram is misleading, as we requested W0(-1) and its "answer is infinity", but "answer is infinity" ×EXP("answer is infinity") clearly cannot give back -1, unless we assume that, in one step, infinity+iPI≠ infinity to assume at the end that infinity+iPI=infinity, which is contradictory.

What would you think if, for such cases, Wolfram Alpha would reply here "undefined", for x—> -oo,
but curiously also for x—>+oo?
Indeed, x—> +oo = +oo + "Somewhat", in particular, oo+ipI, and, as we saw, (x+ipI) × EXP(x+iPI) might give, with Euler and cos PI = - 1, a result of -oo (by special "picking up"), though clearly the graphs shows the "right" answer having rather to be +oo.
01-16-2024, 09:53 PM
Post: #8
 Gil Senior Member Posts: 637 Joined: Oct 2019
RE: Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
I read your last post again, Albert, and think that is a similar reasoning that might have incited the Wolfram team to give a possible math answer for W(-oo)=W(+oo) = +oo.
01-16-2024, 11:45 PM (This post was last modified: 01-17-2024 12:13 AM by Albert Chan.)
Post: #9
 Albert Chan Senior Member Posts: 2,702 Joined: Jul 2018
RE: Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
Not all math software follow Wolfram Alpha's logic.

p2> from mpmath import *
p2> mp.pretty = 1
p2> z = -inf
p2> lambertw(z), log(z)
((+inf + 3.14159265358979j), (+inf + 3.14159265358979j))
p2> z = mpc(0,inf)
p2> lambertw(z), log(z)
((+inf + 1.5707963267949j), (+inf + 1.5707963267949j))
p2> z = inf
p2> lambertw(z), log(z)
(+inf, +inf)

I am OK with ∞ + 1 = ∞, but not so much for ∞ + i = ∞
I like mpmath style better.

p2> inf + 1
+inf
p2> inf + j
(+inf + 1.0j)
01-17-2024, 12:36 AM (This post was last modified: 01-17-2024 01:02 AM by Gil.)
Post: #10
 Gil Senior Member Posts: 637 Joined: Oct 2019
RE: Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
Yes, W0(-inf) = inf+i×pi is the limit that appears when x tends to very large negative real numbers.

But, again,
(inf+i×pi)*EXP(inf+i×pi) (1)
=(inf+i×pi)*EXP(inf) *EXP(i×pi)
=(inf+i×pi)*inf*(cos pi +i× sin pi)
=(inf+i×pi)*inf*(-1)
=(inf+i×inf)*(-1)
=-inf-i*inf ≠ -inf

if I am not mistaken, unless you force and say that first member in (1), inf+i×PI, = inf, with no more imaginary part (but that sounds strange : infinity of bananas [real part of number] + 1 orange×[imaginary part] =? infinity of bananas; on the other hand, infinity of bananas means that there are everywhere bananas in the universe, and consequently no place for a single orange).

And then annoying again, mixing up the definitions.

By the way, what does give your software for W0(infinity +10i). By what I understood, the output should be infinity + 10i, vs inf with Wolfram.
01-17-2024, 12:57 AM
Post: #11
 Gil Senior Member Posts: 637 Joined: Oct 2019
RE: Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
Yes, W0(-inf) = inf+i×pi is the limit that appears when x tends to very large negative real numbers.

But, again,
(inf+i×pi)*EXP(inf+i×pi) (1)
=(inf+i×pi)*EXP(inf) *EXP(i×pi)
=(inf+i×pi)*inf*(cos pi +i× sin pi)
=(inf+i×pi)*inf*(-1)
=(inf+i×inf)*(-1)
=-inf-i*inf ≠ -inf

if I am not mistaken, unless you force and say that first member in (1), inf+i×PI, = inf, with no more imaginary part (but that sounds strange : infinity of bananas [real part of number] + 1 orange×[imaginary part] =? infinity of bananas; on the other hand, infinity of bananas means that there are everywhere bananas in the universe, and consequently no place for a single orange).

And then annoying again, mixing up the definitions.
01-17-2024, 02:06 AM (This post was last modified: 01-17-2024 10:43 PM by Albert Chan.)
Post: #12
 Albert Chan Senior Member Posts: 2,702 Joined: Jul 2018
RE: Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
Update with generalized W formula. Set θ=pi, we have W0(-∞) = ∞ + pi*I

Let z = ∞*cis(θ), r = ln(|z|)

We want to show w = W0(z) = ln(z) = r + θ*I
By checking for round-trip, i.e. w * e^w = z

w = r + θ*I ≈ r * cis(θ/r)                     // polar form
e^w = e^(r + θ*I) = e^r * cis(θ)

w * e^w ≈ r*e^r * cis(θ/r + θ)

|z| → ∞ --> r → ∞ too

w * e^w = ∞ * cis(0 + θ) = z

From definition of k-th branch of W

k = (w + ln(w) - ln(z)) / (2*pi*i)
2*pi*k = im(w + ln(w) - ln(z)) = θ + atan(θ/r) - θ = 0

--> k = 0
--> W0(∞*cis(θ)) = ln(∞*cis(θ)) = ∞ + θ*I

Again, from definition of k-th branch:

--> Wk(∞*cis(θ)) = ln(∞*cis(θ)) + 2*k*pi*I
01-17-2024, 11:34 AM (This post was last modified: 01-17-2024 11:42 AM by Gil.)
Post: #13
 Gil Senior Member Posts: 637 Joined: Oct 2019
RE: Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
"w = r + pi*I ≈ r * cis(pi/r) // polar form
e^w = e^(r*cos(pi/r)) * cis(r*sin(pi/r))
w * e^w = r*e^(r*cos(pi/r)) * cis(pi/r + r*sin(pi/r))"

How to you go from line 2 to 3
w = r * cis(pi/r)
w= r * cos (pi/r) + I*r*sin(pi/r)
e^w = e^(r*cos(pi/r)) * e^(I*r*sin(pi/r))
=e^(r*cos(pi/r)) * cis(r*sin(pi/r))
With w≈ r * cis(pi/r)
w*e^w=r * cis(pi/r) × e^(r*cos(pi/r)) * cis(r*sin(pi/r))
=? r*e^(r*cos(pi/r)) * cis(pi/r + r*sin(pi/r))

cis (A)* cis (B) =? +cis (A+B)
01-17-2024, 12:04 PM (This post was last modified: 01-17-2024 12:05 PM by Gil.)
Post: #14
 Gil Senior Member Posts: 637 Joined: Oct 2019
RE: Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
I am not so familiar with this notation.

I discovered it thanks you, Albert.

And checked that cis (A+B) = cis A × cis B.

By the way, with your software, may I kindly ask you if it were possible to check, for Wk=0, Wk=±1, Wk=±2, W±3 and arguments x = ± infinity +i*20, 20±I*inf and ±inf±I×inf, the given outputs of Wk(x)?

Thanks again for your painstaking.

Your insights are always most previous, for me and, certainly, beyond the HP community.
01-17-2024, 01:51 PM
Post: #15
 Gil Senior Member Posts: 637 Joined: Oct 2019
RE: Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
Some "guessed" results for input z =a+ib, with a = -INF:

W-3(-INF +i20) = inf-i(5pi)
W-3(-INF - i20) = inf-i(7pi)

W-2(-INF +i20) = inf-i(3pi)
W-2(-INF - i20) = inf-i(5pi)

W-1(-INF +i20) = inf-i(pi)
W-1(-INF - i20) = inf-i(3pi)

W0(-INF +i20) = inf+i(pi)
W0(-INF - i20) = inf-i(pi)

W1(-INF + i20) = inf+i(5pi)
W1(-INF - i20) = inf+i(3pi)

W2(-INF + i20) = inf+i(5pi)
W2(-INF - i20) = inf+i(pi)

W3(-INF + i20) = inf+i(7pi)
W3(-INF - i20) = inf+i(5pi)

Wk(-INF, +ib, b>0) = inf+i(2k+1)(pi)
Wk(-INF, +ib, b<0) = inf+i(2k+1-2)(pi)

Wk(-INF, +ib, b>0) = inf+i(2k+1)(pi)
Wk(-INF, +ib, b<0) = inf+i(2k-1)(pi)

Conclusion
Wk(-INF, +ib, b≠0) = inf+i(2k+sign(b))(pi)
& we may check Wk(-INF, +ib, b=0) = inf+i(2k+1)(pi)

Summary
Wk(-INF, +ib) =inf+i(pi) *(2k+1, if b>=0; 2k-1, if b<0)
01-17-2024, 02:01 PM
Post: #16
 Gil Senior Member Posts: 637 Joined: Oct 2019
RE: Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
Some "guessed" results for input z =a+ib, with a = -INF:

W-3(-INF +i20) = inf-i(5pi)
W-3(-INF - i20) = inf-i(7pi)

W-2(-INF +i20) = inf-i(3pi)
W-2(-INF - i20) = inf-i(5pi)

W-1(-INF +i20) = inf-i(pi)
W-1(-INF - i20) = inf-i(3pi)

W0(-INF +i20) = inf+i(pi)
W0(-INF - i20) = inf-i(pi)

W1(-INF + i20) = inf+i(5pi)
W1(-INF - i20) = inf+i(3pi)

W2(-INF + i20) = inf+i(5pi)
W2(-INF - i20) = inf+i(pi)

W3(-INF + i20) = inf+i(7pi)
W3(-INF - i20) = inf+i(5pi)

Wk(-INF, +ib, b>0) = inf+i(2k+1)(pi)
Wk(-INF, +ib, b<0) = inf+i(2k+1-2)(pi)

Wk(-INF, +ib, b>0) = inf+i(2k+1)(pi)
Wk(-INF, +ib, b<0) = inf+i(2k-1)(pi)

Conclusion
Wk(-INF, +ib, b≠0) = inf+i(2k+sign(b))(pi)
& we may check Wk(-INF, +ib, b=0) = inf+i(2k+1)(pi)

Summary
Wk(-INF, +ib) =inf+i(pi) *(2k+1, if b>=0; 2k-1, if b<0)
01-17-2024, 02:39 PM (This post was last modified: 01-18-2024 12:11 AM by Gil.)
Post: #17
 Gil Senior Member Posts: 637 Joined: Oct 2019
RE: Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
Now Wk(inf +ib)

W-3(INF +i20) = inf-i(6pi)
W-3(INF - i20) = inf-i(6pi)

W-3(-INF - i20) = inf-i(5pi)
W-3(-INF + i20) = inf-i(7pi)
W-3(-INF - i0) = inf-i(5pi)

W-2(INF +i20) = inf-i(4pi)
W-2(INF - i20) = inf-i(4pi)

W-1(INF +i20) = inf-i(2pi)
W-1(INF - i20) = inf-i(2pi)

W0(INF +i20) = inf-i(0pi)
W0(INF - i20) = inf-i(0pi)

W1(INF +i20) = inf+i(2pi)
W1(INF - i20) = inf+i(2pi)

W2(INF +i20) = inf+i(4pi)
W2(INF - i20) = inf+i(4pi)

W2(INF +i0) = inf+i(4pi)

Conclusion & summary for Wk(inf+ib)
Wk(INF +ib) = inf+2ik

z=a+ib, a=±infinity, b≠±infinity
Wk(±infinity+ib) =+inf +
i × (2k, if a>0; (else 2k+1, if b>=0; 2k-1, else))
01-17-2024, 02:44 PM
Post: #18
 Gil Senior Member Posts: 637 Joined: Oct 2019
RE: Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
That seems to make sense and should be acceptable for my HP50G result.
01-17-2024, 03:07 PM (This post was last modified: 01-17-2024 03:40 PM by Gil.)
Post: #19
 Gil Senior Member Posts: 637 Joined: Oct 2019
RE: Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
From previous post:

A) z=a+ib, a=±infinity, b≠±infinity
Wk(±infinity+ib) =+inf +
i × (2k, if a>0; (else 2k+1, if b>=0; 2k-1, else))

And to complete

Cases z=a≠±inf + i*INF, i*(-INF)

W-3(20, i*INF) = inf - i(5.5pi)
W-3(20, -i*INF) = inf - i(6.5pi)

W-2(20, i*INF) = inf - i(3.5pi)
W-2(20, -i*INF) = inf - i(4.5pi)

W-1(20, i*INF) = inf - i(1.5pi)
W-1(20, -i*INF) = inf - i(2.5pi)

W0(20, i*INF) = inf +i(0.5pi)
W0(20, -i*INF) = inf - i(0.5pi)

W1(20, i*INF) = inf +i(2.5pi)
W1(20, -i*INF) = inf+i(1.5pi)

B) Wk(a+ib,a≠±infinity, b=±in) =
inf+i×(2k+0.5, if b>0 ; 2k-0.5, else)

Cases z=a+ib, a=±inf, b=±inf

W-3(inf, i×inf) = inf - i(6pi)
W-3(inf, -i×inf) =inf - i(6pi)

W-3(-inf, i×inf) = inf - i(5pi)
W-3(-inf, -i×inf) =inf - i(7pi)

C) Conclusion
Wk(a=+inf, b=±inf) = inf + i(2k)
Wk(a=-inf) = inf +i(2k+1, if b=inf; 2k-1, if b=-inf)

Summary of A & C
Wk(a=+inf, b=free) = inf + i(2k)
Wk(a=-inf) = inf +i(2k+1, if b>≠0; 2k-1, else

And case B repeated

B) Wk(a+ib,a≠±infinity, b=±in) =
inf+i×(2k+0.5, if b>0 ; 2k-0.5, else
)
01-17-2024, 06:34 PM (This post was last modified: 01-19-2024 12:10 AM by Albert Chan.)
Post: #20
 Albert Chan Senior Member Posts: 2,702 Joined: Jul 2018
RE: Lambert function and Wolfram or "±infinity+i×K=±infinity" ?
I have extended proof for W0(-∞) = ∞ + pi*I, for generalized case

(01-17-2024 02:06 AM)Albert Chan Wrote:  ...
--> W0(∞*cis(θ)) = ln(∞*cis(θ)) = ∞ + θ*I

Again, from definition of k-th branch:

--> Wk(∞*cis(θ)) = ln(∞*cis(θ)) + 2*k*pi*I

(01-17-2024 03:07 PM)Gil Wrote:  Cases z=a+ib, a=±inf, b=±inf
...

Unless z is in polar form, we don't know θ. (∞/∞ is indeterminate form)
mpmath, with slope=nan, θ = atan2(b,a) = nan

p2> log(mpc(inf,inf))
(+inf + nanj)

Comment: Technically we do know θ. Above example, 0 ≤ θ ≤ pi/2.
IEEE 754-2008 standard pick the mid-point for θ, instead of nan.

lua> I.log(I.new(inf,inf))
(inf+0.7853981633974483*I)

p3> from cmath import *
p3> log(complex(inf,inf))
(inf+0.7853981633974483j)
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)