# Ticket #13115: trac_13115-groups-object.patch

File trac_13115-groups-object.patch, 6.8 KB (added by Rob Beezer, 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 .. toctree:: :maxdepth: 2 sage/groups/group_generators sage/groups/group sage/groups/generic sage/groups/abelian_gps/abelian_group
• ## sage/groups/all.py

diff --git a/sage/groups/all.py b/sage/groups/all.py
 a from class_function import ClassFunction from additive_abelian.all import * from 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
 - r""" Examples of Groups The groups object, an instance of the :class:GroupGenerators class contains methods that return examples of various groups.  Using tab-completion on this object is an easy way to discover and use the list of groups that are available. """ class GroupGenerators(object): r""" An object of this class gives convenient references to examples of graphs. The global groups object can be used with tab-completion to easily and quickly locate examples of groups implemented in Sage. These include: - :meth:CyclicGroupPermutationGroup - :meth:MathieuPermutationGroup - :meth:QuaternionPermutationGroup - :meth:QuaternionMatrixGroupGF3 .. warning:: This list is under development, so may not be exhaustive. """ def __repr__(self): r""" A message about the purpose of this object. TESTS:: sage: groups   # indirect doctest Object collecting examples of graphs, try "groups." """ return 'Object collecting examples of graphs, try "groups."' def CyclicGroupPermutationGroup(self, n): r""" A cyclic group as a permutation group. INPUT: - n - a positive integer, the size of the group. OUTPUT: A cyclic group of order n as a permutation group of size n. EXAMPLES:: sage: G = groups.CyclicGroupPermutationGroup(4) sage: G.list() [(), (1,2,3,4), (1,3)(2,4), (1,4,3,2)] For further documentation, see :meth:~sage.groups.perm_gps.permgroup_named.CyclicPermutationGroup. """ import sage.groups.perm_gps.permgroup_named return sage.groups.perm_gps.permgroup_named.CyclicPermutationGroup(n) def MathieuPermutationGroup(self, degree): r""" Returns a Mathieu group as a permutation group. INPUT: - degree - the number of symbols in the ambient symmetric group.  Allowable values are 9, 10, 11, 12, 21, 22, 23, and 24. OUTPUT: A Mathieu group, as a permutation of the integers 1 through degree. EXAMPLES: M_{22} is simple and 3-transitive.  :: sage: G = groups.MathieuPermutationGroup(22) sage: G.is_simple() True sage: S1 = G.stabilizer(1) sage: S1.orbits() [[1], [2, 7, 15, 3, 17, 13, 10, 4, 22, 19, 14, 11, 20, 21, 8, 6, 9, 12, 18, 16, 5]] sage: S2 = S1.stabilizer(2) sage: S2.orbits() [[1], [2], [3, 14, 22, 17, 4, 10, 13, 11, 9, 6, 5, 16, 18, 12, 8, 7, 15, 21, 20, 19]] sage: S3 = S2.stabilizer(3) sage: S3.orbits() [[1], [2], [3], [4, 12, 22, 14, 11, 5, 21, 9, 19, 13, 8, 15, 18, 17, 6, 16], [7, 10, 20]] For further documentation, see :meth:~sage.groups.perm_gps.permgroup_named.MathieuGroup. """ import sage.groups.perm_gps.permgroup_named return sage.groups.perm_gps.permgroup_named.MathieuGroup(degree) def QuaternionMatrixGroupGF3(self): r""" The quaternion group as a set of 2\times 2 matrices over GF(3). OUTPUT: A matrix group consisting of 2\times 2 matrices with elements from the finite field of order 3.  The group is the quaternion group, the nonabelian group of order 8 that is not isomorphic to the group of symmetries of a square (the dihedral group D_4). EXAMPLES: The generators are the matrix representations of the elements commonly called I and J, while K is the product of I and J. :: sage: Q = groups.QuaternionMatrixGroupGF3() sage: Q.order() 8 sage: aye = Q.gens()[0]; aye [1 1] [1 2] sage: jay = Q.gens()[1]; jay [2 1] [1 1] sage: kay = aye*jay; kay [0 2] [1 0] TESTS:: sage: Q = groups.QuaternionMatrixGroupGF3() sage: QP = Q.as_permutation_group() sage: QP.is_isomorphic(groups.QuaternionPermutationGroup()) True sage: H = DihedralGroup(4) sage: H.order() 8 sage: QP.is_abelian(), H.is_abelian() (False, False) sage: QP.is_isomorphic(H) False """ from sage.rings.finite_rings.constructor import FiniteField from sage.matrix.matrix_space import MatrixSpace from sage.groups.matrix_gps.matrix_group import MatrixGroup MS = MatrixSpace(FiniteField(3), 2) aye = MS([1,1,1,2]) jay = MS([2,1,1,1]) return MatrixGroup([aye, jay]) def QuaternionPermutationGroup(self): r""" The quaternion group as a set of permutations in S_8. OUTPUT: A group of permutations on the symbols 1 to 8 that is the nonabelian group of order 8 that is not isomorphic to the group of symmetries of a square (the dihedral group D_4). EXAMPLES:: sage: G = groups.QuaternionPermutationGroup() sage: G.degree() 8 sage: G.order() 8 sage: sorted([x.order() for x in G]) [1, 2, 4, 4, 4, 4, 4, 4] """ import sage.groups.perm_gps.permgroup_named return sage.groups.perm_gps.permgroup_named.QuaternionGroup() # This is the object available in the global namespace groups = GroupGenerators() No newline at end of file