23
23
abstract numeration system associated to the morphism and the starting
24
24
letter, see chapter 3 of the book [BR2010b]_::
25
25
26
- sage: w[10000000] # optional - sage.modules
26
+ sage: w[10000000] # needs sage.modules
27
27
'b'
28
28
29
29
"""
@@ -58,7 +58,7 @@ def __init__(self, parent, morphism, letter, coding=None, length=Infinity):
58
58
sage: w = m.fixed_point('a')
59
59
sage: w
60
60
word: abaababaabaababaababaabaababaabaababaaba...
61
- sage: w[555:1000] # optional - sage.modules
61
+ sage: w[555:1000] # needs sage.modules
62
62
word: abaababaabaababaababaabaababaabaababaaba...
63
63
sage: w.length()
64
64
+Infinity
@@ -69,19 +69,19 @@ def __init__(self, parent, morphism, letter, coding=None, length=Infinity):
69
69
sage: m.fixed_point('a')
70
70
word: abcbabacababaabcbabaabccaabcbabaabcbabaa...
71
71
sage: w = m.fixed_point('a')
72
- sage: w[7] # optional - sage.modules
72
+ sage: w[7] # needs sage.modules
73
73
'c'
74
- sage: w[2:7] # optional - sage.modules
74
+ sage: w[2:7] # needs sage.modules
75
75
word: cbaba
76
- sage: w[500:503] # optional - sage.modules
76
+ sage: w[500:503] # needs sage.modules
77
77
word: caa
78
78
79
79
When the morphic word is finite::
80
80
81
81
sage: m = WordMorphism("a->ab,b->")
82
82
sage: w = m.fixed_point("a"); w
83
83
word: ab
84
- sage: w[0] # optional - sage.modules
84
+ sage: w[0] # needs sage.modules
85
85
'a'
86
86
sage: w.length()
87
87
2
@@ -93,7 +93,7 @@ def __init__(self, parent, morphism, letter, coding=None, length=Infinity):
93
93
sage: from sage.combinat.words.morphic import WordDatatype_morphic
94
94
sage: coding = {'a':'x', 'b':'y'}
95
95
sage: w = WordDatatype_morphic(W, m, 'a', coding=coding)
96
- sage: [w[i] for i in range(10)] # optional - sage.modules
96
+ sage: [w[i] for i in range(10)] # needs sage.modules
97
97
['x', 'y', 'x', 'x', 'y', 'x', 'y', 'x', 'x', 'y']
98
98
99
99
TESTS::
@@ -104,9 +104,9 @@ def __init__(self, parent, morphism, letter, coding=None, length=Infinity):
104
104
sage: for _ in range(10000): _ = next(it)
105
105
sage: L = [next(it) for _ in range(10)]; L
106
106
['d', 'd', 'd', 'c', 'd', 'd', 'd', 'c', 'b', 'a']
107
- sage: w[10000:10010] # optional - sage.modules
107
+ sage: w[10000:10010] # needs sage.modules
108
108
word: dddcdddcba
109
- sage: list(w[10000:10010]) == L # optional - sage.modules
109
+ sage: list(w[10000:10010]) == L # needs sage.modules
110
110
True
111
111
112
112
"""
@@ -177,18 +177,18 @@ def representation(self, n):
177
177
178
178
sage: m = WordMorphism('a->ab,b->a')
179
179
sage: w = m.fixed_point('a')
180
- sage: w.representation(5) # optional - sage.modules
180
+ sage: w.representation(5) # needs sage.modules
181
181
[1, 0, 0, 0]
182
182
183
183
When the morphic word is finite::
184
184
185
185
sage: m = WordMorphism("a->ab,b->,c->cdab,d->dcab")
186
186
sage: w = m.fixed_point("a")
187
- sage: w.representation(0) # optional - sage.modules
187
+ sage: w.representation(0) # needs sage.modules
188
188
[]
189
- sage: w.representation(1) # optional - sage.modules
189
+ sage: w.representation(1) # needs sage.modules
190
190
[1]
191
- sage: w.representation(2) # optional - sage.modules
191
+ sage: w.representation(2) # needs sage.modules
192
192
Traceback (most recent call last):
193
193
...
194
194
IndexError: index (=2) out of range, the fixed point is finite and has length 2
@@ -204,7 +204,7 @@ def representation(self, n):
204
204
sage: w = WordDatatype_morphic(W, m, 'a')
205
205
sage: type(w)
206
206
<class 'sage.combinat.words.morphic.WordDatatype_morphic'>
207
- sage: w.representation(5) # optional - sage.modules
207
+ sage: w.representation(5) # needs sage.modules
208
208
[1, 0, 0, 0]
209
209
"""
210
210
letters_to_int = {a :i for (i ,a ) in enumerate (self ._alphabet )}
@@ -255,11 +255,11 @@ def _func(self, key):
255
255
256
256
sage: m = WordMorphism("a->ab,b->a")
257
257
sage: w = m.fixed_point("a")
258
- sage: w[0] # optional - sage.modules
258
+ sage: w[0] # needs sage.modules
259
259
'a'
260
- sage: w[5] # optional - sage.modules
260
+ sage: w[5] # needs sage.modules
261
261
'a'
262
- sage: w[10000] # optional - sage.modules
262
+ sage: w[10000] # needs sage.modules
263
263
'a'
264
264
265
265
TESTS:
@@ -271,7 +271,7 @@ def _func(self, key):
271
271
sage: W = m.domain()
272
272
sage: from sage.combinat.words.morphic import WordDatatype_morphic
273
273
sage: w = WordDatatype_morphic(W, m, 'a')
274
- sage: w._func(5) # optional - sage.modules
274
+ sage: w._func(5) # needs sage.modules
275
275
'a'
276
276
277
277
"""
0 commit comments