![]() | 1 | initial version |
You could define
def sums(a,nmax):
return [sum(a[i] for i in xrange(n+1)) for n in xrange(nmax)]
Then you could compute for instance:
sage: a = [i^2 for i in xrange(20)]
sage: sums(a,10)
[0, 1, 5, 14, 30, 55, 91, 140, 204, 285]
Is that what you want, or do you want something that would take "symbolic lists" given by their names, and return a symbolic expression consisting in the formal sums of list elements? I'm not sure how one could do that.