#7543: Add S-adiques to the word generator
-----------------------------+----------------------------------------------
   Reporter:  slabbe         |       Owner:  slabbe      
       Type:  enhancement    |      Status:  needs_review
   Priority:  major          |   Milestone:  sage-4.3.1  
  Component:  combinatorics  |    Keywords:              
Work_issues:                 |      Author:              
   Upstream:  N/A            |    Reviewer:              
     Merged:                 |  
-----------------------------+----------------------------------------------

Comment(by slabbe):

 I just uploaded the patch. Some more examples. Better doc. The morphisms
 arguments can now be a callable so that the following works:

 {{{
     sage: x = lambda h:WordMorphism({1:[2],2:[3]+[1]*(h+1),3:[3]+[1]*h})
     sage: for h in [0,1,2,3]: print h, x(h)
     0 WordMorphism: 1->2, 2->31, 3->3
     1 WordMorphism: 1->2, 2->311, 3->31
     2 WordMorphism: 1->2, 2->3111, 3->311
     3 WordMorphism: 1->2, 2->31111, 3->3111
     sage: w = Word(lambda n : valuation(n+1, 2) ); w
     word: 0102010301020104010201030102010501020103...
     sage: s = words.s_adique(w, repeat(3), x); s
     word: 3232232232322322322323223223232232232232...
     sage: prefixe = s[:10000]
     sage: map(prefixe.number_of_factors, range(15))
     [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
     sage: [_[i+1] - _[i] for i in range(len(_)-1)]
     [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7543#comment:3>
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