Ask Your Question

periodicity of a word

asked 2019-01-19 16:39:09 +0100

GA316 gravatar image

updated 2019-01-19 18:03:16 +0100

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 18:54:42 +0100 )edit

1 Answer

Sort by » oldest newest most voted

answered 2019-01-19 20:55:55 +0100

tmonteil gravatar image

updated 2019-01-19 21:46:34 +0100

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 16:39:09 +0100

Seen: 173 times

Last updated: Jan 19 '19