Computes the Riemann zeta function zeta(z), one of the most important functions in analytic number theory.
Mathematical Definition:
The Riemann zeta function is defined by the series: $$\zeta(z) = \sum_{n=1}^\infty \frac{1}{n^z}$$
for Re(z) > 1, and by analytic continuation elsewhere.
Special Values:
zeta(2) = pi^2/6 (Basel problem)
zeta(4) = pi^4/90
zeta(0) = -1/2
zeta(-1) = -1/12
Closed forms exist for all even positive integers and all negative integers
For odd positive integers > 1, values are computed numerically
Implementation:
The function uses different computational strategies depending on the argument:
For 0 < z < 1: Rational approximation form
For 1 < z < 4: Rational approximation around nearby integers
For z > 4: Simple rational approximation series
Reflection formula for negative arguments
Pre-computed cached values for positive odd integers
Specialised rational approximations for standard floating-point precisions
Applications:
The Riemann zeta function appears in number theory (distribution of primes), physics (quantum field theory, statistical mechanics), and probability theory. The famous Riemann Hypothesis concerns the non-trivial zeros of this function.
See also
Boost Documentation for more details on the mathematical background.