Skip to content

8carlosf/pyRndSetPartitionGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pyRndSetPartitionGenerator

Generation of a Random Partition of a Finite Set by an Urn Model

Usefull information:

Usage

./main.py N Q

N: set size K: number of random set partitions to generate

Example

./main.py 10 100

Generate 100 random partitions of size 10 sets

Applications

  • The code can be easily modified to compute Stirling numbers of the second kind for a given set size N
  • The built in Bell number function can compute Bell Numbers for big N's
  • Given that this algorithm generates random set partitions with the correct natural distribution it can be used with the Monte Carlo Method to get very accurate statistics related to set partitions

Recommendations

  • If speed is needed and N is big, you can pre-compute the needed Bell Numbers, save them into a file and use that instead of the built in Bell number function.
  • The same cache trick can be applied for the Unm function, although m can be infinite, the probability of big a m appearing converges to 0, computing it up to 2*N should be more than enogh

Please report any issues and suggestions. Thank you

About

Generation of a Random Partition of a Finite Set by an Urn Model

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages