lambertw, all branches
|
04-13-2023, 03:03 PM
(This post was last modified: 04-17-2023 10:16 PM by Albert Chan.)
Post: #12
|
|||
|
|||
RE: lambertw, all branches
Here is equivalent complex.W version 2, adapted to machine without signed zero.
Without signed zero, this trick is out: W(a, k) = conj(W(conj(a), -k) Instead, let W(a, k) = x = re(z) + s*im(z)*I , such that s = ±1, arg(z) ≥ 0 s = sign(arg(x)) = ±1 |x| = |z| arg(x) = s * arg(z) lua> I.W(-1e-100, -1, true) (-230.25850929940458-0*I) (-235.72143712473638-0*I) (-235.72115887568603-0*I) (-235.72115887568532-0*I) (-235.72115887568535-0*I) true Above example, s=-1, all x iterations, arg(x) = s * pi Almost identical, for efficiency: arg(x) ≠ bad = s * -pi In other words, iteration overshoot allowed, where arg(z) ≥ 0 does not hold. But, not to the extreme opposite direction, i.e. arg(z) ≠ -pi We need to add arg(x) edge case, to make W (without signed zero) work the same as I.W Code: h = arg(x) I use Python mpmath, which does not have signed zero. Code: from mpmath import * # no signed zero support >>> W(-1e-100, -1, True) -230.258509299405 (-235.721437124736 + 0.0j) (-235.721158875686 + 0.0j) (-235.721158875685 + 0.0j) (mpc(real='-235.72115887568535', imag='0.0'), True) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)