1 | initial version |
You can avoid this problem if you don't use a symbolic function but define a python function:
sage: var('n')
sage: def g(x,k):
sage: return sum((2/n)*(sin(n*x)*(-1)^(n+1)), n, 1, k)
sage: print g(x,2)
-sin(2*x) + 2*sin(x)