#19159: Check if a word is a Christoffel word.
-------------------------------------+-------------------------------------
       Reporter:  mlapointe          |        Owner:  mlapointe
           Type:  enhancement        |       Status:  needs_work
       Priority:  minor              |    Milestone:  sage-6.9
      Component:  combinatorics      |   Resolution:
       Keywords:  words,             |    Merged in:
  Christoffel, days69                |    Reviewers:
        Authors:  Mélodie Lapointe   |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:                     |  dceb8c447b2f6ac617cb7c3328c83b47458ad2c8
  u/mlapointe/check_if_a_word_is_a_christoffel_word_|     Stopgaps:
   Dependencies:                     |
-------------------------------------+-------------------------------------
Changes (by nadialafreniere):

 * status:  needs_review => needs_work


Comment:

 {{{#!diff
 #A Christoffel word is a non-empty word over a binary alphabet
 +        if len(self) < 0 or len(self.letters()) > 2 or
 self.is_palindrome():
 +            return False
 +        elif self.is_symmetric() and self[1:len(self)-1].is_palindrome():
 +            return True
 +        else:
 +            return False
 }}}

 A comment should always start with a space after '#'. As well,
 `self[1:len(self)-1]` should be transformed in `self[1:len(self) - 1]`.
 For more info on Python and Sage conventions, see
 http://doc.sagemath.org/html/en/developer/coding_basics.html#python-code-
 style

 I'm also wondering about the first condition: When the length of a word
 can be strictly shorter than 0?

 Also, a single letter is a Christoffel word, according to the reference
 you give (Berstel et al.) Right now, it returns false because it is a
 palindrome. You should add a test for it.

--
Ticket URL: <http://trac.sagemath.org/ticket/19159#comment:6>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to