Algorithms for mathematical constants¶
Most mathematical constants are evaluated using the generic hypergeometric summation code.
Pi¶
which is hypergeometric and adds roughly 14 digits per term. Methods based on the arithmetic-geometric mean seem to be slower by a factor three in practice.
A small trick
is to compute
Logarithms of integers¶
The standalone constant
Logarithms of other small integers are in certain situations computed using Machin-like formulas, e.g.:
Euler’s constant¶
Euler’s constant
in which
All series are evaluated using binary splitting.
The first two series are evaluated simultaneously, with the summation
taken up to
Catalan’s constant¶
Catalan’s constant is computed using the hypergeometric series
where
discovered by Zuniga [Zun2023]. It was previously computed using a series given in [PP2010].
Apery’s constant¶
Apery’s constant
where
discovered by Zuniga [Zun2023].
Khinchin’s constant¶
Khinchin’s constant
where
Thus, for an error of at most
Glaisher’s constant¶
Glaisher’s constant
Reciprocal Fibonacci constant¶
We use Gosper’s series ([Gos1974], corrected in [Arn2012])
where