Ask Your Question
0

periodicity of a word

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

GA316 gravatar image

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

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

1 Answer

Sort by » oldest newest most voted
0

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

tmonteil gravatar image

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

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

Seen: 180 times

Last updated: Jan 19 '19