Opened 11 years ago

Last modified 8 years ago

#12226 new enhancement

rational exponent for finite words

Reported by: sstarosta Owned by: sstarosta
Priority: minor Milestone: sage-6.4
Component: combinatorics Keywords:
Cc: vdelecroix, slabbe Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

Upgrade exponent of a FiniteWord_class to calculate rational exponents.

Now:

sage: Word('1231').exponent()
1

Expected:

sage: Word('1231').exponent()
4/3

The goal

sage: Word('1231').exponent()
4/3
sage: Word('1231').exponent(integer=True)
1

Also, upgrade (deprecate, review, and/or change name) the method primitive() to be in accordance with the terminology used in literature (the word is usually called the period instead of the primitive)

sage: Word('1231').exponent()
4/3
sage: Word('1231').period()
word: 123

Upgrade influenced methods (primitive_length(), ...).

Change History (9)

comment:1 Changed 11 years ago by sstarosta

  • Owner changed from sage-combinat to sstarosta
  • Summary changed from rational a finite word to rational exponent for finite words

comment:2 follow-up: Changed 11 years ago by slabbe

Should not period be an integer?

... I already had the idea of making period an alias of minimal_period:

sage: Word('1231').minimal_period()
3

What do you think?

comment:3 in reply to: ↑ 2 ; follow-up: Changed 11 years ago by sstarosta

Replying to slabbe:

Should not period be an integer?

You are right, I found both versions in the literature (integer in Lothaire, word for instance in http://www.springerlink.com/content/t59071u33573168v/ )

When hearing period without context, I think an integer is expected. Although a word is definitely more useful in papers and you have the integer by taking just the length of the word.

Is something like that stupid?

sage: Word('1231').period(word=True)
word: 123
sage: Word('1231').period()
3

What do you think?

I think an alias is not necessary. There is no other period, and anyone looking for that notion will use "period" anyway.

comment:4 in reply to: ↑ 3 Changed 11 years ago by slabbe

I think an alias is not necessary. There is no other period, and anyone looking for that notion will use "period" anyway.

If 3 is a period, than 6, 9, 12 are period as well. But I agree that 3 is *the* period.

I would rather suggest the following :

sage: Word('1231').period_word()
word: 123
sage: Word('1231').period()
3

comment:5 in reply to: ↑ description Changed 11 years ago by slabbe

The goal

sage: Word('1231').exponent()
4/3
sage: Word('1231').exponent(integer=True)
1

I would prefer the argument to speak about the use or not of the fraction :

sage: Word('1231').exponent() # default
1
sage: Word('1231').exponent(allow_fraction=True)
4/3

or

sage: Word('1231').exponent(allow_fraction=False)
1
sage: Word('1231').exponent() # default
4/3

comment:6 Changed 9 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:7 Changed 9 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:8 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:9 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4
Note: See TracTickets for help on using tickets.