Karim Belabas on Wed, 27 May 2015 23:43:52 +0200


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

Re: suminf and moebus


* Charles Greathouse [2015-05-27 23:24]:
> In number theory it's common to take infinite sums of the form mu(n) *
> f(n). On several occasions I've seen code of the form
> 
> suminf(n=1, moebius(n)*f(n))
> 
> which looks like it would compute such a sum, but since mu(48) = mu(49) =
> mu(50) = 0, the sum is prematurely truncated.
> 
> It's not too hard to re-write the suminf mechanics to bypass this: get an
> initial estimate of the sum, scale down according to
> default(realprecision), and run the sum until f(n) (or f(n), f(n+1), ...,
> f(n+k) for some small k) is 0. But this is kind of a pain, and easy to get
> wrong in subtle ways. Is there a better way of doing this?

1) suminf is a trivial function (compared to e.g sumalt or the various
sumnum* available in 2.8.*). Your proposed workaround is sound, and not
hard to experiment with until you get it right: it will depend very much
on the specific functions f you allow...

I don't see a way of making it foolproof *and* generic, given that GP
only sees a closure and can only guess mathematical properties via
sampling...

2) if f is multiplicative, prodeuler will be a happier choice.

Cheers,

    K.B.
--
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite de Bordeaux         Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux.fr/~kbelabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux.fr/  [PARI/GP]
`