First time here? Check out the FAQ!

Ask Your Question
0

free algebra and indexed letters

asked 13 years ago

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 ?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 13 years ago

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.

Preview: (hide)
link

Comments

Thanks, that helps !

Matthieu Deneufchâtel gravatar imageMatthieu Deneufchâtel ( 13 years ago )

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: 13 years ago

Seen: 318 times

Last updated: Dec 31 '11