You defined
sage: a = sum(sqrt(x), x, 0, oo); a
sum(sqrt(x), x, 0, +Infinity)
Let us explore this object.
sage: a.parent()
Symbolic Ring
Typing a.
and pressing the tab key, we find among other
methods the following two.
sage: a.operator()
sum
sage: a.operands()
[sqrt(x), x, 0, +Infinity]
So we can define a function that will replace +Infinity
by n
:
sage: def partial(a,n):
....: return a.operator()(*(a.operands()[:-1]+[n]))
....:
sage: partial(a,10)
sum(sqrt(x), x, 0, 10)
and use it to get the first few partial sums:
sage: for n in xrange(5r):
....: print partial(a,n)
....:
sum(sqrt(x), x, 0, 0)
sum(sqrt(x), x, 0, 1)
sum(sqrt(x), x, 0, 2)
sum(sqrt(x), x, 0, 3)
sum(sqrt(x), x, 0, 4)
What do you mean by "first ten terms"? Do you mean this sage: a = sum(sqrt(x), x, 0, 10) Also, what do you mean by "closed form expression"? This sum is not even convergent.
Yes, but I was wondering whether it can be done from the already-existing object.