Changes between Version 21 and Version 27 of Ticket #21769


Ignore:
Timestamp:
11/22/16 15:29:11 (6 years ago)
Author:
tscrim
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #21769

    • Property Status changed from needs_review to positive_review
    • Property Keywords days79 added
    • Property Commit changed from b1aef84b1de0a55db584a9834222d3b00eb92e48 to cc3c8b0ccda7162e7941bb30c31c3b9379cead05
    • Property Authors changed from to Marco Cognetta
    • Property Type changed from defect to enhancement
    • Property Summary changed from Adding Baum-Sweet Word (Was "WordMorphism does not allow elements of length > 1 in the domain") to Adding Baum-Sweet Word
  • Ticket #21769 – Description

    v21 v27  
    22
    33Information on the Baum-Sweet word can be found at https://en.wikipedia.org/wiki/Baum%E2%80%93Sweet_sequence
    4 ----
    5 **The following is from the original ticket before it was modified.**
    6 
    7 WordMorphism fails with morphisms that have domains with elements of greater than length 1.
    8 For example, the morphism below:
    9 
    10 
    11 00→0000
    12 
    13 01→1001
    14 
    15 10→0100
    16 
    17 11→1101
    18 
    19 One fix for this could be checking if the language of domain of the morphism is prefix-free (if it is, the morphism should still be valid) or if every element in the domain is the same length.
    20 
    21 Example:
    22 {{{
    23 sage: WordMorphism("00->0000,01->1001,10->0100,11->1101")
    24 ValueError: The second and third characters must be '->' (not '0-')
    25 }}}
    26 
    27 There is also some unfortunate behavior if you try to define the morphism as a dict.
    28 
    29 {{{
    30 sage: WordMorphism({00:0000,01:1001,10:0100,11:1101})
    31 DeprecationWarning: use 0o as octal prefix instead of 0
    32 If you do not want this number to be interpreted as octal, remove the leading zeros.
    33 See http://trac.sagemath.org/17413 for details.
    34   exec(code_obj, self.user_global_ns, self.user_ns)
    35 WordMorphism: 0->0, 1->1001, 10->64, 11->1101
    36 }}}
    37 
    38 It makes sense why the above example does not work, but it would be nice if one could do it this way.
    39 
    40 I tried to mess around with it a few more times to see if there was a way of doing it without modifying the underlying code but I didn't get anywhere. I was trying to use patterns used in the examples as that would be what most users would go off of.
    41 
    42 {{{
    43 sage: WordMorphism({(0,0):(0,0,0,0),(0,1):(1,0,0,1),(1,0):(0,1,0,0),(1,1):(1,1,0,1)})
    44 WordMorphism: (0, 0)->0000, (0, 1)->1001, (1, 0)->0100, (1, 1)->1101
    45 }}}
    46 
    47 
    48 I'd like to work on this if this is deemed something that should be fixed.