# Power series with alternating exponent

Mathematically, we have $4^{(-1)^k} = \frac18 (17+15(-1)^k)$ for all integers $k$. However, this identity is not being used for the computation of $\sum_{k=0}^\infty 4^{(-1)^k} x^k$:

sage: sum(4^((-1)^k)*x^k, k, 0, oo)._giac_().normal().sage()
sum(4^((-1)^k)*x^k, k, 0, +Infinity)


However:

sage: sum(1/8*(17+15*(-1)^k)*x^k, k, 0, oo)._giac_().normal().sage()
-1/4*(x + 16)/(x^2 - 1)


Is there a way to compute the first expression with Sage or is it possible to implement this process so that Sage can handle such expressions automatically?

edit retag close merge delete

Sort by ยป oldest newest most voted

One way is:

var('k')
assume(x>-1)
assume(x<1)
(4*sum(x^(2*k), k, 0, oo)+sum(x^(2*k+1), k, 0, oo)/4).combine()

-1/4*(x + 16)/(x^2 - 1)


A more automatic version:

var('x k')
assume(k,'integer')
w(k)=4^((-1)^k)*x^k
a(k)=w(k=2*k).full_simplify()
b(k)=w(k=2*k+1).full_simplify()
(sum(a(k),k,0,oo)+sum(b(k),k,0,oo)).combine()

-1/4*(x + 16)/(x^2 - 1)


(assuming that both series converge)

more

Is there any way Sage can handle $\sum_{k=0}^\infty 4^{(-1)^k} x^k$ directly/automatically?

( 2023-07-09 22:57:37 +0100 )edit