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

Bases: IndexedGroup, 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'}
>>> from sage.all import *
>>> G = Groups().Commutative().free(index_set=ZZ)
>>> G
Free abelian group indexed by Integer Ring
>>> G = Groups().Commutative().free(index_set='abcde')
>>> G
Free abelian group indexed by {'a', 'b', 'c', 'd', 'e'}
G = Groups().Commutative().free(index_set=ZZ)
G
G = Groups().Commutative().free(index_set='abcde')
G
class Element(F, x)[source]

Bases: IndexedFreeAbelianMonoidElement, Element

gen(x)[source]

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]
>>> from sage.all import *
>>> G = Groups().Commutative().free(index_set=ZZ)
>>> G.gen(Integer(0))
F[0]
>>> G.gen(Integer(2))
F[2]
G = Groups().Commutative().free(index_set=ZZ)
G.gen(0)
G.gen(2)
one()[source]

Return the identity element of self.

EXAMPLES:

sage: G = Groups().Commutative().free(index_set=ZZ)
sage: G.one()
1
>>> from sage.all import *
>>> G = Groups().Commutative().free(index_set=ZZ)
>>> G.one()
1
G = Groups().Commutative().free(index_set=ZZ)
G.one()
class sage.groups.indexed_free_group.IndexedFreeGroup(indices, prefix, category=None, **kwds)[source]

Bases: IndexedGroup, 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'}
>>> from sage.all import *
>>> G = Groups().free(index_set=ZZ)
>>> G
Free group indexed by Integer Ring
>>> G = Groups().free(index_set='abcde')
>>> G
Free group indexed by {'a', 'b', 'c', 'd', 'e'}
G = Groups().free(index_set=ZZ)
G
G = Groups().free(index_set='abcde')
G
class Element(F, x)[source]

Bases: IndexedFreeMonoidElement

length()[source]

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
>>> from sage.all import *
>>> G = Groups().free(index_set=ZZ)
>>> a,b,c,d,e = [G.gen(i) for i in range(Integer(5))]
>>> elt = a*c**-Integer(3)*b**-Integer(2)*a
>>> elt.length()
7
>>> len(elt)
7

>>> G = Groups().free(index_set=ZZ)
>>> a,b,c,d,e = [G.gen(i) for i in range(Integer(5))]
>>> elt = a*c**-Integer(3)*b**-Integer(2)*a
>>> elt.length()
7
>>> len(elt)
7
G = Groups().free(index_set=ZZ)
a,b,c,d,e = [G.gen(i) for i in range(5)]
elt = a*c^-3*b^-2*a
elt.length()
len(elt)
G = Groups().free(index_set=ZZ)
a,b,c,d,e = [G.gen(i) for i in range(5)]
elt = a*c^-3*b^-2*a
elt.length()
len(elt)
to_word_list()[source]

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)]
>>> from sage.all import *
>>> G = Groups().free(index_set=ZZ)
>>> a,b,c,d,e = [G.gen(i) for i in range(Integer(5))]
>>> x = a*b**Integer(2)*e*a**-Integer(1)
>>> x.to_word_list()
[(0, 1), (1, 1), (1, 1), (4, 1), (0, -1)]
G = Groups().free(index_set=ZZ)
a,b,c,d,e = [G.gen(i) for i in range(5)]
x = a*b^2*e*a^-1
x.to_word_list()
gen(x)[source]

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]
>>> from sage.all import *
>>> G = Groups().free(index_set=ZZ)
>>> G.gen(Integer(0))
F[0]
>>> G.gen(Integer(2))
F[2]
G = Groups().free(index_set=ZZ)
G.gen(0)
G.gen(2)
one()[source]

Return the identity element of self.

EXAMPLES:

sage: G = Groups().free(ZZ)
sage: G.one()
1
>>> from sage.all import *
>>> G = Groups().free(ZZ)
>>> G.one()
1
G = Groups().free(ZZ)
G.one()
class sage.groups.indexed_free_group.IndexedGroup(indices, prefix, category=None, names=None, **kwds)[source]

Bases: IndexedMonoid

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

gens()[source]

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']]
>>> from sage.all import *
>>> G = Groups.free(index_set=ZZ)
>>> G.group_generators()
Lazy family (Generator map from Integer Ring to
 Free group indexed by Integer Ring(i))_{i in Integer Ring}
>>> G = Groups().free(index_set='abcde')
>>> sorted(G.group_generators())
[F['a'], F['b'], F['c'], F['d'], F['e']]
G = Groups.free(index_set=ZZ)
G.group_generators()
G = Groups().free(index_set='abcde')
sorted(G.group_generators())
group_generators()[source]

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']]
>>> from sage.all import *
>>> G = Groups.free(index_set=ZZ)
>>> G.group_generators()
Lazy family (Generator map from Integer Ring to
 Free group indexed by Integer Ring(i))_{i in Integer Ring}
>>> G = Groups().free(index_set='abcde')
>>> sorted(G.group_generators())
[F['a'], F['b'], F['c'], F['d'], F['e']]
G = Groups.free(index_set=ZZ)
G.group_generators()
G = Groups().free(index_set='abcde')
sorted(G.group_generators())
order()[source]

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
>>> from sage.all import *
>>> G = Groups().free(index_set=ZZ)
>>> G.order()
+Infinity
>>> G = Groups().Commutative().free(index_set='abc')
>>> G.order()
+Infinity
>>> G = Groups().Commutative().free(index_set=[])
>>> G.order()
1
G = Groups().free(index_set=ZZ)
G.order()
G = Groups().Commutative().free(index_set='abc')
G.order()
G = Groups().Commutative().free(index_set=[])
G.order()
rank()[source]

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
>>> from sage.all import *
>>> G = Groups().free(index_set=ZZ)
>>> G.rank()
+Infinity
>>> G = Groups().free(index_set='abc')
>>> G.rank()
3
>>> G = Groups().free(index_set=[])
>>> G.rank()
0
G = Groups().free(index_set=ZZ)
G.rank()
G = Groups().free(index_set='abc')
G.rank()
G = Groups().free(index_set=[])
G.rank()
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
>>> from sage.all import *
>>> G = Groups().Commutative().free(index_set=ZZ)
>>> G.rank()
+Infinity
>>> G = Groups().Commutative().free(index_set='abc')
>>> G.rank()
3
>>> G = Groups().Commutative().free(index_set=[])
>>> G.rank()
0
G = Groups().Commutative().free(index_set=ZZ)
G.rank()
G = Groups().Commutative().free(index_set='abc')
G.rank()
G = Groups().Commutative().free(index_set=[])
G.rank()
>>> from sage.all import *
>>> G = Groups().Commutative().free(index_set=ZZ)
>>> G.rank()
+Infinity
>>> G = Groups().Commutative().free(index_set='abc')
>>> G.rank()
3
>>> G = Groups().Commutative().free(index_set=[])
>>> G.rank()
0
G = Groups().Commutative().free(index_set=ZZ)
G.rank()
G = Groups().Commutative().free(index_set='abc')
G.rank()
G = Groups().Commutative().free(index_set=[])
G.rank()