Week 1

I had been working on implementing the functionality provided by combinatorica for the Permutation object. Most of the features provided by combinatorica are now implemented for Sympy but a few outstanding issues need some resolving. The most egregious of which is the lack of a next() and a prev() function.

Some of the extras that have been implemented however are a few distance metrics, addition and subtraction of permutations on the basis of their Lehmer codes (inversion vectors) and linear time non lexicographic ranking and unranking.

Users will note that for now the Permutation class only supports numbers ordered from 0 to n. This design is deliberate as it significantly simplifies the implementation and keeps everything consistent. If one wishes to use the permutation class for objects other than integers then they would need to provide for some sort of mapping themselves. I will probably create a tutorial illustrating this in the future.

Regarding the work on partitions, thanks go out to community member Christopher Smith for correcting an implementation of mine of the k partitions and compositions algorithm. I have reposted the k partitions algorithm and started work on the integer partitions module. Currently we can compare two integer partitions based on the concept of majorizing which says that a partition majorizes another if the first k sum of its elements is greater than the first k sum of the other’s elements for all k > 0.

More stuff coming up…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: