Skip to content

Commit 2e33391

Browse files
author
Matthias Koeppe
committed
./sage -fixdoctests --distribution sagemath-categories --only-tags src/sage/combinat
1 parent 91e44aa commit 2e33391

File tree

12 files changed

+269
-269
lines changed

12 files changed

+269
-269
lines changed

src/sage/combinat/words/abstract_word.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,24 +1476,24 @@ def sum_digits(self, base=2, mod=None):
14761476
14771477
Sum of digits modulo 2 of the prime numbers written in base 2::
14781478
1479-
sage: Word(primes(1000)).sum_digits() # optional - sage.libs.pari
1479+
sage: Word(primes(1000)).sum_digits() # needs sage.libs.pari
14801480
word: 1001110100111010111011001011101110011011...
14811481
14821482
Sum of digits modulo 3 of the prime numbers written in base 3::
14831483
1484-
sage: Word(primes(1000)).sum_digits(base=3) # optional - sage.libs.pari
1484+
sage: Word(primes(1000)).sum_digits(base=3) # needs sage.libs.pari
14851485
word: 2100002020002221222121022221022122111022...
1486-
sage: Word(primes(1000)).sum_digits(base=3, mod=3) # optional - sage.libs.pari
1486+
sage: Word(primes(1000)).sum_digits(base=3, mod=3) # needs sage.libs.pari
14871487
word: 2100002020002221222121022221022122111022...
14881488
14891489
Sum of digits modulo 2 of the prime numbers written in base 3::
14901490
1491-
sage: Word(primes(1000)).sum_digits(base=3, mod=2) # optional - sage.libs.pari
1491+
sage: Word(primes(1000)).sum_digits(base=3, mod=2) # needs sage.libs.pari
14921492
word: 0111111111111111111111111111111111111111...
14931493
14941494
Sum of digits modulo 7 of the prime numbers written in base 10::
14951495
1496-
sage: Word(primes(1000)).sum_digits(base=10, mod=7) # optional - sage.libs.pari
1496+
sage: Word(primes(1000)).sum_digits(base=10, mod=7) # needs sage.libs.pari
14971497
word: 2350241354435041006132432241353546006304...
14981498
14991499
Negative entries::

src/sage/combinat/words/alphabet.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,15 @@ def build_alphabet(data=None, names=None, name=None):
192192
Traceback (most recent call last):
193193
...
194194
ValueError: invalid value for names
195-
sage: Alphabet(8, x) # optional - sage.symbolic
195+
sage: Alphabet(8, x) # needs sage.symbolic
196196
Traceback (most recent call last):
197197
...
198198
ValueError: invalid value for names
199-
sage: Alphabet(name=x, names="punctuation") # optional - sage.symbolic
199+
sage: Alphabet(name=x, names="punctuation") # needs sage.symbolic
200200
Traceback (most recent call last):
201201
...
202202
ValueError: name cannot be specified with any other argument
203-
sage: Alphabet(x) # optional - sage.symbolic
203+
sage: Alphabet(x) # needs sage.symbolic
204204
Traceback (most recent call last):
205205
...
206206
ValueError: unable to construct an alphabet from the given parameters

src/sage/combinat/words/finite_word.py

Lines changed: 48 additions & 48 deletions
Large diffs are not rendered by default.

