# How can I calculate this sum? (accept both sage(cocalc) and by hand)

How can I calculate this sum?

1/1-(x+x^2)^2

• This is the sum of infinity formula : a/1-r, while a=1 and r=(x+x^2)^2 Please also confirm if my formula is right.
edit retag close merge delete

I'm afraid that your formula is not correct :

sage: var("r")
r
sage: (1/(1-r)).maxima_methods().powerseries(r,0)
sum(r^i1, i1, 0, +Infinity)


This can be shown in an elementary fashion by doing the "long division" of 1 by (1-r) "by hand"...

Could you restate your question a bit more clearly ? Xhat is summed, for what variable ?

My formula is equal to a/(1-r), for that is for adding a certain sequence to infinity. So now I have to apply to 1/1-(x+x^2)^2.

Do you mean "That" when you type "Xhat"? (to Emmanuel Charpentier)

Sort by » oldest newest most voted I'm certain that the question is not correctly asked. Notice that in the sentence,

How can I calculate this sum?

1/1-(x+x^2)^2

there is no sum at all!

However, it seems that the OP wants to know if the expresion $$\frac{1}{1 - (x + x^2)^2} = \sum_{n = 0}^\infty (x + x^2)^{2n},$$ is valid.

If that is the question... I'd say yes, as long as $(x + x^2)^2 <1.$

more

It seems you want the power series expansion of $1 / (1 - (x + x^2)^2))$.

It is not clear if you want the first few terms of this power series, or a formula for the general term.

To get the first few terms, you can use the method .series().

sage: x = SR.var('x')
sage: f = 1/(1-(x+x^2)^2)
sage: f.series(x)
1 + 1*x^2 + 2*x^3 + 2*x^4 + 4*x^5 + 7*x^6 + 10*x^7 + 17*x^8 + 28*x^9 + 44*x^10
+ 72*x^11 + 117*x^12 + 188*x^13 + 305*x^14 + 494*x^15 + 798*x^16 + 1292*x^17
+ 2091*x^18 + 3382*x^19 + Order(x^20)


more