question on list comprehensions

Terry Reedy tjreedy at udel.edu
Sun Oct 17 20:25:54 EDT 2004


"Alex Martelli" <aleaxit at yahoo.com> wrote in message 
news:1gltsqx.3sh0uedtr3f0N%aleaxit at yahoo.com...
> If I recall correctly, you can generally find closed-form solutions for
> summations of polynomials in i.

Yes, as with integrals, the sum of an nth degree poly is (n+1)th degree. 
The n+2 coefficients for the sum from 0 to k can be determined by actually 
summing the poly for each of 0 to n+1 and equating the n+2 partial sume to 
the result poly (with powers evaluated) to get n+2 equations in n+2 
unknowns.  Even with integral coefficients in the poly to be summed, the 
coefficients are generally non-integral rationals and can get pretty nasty 
to calculate, so for exact results, it may well be easier and faster to 
write and run a program.

Terry J. Reedy






More information about the Python-list mailing list