Answer by niles for With Maple I can writeseq(add(a[i], i=0..n), n=0..3); and...
Do you just want syntax to add the first `k` entries in a list? As @kcrisman alluded, you can get the first `k` entries by [slicing](http://stackoverflow.com/questions/509211/pythons-slice-notation),...
View ArticleAnswer by slelievre for With Maple I can writeseq(add(a[i], i=0..n), n=0..3);...
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,...
View ArticleComment by kcrisman for With Maple I can writeseq(add(a[i], i=0..n), n=0..3);...
Hmm, now I'm more confused about what you want. Lists are Python objects and of course the brackets are slicing.
View ArticleComment by kcrisman for With Maple I can writeseq(add(a[i], i=0..n), n=0..3);...
Is http://ask.sagemath.org/question/363/a-list-of-symbolic-variables helpful? This is unfortunately not implemented in the same way, see http://trac.sagemath.org/ticket/11576
View ArticleSymbolic accumulation
With Maple I can write seq(add(a[i], i=0..n), n=0..3); and get a[0], a[0]+a[1], a[0]+a[1]+a[2], a[0]+a[1]+a[2]+a[3] (*) If I write in Sage for n in range(4): add(a[i] for i in range(n)) I get the...
View Article