Dana Jacobsen >
Math-Prime-Util-0.14 >
Math::Prime::Util::ZetaBigFloat

Module Version: 0.14
Math::Prime::Util::ZetaBigFloat - Perl Big Float versions of Riemann Zeta and R functions

Version 0.14

Math::BigFloat versions`of the Riemann Zeta and Riemann R functions. These are kept in a separate module because they use a lot of big tables that we'd prefer not to have loaded all the time.

Pure Perl implementations of Riemann Zeta and Riemann R using Math::BigFloat.

my $z = RiemannZeta($s);

Given a floating point input `s`

where `s >= 0.5`

, returns the floating point value of ζ(s)-1, where ζ(s) is the Riemann zeta function. One is subtracted to ensure maximum precision for large values of `s`

. The zeta function is the sum from k=1 to infinity of `1 / k^s`

Accuracy should be at least 14 digits, but currently does not increase accuracy with big floats. Small integer values are returned from a table, values between 0.5 and 5 use rational Chebyshev approximation, and larger values use a series.

my $r = RiemannR($x);

Given a positive non-zero floating point input, returns the floating point value of Riemann's R function. Riemann's R function gives a very close approximation to the prime counting function.

Accuracy should be at least 14 digits.

Bugs in Math::BigFloat (RT 43692, RT 77105) cause many problems with this code. I've attempted to apply workarounds, but it is possible there are cases they miss.

The accuracy goals (35 digits) are sometimes missed by a digit or two, and extensive testing needs to be done to ensure we meet the goals.

Performance is not good at all. A version using XS+GMP would be good to have. Pari can give better accuracy in a miniscule fraction of the time.

Dana Jacobsen <dana@acm.org>

Copyright 2012 by Dana Jacobsen <dana@acm.org>

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: