Ask Your Question
0

free algebra and indexed letters

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

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
0

answered 2011-12-31 01:33:24 +0100

I think when you evaluate

mot=Word('y1')

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

mot=Word(['y1'])

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

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

Not ideal, but it seems to work.

edit flag offensive delete link more

Comments

Thanks, that helps !

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

Stats

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

Seen: 289 times

Last updated: Dec 31 '11