I need to compute the rising factorial of big numbers, the best I found until now is the rising factorial function from the sympy package sympy package, that is really nice, but I would still need something faster.
What I would need exactly is a really fast version of this:
from itertools import combinations
from numpy import prod
def my_rising_factorial(degree, elt):
return sum([prod(i) for i in combinations(xrange(1,degree),elt)])
EDIT: that is given a rising factorial, x(n) = x (x + 1)(x + 2)...(x + n-1), I would like to retrieve a given multiplier of its expanded formula.
eg:
given: x(6) = x(x + 1)(x + 2)(x + 3)(x + 5)(x + 6)
and the expanded form: x(6) = x**6 + 15*x**5 + 85*x**4 + 225*x**3 + 274*x**2 + 120*x
I want some how to get one of those multipliers (in this case 1, 15, 85, 225, 274, 120)
with "my_rising_factorial()" it works well... but really slowly
>>>[my_rising_factorial(6,i) for i in xrange (6)]
[1.0, 15, 85, 225, 274, 120]
Try this package: http://tnt.math.se.tmu.ac.jp/nzmath/
Like job said, the function you want is Stirling Number of the 1st kind (I'd worked out the recursive definition and was about to post it, but I didn't know the name).
The function is nzmath.combinatorial.stirling1