Copyright | (c) 2018 Alexandre Rodrigues Baldé Andrew Lelechenko |
---|---|

License | MIT |

Maintainer | Andrew Lelechenko <andrew.lelechenko@gmail.com> |

Safe Haskell | None |

Language | Haskell2010 |

Numeric evaluation of various zeta-functions.

# Riemann zeta-function

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)`

.

`>>>`

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

Beware to force evaluation of `zetas !! 1`

if the type `a`

does not support infinite values
(for instance, `Fixed`

).

zetasEven :: [ExactPi] Source #

Infinite sequence of exact values of Riemann zeta-function at even arguments, starting with `ζ(0)`

.
Note that due to numerical errors conversion to `Double`

may return values below 1:

`>>>`

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

Use your favorite type for long-precision arithmetic. For instance, `Fixed`

works fine:

`>>>`

`import Data.Number.Fixed`

`>>>`

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

# Dirichlet beta-function

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

Infinite sequence of approximate (up to given precision)
values of Dirichlet beta-function at integer arguments, starting with `β(0)`

.

`>>>`

[0.5,0.7853981633974483,0.9159655941772189,0.9689461462593694,0.9889445517411051]`take 5 (betas 1e-14) :: [Double]`

betasOdd :: [ExactPi] Source #

Infinite sequence of exact values of Dirichlet beta-function at odd arguments, starting with `β(1)`

.

`>>>`

0.9999999999999987`approximateValue (betasOdd !! 25) :: Double`

`>>>`

`import Data.Number.Fixed`

`>>>`

0.99999999999999999999999960726927497384196726751694`approximateValue (betasOdd !! 25) :: Fixed Prec50`

# Hurwitz zeta-functions

zetaHurwitz :: forall a. (Floating a, Ord a) => a -> a -> [a] Source #

Values of Hurwitz zeta function evaluated at `ζ(s, a)`

for `s ∈ [0, 1 ..]`

.

The algorithm used was based on the Euler-Maclaurin formula and was derived from Fast and Rigorous Computation of Special Functions to High Precision by F. Johansson, chapter 4.8, formula 4.8.5. The error for each value in this recurrence is given in formula 4.8.9 as an indefinite integral, and in formula 4.8.12 as a closed form formula.

It is the **user's responsibility** to provide an appropriate precision for
the type chosen.

For instance, when using `Double`

s, it does not make sense
to provide a number `ε < 1e-53`

as the desired precision. For `Float`

s,
providing an `ε < 1e-24`

also does not make sense.
Example of how to call the function:

`>>>`

1024.3489745265808`zetaHurwitz 1e-15 0.25 !! 5`