#7543: Add S-adic to the word generator
-----------------------------+----------------------------------------------
   Reporter:  slabbe         |       Owner:  slabbe           
       Type:  enhancement    |      Status:  positive_review  
   Priority:  major          |   Milestone:  sage-4.3.1       
  Component:  combinatorics  |    Keywords:                   
Work_issues:                 |      Author:                   
   Upstream:  N/A            |    Reviewer:  Vincent Delecroix
     Merged:                 |  
-----------------------------+----------------------------------------------
Changes (by vdelecroix):

  * reviewer:  => Vincent Delecroix


Old description:

> The definition of S-adiques words is found here :
>
> [https://www.lirmm.fr/arith/wiki/PytheasFogg/S-adiques Pytheas S-adiques]
>
> This patch adds S-adiques to the word generator :
>
> {{{
>     sage: tm = WordMorphism('a->ab,b->ba')
>     sage: fib = WordMorphism('a->ab,b->a')
>     sage: from itertools import repeat
>
> One trivial example of infinite s-adique word::
>
>     sage: words.s_adique(repeat(tm),repeat('a'))
>     word: abbabaabbaababbabaababbaabbabaabbaababba...
>
> A less trivial infinite s-adique word::
>
>     sage: m = WordMorphism({0:tm,1:fib})
>     sage: tmword = words.ThueMorseWord()
>     sage: w = m(tmword)
>     sage: words.s_adique(w, repeat('a'))
>     word: abbaababbaabbaabbaababbaababbaabbaababba...
>
> Random infinite s-adique words::
>
>     sage: from sage.misc.prandom import randint
>     sage: def it():
>     ...     while True: yield randint(0,1)
>     sage: words.s_adique(it(), repeat('a'), [tm,fib])
>     word: abbaabababbaababbaabbaababbaabababbaabba...
>     sage: words.s_adique(it(), repeat('a'), [tm,fib])
> }}}
>
> See the patch for more examples.

New description:

 The definition of S-adic words is found here :

 [https://www.lirmm.fr/arith/wiki/PytheasFogg/S-adiques Pytheas S-adiques]

 This patch adds S-adic to the word generator :

 {{{
     sage: tm = WordMorphism('a->ab,b->ba')
     sage: fib = WordMorphism('a->ab,b->a')
     sage: from itertools import repeat

 One trivial example of infinite s-adic word::

     sage: words.s_adic(repeat(tm),repeat('a'))
     word: abbabaabbaababbabaababbaabbabaabbaababba...

 A less trivial infinite s-adic word::

     sage: m = WordMorphism({0:tm,1:fib})
     sage: tmword = words.ThueMorseWord()
     sage: w = m(tmword)
     sage: words.s_adic(w, repeat('a'))
     word: abbaababbaabbaabbaababbaababbaabbaababba...

 Random infinite s-adic words::

     sage: from sage.misc.prandom import randint
     sage: def it():
     ...     while True: yield randint(0,1)
     sage: words.s_adic(it(), repeat('a'), [tm,fib])
     word: abbaabababbaababbaabbaababbaabababbaabba...
     sage: words.s_adic(it(), repeat('a'), [tm,fib])
 }}}

 See the patch for more examples.

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7543#comment:5>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.


Reply via email to