Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Combinatorial elements and classes

I would like to construct a free module over QQ (for simplicity) whose basis is index by finite sequences of strictly decreasing positive half odd integers (so odd numbers divided by 2).

CombinatorialFreeModule() seems like the tool to use for this, if I can define the class of sequences mentioned in the previous sentence. I understand that these sequences are in bijection with integer partitions, so I could just use Partitions() as in CombinatorialFreeModule(QQ,Partitions()). However, I'm trying to improve my understanding of Sage and so I'm trying to program an appropriate class of sequences of half odd integers by looking at the source code for Partitions().

Sadly, I'm running into trouble before I even managed to get started properly. I think my class will need to inherit from CombinatorialElement which the Partitions() source code imports via from .combinat import CombinatorialElement. This produces the following error: Import Error: attempted relative import with no known parent package.

So how do I import CombinatorialElement properly?

click to hide/show revision 2
retagged

Combinatorial elements and classes

I would like to construct a free module over QQ (for simplicity) whose basis is index by finite sequences of strictly decreasing positive half odd integers (so odd numbers divided by 2).

CombinatorialFreeModule() seems like the tool to use for this, if I can define the class of sequences mentioned in the previous sentence. I understand that these sequences are in bijection with integer partitions, so I could just use Partitions() as in CombinatorialFreeModule(QQ,Partitions()). However, I'm trying to improve my understanding of Sage and so I'm trying to program an appropriate class of sequences of half odd integers by looking at the source code for Partitions().

Sadly, I'm running into trouble before I even managed to get started properly. I think my class will need to inherit from CombinatorialElement which the Partitions() source code imports via from .combinat import CombinatorialElement. This produces the following error: Import Error: attempted relative import with no known parent package.

So how do I import CombinatorialElement properly?