scipy.special.wrightomega#
- scipy.special.wrightomega(z, out=None) = <wrapped_ufunc 'wrightomega'>#
Wright Omega function.
Defined as the solution to
\[\omega + \log(\omega) = z\]where \(\log\) is the principal branch of the complex logarithm.
- Parameters:
- zarray_like
Points at which to evaluate the Wright Omega function
- outndarray, optional
Optional output array for the function values
- Returns:
- omegascalar or ndarray
Values of the Wright Omega function
See also
lambertwThe Lambert W function
Notes
Added in version 0.19.0.
The function can also be defined as
\[\omega(z) = W_{K(z)}(e^z)\]where \(K(z) = \lceil (\Im(z) - \pi)/(2\pi) \rceil\) is the unwinding number and \(W\) is the Lambert W function.
The implementation here is taken from [1].
Array API Standard Support
wrightomegahas support for Python Array API Standard compatible backends in addition to NumPy. The following combinations of backend and device (or other capability) are supported.Library
CPU
GPU
NumPy
✅
n/a
CuPy
n/a
⛔
PyTorch
✅
⛔
JAX
✅
⛔
Dask
✅
n/a
For the NumPy backend, this function supports all NumPy ufunc keyword arguments. Other backends may support
out, but typically none of the other ufunc kwargs.outis typically supported for CuPy and PyTorch, but not currently in cases where SciPy relies on a generic Array API implementation or, for PyTorch on CPU, falls back to the NumPy backend.outis never supported for JAX because JAX arrays are immutable.wrightomegadoes not currently supportoutfor the PyTorch backend.See Array API coverage for more information.
References
[1]Lawrence, Corless, and Jeffrey, “Algorithm 917: Complex Double-Precision Evaluation of the Wright \(\omega\) Function.” ACM Transactions on Mathematical Software, 2012. DOI:10.1145/2168773.2168779.
Examples
>>> import numpy as np >>> from scipy.special import wrightomega, lambertw
>>> wrightomega([-2, -1, 0, 1, 2]) array([0.12002824, 0.27846454, 0.56714329, 1. , 1.5571456 ])
Complex input:
>>> wrightomega(3 + 5j) (1.5804428632097158+3.8213626783287937j)
Verify that
wrightomega(z)satisfiesw + log(w) = z:>>> w = -5 + 4j >>> wrightomega(w + np.log(w)) (-5+4j)
Verify the connection to
lambertw:>>> z = 0.5 + 3j >>> wrightomega(z) (0.0966015889280649+1.4937828458191993j) >>> lambertw(np.exp(z)) (0.09660158892806493+1.4937828458191993j)
>>> z = 0.5 + 4j >>> wrightomega(z) (-0.3362123489037213+2.282986001579032j) >>> lambertw(np.exp(z), k=1) (-0.33621234890372115+2.282986001579032j)