(28/48/50) Lambert W Function
04-03-2023, 10:47 PM (This post was last modified: 04-04-2023 12:19 AM by Albert Chan.)
Post: #26
 Albert Chan Senior Member Posts: 2,697 Joined: Jul 2018
RE: (28/48/50) Lambert W Function
(04-02-2023 11:12 PM)Albert Chan Wrote:  lua> a, k = 3+4*I, 5
lua> x = 2*k*pi*I -- guess for Wk(a)

With Newton's rapid convergence, it might be overkill for better W guess ...

x = r cis(θ)
e^x = e^(r*cos(θ)) cis(r*sin(θ))
x*e^x = r*e^(r*cos(θ)) cis(θ+r*sin(θ)) = a

r*e^(r*cos(θ)) = |a|
θ+r*sin(θ) = arg(a) + 2*k*pi = T           // for W branch k

cos(θ) = ln(|a|/r)/r
sin(θ) = (T-θ)/r

We assume k positive --> both r and x imag part positive too.

lua> a, k = 3+4*I, 5
lua> A, T = I.abs(a), 2*k*pi + I.arg(a)
lua> A, T
5      32.34322175389954

lua> c = 0 -- = cos(θ)
lua> r = (T-acos(c)) / sqrt(1-c*c) -- = T - pi/2
lua> c = log(A/r)/r
lua> x = r * I.new(c, sqrt(1-c*c))
lua> x -- Wk(a) guess
(-1.81718109820366+30.71872424960138*I)

Rinse and repeat ...

lua> r = (T-acos(c)) / sqrt(1-c*c)
lua> c = log(A/r)/r
lua> x2 = r * I.new(c, sqrt(1-c*c))
lua> x2
(-1.8170057678766207+30.7133303234809*I)

lua> r = (T-acos(c)) / sqrt(1-c*c)
lua> c = log(A/r)/r
lua> x3 = r * I.new(c, sqrt(1-c*c))
lua> x3
(-1.8170058919343504+30.713334139703402*I)

lua> aitken(x, x2, x3)
(-1.8170058918466334+30.71333413700532*I)

We don't even need machine to support complex numbers.
We could just iterate for (r, c), improve with Aitken's delta-squared process
Assuming K is positve, after (r, c) converged, Wk(a) = complex(r*c, r*sqrt(1-c*c))
 « Next Oldest | Next Newest »

 Messages In This Thread (28/48/50) Lambert W Function - John Keith - 03-20-2023, 08:43 PM RE: (28/48/50) Lambert W Function - Albert Chan - 03-20-2023, 10:51 PM RE: (28/48/50) Lambert W Function - John Keith - 03-21-2023, 01:53 PM RE: (28/48/50) Lambert W Function - Albert Chan - 03-21-2023, 05:15 PM RE: (28/48/50) Lambert W Function - John Keith - 03-22-2023, 07:30 PM RE: (28/48/50) Lambert W Function - Albert Chan - 03-23-2023, 12:16 AM RE: (28/48/50) Lambert W Function - John Keith - 03-23-2023, 05:53 PM RE: (28/48/50) Lambert W Function - Albert Chan - 03-23-2023, 07:30 PM RE: (28/48/50) Lambert W Function - Gerald H - 03-21-2023, 06:15 AM RE: (28/48/50) Lambert W Function - John Keith - 03-22-2023, 08:55 PM RE: (28/48/50) Lambert W Function - Albert Chan - 03-23-2023, 02:56 AM RE: (28/48/50) Lambert W Function - Albert Chan - 03-26-2023, 06:43 PM RE: (28/48/50) Lambert W Function - Albert Chan - 04-02-2023, 11:12 PM RE: (28/48/50) Lambert W Function - John Keith - 04-03-2023, 07:24 PM RE: (28/48/50) Lambert W Function - Albert Chan - 04-03-2023, 08:47 PM RE: (28/48/50) Lambert W Function - John Keith - 03-27-2023, 04:45 PM RE: (28/48/50) Lambert W Function - Albert Chan - 03-27-2023, 08:57 PM RE: (28/48/50) Lambert W Function - Albert Chan - 03-31-2023, 04:06 PM RE: (28/48/50) Lambert W Function - John Keith - 03-31-2023, 06:15 PM RE: (28/48/50) Lambert W Function - Albert Chan - 03-31-2023, 07:10 PM RE: (28/48/50) Lambert W Function - Albert Chan - 03-27-2023, 11:30 PM RE: (28/48/50) Lambert W Function - Albert Chan - 03-31-2023, 10:07 PM RE: (28/48/50) Lambert W Function - Albert Chan - 04-01-2023, 12:44 PM RE: (28/48/50) Lambert W Function - John Keith - 04-01-2023, 05:36 PM RE: (28/48/50) Lambert W Function - John Keith - 04-01-2023, 05:59 PM RE: (28/48/50) Lambert W Function - Albert Chan - 04-03-2023 10:47 PM RE: (28/48/50) Lambert W Function - Albert Chan - 04-04-2023, 01:03 AM RE: (28/48/50) Lambert W Function - John Keith - 04-04-2023, 07:09 PM RE: (28/48/50) Lambert W Function - Gil - 01-29-2024, 11:04 AM RE: (28/48/50) Lambert W Function - Albert Chan - 01-29-2024, 03:51 PM RE: (28/48/50) Lambert W Function - Gil - 01-29-2024, 02:47 PM RE: (28/48/50) Lambert W Function - Gil - 01-29-2024, 06:46 PM RE: (28/48/50) Lambert W Function - Albert Chan - 01-29-2024, 07:30 PM RE: (28/48/50) Lambert W Function - Gil - 01-29-2024, 09:50 PM RE: (28/48/50) Lambert W Function - Albert Chan - 01-30-2024, 12:18 AM RE: (28/48/50) Lambert W Function - Gil - 01-30-2024, 12:33 AM RE: (28/48/50) Lambert W Function - Albert Chan - 01-30-2024, 01:09 AM RE: (28/48/50) Lambert W Function - Gil - 01-30-2024, 12:04 PM RE: (28/48/50) Lambert W Function - Albert Chan - 01-30-2024, 01:47 PM RE: (28/48/50) Lambert W Function - Gil - 01-30-2024, 02:52 PM RE: (28/48/50) Lambert W Function - Albert Chan - 01-30-2024, 04:04 PM RE: (28/48/50) Lambert W Function - Gil - 01-31-2024, 07:10 PM

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