Help with symbolic sum
Simple things that I will do with Maple in seconds, with Sage often drive me desperate to Ask-Sage. Sigh.
With Maple:
for n from 0 to 4 do add(j!*stirling1(n,j)*(x-1)^(-j-1), j=0..n) od;
1
-----
x - 1
1
--------
2
(x - 1)
1 2
- -------- + --------
2 3
(x - 1) (x - 1)
2 6 6
-------- - -------- + --------
2 3 4
(x - 1) (x - 1) (x - 1)
With Sage 6.3:
x = SR.var('x')
for n in range(4):
S = sum(factorial(j)*stirling_number1(n,j)*(x-1)^(-j-1) for j in (0,n))
print S
Returns:
2/(x - 1)
(x - 1)^(-2)
2/(x - 1)^3
6/(x - 1)^4
24/(x - 1)^5
Or:
from sage.calculus.calculus import symbolic_sum
x, j = SR.var('x, j')
for n in range(5):
S = symbolic_sum(factorial(j)*stirling_number1(n,j)*(x-1)^(-j-1),j,0,n)
print S
Returns:
TypeError: unable to convert x (=j) to an integer
I ask for enlightenment.
What is your question ? Why are you unhappy with your first attempt ?
I am unhappy because the results of Maple and Sage obviously diverge and I suspect that Maple's answer is the correct one; or isn't it?
You used (0,n), and this thing is a pair. What you wanted to use was range(n+1) or [0..n].
+1 for Nathann. Yes. Thanks. I was hopping between different languages until I was blind. Nathann please convert your comment to an answer and I will accept it.
It also appears at the bottom of my other answer. But I will never compare to tmonteil where it comes to Karma!