fn
zeta
→Tensorzeta(x: Tensor, q: Tensor)Hurwitz zeta function .
Computes the Hurwitz zeta function, a two-argument generalisation of the Riemann zeta that arises in moment-generating functions of discrete distributions, in expansions of polygamma functions, and as a regulariser in analytic number theory.
Parameters
xTensorExponent; must satisfy for the series to
converge. Any floating-point dtype.
qTensorShift parameter; broadcast-compatible with
x. Should be
positive (avoid the poles at non-positive integers).Returns
Tensor element-wise, broadcast to the common shape
of x and q.
Notes
Series definition:
The implementation accumulates an explicit prefix of 12 terms and closes the tail with the Euler–Maclaurin correction
where and the are Bernoulli
numbers. Accuracy is roughly for
and moderate q — adequate for ML log-density work, not for
heroic-precision scientific computing. The Riemann zeta is the
special case .
Examples
>>> import lucid
>>> from lucid.special import zeta
>>> x = lucid.tensor([2.0, 3.0])
>>> q = lucid.tensor([1.0, 1.0])
>>> zeta(x, q)
Tensor([1.6449, 1.2021])