Ask Your Question
0

Combinatorial elements and classes

asked 2024-04-15 16:07:10 +0200

Gonneman gravatar image

updated 2024-04-16 07:27:46 +0200

FrédéricC gravatar image

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?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2024-04-15 18:10:36 +0200

The command import_statements will tell you how to import something:

sage: import_statements('CombinatorialElement')
from sage.combinat.combinat import CombinatorialElement

So use from sage.combinat.combinat import CombinatorialElement.

edit flag offensive delete link more

Comments

Thank you!

Gonneman gravatar imageGonneman ( 2024-04-15 19:35:13 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2024-04-15 16:07:10 +0200

Seen: 81 times

Last updated: Apr 15