# Problem with partial_fraction

With Maple I can compute the partial fractions of the sums given below

```
M := [1, x, x^2 + 1, x^3 + 3*x, x^4 + 6*x^2 + 2, x^5 + 10*x^3 + 10*x, x^6 + 15*x^4 + 30*x^2 + 5]:
for k from 1 to 7 do
p := expand(sum(x^j*subs(x=j,M[k]),j=0..infinity)):
lprint([k], convert(p,parfrac)) od:
```

and get:

```
[1], -1/(x-1)
[2], 1/(x-1)+1/(x-1)^2
[3], -2/(x-1)-3/(x-1)^2-2/(x-1)^3
[4], 6/(x-1)^4+4/(x-1)+10/(x-1)^2+12/(x-1)^3
[5], -60/(x-1)^4-9/(x-1)-24/(x-1)^5-33/(x-1)^2-62/(x-1)^3
[6], 120/(x-1)^6+450/(x-1)^4+21/(x-1)+360/(x-1)^5+111/(x-1)^2+300/(x-1)^3
[7], -2520/(x-1)^6-3000/(x-1)^4-51/(x-1)-720/(x-1)^7-3720/(x-1)^5-378/(x-1)^2-1412/(x-1)^3
```

With Sage I can do

```
from sage.calculus.calculus import symbolic_sum
x, j = SR.var('x, j')
M = [1, x, x^2 + 1, x^3 + 3*x, x^4 + 6*x^2 + 2, x^5 + 10*x^3 + 10*x, x^6 + 15*x^4 + 30*x^2 + 5]
for k in (0..6):
p = symbolic_sum(x^j*M[k](x=j), j, 0, oo)
print [k], p.partial_fraction()
```

and get:

```
[0] TypeError: 'sage.rings.integer.Integer' object is not callable
[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] 2*hypergeometric((1, -1/2*sqrt(-4*sqrt(7) - 12) + 1, 1/2*sqrt(-4*sqrt(7) - 12) + 1,
-1/2*sqrt(4*sqrt(7) - 12) + 1, 1/2*sqrt(4*sqrt(7) - 12) + 1), (-sqrt(-sqrt(7) - 3),
sqrt(-sqrt(7) - 3), -sqrt(sqrt(7) - 3), sqrt(sqrt(7) - 3)), x)
[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] TypeError: ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative exponent.
```

Is it true that something basic like the partial fraction decomposition is completely unusable in Sage?

*Edit:* By request of rws the input p explicit:

```
[0], -1/(x-1)
[1], x/(x-1)^2
[2], -(2*x^2-x+1)/(x-1)^3
[3], 2*x*(-x+2*x^2+2)/(x-1)^4
[4], -(2-x+17*x^2-3*x^3+9*x^4)/(x-1)^5
[5], 3*x*(7+2*x+22*x^2+2*x^3+7*x^4)/(x-1)^6
[6], -(5+16*x+177*x^2+112*x^3+287*x^4+72*x^5+51*x^6)/(x-1)^7
```

Can you provide the input for partial_fraction for 4 and 6?

For reference: other ask-sage questions about infinite sums

http://ask.sagemath.org/questions/sco... .

@rws It's there, input is M[k] for k =0..6. For example input 4 = M[4] = x^4 + 6*x^2 + 2.

@Peter Luschny: I think @rws meant "can you provide p in each case, before applying .partial_fraction()". My long comment disguised as an answer does that.

@slelievre This occurred to me right after I had written my comment. See my edit to the question above, which I wrote immediately after the comment and you apparently overlooked. It is easy to get: take the solutions of Maple and press 'simplify'. At least this gives you the correct input.