Ask Your Question
0

periodicity of a word

asked 2019-01-19 09:39:09 -0500

GA316 gravatar image

updated 2019-01-19 11:03:16 -0500

eric_g gravatar image

I have the following code to create words.

sage: M.<x,y,z> = FreeMonoid(3)
sage: Word(x^3*y*x*z^2*x)
word: xxxyxzzx

I want find the periodicity of a given word.

For example ababab has periodicity 3 and abcdabcde has periodicity 1.

Kindly help me with this.

Thank you.

edit retag flag offensive close merge delete

Comments

What should be the periodicity of abcabcab?

rburing gravatar imagerburing ( 2019-01-19 11:54:42 -0500 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2019-01-19 13:55:55 -0500

tmonteil gravatar image

updated 2019-01-19 14:46:34 -0500

Just give a name to your word:

sage: w= Word(x^3*y*x*z^2*x)

Then discover some methd related to periods:

sage: w.per<TAB_KEY>

Then look at the documentation of the periods method:

sage: w.periods?

Then construct your own periodicity function, knowing that:

sage: w.periods()
[7]

sage: w = Word('ababab')
sage: w.periods()
[2, 4]

sage: w = Word('abcdabcde')
sage: w.periods()
[]
edit flag offensive delete link more

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: 2019-01-19 09:39:09 -0500

Seen: 57 times

Last updated: Jan 19