Talk Some combinatorial calculations in Python


This talk is about how I'm using Python to help me tackle a mathematical research problem. I'll talk about the problem, the calculations and my use of Python.

My mathematical problem is this: find or at least guess linear functions of flag vectors of convex polytopes that never take negative values. This is related to intersection homology, because the dimension of a homology space is such a function.

The leads, in dimension 5, to a calculation that is, roughly, a longish calculation on all 32-bit numbers (every subset of the vertices of a 5-cube) followed by 256 shortish calculations on each of the outputs of the previous calculation. I have done this calculation (about 15 Ghz days).

In dimension 6 we need to look at all 64-bit numbers followed by 2**13 shortish calculations. This is not feasible. However, a small subset (perhaps only 20 64-bit numbers) would be sufficient if carefully chosen.

The calculations are very combinatorial in nature. I have found Pythons tools for iteration very powerful and also a good example to follow. I will talk about subclassing Python's builtin types, to give an easier and safer approach to processing combinatorial data (along the lines of Python's collections.namedtuple).

The math is uses concepts that are not implemented in the standard computer algebra packages. It has relations, for example, to graph theory. For now I find it easiest to develop in Python (but soon I might go over to Sage).

The code for this talk is in repositories at The most recent paper is at

tagged by
no related entity