EDIT: Answer added.
I haven't slept much lately and I've been raging on this thing for a couple hours now. I really hope some people here can have the same obsession/rage and will help me out.
I have two sets, A and B. |A| = m, |B| = n. I was looking for the number of surjections from A to B, and I found a formula here: http://www.ma.utexas.edu/users/kbi/COURSES/TERM/11S/325K/L17.pdf
I seem to have understood the following:
You have to calculate the Stirling number of the second kind, and then multiply it with n! due to the fact that Stirling numbers only divide/group (and do not map). I have the following in maple:
f:=(n,m)->n!/(m!*(n-m)!);
test:=Sum((-1)^if(n,n-i)(n-i)^m,i=0..n);
If I set m to be 500 and n to be 300, then test > n^m, the latter being the total number of functions. The number of surjective functions is a subset of the number of functions and should therefore not be higher. My blood is boiling, because I know I'm overseeing something idiotic. Hoping for help.
EDIT:
Not sure what the protocol is on adding answers, but this question has been answered.
It is most likely a problem with maple.
I added a screenshot of my maple worksheet.
I defined a function f1(n,m) myself, that acted odd.
I googled and found that maple has a default implemented Stirling2(n,m) function.
As the screenshot shows, both functions give the same result for many values of n and m, but not for all.
Apparantly I need 10 rep to post images, so I'll link to imgur:
binomial(n,r)
; what happens if you use it instead of your $f$? – Brian M. Scott May 12 '13 at 16:11test
: there’s no way that it should be negative. The correct value with $n=45$ is about $1.570978205708\times 10^{69}$, according to this and my calculator, which says that $45!\approx1.196222208655\times10^{56}$. – Brian M. Scott May 12 '13 at 16:36