scipy.special.wofz#
- scipy.special.wofz(z, out=None) = <wrapped_ufunc 'wofz'>#
Faddeeva function.
Returns the value of the Faddeeva function for complex argument:
\[w(z) = e^{-z^2} \operatorname{erfc}(-i z)\]- Parameters:
- zarray_like
complex argument
- outndarray, optional
Optional output array for the function results
- Returns:
- scalar or ndarray
Value of the Faddeeva function
Notes
Array API Standard Support
wofzhas 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.wofzdoes not currently supportoutfor the PyTorch backend.See Array API coverage for more information.
References
[1]Steven G. Johnson, Faddeeva W function implementation. http://ab-initio.mit.edu/Faddeeva
Examples
>>> import numpy as np >>> from scipy import special >>> import matplotlib.pyplot as plt
>>> x = np.linspace(-3, 3) >>> z = special.wofz(x)
>>> plt.plot(x, z.real, label='wofz(x).real') >>> plt.plot(x, z.imag, label='wofz(x).imag') >>> plt.xlabel('$x$') >>> plt.legend(framealpha=1, shadow=True) >>> plt.grid(alpha=0.25) >>> plt.show()