Status: Valid
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 3510 by [email protected]: implement Stirling numbers
http://code.google.com/p/sympy/issues/detail?id=3510

The number of partitions of n items into k bins is given be the Stirling number of the second kind. I see we have a wester test that tests for S1. Perhaps both could be added.

http://en.wikipedia.org/wiki/Stirling_number_of_the_second_kind

def S2(n, k):
...     if k > n:
...         return 0
...     j = Dummy()
...     arg = (-1)**(k-j)*j**n*binomial(k,j)
...     return 1/factorial(k)*Sum(arg,(j,0,k)).doit()
...
for n in range(11):
...   for k in range(11):
...     print S2(n,k),
...   print
...
1 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 0
0 1 1 0 0 0 0 0 0 0 0
0 1 3 1 0 0 0 0 0 0 0
0 1 7 6 1 0 0 0 0 0 0
0 1 15 25 10 1 0 0 0 0 0
0 1 31 90 65 15 1 0 0 0 0
0 1 63 301 350 140 21 1 0 0 0
0 1 127 966 1701 1050 266 28 1 0 0
0 1 255 3025 7770 6951 2646 462 36 1 0
0 1 511 9330 34105 42525 22827 5880 750 45 1


--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to