1 | initial version |
Granted, it's not obvious, but you must assume abs(x)<1
beforehand:
sage: assume(abs(x)<1)
With that, I get from your code:
sage: for k in (1..6):
p = symbolic_sum(x^j*M[k](x=j), j, 0, oo)
print [k], p.partial_fraction()
....:
[1] 1/(x - 1) + 1/(x - 1)^2
[2] -2/(x - 1) - 3/(x - 1)^2 - 2/(x - 1)^3
[3] 4/(x - 1) + 10/(x - 1)^2 + 12/(x - 1)^3 + 6/(x - 1)^4
[4] -9/(x - 1) - 33/(x - 1)^2 - 62/(x - 1)^3 - 60/(x - 1)^4 - 24/(x - 1)^5
[5] 21/(x - 1) + 111/(x - 1)^2 + 300/(x - 1)^3 + 450/(x - 1)^4 + 360/(x - 1)^5 + 120/(x - 1)^6
[6] -51/(x - 1) - 378/(x - 1)^2 - 1412/(x - 1)^3 - 3000/(x - 1)^4 - 3720/(x - 1)^5 - 2520/(x - 1)^6 - 720/(x - 1)^7
2 | No.2 Revision |
It's not partial_fraction
that does the unexpected here but symbolic_sum
, and actually it seems correct. Granted, it's not obvious, but you must assume abs(x)<1
beforehand:beforehand, for convergence reasons:
sage: assume(abs(x)<1)
With that, I get from your code:
sage: for k in (1..6):
p = symbolic_sum(x^j*M[k](x=j), j, 0, oo)
print [k], p.partial_fraction()
....:
[1] 1/(x - 1) + 1/(x - 1)^2
[2] -2/(x - 1) - 3/(x - 1)^2 - 2/(x - 1)^3
[3] 4/(x - 1) + 10/(x - 1)^2 + 12/(x - 1)^3 + 6/(x - 1)^4
[4] -9/(x - 1) - 33/(x - 1)^2 - 62/(x - 1)^3 - 60/(x - 1)^4 - 24/(x - 1)^5
[5] 21/(x - 1) + 111/(x - 1)^2 + 300/(x - 1)^3 + 450/(x - 1)^4 + 360/(x - 1)^5 + 120/(x - 1)^6
[6] -51/(x - 1) - 378/(x - 1)^2 - 1412/(x - 1)^3 - 3000/(x - 1)^4 - 3720/(x - 1)^5 - 2520/(x - 1)^6 - 720/(x - 1)^7