# Revision history [back]

### Coefficients of series

Consider the sequence of polynomials:

p = lambda x, n: ((1 + x^2)^n + n*x*(1 + x^2)^(n - 1))

for n in (0..4):
print p(x,n).series(x,3*n)

1
1 + 1*x + 1*x^2
1 + 2*x + 2*x^2 + 2*x^3 + 1*x^4
1 + 3*x + 3*x^2 + 6*x^3 + 3*x^4 + 3*x^5 + 1*x^6
1 + 4*x + 4*x^2 + 12*x^3 + 6*x^4 + 12*x^5 + 4*x^6 + 4*x^7 + 1*x^8

for n in (0..4):
print g(x,n).list()


[1, 1, 1]
[1, 2, 2, 2, 1]
[1, 3, 3, 6, 3, 3, 1]
[1, 4, 4, 12, 6, 12, 4, 4, 1]


These are obviously the coefficients of the polynomials.

So I expected that I could also write instead

for n in (0..4):
print g(x,n).series(x,3*n).coefficients()


But this is not the case. What I get is:

[]
[[1, 0], [1, 1]]
[[1, 0], [2, 1], [2, 2], [2, 3]]
[[1, 0], [3, 1], [3, 2], [6, 3], [3, 4], [3, 5]]
[[1, 0], [4, 1], [4, 2], [12, 3], [6, 4], [12, 5], [4, 6], [4, 7]]


Here the term 1x^(2n) is missing. Is this a bug?

### Coefficients of series

Consider the sequence of polynomials:

p g = lambda x, n: ((1 + x^2)^n + n*x*(1 + x^2)^(n - 1))

for n in (0..4):
print p(x,n).series(x,3*n)
g(x,n).series(x,3*n)

1
1 + 1*x + 1*x^2
1 + 2*x + 2*x^2 + 2*x^3 + 1*x^4
1 + 3*x + 3*x^2 + 6*x^3 + 3*x^4 + 3*x^5 + 1*x^6
1 + 4*x + 4*x^2 + 12*x^3 + 6*x^4 + 12*x^5 + 4*x^6 + 4*x^7 + 1*x^8

for n in (0..4):
print g(x,n).list()


[1, 1, 1]
[1, 2, 2, 2, 1]
[1, 3, 3, 6, 3, 3, 1]
[1, 4, 4, 12, 6, 12, 4, 4, 1]


These are obviously the coefficients of the polynomials.

So I expected that I could also write instead

for n in (0..4):
print g(x,n).series(x,3*n).coefficients()


But this is not the case. What I get is:

[]
[[1, 0], [1, 1]]
[[1, 0], [2, 1], [2, 2], [2, 3]]
[[1, 0], [3, 1], [3, 2], [6, 3], [3, 4], [3, 5]]
[[1, 0], [4, 1], [4, 2], [12, 3], [6, 4], [12, 5], [4, 6], [4, 7]]


Here the term 1x^(2n) is missing. Is this a bug?