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

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

# HG changeset patch
# User Rob Beezer <beezer@ups.edu>
# Date 1343874646 18000
# Node ID 53017b97aba5e6f9dfe7f7753ba2baf0fdf58f55
13115: group catalog module 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/groups_catalog sage/groups/group sage/groups/generic sage/groups/abelian_gps/abelian_group sage/groups/matrix_gps/orthogonal sage/groups/matrix_gps/symplectic sage/groups/matrix_gps/unitary sage/groups/misc_gps/misc_groups
• 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 * import groups_catalog as groups
• new file sage/groups/groups_catalog.py

diff --git a/sage/groups/groups_catalog.py b/sage/groups/groups_catalog.py
new file mode 100644
 - r""" Examples of Groups The groups object may be used to access examples of various groups. Using tab-completion on this object is an easy way to discover and quickly create the groups that are available (as listed here). Let  indicate pressing the tab key.  So begin by typing groups. to the see primary divisions, followed by (for example) groups.matrix. to access various groups implemented as sets of matrices. - Permutation Groups  (groups.permutation.) - :class:groups.permutation.Symmetric  - :class:groups.permutation.Alternating  - :class:groups.permutation.KleinFour  - :class:groups.permutation.Quaternion  - :class:groups.permutation.Cyclic  - :class:groups.permutation.Dihedral  - :class:groups.permutation.DiCyclic  - :class:groups.permutation.Mathieu  - :class:groups.permutation.Suzuki  - :class:groups.permutation.PGL  - :class:groups.permutation.PSL  - :class:groups.permutation.PSp  - :class:groups.permutation.PSU  - :class:groups.permutation.PGU  - :class:groups.permutation.Transitive  - :class:groups.permutation.RubiksCube  - Matrix Groups (groups.matrix.) - :func:groups.matrix.QuaternionGF3  - :func:groups.matrix.GL  - :func:groups.matrix.SL  - :func:groups.matrix.Sp  - :func:groups.matrix.GU  - :func:groups.matrix.SU  - :func:groups.matrix.GO  - :func:groups.matrix.SO  - Miscellaneous Groups (groups.misc.) """ # Implementation notes: # #   With this  groups_catalog.py  module imported as #   "groups" in all.py then  groups.  is available # #   "catalog" modules are made available #   as groups.matrix, etc by imports below # #   Do not use this file for code # #   Please keep this top-level clean, use #   groups.misc for one-off examples # #   Candidates for new primary divisions: #       groups.sporadic - 26 sporadic groups #       groups.misc - one-off stuff (implemented, but empty) #       groups.presentation - free groups with relations #       groups.symmetries - permutation groups of regular solids, or similar from sage.groups.matrix_gps import matrix_groups_catalog as matrix from sage.groups.perm_gps import permutation_groups_catalog as permutation from sage.groups.misc_gps import misc_groups_catalog as misc
• sage/groups/matrix_gps/general_linear.py

diff --git a/sage/groups/matrix_gps/general_linear.py b/sage/groups/matrix_gps/general_linear.py
 a Return the general linear group of degree n over the ring R. .. note:: This group is also available via groups.matrix.GL(). EXAMPLES:: sage: G = GL(6,GF(5)) [2 1] [2 0] ] TESTS:: sage: groups.matrix.GL(2, 3) General Linear Group of degree 2 over Finite Field of size 3 """ if isinstance(R, (int, long, Integer)): R = FiniteField(R, var)
• new file sage/groups/matrix_gps/matrix_groups_catalog.py

diff --git a/sage/groups/matrix_gps/matrix_groups_catalog.py b/sage/groups/matrix_gps/matrix_groups_catalog.py
new file mode 100644
 - r""" Type groups.matrix. to access examples of groups implemented as permutation groups. """ # groups imported here will be available # via  groups.matrix. # # Do not use this file for code # # If you import a new group, then add an # entry to the list in the module-level # docstring of groups/groups_catalog.py from general_linear import GL from special_linear import SL from symplectic import Sp from unitary import SU, GU from orthogonal import SO, GO from sage.groups.misc_gps.misc_groups import QuaternionMatrixGroupGF3 as QuaternionGF3
• sage/groups/matrix_gps/orthogonal.py

diff --git a/sage/groups/matrix_gps/orthogonal.py b/sage/groups/matrix_gps/orthogonal.py
 a depending on the invariant form .. note:: This group is also available via groups.matrix.SO(). EXAMPLES:: sage: G = SO(3,GF(5)) sage: G.as_matrix_group() Matrix group over Finite Field of size 5 with 3 generators: [[[2, 0, 0], [0, 3, 0], [0, 0, 1]], [[3, 2, 3], [0, 2, 0], [0, 3, 1]], [[1, 4, 4], [4, 0, 0], [2, 0, 4]]] TESTS:: sage: groups.matrix.SO(2, 3, e=1) Special Orthogonal Group of degree 2, form parameter 1, over the Finite Field of size 3 """ if isinstance(R, (int, long, Integer)): R = FiniteField(R, var) """ Return the general orthogonal group. .. note:: This group is also available via groups.matrix.GO(). EXAMPLES: TESTS:: sage: groups.matrix.GO(2, 3, e=-1) General Orthogonal Group of degree 2, form parameter -1, over the Finite Field of size 3 """ if n%2!=0 and e!=0: raise ValueError, "if e = 0, then n must be even."
