Charles Greathouse on Wed, 27 May 2015 23:24:17 +0200


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

suminf and moebus


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?

Charles Greathouse
Analyst/Programmer
Case Western Reserve University