lambertw, all branches
|
02-01-2024, 02:17 AM
Post: #56
|
|||
|
|||
RE: lambertw, all branches
(01-28-2024 11:18 PM)Albert Chan Wrote: But let's try a *bad* guess, x0=B+j, crossed discontinuity! This is a safe way to fix stuck in loops problem for bad guess. We know ahead of time final sign of imag part is s or 0 (if x is real) If any iterations does not match the sign, LN will nudge it back. Code: def LN(x, bad=-s): For debugging purpose, lets add a way to input user-supplied guess. Put this right before Newton while 1 loop Code: if verbal and verbal!=True: x = verbal Repeat the same test, with bad guess p2> a = mpc(-0.1) p2> B = ln(-a) p2> W(a, -1, B+j) p2> W.W(a, -1, B+j) (-2.30258509299405 + 1.0j) (-3.14484755109194 - 1.43195611385943j) (-3.45450302775194 - 0.017653789718918j) (-3.57799843751793 + 0.000256987554174169j) (-3.57715209366168 - 0.000199346248602327j) (-3.57715206180199 - 8.48877473305296e-13j) (-3.5771520639573 + 5.31405873378874e-16j) (-3.5771520639573 + 0.0j) It is hard to nudge back to real line, but it work! I think guess is good enough without this trick, so it is not updated to version 3. Perhaps I would put it to next version. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: