Free groups and free abelian groups implemented using an indexed set of generators.
AUTHORS:
Bases: sage.groups.indexed_free_group.IndexedGroup, sage.groups.group.AbelianGroup
An indexed free abelian group.
EXAMPLES:
sage: G = Groups().Commutative().free(index_set=ZZ)
sage: G
Free abelian group indexed by Integer Ring
sage: G = Groups().Commutative().free(index_set='abcde')
sage: G
Free abelian group indexed by {'a', 'b', 'c', 'd', 'e'}
Bases: sage.monoids.indexed_free_monoid.IndexedFreeAbelianMonoidElement, sage.groups.indexed_free_group.IndexedFreeGroup.Element
Create the element x of an indexed free abelian monoid F.
EXAMPLES:
sage: F = FreeAbelianMonoid(index_set=ZZ)
sage: x = F([(0, 1), (2, 2), (-1, 2)])
sage: y = F({0:1, 2:2, -1:2})
sage: z = F(reversed([(0, 1), (2, 2), (-1, 2)]))
sage: x == y and y == z
True
sage: TestSuite(x).run()
The generator indexed by x of self.
EXAMPLES:
sage: G = Groups().Commutative().free(index_set=ZZ)
sage: G.gen(0)
F[0]
sage: G.gen(2)
F[2]
Return the identity element of self.
EXAMPLES:
sage: G = Groups().Commutative().free(index_set=ZZ)
sage: G.one()
1
Bases: sage.groups.indexed_free_group.IndexedGroup, sage.groups.group.Group
An indexed free group.
EXAMPLES:
sage: G = Groups().free(index_set=ZZ)
sage: G
Free group indexed by Integer Ring
sage: G = Groups().free(index_set='abcde')
sage: G
Free group indexed by {'a', 'b', 'c', 'd', 'e'}
Bases: sage.monoids.indexed_free_monoid.IndexedFreeMonoidElement
Create the element x of an indexed free abelian monoid F.
EXAMPLES:
sage: F = FreeMonoid(index_set=tuple('abcde'))
sage: x = F( [(1, 2), (0, 1), (3, 2), (0, 1)] )
sage: y = F( ((1, 2), (0, 1), [3, 2], [0, 1]) )
sage: z = F( reversed([(0, 1), (3, 2), (0, 1), (1, 2)]) )
sage: x == y and y == z
True
sage: TestSuite(x).run()
Return the length of self.
EXAMPLES:
sage: G = Groups().free(index_set=ZZ)
sage: a,b,c,d,e = [G.gen(i) for i in range(5)]
sage: elt = a*c^-3*b^-2*a
sage: elt.length()
7
sage: len(elt)
7
sage: G = Groups().free(index_set=ZZ)
sage: a,b,c,d,e = [G.gen(i) for i in range(5)]
sage: elt = a*c^-3*b^-2*a
sage: elt.length()
7
sage: len(elt)
7
Return self as a word represented as a list whose entries are the pairs (i, s) where i is the index and s is the sign.
EXAMPLES:
sage: G = Groups().free(index_set=ZZ)
sage: a,b,c,d,e = [G.gen(i) for i in range(5)]
sage: x = a*b^2*e*a^-1
sage: x.to_word_list()
[(0, 1), (1, 1), (1, 1), (4, 1), (0, -1)]
The generator indexed by x of self.
EXAMPLES:
sage: G = Groups().free(index_set=ZZ)
sage: G.gen(0)
F[0]
sage: G.gen(2)
F[2]
Return the identity element of self.
EXAMPLES:
sage: G = Groups().free(ZZ)
sage: G.one()
1
Bases: sage.monoids.indexed_free_monoid.IndexedMonoid
Base class for free (abelian) groups whose generators are indexed by a set.
TESTS:
We check finite properties:
sage: G = Groups().free(index_set=ZZ)
sage: G.is_finite()
False
sage: G = Groups().free(index_set='abc')
sage: G.is_finite()
False
sage: G = Groups().free(index_set=[])
sage: G.is_finite()
True
sage: G = Groups().Commutative().free(index_set=ZZ)
sage: G.is_finite()
False
sage: G = Groups().Commutative().free(index_set='abc')
sage: G.is_finite()
False
sage: G = Groups().Commutative().free(index_set=[])
sage: G.is_finite()
True
Return the group generators of self.
EXAMPLES:
sage: G = Groups.free(index_set=ZZ)
sage: G.group_generators()
Lazy family (Generator map from Integer Ring to
Free group indexed by Integer Ring(i))_{i in Integer Ring}
sage: G = Groups().free(index_set='abcde')
sage: sorted(G.group_generators())
[F['a'], F['b'], F['c'], F['d'], F['e']]
Return the group generators of self.
EXAMPLES:
sage: G = Groups.free(index_set=ZZ)
sage: G.group_generators()
Lazy family (Generator map from Integer Ring to
Free group indexed by Integer Ring(i))_{i in Integer Ring}
sage: G = Groups().free(index_set='abcde')
sage: sorted(G.group_generators())
[F['a'], F['b'], F['c'], F['d'], F['e']]
Return the number of elements of self, which is unless
this is the trivial group.
EXAMPLES:
sage: G = Groups().free(index_set=ZZ)
sage: G.order()
+Infinity
sage: G = Groups().Commutative().free(index_set='abc')
sage: G.order()
+Infinity
sage: G = Groups().Commutative().free(index_set=[])
sage: G.order()
1
Return the rank of self.
This is the number of generators of self.
EXAMPLES:
sage: G = Groups().free(index_set=ZZ)
sage: G.rank()
+Infinity
sage: G = Groups().free(index_set='abc')
sage: G.rank()
3
sage: G = Groups().free(index_set=[])
sage: G.rank()
0
sage: G = Groups().Commutative().free(index_set=ZZ)
sage: G.rank()
+Infinity
sage: G = Groups().Commutative().free(index_set='abc')
sage: G.rank()
3
sage: G = Groups().Commutative().free(index_set=[])
sage: G.rank()
0