Ask Your Question

periodicity of a word

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

GA316 gravatar image

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

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


What should be the periodicity of abcabcab?

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

1 answer

Sort by » oldest newest most voted

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

tmonteil gravatar image

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

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()

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


Asked: 2019-01-19 09:39:09 -0600

Seen: 81 times

Last updated: Jan 19 '19