Zeta and L values
, , : special values of zeta and L functions carry arithmetic. Some are exact, and those are returned exactly. Everywhere else the value comes as an interval with rational endpoints that provably contains it.
The functions
For a Dirichlet character ,
and the Riemann zeta function is the case of the trivial character. Each extends to the whole complex plane, with a single pole at when is principal and none otherwise.
Exact values
At the non-positive integers the values are rational numbers given by Bernoulli numbers, , and at the positive even integers Euler's formula gives a rational multiple of a power of .
import { bernoulli, zetaExact, lValueExact, kroneckerCharacter, dirichletCharacter } from "@ratmath/numtheory";
[0, 1, 2, 4, 6, 12].map(bernoulli); // 1, -1/2, 1/6, -1/30, 1/42, -691/2730
zetaExact(-1); // -1/12
zetaExact(-3); // 1/120
zetaExact(-2); // 0: a trivial zero
String(zetaExact(2)); // "π^2/6"
String(zetaExact(12)); // "691π^12/638512875"
zetaExact(12).coefficient; // 691/638512875
For a character the same holds with generalised Bernoulli numbers: , where . For a real character the value is a Rational; for a complex one it lies in the cyclotomic field of the character's order.
lValueExact(kroneckerCharacter(-23), 0); // 3
lValueExact(kroneckerCharacter(-163), 0); // 1
lValueExact(kroneckerCharacter(-4), 0); // 1/2
lValueExact(kroneckerCharacter(5), -1); // -2/5
String(lValueExact(dirichletCharacter(5, 2), 0)); // "3/5 + (1/5)ζ4": (3 + i)/5
The first lines are the class number formula. For a negative fundamental discriminant , with roots of unity in ,
So is the class number of , found on the Class groups page by entirely different means, and is the reason is so nearly a whole number.
Enclosures
At other points there is no closed form. zetaValue and lValue return a RationalInterval narrower than (64 by default) that contains the true value. The argument is given exactly: a whole number, a fraction as text, or [σ, t] for the point of the plane, in which case the result is { re, im }.
import { zetaValue, lValue, hurwitzZeta } from "@ratmath/numtheory";
const z = zetaValue(3); // Apéry's constant
z.compactedDecimalInterval(); // "1.202056903159594285[38:41]"
zetaValue(3, { bits: 200 }); // sixty digits
zetaValue("1/2").low.toNumber(); // -1.4603545088095868
const w = zetaValue(["1/2", 14]); // near the first zero, 1/2 + 14.1347…i
[w.re.low.toNumber(), w.im.low.toNumber()]; // [0.02224114…, -0.10325812…]
lValue(kroneckerCharacter(-4), 1).compactedDecimalInterval(); // "0.7853981633974483096[1:3]" = π/4
lValue(kroneckerCharacter(8), 1).low.toNumber(); // 0.6232252401402305 = ln(1 + √2)/√2
lValue(dirichletCharacter(7, 3), [2, 5]); // { re, im }: a complex character, off the real line
The last real example is the class number formula for a real quadratic field: , here with and the unit from the Units page.
How the enclosures are proved
Every L-function is a combination of Hurwitz zeta functions :
And is computed by the Euler–Maclaurin formula: sum the first terms directly, replace the rest by an integral, and correct with Bernoulli numbers,
with the remainder bounded explicitly:
The formula holds wherever the bound makes sense, which is how it reaches the left half plane and the critical strip. Every operation is done in ball arithmetic: a midpoint and a radius, with each rounding added to the radius, and exponentials, logarithms, sines and cosines carrying their own error bounds. The remainder bound is added at the end. At the poles of the individual cancel because , and the limit is taken exactly.
hurwitzZeta(2, "1/4").low.toNumber(); // 17.197329154507… = π² + 8G, with G Catalan's constant
// an enclosure contains the exact value where there is one
const e = zetaValue(-5, { bits: 100 });
const x = zetaExact(-5); // -1/252
e.low.lessThanOrEqual(x) && x.lessThanOrEqual(e.high); // true
Limits: the modulus of the character is at most 5000 for enclosures, and the cost grows with the modulus and with the height . For the zeros of , with proof that they lie on the critical line, see the gamma and zeta page of @ratmath/complex.
@ratmath/numtheory and Core's Rational in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.