Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Expanding summation with factorial

If I do this in sage

F=sum(k^2*factorial(n), v=k, a=1, b=n+1); F

it correctly expands to what I want:

⎛   3      2           ⎞   
⎝2⋅n  + 9⋅n  + 13⋅n + 6⎠⋅n!
───────────────────────────
             6

However, if the factorial is a function of the summed variable, it doesn't work anymore:

sage: F=sum(k^2*factorial(k), v=k, a=1, b=n+1); F
sum(k^2*factorial(k), k, 1, n + 1)
sage: F.expand_sum()
sum(k^2*factorial(k), k, 1, n + 1)

Is this the expected behavior? How can I get it to expand no matter what's inside the summation?

I'm using Sagemath 7.5, by the way.

Thank you.