Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.