A python library of various useful combinatorics functions and classes.
to import functions, use from combinatorics import functions
or from combinatorics.functions import *
to import triangles, use from combinatorics import triangles
or from combinatorics.triangles import *
functions contains common combinatorics functions and triagles contains triagles like pascals triangle,
which allows you to do some calculations more efficiently
multinomial(n,r1,r2,r3...): count number of distinct permutations of size n when each r is a group of 1 or more identical items
sterling1(n,r): count number of unique ways to arrange n distinct items in r non-empty cycles, excluding rotations and reflections.
pbinom(k,n,p,type='equal') where n is the number of trials, k is the number of successes and p is the probability of success.
All of these triangles have the same interface, call get(<row>,<col>)
to retrieve a value from the tree, print()
to print the tree and data()
to get the raw python list.
All triangles grow if you call get
on a value larger than the previously allocated tree.
create new pascals triangle of size 0 (empty triangle)
retrieve value at the specified row and col in pascal's triangle.
print entire triangle up to the last row specified by use
get 2D python list that stores triangle data
create a new bells triangle of size 2 (two rows)
retrieve value at the specified row and col in bell's triangle.
print entire tree
get list contining tree.