Bill Daly on Tue, 16 Aug 2005 20:44:38 +0200

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]


I think I now understand what is going on in the PARI implementation of zeta(), and I have a couple of comments.

1. In the Euler-MacLaurin sum loop in czeta(), the summand is of the form gamma(s+2*j-1)/gamma(s) * B(2*j)/((2*j)!*nn^(2*j)). Using the identity B(2*j) = -(-1)^j * zeta(2*j) * 2*(2*j)!/(2*Pi)^(2*j), the summand becomes gamma(s+2*j-1)/gamma(s) * -(-1)^j * zeta(2*j) * 2/(2*Pi*n)^(2*j). This substitution has two potential advantages:

a) If 2*j > bit_accuracy(prec), we may take zeta(2*j) = 1, while for smaller values of j, the values of zeta(2*j) can be precomputed and stored in a table.

b) The terms (2*j)! cancel out, eliminating the need to call divgsns() in the Euler-MacLaurin loop. The new term (2*Pi)^(2*j) can be combined with the existing term nn^(2*j) by defining invn2 as 1/(2*Pi*nn)^2 instead of 1/nn^2.

I don't have a development environment set up for PARI, so I haven't been able to test this idea directly. I have tested it successfully in GP, and I can supply the code to anyone who may be interested. The same substitution might be advantageous in calculating gamma(), lngamma() and psi().

2. In the Dirichlet sum loop, the code calls n_s() for each odd n to calculate n^-s, and n_s() does a linear search to find the prime power factors of n. It seems to me that if memory is not a constraint, one could save the cost of the linear searches by calculating the odd entries in tab[] by sieving, i.e. something of the form:

    p_s = p^-s;
    q = p;
    while (q <= nn,
      r = q;
      while (r <= nn,
        tab[r] *= p_s;
        r += q;
      q *= p;

This assumes that the odd entries in tab[] have all been initialized to 1.

Regards, Bill


This message and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. It may contain sensitive and private proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you are not the intended recipient, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. Tradition Asiel Securities Inc. and Tradition (North America) Inc. reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them.

Unless otherwise stated, any pricing information given in this message is indicative only, is subject to change and does not constitute an offer to deal at any price quoted. Any reference to the terms of executed transactions should be treated as preliminary only and subject to our formal written confirmation. Tradition Asiel Securities Inc. and Tradition (North America) Inc. are not responsible for any recommendation, solicitation, offer or agreement or any information about any transaction, customer account or account activity contained in this communication.

This footnote also confirms that this email message has been swept by
Anti-virus detection software for the presence of computer viruses.