Indexed Free Groups - Groups

Skip to content
Back to top
View this page
Edit this page

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

  Bases: `IndexedGroup`, `AbelianGroup`

  An indexed free abelian group.

  EXAMPLES:

  Sage

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

  Python

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

  class Element(F, x)

    Bases: `IndexedFreeAbelianMonoidElement`, `Element`

  gen(x)

    The generator indexed by `x` of `self`.

    EXAMPLES:

    Sage

        sage: G = Groups().Commutative().free(index_set=ZZ)
        sage: G.gen(0)
        F[0]
        sage: G.gen(2)
        F[2]

    Python

        >>> from sage.all import *
        >>> G = Groups().Commutative().free(index_set=ZZ)
        >>> G.gen(Integer(0))
        F[0]
        >>> G.gen(Integer(2))
        F[2]

  one()

    Return the identity element of `self`.

    EXAMPLES:

    Sage

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

    Python

        >>> from sage.all import *
        >>> G = Groups().Commutative().free(index_set=ZZ)
        >>> G.one()
        1

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

  Bases: `IndexedGroup`, `Group`

  An indexed free group.

  EXAMPLES:

  Sage

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

  Python

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

  class Element(F, x)

    Bases: `IndexedFreeMonoidElement`

    length()

      Return the length of `self`.

      EXAMPLES:

      Sage

          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

      Python

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

    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

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

      Python

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

  gen(x)

    The generator indexed by `x` of `self`.

    EXAMPLES:

    Sage

        sage: G = Groups().free(index_set=ZZ)
        sage: G.gen(0)
        F[0]
        sage: G.gen(2)
        F[2]

    Python

        >>> from sage.all import *
        >>> G = Groups().free(index_set=ZZ)
        >>> G.gen(Integer(0))
        F[0]
        >>> G.gen(Integer(2))
        F[2]

  one()

    Return the identity element of `self`.

    EXAMPLES:

    Sage

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

    Python

        >>> from sage.all import *
        >>> G = Groups().free(ZZ)
        >>> G.one()
        1

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

  Bases: `IndexedMonoid`

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

  gens()

    alias of `group_generators()`.

  group_generators()

    Return the group generators of `self`.

    EXAMPLES:

    Sage

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

    Python

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

  order()

    Return the number of elements of `self`, which is \(\infty\) unless this is the trivial group.

    EXAMPLES:

    Sage

        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

    Python

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

  rank()

    Return the rank of `self`.

    This is the number of generators of `self`.

    EXAMPLES:

    Sage

        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

    Python

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

    Sage

        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

    [Python]

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