Well, it’s a bit more intricate than I thought initially :
sage: reset() sage: k = var("k") sage: Ex = (1 + (-1)^k)*x^k sage: sum(Ex,
k, 0, oo) sum(((-1)^k + 1)*x^k, k, 0, +Infinity)
Sage (i. e. Maxima) can’t solve it.
sage: sum(Ex, k, 0, oo, algorithm="giac") 1/(x + 1) - 1/(x - 1)
Giac does
Debian 12, Sage 9.5 (debian package), Mathematica 13.3
sage: mathematica("Sum[%s, %s]"%tuple(map(lambda u:repr(mathematica(u)),
((1+(-1
: )^k)*x^k, [k , 0, oo]
-2/(-1 + x^2)
sage: mathematica.Sum(*map(mathematica, ((1+(-1)^k)*x^k, [k , 0, oo])))
{(1 + (-1)^k)*k*x^k, 0, (1 + (-1)^k)*x^k*Inf