# Revision history [back]

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)


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)