Ticket #13115: trac_13115-groups-object.patch

File trac_13115-groups-object.patch, 6.8 KB (added by rbeezer, 10 years ago)
  • doc/en/reference/groups.rst

    # HG changeset patch
    # User Rob Beezer <beezer@ups.edu>
    # Date 1339645864 25200
    # Node ID f73800163cb69ef344bb78505195c96a3e3f48d0
    # Parent  6c345ac8a80ecf9ed03a07896b98c608aa79f1e5
    object to organize examples of groups
    
    diff --git a/doc/en/reference/groups.rst b/doc/en/reference/groups.rst
    a b  
    66.. toctree::
    77   :maxdepth: 2
    88
     9   sage/groups/group_generators
    910   sage/groups/group
    1011   sage/groups/generic
    1112   sage/groups/abelian_gps/abelian_group
  • sage/groups/all.py

    diff --git a/sage/groups/all.py b/sage/groups/all.py
    a b  
    1212from class_function import ClassFunction
    1313
    1414from additive_abelian.all import *
     15
     16from group_generators import groups
  • new file sage/groups/group_generators.py

    diff --git a/sage/groups/group_generators.py b/sage/groups/group_generators.py
    new file mode 100644
    - +  
     1r"""
     2Examples of Groups
     3
     4The ``groups`` object, an instance of the :class:`GroupGenerators` class
     5contains methods that return examples of various groups.  Using
     6tab-completion on this object is an easy way to discover and use the
     7list of groups that are available.
     8"""
     9
     10class GroupGenerators(object):
     11    r"""
     12    An object of this class gives convenient references
     13    to examples of graphs.
     14
     15    The global ``groups`` object can be used with tab-completion
     16    to easily and quickly locate examples of groups implemented in Sage.
     17    These include:
     18
     19      - :meth:`CyclicGroupPermutationGroup`
     20      - :meth:`MathieuPermutationGroup`
     21      - :meth:`QuaternionPermutationGroup`
     22      - :meth:`QuaternionMatrixGroupGF3`
     23
     24    .. warning::
     25
     26        This list is under development, so may not be exhaustive.
     27    """
     28
     29    def __repr__(self):
     30        r"""
     31        A message about the purpose of this object.
     32
     33        TESTS::
     34       
     35            sage: groups   # indirect doctest
     36            Object collecting examples of graphs, try "groups.<tab>"
     37        """
     38        return 'Object collecting examples of graphs, try "groups.<tab>"'
     39       
     40   
     41    def CyclicGroupPermutationGroup(self, n):
     42        r"""
     43        A cyclic group as a permutation group.
     44
     45        INPUT:
     46
     47          - ``n`` - a positive integer, the size of the group.
     48
     49        OUTPUT:
     50
     51        A cyclic group of order `n` as a permutation group of size `n`.
     52       
     53        EXAMPLES::
     54
     55            sage: G = groups.CyclicGroupPermutationGroup(4)
     56            sage: G.list()
     57            [(), (1,2,3,4), (1,3)(2,4), (1,4,3,2)]
     58
     59        For further documentation, see
     60        :meth:`~sage.groups.perm_gps.permgroup_named.CyclicPermutationGroup`.
     61        """
     62        import sage.groups.perm_gps.permgroup_named
     63        return sage.groups.perm_gps.permgroup_named.CyclicPermutationGroup(n)
     64
     65    def MathieuPermutationGroup(self, degree):
     66        r"""
     67        Returns a Mathieu group as a permutation group.
     68
     69        INPUT:
     70
     71         - ``degree`` - the number of symbols in the
     72           ambient symmetric group.  Allowable values are
     73           9, 10, 11, 12, 21, 22, 23, and 24.
     74
     75        OUTPUT:
     76
     77        A Mathieu group, as a permutation of the integers
     78        ``1`` through ``degree``.
     79
     80        EXAMPLES:
     81
     82        `M_{22}` is simple and `3`-transitive.  ::
     83
     84            sage: G = groups.MathieuPermutationGroup(22)
     85            sage: G.is_simple()
     86            True
     87            sage: S1 = G.stabilizer(1)
     88            sage: S1.orbits()
     89            [[1], [2, 7, 15, 3, 17, 13, 10, 4, 22, 19, 14, 11, 20, 21, 8, 6, 9, 12, 18, 16, 5]]
     90            sage: S2 = S1.stabilizer(2)
     91            sage: S2.orbits()
     92            [[1], [2], [3, 14, 22, 17, 4, 10, 13, 11, 9, 6, 5, 16, 18, 12, 8, 7, 15, 21, 20, 19]]
     93            sage: S3 = S2.stabilizer(3)
     94            sage: S3.orbits()
     95            [[1], [2], [3], [4, 12, 22, 14, 11, 5, 21, 9, 19, 13, 8, 15, 18, 17, 6, 16], [7, 10, 20]]
     96           
     97        For further documentation, see
     98        :meth:`~sage.groups.perm_gps.permgroup_named.MathieuGroup`.
     99        """
     100        import sage.groups.perm_gps.permgroup_named
     101        return sage.groups.perm_gps.permgroup_named.MathieuGroup(degree)
     102
     103    def QuaternionMatrixGroupGF3(self):
     104        r"""
     105        The quaternion group as a set of `2\times 2` matrices over `GF(3)`.
     106
     107        OUTPUT:
     108
     109        A matrix group consisting of `2\times 2` matrices with
     110        elements from the finite field of order 3.  The group is
     111        the quaternion group, the nonabelian group of order 8 that
     112        is not isomorphic to the group of symmetries of a square
     113        (the dihedral group `D_4`).
     114
     115        EXAMPLES:
     116
     117        The generators are the matrix representations of the
     118        elements commonly called `I` and `J`, while `K`
     119        is the product of `I` and `J`. ::
     120           
     121            sage: Q = groups.QuaternionMatrixGroupGF3()
     122            sage: Q.order()
     123            8
     124            sage: aye = Q.gens()[0]; aye
     125            [1 1]
     126            [1 2]
     127            sage: jay = Q.gens()[1]; jay
     128            [2 1]
     129            [1 1]
     130            sage: kay = aye*jay; kay
     131            [0 2]
     132            [1 0]
     133
     134        TESTS::
     135       
     136            sage: Q = groups.QuaternionMatrixGroupGF3()
     137            sage: QP = Q.as_permutation_group()
     138            sage: QP.is_isomorphic(groups.QuaternionPermutationGroup())
     139            True
     140            sage: H = DihedralGroup(4)
     141            sage: H.order()
     142            8
     143            sage: QP.is_abelian(), H.is_abelian()
     144            (False, False)
     145            sage: QP.is_isomorphic(H)
     146            False
     147        """
     148        from sage.rings.finite_rings.constructor import FiniteField
     149        from sage.matrix.matrix_space import MatrixSpace
     150        from sage.groups.matrix_gps.matrix_group import MatrixGroup
     151        MS = MatrixSpace(FiniteField(3), 2)
     152        aye = MS([1,1,1,2])
     153        jay = MS([2,1,1,1])
     154        return MatrixGroup([aye, jay])
     155
     156    def QuaternionPermutationGroup(self):
     157        r"""
     158        The quaternion group as a set of permutations in `S_8`.
     159
     160        OUTPUT:
     161
     162        A group of permutations on the symbols ``1`` to ``8`` that
     163        is the nonabelian group of order 8 that is not isomorphic
     164        to the group of symmetries of a square (the dihedral
     165        group `D_4`).
     166
     167        EXAMPLES::
     168
     169            sage: G = groups.QuaternionPermutationGroup()
     170            sage: G.degree()
     171            8
     172            sage: G.order()
     173            8
     174            sage: sorted([x.order() for x in G])
     175            [1, 2, 4, 4, 4, 4, 4, 4]
     176        """
     177        import sage.groups.perm_gps.permgroup_named
     178        return sage.groups.perm_gps.permgroup_named.QuaternionGroup()
     179
     180# This is the object available in the global namespace       
     181groups = GroupGenerators()
     182
     183
     184   
     185 No newline at end of file