Ask Your Question

free algebra and indexed letters

asked 2011-12-30 12:41:57 +0200

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-31 01:33:24 +0200

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 11:26:07 +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


Asked: 2011-12-30 12:41:57 +0200

Seen: 212 times

Last updated: Dec 31 '11