src/sage/combinat/words/lyndon_word.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ def LyndonWords(e=None, k=None):
6464
word: 1112
6565
sage: LW.last()
6666
word: 2333
67-
sage: LW.random_element() # random # optional - sage.libs.pari
67+
sage: LW.random_element() # random # needs sage.libs.pari
6868
word: 1232
69-
sage: LW.cardinality() # optional - sage.libs.pari
69+
sage: LW.cardinality() # needs sage.libs.pari
7070
18
7171
7272
If e is a (weak) composition, then it returns the class of Lyndon
@@ -277,17 +277,17 @@ def cardinality(self):
277277
278278
sage: LyndonWords([]).cardinality()
279279
0
280-
sage: LyndonWords([2,2]).cardinality() # optional - sage.libs.pari
280+
sage: LyndonWords([2,2]).cardinality() # needs sage.libs.pari
281281
1
282-
sage: LyndonWords([2,3,2]).cardinality() # optional - sage.libs.pari
282+
sage: LyndonWords([2,3,2]).cardinality() # needs sage.libs.pari
283283
30
284284
285285
Check to make sure that the count matches up with the number of
286286
Lyndon words generated::
287287
288288
sage: comps = [[],[2,2],[3,2,7],[4,2]] + Compositions(4).list()
289289
sage: lws = [LyndonWords(comp) for comp in comps]
290-
sage: all(lw.cardinality() == len(lw.list()) for lw in lws) # optional - sage.libs.pari
290+
sage: all(lw.cardinality() == len(lw.list()) for lw in lws) # needs sage.libs.pari
291291
True
292292
"""
293293
evaluation = self._e
@@ -417,7 +417,7 @@ def __call__(self, *args, **kwds):
417417
Make sure that the correct length is checked (:trac:`30186`)::
418418
419419
sage: L = LyndonWords(2, 4)
420-
sage: _ = L(L.random_element()) # optional - sage.libs.pari
420+
sage: _ = L(L.random_element()) # needs sage.libs.pari
421421
"""
422422
w = self._words(*args, **kwds)
423423
if kwds.get('check', True) and not w.is_lyndon():
@@ -443,7 +443,7 @@ def cardinality(self):
443443
"""
444444
TESTS::
445445
446-
sage: [ LyndonWords(3,i).cardinality() for i in range(1, 11) ] # optional - sage.libs.pari
446+
sage: [ LyndonWords(3,i).cardinality() for i in range(1, 11) ] # needs sage.libs.pari
447447
[3, 3, 8, 18, 48, 116, 312, 810, 2184, 5880]
448448
"""
449449
if self._k == 0:
@@ -470,7 +470,7 @@ def __iter__(self):
470470
sage: sum(1 for lw in LyndonWords(1, 1000))
471471
0
472472
473-
sage: list(LyndonWords(1, 1)) # optional - sage.libs.pari
473+
sage: list(LyndonWords(1, 1)) # needs sage.libs.pari
474474
[word: 1]
475475
"""
476476
W = self._words._element_classes['list']

src/sage/combinat/words/morphic.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
abstract numeration system associated to the morphism and the starting
2424
letter, see chapter 3 of the book [BR2010b]_::
2525
26-
sage: w[10000000] # optional - sage.modules
26+
sage: w[10000000] # needs sage.modules
2727
'b'
2828
2929
"""
@@ -58,7 +58,7 @@ def __init__(self, parent, morphism, letter, coding=None, length=Infinity):
5858
sage: w = m.fixed_point('a')
5959
sage: w
6060
word: abaababaabaababaababaabaababaabaababaaba...
61-
sage: w[555:1000] # optional - sage.modules
61+
sage: w[555:1000] # needs sage.modules
6262
word: abaababaabaababaababaabaababaabaababaaba...
6363
sage: w.length()
6464
+Infinity
@@ -69,19 +69,19 @@ def __init__(self, parent, morphism, letter, coding=None, length=Infinity):
6969
sage: m.fixed_point('a')
7070
word: abcbabacababaabcbabaabccaabcbabaabcbabaa...
7171
sage: w = m.fixed_point('a')
72-
sage: w[7] # optional - sage.modules
72+
sage: w[7] # needs sage.modules
7373
'c'
74-
sage: w[2:7] # optional - sage.modules
74+
sage: w[2:7] # needs sage.modules
7575
word: cbaba
76-
sage: w[500:503] # optional - sage.modules
76+
sage: w[500:503] # needs sage.modules
7777
word: caa
7878
7979
When the morphic word is finite::
8080
8181
sage: m = WordMorphism("a->ab,b->")
8282
sage: w = m.fixed_point("a"); w
8383
word: ab
84-
sage: w[0] # optional - sage.modules
84+
sage: w[0] # needs sage.modules
8585
'a'
8686
sage: w.length()
8787
2
@@ -93,7 +93,7 @@ def __init__(self, parent, morphism, letter, coding=None, length=Infinity):
9393
sage: from sage.combinat.words.morphic import WordDatatype_morphic
9494
sage: coding = {'a':'x', 'b':'y'}
9595
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
9797
['x', 'y', 'x', 'x', 'y', 'x', 'y', 'x', 'x', 'y']
9898
9999
TESTS::
@@ -104,9 +104,9 @@ def __init__(self, parent, morphism, letter, coding=None, length=Infinity):
104104
sage: for _ in range(10000): _ = next(it)
105105
sage: L = [next(it) for _ in range(10)]; L
106106
['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
108108
word: dddcdddcba
109-
sage: list(w[10000:10010]) == L # optional - sage.modules
109+
sage: list(w[10000:10010]) == L # needs sage.modules
110110
True
111111
112112
"""
@@ -177,18 +177,18 @@ def representation(self, n):
177177
178178
sage: m = WordMorphism('a->ab,b->a')
179179
sage: w = m.fixed_point('a')
180-
sage: w.representation(5) # optional - sage.modules
180+
sage: w.representation(5) # needs sage.modules
181181
[1, 0, 0, 0]
182182
183183
When the morphic word is finite::
184184
185185
sage: m = WordMorphism("a->ab,b->,c->cdab,d->dcab")
186186
sage: w = m.fixed_point("a")
187-
sage: w.representation(0) # optional - sage.modules
187+
sage: w.representation(0) # needs sage.modules
188188
[]
189-
sage: w.representation(1) # optional - sage.modules
189+
sage: w.representation(1) # needs sage.modules
190190
[1]
191-
sage: w.representation(2) # optional - sage.modules
191+
sage: w.representation(2) # needs sage.modules
192192
Traceback (most recent call last):
193193
...
194194
IndexError: index (=2) out of range, the fixed point is finite and has length 2
@@ -204,7 +204,7 @@ def representation(self, n):
204204
sage: w = WordDatatype_morphic(W, m, 'a')
205205
sage: type(w)
206206
<class 'sage.combinat.words.morphic.WordDatatype_morphic'>
207-
sage: w.representation(5) # optional - sage.modules
207+
sage: w.representation(5) # needs sage.modules
208208
[1, 0, 0, 0]
209209
"""
210210
letters_to_int = {a:i for (i,a) in enumerate(self._alphabet)}
@@ -255,11 +255,11 @@ def _func(self, key):
255255
256256
sage: m = WordMorphism("a->ab,b->a")
257257
sage: w = m.fixed_point("a")
258-
sage: w[0] # optional - sage.modules
258+
sage: w[0] # needs sage.modules
259259
'a'
260-
sage: w[5] # optional - sage.modules
260+
sage: w[5] # needs sage.modules
261261
'a'
262-
sage: w[10000] # optional - sage.modules
262+
sage: w[10000] # needs sage.modules
263263
'a'
264264
265265
TESTS:
@@ -271,7 +271,7 @@ def _func(self, key):
271271
sage: W = m.domain()
272272
sage: from sage.combinat.words.morphic import WordDatatype_morphic
273273
sage: w = WordDatatype_morphic(W, m, 'a')
274-
sage: w._func(5) # optional - sage.modules
274+
sage: w._func(5) # needs sage.modules
275275
'a'
276276
277277
"""

0 commit comments

Comments
 (0)