#7543: Add S-adiques to the word generator
-----------------------------+----------------------------------------------
Reporter: slabbe | Owner: mhansen
Type: enhancement | Status: new
Priority: major | Milestone: sage-4.3
Component: combinatorics | Keywords:
Work_issues: | Author:
Upstream: N/A | Reviewer:
Merged: |
-----------------------------+----------------------------------------------
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.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7543>
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.