[libmath-prime-util-perl] 37/54: Doc updates

Partha P. Mukherjee ppm-guest at moszumanska.debian.org
Thu May 21 18:52:10 UTC 2015


This is an automated email from the git hooks/post-receive script.

ppm-guest pushed a commit to annotated tag v0.38
in repository libmath-prime-util-perl.

commit 96ca9117dbc8c2898b29a990e33da606012811a1
Author: Dana Jacobsen <dana at acm.org>
Date:   Wed Feb 19 16:29:48 2014 -0800

    Doc updates
---
 lib/Math/Prime/Util.pm | 31 ++++++++++++-------------------
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm
index e0b3bc7..dbd8fd6 100644
--- a/lib/Math/Prime/Util.pm
+++ b/lib/Math/Prime/Util.pm
@@ -1918,17 +1918,10 @@ This is -1 raised to Ω(n) (the total number of prime factors).
   say chebyshev_theta(10000);
 
 Returns θ(n), the first Chebyshev function for a non-negative integer input.
-This is the sum of the logarithm of each prime where C<p E<lt>= n>.  An
-alternate computation is as the logarithm of n primorial.
-Hence these functions:
-
-  use List::Util qw/sum/;  use Math::BigFloat;
-
-  sub c1a { 0+sum( map { log($_) } @{primes(shift)} ) }
-  sub c1b { Math::BigFloat->new(primorial(shift))->blog }
-
-yield similar results, albeit slower and using more memory.
+This is the sum of the logarithm of each prime where C<p E<lt>= n>.  This
+is effectively:
 
+  my $s = 0;  forprimes { $s += log($_) } $n;  return $s;
 
 =head2 chebyshev_psi
 
@@ -1936,16 +1929,10 @@ yield similar results, albeit slower and using more memory.
 
 Returns ψ(n), the second Chebyshev function for a non-negative integer input.
 This is the sum of the logarithm of each prime power where C<p^k E<lt>= n>
-for an integer k.  An alternate computation is as the summatory Mangoldt
-function.  Another alternate computation is as the logarithm of
-LCM(1,2,...,n).  Hence these functions:
+for an integer k.  An alternate but slower computation is as the summatory
+Mangoldt function, such as:
 
-  use List::Util qw/sum/;  use Math::BigFloat;
-
-  sub c2a { 0+sum( map { log(exp_mangoldt($_)) } 1 .. shift ) }
-  sub c2b { Math::BigFloat->new(consecutive_integer_lcm(shift))->blog }
-
-yield similar results, albeit slower and using more memory.
+  my $s = 0;  for (1..$n) { $s += log(exp_mangoldt($_)) }  return $s;
 
 
 =head2 divisor_sum
@@ -2182,6 +2169,12 @@ Examples of various ways to set your own irand function:
   use Crypt::Random qw/makerandom/;
   prime_set_config(irand => sub { makerandom(Size=>32, Uniform=>1); });
 
+  # Net::Random.  You probably don't want to use this, but if you do:
+  use Net::Random;
+  { my $rng = Net::Random->new(src=>"fourmilab.ch",max=>0xFFFFFFFF);
+    sub nr_irand { return $rng->get(1); } }
+  prime_set_config(irand => \&nr_irand);
+
   # Mersenne Twister.  Very fast, decent RNG, auto seeding.
   use Math::Random::MT::Auto;
   prime_set_config(irand=>sub {Math::Random::MT::Auto::irand() & 0xFFFFFFFF});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git



More information about the Pkg-perl-cvs-commits mailing list