Ask Your Question

free algebra and indexed letters

asked 2011-12-30 05:41:57 -0600

Matthieu Deneufchâtel gravatar image

I try to work with a Combinatorial Free Module with basis a set of Words over an alphabet of indexed letters (y1,y2,...). For example, I define

from sage.combinat.free_module import CombinatorialFreeModule as CFM Mots=Words(['y1','y2','y3','y4','y5','y6','y7','y8']) Module=CFM(QQ,Mots)

But I have some problems with the letters. For example :

mot=Word('y1') sage: mot word: y1 sage: mot in Mots False

Is there a way to cure this problem ?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2011-12-30 18:33:24 -0600

I think when you evaluate


it treats 'y' and '1' as separate characters, giving a word of length 2. Instead,


makes it have length one. To force it to live in Mots, do this:

sage: mot = Mots(Word(['y1']))
sage: Word(['y1']) in Mots
sage: Mots(Word(['y1'])) in Mots

Not ideal, but it seems to work.

edit flag offensive delete link more


Thanks, that helps !

Matthieu Deneufchâtel gravatar imageMatthieu Deneufchâtel ( 2011-12-31 04:26:07 -0600 )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


Asked: 2011-12-30 05:41:57 -0600

Seen: 52 times

Last updated: Dec 30 '11