• sage/groups/matrix_gps/special_linear.py

diff --git a/sage/groups/matrix_gps/special_linear.py b/sage/groups/matrix_gps/special_linear.py
 a Return the special linear group of degree n over the ring R. .. note:: This group is also available via groups.matrix.SL(). EXAMPLES:: sage: SL(3,GF(2)) ] sage: TestSuite(G).run() TESTS:: sage: groups.matrix.SL(2, 3) Special Linear Group of degree 2 over Finite Field of size 3 """ if isinstance(R, (int, long, Integer)): R = FiniteField(R, var)
• sage/groups/matrix_gps/symplectic.py

diff --git a/sage/groups/matrix_gps/symplectic.py b/sage/groups/matrix_gps/symplectic.py
 a """ Return the symplectic group of degree n over R. .. note:: This group is also available via groups.matrix.Sp(). EXAMPLES:: sage: Sp(4,5) Traceback (most recent call last): ... ValueError: the degree n (=3) must be even TESTS:: sage: groups.matrix.Sp(2, 3) Symplectic Group of rank 1 over Finite Field of size 3 """ if n%2!=0: raise ValueError, "the degree n (=%s) must be even"%n
• sage/groups/matrix_gps/unitary.py

diff --git a/sage/groups/matrix_gps/unitary.py b/sage/groups/matrix_gps/unitary.py
 a quadratic extension of F, if needed. .. note:: This group is also available via groups.matrix.GU(). EXAMPLES:: sage: G = GU(3,GF(7)); G [     4      4      0] [     1      0      0] ] TESTS:: sage: groups.matrix.GU(2, 3) General Unitary Group of degree 2 over Finite Field of size 3 """ if isinstance(F, (int, long, Integer)): F = GF(F,var) Return the special unitary group of degree n over F. .. note:: This group is also available via groups.matrix.SU(). EXAMPLES:: sage: SU(3,5) Traceback (most recent call last): ... NotImplementedError: special unitary group only implemented over finite fields TESTS:: sage: groups.matrix.SU(2, 3) Special Unitary Group of degree 2 over Finite Field of size 3 """ if isinstance(F, (int, long, Integer)): F = GF(F,var)
• new file sage/groups/misc_gps/misc_groups.py

diff --git a/sage/groups/misc_gps/__init__.py b/sage/groups/misc_gps/__init__.py
new file mode 100644
diff --git a/sage/groups/misc_gps/misc_groups.py b/sage/groups/misc_gps/misc_groups.py
new file mode 100644
 - r""" Miscellaneous Groups This is a collection of groups that may not fit into some of the other infinite families described elsewhere. """ # Implementation note: #     When adding a group here make an entry #     in the  misc_groups_catalog.py module #     or a more closely-related catalog module def QuaternionMatrixGroupGF3(): 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). .. note:: This group is most easily available via groups.matrix.QuaternionGF3(). 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: from sage.groups.misc_gps.misc_groups import QuaternionMatrixGroupGF3 sage: Q = 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: groups.matrix.QuaternionGF3() Matrix group over Finite Field of size 3 with 2 generators: [[[1, 1], [1, 2]], [[2, 1], [1, 1]]] sage: Q = QuaternionMatrixGroupGF3() sage: QP = Q.as_permutation_group() sage: QP.is_isomorphic(QuaternionGroup()) 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])
• new file sage/groups/misc_gps/misc_groups_catalog.py

diff --git a/sage/groups/misc_gps/misc_groups_catalog.py b/sage/groups/misc_gps/misc_groups_catalog.py
new file mode 100644
 - r""" Type groups.misc. to access examples of various groups not listed elsewhere. """ # groups imported here will be available # via  groups.misc. # # Do not use this file for code # # If you import a new group, then add an # entry to the list in the module-level # docstring of groups/groups_catalog.py
• sage/groups/perm_gps/cubegroup.py

diff --git a/sage/groups/perm_gps/cubegroup.py b/sage/groups/perm_gps/cubegroup.py
 a """ A python class to help compute Rubik's cube group actions. .. note:: This group is also available via groups.permutation.RubiksCube(). EXAMPLES: If G denotes the cube group then it may be regarded as a subgroup of SymmetricGroup(48), where the 48 facets are labeled as follows. The PermutationGroup of all legal moves of the Rubik's cube. sage: print rubik The Rubik's cube group with generators R,L,F,B,U,D in SymmetricGroup(48). TESTS:: sage: groups.permutation.RubiksCube() The PermutationGroup of all legal moves of the Rubik's cube. """ def __init__(self): U = "( 1, 3, 8, 6)( 2, 5, 7, 4)( 9,33,25,17)(10,34,26,18)(11,35,27,19)" ## U = top
• sage/groups/perm_gps/permgroup_named.py

diff --git a/sage/groups/perm_gps/permgroup_named.py b/sage/groups/perm_gps/permgroup_named.py
 a - n - a positive integer, or list or tuple thereof .. note:: This group is also available via groups.permutation.Symmetric(). EXAMPLES:: sage: G = SymmetricGroup(8) TESTS:: sage: TestSuite(SymmetricGroup(0)).run() sage: groups.permutation.Symmetric(4) Symmetric group of order 4! as a permutation group """ from sage.categories.finite_weyl_groups import FiniteWeylGroups from sage.categories.finite_permutation_groups import FinitePermutationGroups n -- a positive integer, or list or tuple thereof .. note:: This group is also available via groups.permutation.Alternating(). EXAMPLES:: sage: G = AlternatingGroup(6) sage: G.category() Category of finite permutation groups sage: TestSuite(G).run() TESTS:: sage: groups.permutation.Alternating(6) Alternating group of order 6!/2 as a permutation group """ PermutationGroup_symalt.__init__(self, gap_group='AlternatingGroup(%s)'%len(domain), domain=domain) INPUT: n -- a positive integer .. note:: This group is also available via groups.permutation.Cyclic(). EXAMPLES:: sage: G = CyclicPermutationGroup(8) sage: C = CyclicPermutationGroup(10) sage: C.as_AbelianGroup() Multiplicative Abelian Group isomorphic to C2 x C5 TESTS:: sage: groups.permutation.Cyclic(6) Cyclic group of order 6 as a permutation group """ n = Integer(n) if n < 1: i+1 and code a^{i}x as the symbol 2n+i+1.  The two generators are then represented using a left regular representation. .. note:: This group is also available via groups.permutation.DiCyclic(). EXAMPLES: A dicyclic group of order 384, with a large power of 2 as a divisor:: sage: G.is_isomorphic(H) or G.is_isomorphic(K) False TESTS:: sage: groups.permutation.DiCyclic(6) Diyclic group of order 24 as a permutation group REFERENCES: .. [CONRAD2009] Groups of order 12 OUTPUT: -- the Klein 4 group of order 4, as a permutation group of degree 4. .. note:: This group is also available via groups.permutation.KleinFour(). EXAMPLES: sage: G = KleinFourGroup(); G The Klein 4 group of order 4, as a permutation group Category of finite permutation groups sage: TestSuite(G).run() sage: groups.permutation.KleinFour() The Klein 4 group of order 4, as a permutation group AUTHOR: -- Bobby Moretti (2006-10) """ See the DiCyclicGroup class for a generalization of this construction. .. note:: This group is also available via groups.permutation.Quaternion(). EXAMPLES: The quaternion group is one of two non-abelian groups of order 8, sage: neg_one in Q.center() True TESTS:: sage: groups.permutation.Quaternion() Quaternion group of order 8 as a permutation group AUTHOR: -- Rob Beezer (2009-10-09) """ OUTPUT: -- the dihedral group of order 2*n, as a permutation group .. note:: This group is also available via groups.permutation.Dihedral(). EXAMPLES: sage: DihedralGroup(1) Dihedral group of order 2 as a permutation group sage: G.category() Category of finite permutation groups sage: TestSuite(G).run() sage: groups.permutation.Dihedral(6) Dihedral group of order 12 as a permutation group """ n = Integer(n) if n <= 0: OUTPUT: -- the Mathieu group of degree n, as a permutation group .. note:: This group is also available via groups.permutation.Mathieu(). EXAMPLES:: sage: G = MathieuGroup(12) Category of finite permutation groups sage: TestSuite(G).run(skip=["_test_enumerated_set_contains", "_test_enumerated_set_iter_list"]) sage: groups.permutation.Mathieu(9) Mathieu group of degree 9 and order 72 as a permutation group Note: this is a fairly big group, so we skip some tests that currently require to list all the elements of the group, because there is no proper iterator yet. OUTPUT: the n-th transitive group of degree d .. note:: This group is also available via groups.permutation.Transitive(). EXAMPLES:: sage: TransitiveGroup(0,1) TESTS:: sage: groups.permutation.Transitive(1, 1) Transitive group number 1 of degree 1 sage: TestSuite(TransitiveGroup(0,1)).run() sage: TestSuite(TransitiveGroup(1,1)).run() sage: TestSuite(TransitiveGroup(5,2)).run()# requires optional database_gap OUTPUT: PGL(n,q) .. note:: This group is also available via groups.permutation.PGL(). EXAMPLES: sage: G = PGL(2,3); G Permutation Group with generators [(3,4), (1,2,4)] sage: G.category() Category of finite permutation groups sage: TestSuite(G).run() TESTS:: sage: groups.permutation.PGL(2, 3) Permutation Group with generators [(3,4), (1,2,4)] """ id = 'Group([()])' if n == 1 else 'PGL(%s,%s)'%(n,q) PermutationGroup_generic.__init__(self, gap_group=id) OUTPUT: PSL(n,q) .. note:: This group is also available via groups.permutation.PSL(). EXAMPLES: sage: G = PSL(2,3); G Permutation Group with generators [(2,3,4), (1,2)(3,4)] sage: G.category() Category of finite permutation groups sage: TestSuite(G).run() TESTS:: sage: groups.permutation.PSL(2, 3) Permutation Group with generators [(2,3,4), (1,2)(3,4)] """ if n == 1: id = 'Group([()])' OUTPUT: PSp(n,q) .. note:: This group is also available via groups.permutation.PSp(). EXAMPLES: sage: G = PSp(2,3); G Permutation Group with generators [(2,3,4), (1,2)(3,4)] Permutation Group with generators [(3,8,6,4,9,7,5), (1,2,3)(4,7,5)(6,9,8)] sage: G.base_ring() Finite Field in alpha of size 2^3 TESTS:: sage: groups.permutation.PSp(2, 3) Permutation Group with generators [(2,3,4), (1,2)(3,4)] """ if n%2 == 1: raise TypeError, "The degree n must be even" OUTPUT: PSU(n,q) .. note:: This group is also available via groups.permutation.PSU(). EXAMPLES: sage: PSU(2,3) The projective special unitary group of degree 2 over Finite Field of size 3 The projective special unitary group of degree 2 over Finite Field in alpha of size 2^3 sage: G.base_ring() Finite Field in alpha of size 2^3 TESTS:: sage: groups.permutation.PSU(2, 3) The projective special unitary group of degree 2 over Finite Field of size 3 """ id = 'PSU(%s,%s)'%(n,q) PermutationGroup_generic.__init__(self, gap_group=id) OUTPUT: PGU(n,q) .. note:: This group is also available via groups.permutation.PGU(). EXAMPLES: sage: PGU(2,3) The projective general unitary group of degree 2 over Finite Field of size 3 The projective general unitary group of degree 2 over Finite Field in alpha of size 2^3 sage: G.base_ring() Finite Field in alpha of size 2^3 TESTS:: sage: groups.permutation.PGU(2, 3) The projective general unitary group of degree 2 over Finite Field of size 3 """ id = 'PGU(%s,%s)'%(n,q) PermutationGroup_generic.__init__(self, gap_group=id) - A Suzuki group. .. note:: This group is also available via groups.permutation.Suzuki(). EXAMPLES:: sage: SuzukiGroup(8) Permutation Group with generators [(1,2)(3,10)(4,42)(5,18)(6,50)(7,26)(8,58)(9,34)(12,28)(13,45)(14,44)(15,23)(16,31)(17,21)(19,39)(20,38)(22,25)(24,61)(27,60)(29,65)(30,55)(32,33)(35,52)(36,49)(37,59)(40,54)(41,62)(43,53)(46,48)(47,56)(51,63)(57,64), (1,28,10,44)(3,50,11,42)(4,43,53,64)(5,9,39,52)(6,36,63,13)(7,51,60,57)(8,33,37,16)(12,24,55,29)(14,30,48,47)(15,19,61,54)(17,59,22,62)(18,23,34,31)(20,38,49,25)(21,26,45,58)(27,32,41,65)(35,46,40,56)] Permutation Group with generators [(1,2)(3,10)(4,42)(5,18)(6,50)(7,26)(8,58)(9,34)(12,28)(13,45)(14,44)(15,23)(16,31)(17,21)(19,39)(20,38)(22,25)(24,61)(27,60)(29,65)(30,55)(32,33)(35,52)(36,49)(37,59)(40,54)(41,62)(43,53)(46,48)(47,56)(51,63)(57,64), (1,28,10,44)(3,50,11,42)(4,43,53,64)(5,9,39,52)(6,36,63,13)(7,51,60,57)(8,33,37,16)(12,24,55,29)(14,30,48,47)(15,19,61,54)(17,59,22,62)(18,23,34,31)(20,38,49,25)(21,26,45,58)(27,32,41,65)(35,46,40,56)] sage: print SuzukiGroup(8) The Suzuki group over Finite Field in a of size 2^3 sage: G.base_ring() Finite Field in alpha of size 2^5 TESTS:: sage: groups.permutation.Suzuki(8) Permutation Group with generators [(1,2)(3,10)(4,42)(5,18)(6,50)(7,26)(8,58)(9,34)(12,28)(13,45)(14,44)(15,23)(16,31)(17,21)(19,39)(20,38)(22,25)(24,61)(27,60)(29,65)(30,55)(32,33)(35,52)(36,49)(37,59)(40,54)(41,62)(43,53)(46,48)(47,56)(51,63)(57,64), (1,28,10,44)(3,50,11,42)(4,43,53,64)(5,9,39,52)(6,36,63,13)(7,51,60,57)(8,33,37,16)(12,24,55,29)(14,30,48,47)(15,19,61,54)(17,59,22,62)(18,23,34,31)(20,38,49,25)(21,26,45,58)(27,32,41,65)(35,46,40,56)] REFERENCES: -  http://en.wikipedia.org/wiki/Group_of_Lie_type\#Suzuki-Ree_groups
