{ } Raw JSON

bundles / scipy 1.17.1 / scipy / special / _basic / zeta

function

scipy.special._basic:zeta

source: /scipy/special/_basic.py :3272

Signature

def   zeta ( x q = None out = None )

Summary

Riemann or Hurwitz zeta function.

Parameters

x : array_like of float or complex.

Input data

q : array_like of float, optional

Input data, must be real. Defaults to Riemann zeta. When q is None, complex inputs x are supported. If q is not None, then currently only real inputs x with x >= 1 are supported, even when q = 1.0 (corresponding to the Riemann zeta function).

out : ndarray, optional

Output array for the computed values.

Returns

out : array_like

Values 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.

Array API Standard Support

zeta has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable SCIPY_ARRAY_API=1 and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. 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                 
====================  ====================  ====================

See dev-arrayapi for more information.

Examples

import numpy as np
from scipy.special import zeta, polygamma, factorial
Some specific values:
zeta(2), np.pi**2/6
zeta(4), np.pi**4/90
First nontrivial zero:
zeta(0.5 + 14.134725141734695j)
Relation to the `polygamma` function:
m = 3
x = 1.25
polygamma(m, x)
(-1)**(m+1) * factorial(m) * zeta(m+1, x)

See also

zetac

Aliases

  • scipy.special.zeta

Referenced by