bundles / scipy latest / scipy / special / _basic / zeta
function
scipy.special._basic:zeta
source: build-install/usr/lib/python3.14/site-packages/scipy/special/_basic.py:3703
Signature
def zeta(x, q = None, out = None)Summary
Riemann or Hurwitz zeta function.
Parameters
x: array_like of float or complexInput data
q: array_like of float, optionalInput data, must be real. Defaults to Riemann zeta. When
qisNone, complex inputsxare supported. Ifqis notNone, then currently only real inputsx(complex dtypes are allowed butxmust have zero imaginary part) withx >= 1are supported, except whenq = 1.0(corresponding to the Riemann zeta function).out: ndarray, optionalOutput array for the computed values.
Returns
out: array_likeValues of zeta(x).
Notes
The two-argument version is the Hurwitz zeta function
see [dlmf] for details. The Riemann zeta function corresponds to the case when q = 1.
For complex inputs with q = None, points with abs(z.imag) > 1e9 and 0 <= abs(z.real) < 2.5 are currently not supported due to slow convergence causing excessive runtime.
Examples
import numpy as np from scipy.special import zeta, polygamma, factorial✓
zeta(2), np.pi**2/6
✗(np.float64(1.6449340668482264), 1.6449340668482264)
zeta(4), np.pi**4/90
✗(np.float64(1.0823232337111381), 1.082323233711138)First nontrivial zero:
zeta(0.5 + 14.134725141734695j)
✗np.complex128(8.878113823622034e-16+1.3951266857616299e-15j)Relation to the `polygamma` function:
m = 3 x = 1.25✓
polygamma(m, x) (-1)**(m+1) * factorial(m) * zeta(m+1, x)✗
np.float64(2.782144009188397)
See also
Aliases
scipy.special.zeta