AUTHORS:
Bases: sage.monoids.indexed_free_monoid.IndexedMonoid
Free abelian monoid with an indexed set of generators.
INPUT:
For the optional arguments that control the printing, see IndexedGenerators.
EXAMPLES:
sage: F = FreeAbelianMonoid(index_set=ZZ)
sage: F.gen(15)^3 * F.gen(2) * F.gen(15)
F[2]*F[15]^4
sage: F.gen(1)
F[1]
Now we examine some of the printing options:
sage: F = FreeAbelianMonoid(index_set=Partitions(), prefix='A', bracket=False, scalar_mult='%')
sage: F.gen([3,1,1]) * F.gen([2,2])
A[2, 2]%A[3, 1, 1]
alias of IndexedFreeAbelianMonoidElement
The generator indexed by x of self.
EXAMPLES:
sage: F = FreeAbelianMonoid(index_set=ZZ)
sage: F.gen(0)
F[0]
sage: F.gen(2)
F[2]
Return the identity element of self.
EXAMPLES:
sage: F = FreeAbelianMonoid(index_set=ZZ)
sage: F.one()
1
Bases: sage.monoids.indexed_free_monoid.IndexedMonoidElement
An element of an indexed free abelian monoid.
Return self as a dictionary.
EXAMPLES:
sage: F = FreeAbelianMonoid(index_set=ZZ)
sage: a,b,c,d,e = [F.gen(i) for i in range(5)]
sage: (a*c^3).dict()
{0: 1, 2: 3}
Return the length of self.
EXAMPLES:
sage: F = FreeAbelianMonoid(index_set=ZZ)
sage: a,b,c,d,e = [F.gen(i) for i in range(5)]
sage: elt = a*c^3*b^2*a
sage: elt.length()
7
sage: len(elt)
7
Bases: sage.monoids.indexed_free_monoid.IndexedMonoid
Free monoid with an indexed set of generators.
INPUT:
For the optional arguments that control the printing, see IndexedGenerators.
EXAMPLES:
sage: F = FreeMonoid(index_set=ZZ)
sage: F.gen(15)^3 * F.gen(2) * F.gen(15)
F[15]^3*F[2]*F[15]
sage: F.gen(1)
F[1]
Now we examine some of the printing options:
sage: F = FreeMonoid(index_set=ZZ, prefix='X', bracket=['|','>'])
sage: F.gen(2) * F.gen(12)
X|2>*X|12>
alias of IndexedFreeMonoidElement
The generator indexed by x of self.
EXAMPLES:
sage: F = FreeMonoid(index_set=ZZ)
sage: F.gen(0)
F[0]
sage: F.gen(2)
F[2]
Return the identity element of self.
EXAMPLES:
sage: F = FreeMonoid(index_set=ZZ)
sage: F.one()
1
Bases: sage.monoids.indexed_free_monoid.IndexedMonoidElement
An element of an indexed free abelian monoid.
Return the length of self.
EXAMPLES:
sage: F = FreeMonoid(index_set=ZZ)
sage: a,b,c,d,e = [F.gen(i) for i in range(5)]
sage: elt = a*c^3*b^2*a
sage: elt.length()
7
sage: len(elt)
7
Bases: sage.structure.parent.Parent, sage.structure.indexed_generators.IndexedGenerators, sage.structure.unique_representation.UniqueRepresentation
Base class for monoids with an indexed set of generators.
INPUT:
For the optional arguments that control the printing, see IndexedGenerators.
Return the cardinality of self, which is unless this is
the trivial monoid.
EXAMPLES:
sage: F = FreeMonoid(index_set=ZZ)
sage: F.cardinality()
+Infinity
sage: F = FreeMonoid(index_set=())
sage: F.cardinality()
1
sage: F = FreeAbelianMonoid(index_set=ZZ)
sage: F.cardinality()
+Infinity
sage: F = FreeAbelianMonoid(index_set=())
sage: F.cardinality()
1
Return the monoid generators of self.
EXAMPLES:
sage: F = FreeAbelianMonoid(index_set=ZZ)
sage: F.monoid_generators()
Lazy family (Generator map from Integer Ring to
Free abelian monoid indexed by Integer Ring(i))_{i in Integer Ring}
sage: F = FreeAbelianMonoid(index_set=tuple('abcde'))
sage: sorted(F.monoid_generators())
[F['a'], F['b'], F['c'], F['d'], F['e']]
Return the monoid generators of self.
EXAMPLES:
sage: F = FreeAbelianMonoid(index_set=ZZ)
sage: F.monoid_generators()
Lazy family (Generator map from Integer Ring to
Free abelian monoid indexed by Integer Ring(i))_{i in Integer Ring}
sage: F = FreeAbelianMonoid(index_set=tuple('abcde'))
sage: sorted(F.monoid_generators())
[F['a'], F['b'], F['c'], F['d'], F['e']]
Bases: sage.structure.element.MonoidElement
An element of an indexed monoid.
This is an abstract class which uses the (abstract) method _sorted_items() for all of its functions. So to implement an element of an indexed monoid, one just needs to implement _sorted_items(), which returns a list of pairs (i, p) where i is the index and p is the corresponding power, sorted in some order. For example, in the free monoid there is no such choice, but for the free abelian monoid, one could want lex order or have the highest powers first.
Indexed monoid elements are ordered lexicographically with respect to the result of _sorted_items() (which for abelian free monoids is influenced by the order on the indexing set).
Return the support of the leading generator of self.
EXAMPLES:
sage: F = FreeMonoid(index_set=ZZ)
sage: a,b,c,d,e = [F.gen(i) for i in range(5)]
sage: (b*a*c^3*a).leading_support()
1
sage: F = FreeAbelianMonoid(index_set=ZZ)
sage: a,b,c,d,e = [F.gen(i) for i in range(5)]
sage: (b*c^3*a).leading_support()
0
Return a list of the objects indexing self with non-zero exponents.
EXAMPLES:
sage: F = FreeMonoid(index_set=ZZ)
sage: a,b,c,d,e = [F.gen(i) for i in range(5)]
sage: (b*a*c^3*b).support()
[0, 1, 2]
sage: F = FreeAbelianMonoid(index_set=ZZ)
sage: a,b,c,d,e = [F.gen(i) for i in range(5)]
sage: (a*c^3).support()
[0, 2]
Return self as a word represented as a list whose entries are indices of self.
EXAMPLES:
sage: F = FreeMonoid(index_set=ZZ)
sage: a,b,c,d,e = [F.gen(i) for i in range(5)]
sage: (b*a*c^3*a).to_word_list()
[1, 0, 2, 2, 2, 0]
sage: F = FreeAbelianMonoid(index_set=ZZ)
sage: a,b,c,d,e = [F.gen(i) for i in range(5)]
sage: (b*c^3*a).to_word_list()
[0, 1, 2, 2, 2]
Return the support of the trailing generator of self.
EXAMPLES:
sage: F = FreeMonoid(index_set=ZZ)
sage: a,b,c,d,e = [F.gen(i) for i in range(5)]
sage: (b*a*c^3*a).trailing_support()
0
sage: F = FreeAbelianMonoid(index_set=ZZ)
sage: a,b,c,d,e = [F.gen(i) for i in range(5)]
sage: (b*c^3*a).trailing_support()
2