Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The command sum has two different meanings, depending on the syntax that you use.

On the one hand

sum(f(k), k, a, b)

means the symbolic sum, trying to find formulas and where k is a symbolic variable in the symbolic ring SR.

On the other hand,

sum(f(k) for k in range(a, b+1))

is just performing the summation, one value after another, as Python does. Here you need not (and should rather not) declare k as a symbolic variable.

You should rather use the python syntax, until you understand better what sage is doing.