If I define
monom=[x^n for n in range(5)]
then the $n$-th entry $x^n$ is obtained by monom[n]. Why cannot I sum all these? That is,
sum(monom[n], n, 0, 5)
yields error. How can I correctly make it to act as
sum(x^n, n, 0, 5)
?
1 | initial version |
If I define
monom=[x^n for n in range(5)]
then the $n$-th entry $x^n$ is obtained by monom[n]. Why cannot I sum all these? That is,
sum(monom[n], n, 0, 5)
yields error. How can I correctly make it to act as
sum(x^n, n, 0, 5)
?
If I definelet
var('x,n')
monom=[x^n for n in range(5)]
then the $n$-th entry $x^n$ is obtained by monom[n]. Why cannot I sum all these? That is,
sum(monom[n], n, 0, 5)
yields error. How can I correctly make it to act as
sum(x^n, n, 0, 5)
?