Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hello BrowserUk, A Stirling number of the second kind, S(n,k), gives the number of ways in which a set of n elements can be partitioned into exactly k non-empty subsets. It can be calculated by an explicit formula: S(n,k) = 1/k!.SUM[j=0 to k]( (-1)^(k-j) . kCj . j^n ) where kCj is a binomial coefficient (“ k select j ”). But if you’re calculating successive values of S, it will be more efficient to use the recurrence relation: S(n+1,k) = k.S(n,k) + S(n,k-1) Here’s a simple implementation:
Output:
I would say, “hope that helps,” but I’m sure you already know all of the above. So my best hope is that it will help you to clarify what you mean by “tangible explanation” and “transcribing the above description into English.” Then again, if what you’re really after is an explanation of the maths behind the formulae, you’ll need an actual mathematician. ;-) Cheers,
In reply to Re: Can this be explained in layman's terms?
by Athanasius
|
|