arithmoi-0.6.0.1: Efficient basic number-theoretic functions.

Copyright (c) 2016 Andrew Lelechenko MIT Andrew Lelechenko Provisional Non-portable (GHC extensions) Safe Haskell2010

Math.NumberTheory.Zeta

Description

Riemann zeta-function.

Synopsis

# Documentation

zetas :: (Floating a, Ord a) => a -> [a] Source #

Infinite sequence of approximate (up to given precision) values of Riemann zeta-function at integer arguments, starting with ζ(0). Computations for odd arguments are performed in accordance to Computational strategies for the Riemann zeta function by J. M. Borwein, D. M. Bradley, R. E. Crandall, formula (57).

> take 5 (zetas 1e-14) :: [Double]
[-0.5,Infinity,1.6449340668482262,1.2020569031595942,1.0823232337111381]

Beware to force evaluation of zetas !! 1, if the type a does not support infinite values (for instance, Fixed).

Infinite sequence of exact values of Riemann zeta-function at even arguments, starting with ζ(0). Note that due to numerical errors convertation to Double may return values below 1:

> approximateValue (zetasEven !! 25) :: Double
0.9999999999999996

Use your favorite type for long-precision arithmetic. For instance, Fixed works fine:

> approximateValue (zetasEven !! 25) :: Fixed Prec50
1.00000000000000088817842111574532859293035196051773

approximateValue :: Floating a => ExactPi -> a #

Approximates an exact or approximate value, converting it to a Floating type. This uses the value of pi supplied by the destination type, to provide the appropriate precision.