Skip to content

Commit

Permalink
sage.combinat.words: More block tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Nov 4, 2023
1 parent 6613b17 commit 8153dbd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
13 changes: 7 additions & 6 deletions src/sage/combinat/words/finite_word.py
Original file line number Diff line number Diff line change
Expand Up @@ -6824,18 +6824,19 @@ def colored_vector(self, x=0, y=0, width='default', height=1, cmap='hsv', thickn
EXAMPLES::
sage: Word(range(20)).colored_vector() # needs sage.plot
sage: # needs sage.plot
sage: Word(range(20)).colored_vector()
Graphics object consisting of 21 graphics primitives
sage: Word(range(100)).colored_vector(0,0,10,1) # needs sage.plot
sage: Word(range(100)).colored_vector(0,0,10,1)
Graphics object consisting of 101 graphics primitives
sage: Words(range(100))(range(10)).colored_vector() # needs sage.plot
sage: Words(range(100))(range(10)).colored_vector()
Graphics object consisting of 11 graphics primitives
sage: w = Word('abbabaab')
sage: w.colored_vector() # needs sage.plot
sage: w.colored_vector()
Graphics object consisting of 9 graphics primitives
sage: w.colored_vector(cmap='autumn') # needs sage.plot
sage: w.colored_vector(cmap='autumn')
Graphics object consisting of 9 graphics primitives
sage: Word(range(20)).colored_vector(label='Rainbow') # needs sage.plot
sage: Word(range(20)).colored_vector(label='Rainbow')
Graphics object consisting of 23 graphics primitives
When two words are defined under the same parent, same letters are
Expand Down
27 changes: 14 additions & 13 deletions src/sage/combinat/words/morphism.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def __init__(self, data, domain=None, codomain=None):
The image of a letter can be a set, but the order is not
preserved::
sage: WordMorphism({2:[4,5,6],3:set([4,1,8])}) #random results
sage: WordMorphism({2:[4,5,6],3:set([4,1,8])}) # random results
WordMorphism: 2->456, 3->814
If the image of a letter is not iterable, it is considered as a
Expand Down Expand Up @@ -1099,23 +1099,24 @@ def _matrix_(self, R=None):
EXAMPLES::
sage: # needs sage.modules
sage: fibo = WordMorphism('a->ab,b->a')
sage: tm = WordMorphism('a->ab,b->ba')
sage: Mfibo = matrix(fibo); Mfibo # indirect doctest # needs sage.modules
sage: Mfibo = matrix(fibo); Mfibo # indirect doctest
[1 1]
[1 0]
sage: Mtm = matrix(tm); Mtm # needs sage.modules
sage: Mtm = matrix(tm); Mtm
[1 1]
[1 1]
sage: Mtm * Mfibo == matrix(tm*fibo) # indirect doctest # needs sage.modules
sage: Mtm * Mfibo == matrix(tm*fibo) # indirect doctest
True
sage: Mfibo * Mtm == matrix(fibo*tm) # indirect doctest # needs sage.modules
sage: Mfibo * Mtm == matrix(fibo*tm) # indirect doctest
True
sage: Mfibo.parent() # needs sage.modules
sage: Mfibo.parent()
Full MatrixSpace of 2 by 2 dense matrices over Integer Ring
sage: p = Mfibo.charpoly(); p # needs sage.modules
sage: p = Mfibo.charpoly(); p
x^2 - x - 1
sage: p.roots(ring=RR, multiplicities=False) # needs sage.modules
sage: p.roots(ring=RR, multiplicities=False)
[-0.618033988749895, 1.61803398874989]
"""
if R is None:
Expand Down Expand Up @@ -1406,19 +1407,19 @@ def partition_of_domain_alphabet(self):
EXAMPLES::
sage: m = WordMorphism('a->b,b->a')
sage: m.partition_of_domain_alphabet() #random ordering
sage: m.partition_of_domain_alphabet() # random ordering
({'a'}, {'b'}, {})
sage: m = WordMorphism('a->b,b->a,c->c')
sage: m.partition_of_domain_alphabet() #random ordering
sage: m.partition_of_domain_alphabet() # random ordering
({'a'}, {'b'}, {'c'})
sage: m = WordMorphism('a->a,b->b,c->c')
sage: m.partition_of_domain_alphabet() #random ordering
sage: m.partition_of_domain_alphabet() # random ordering
({}, {}, {'a', 'c', 'b'})
sage: m = WordMorphism('A->T,T->A,C->G,G->C')
sage: m.partition_of_domain_alphabet() #random ordering
sage: m.partition_of_domain_alphabet() # random ordering
({'A', 'C'}, {'T', 'G'}, {})
sage: I = WordMorphism({0:oo,oo:0,1:-1,-1:1,2:-2,-2:2,3:-3,-3:3})
sage: I.partition_of_domain_alphabet() #random ordering
sage: I.partition_of_domain_alphabet() # random ordering
({0, -1, -3, -2}, {1, 2, 3, +Infinity}, {})
TESTS::
Expand Down

0 comments on commit 8153dbd

Please sign in to comment.