lambertw, all branches
|
04-07-2023, 07:54 PM
Post: #4
|
|||
|
|||
RE: lambertw, all branches
Hi, pier4r
I am still learning, and math is not up to par into article section, where no feedback allowed. Hopefully, someone reading this may suggest a better way. (04-07-2023 02:47 PM)Albert Chan Wrote: For k=-1, solve for f=0 is especially difficult. Example, as I am writing code, I realized k "flipping" is unnecessary. With equivalent starting guess, convergence is the same. It is just here, "equivalent" may mean a difference of +0*I vs -0*I Below is work in progress code, without flipping k to non-negative. It simply solve f=0 by Newton's method, with a supplied guess x lua> a, k = -0.1, -1 lua> x = I.log(-a) lua> I.W(a, k, true, x) (-2.3025850929940455+0*I) (-3.7769077194622533-11.106812831380271*I) (-3.949948702089913-0.9503184433887455*I) (-3.558355491208183-0.04104686782028688*I) (-3.577077533853747+8.297706605468053e-005*I) (-3.5770735614781484-8.721290183674583*I) ... lua> I.W(a, k, true, I.conj(x)) -- +0*I to -0*I fixed it! (-2.3025850929940455-0*I) (-3.7769077194622533-0*I) (-3.579124176402325-0*I) (-3.5771522746958055-0*I) (-3.5771520639573-0*I) (-3.577152063957297-0*I) (04-07-2023 02:47 PM)Albert Chan Wrote: f = x + ln(x) - ln(a) - 2*k*pi*I = 0 Guess x with +0*I is a lousy one, with phase(x) = +pi LHS = 0 + (+pi) = +pi RHS = 2*(-1)*pi + (pi) = -pi guess of conj(x) with -0*I is much better, LHS = 0 + (-pi) = -pi = RHS The fix is simple, argument for log, instead of wrong implicit I.new(-a), use explicit -I.new(a) lua> I.log(-I.new(a)) -- good W-1 guess (-2.3025850929940455-0*I) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)