# Indexed Free Groups¶

Free groups and free abelian groups implemented using an indexed set of generators.

AUTHORS:

• Travis Scrimshaw (2013-10-16): Initial version
class sage.groups.indexed_free_group.IndexedFreeAbelianGroup(indices, prefix, category=None, **kwds)

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'}

class Element(F, x)
gen(x)

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]

one()

Return the identity element of self.

EXAMPLES:

sage: G = Groups().Commutative().free(index_set=ZZ)
sage: G.one()
1

class sage.groups.indexed_free_group.IndexedFreeGroup(indices, prefix, category=None, **kwds)

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'}

class Element(F, x)
length()

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

to_word_list()

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)]

gen(x)

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]

one()

Return the identity element of self.

EXAMPLES:

sage: G = Groups().free(ZZ)
sage: G.one()
1

class sage.groups.indexed_free_group.IndexedGroup(indices, prefix, category=None, names=None, **kwds)

Base class for free (abelian) groups whose generators are indexed by a set.

gens()

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']]

group_generators()

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']]

order()

Return the number of elements of self, which is $$\infty$$ 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

rank()

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