• new file sage/groups/perm_gps/permutation_groups_catalog.py

diff --git a/sage/groups/perm_gps/permutation_groups_catalog.py b/sage/groups/perm_gps/permutation_groups_catalog.py
new file mode 100644
 - r""" Type groups.permutation. to access examples of groups implemented as permutation groups. """ # groups imported here will be available # via  groups.permutation. # # Do not use this file for code # # If you import a new group, then add an # entry to the list in the module-level # docstring of groups/groups_catalog.py from permgroup_named import KleinFourGroup as KleinFour from permgroup_named import QuaternionGroup as Quaternion from permgroup_named import SymmetricGroup as Symmetric from permgroup_named import AlternatingGroup as Alternating from permgroup_named import CyclicPermutationGroup as Cyclic from permgroup_named import DihedralGroup as Dihedral from permgroup_named import DiCyclicGroup as DiCyclic from permgroup_named import MathieuGroup as Mathieu from permgroup_named import SuzukiGroup as Suzuki from permgroup_named import (PGL, PSL, PSp,PSU,PGU,) from permgroup_named import TransitiveGroup as Transitive from cubegroup import CubeGroup as RubiksCube
• setup.py

diff --git a/setup.py b/setup.py`
 a 'sage.groups.abelian_gps', 'sage.groups.additive_abelian', 'sage.groups.matrix_gps', 'sage.groups.misc_gps', 'sage.groups.perm_gps', 'sage.groups.perm_gps.partn_ref',