Ticket #3683: 10129.patch

File 10129.patch, 6.2 KB (added by wdj, 13 years ago)

based on 3.1.alpha0

  • sage/groups/matrix_gps/matrix_group.py

    # HG changeset patch
    # User David Joyner <wdjoyner@gmail.com>
    # Date 1218565838 14400
    # Node ID 6417e6c84a2a6f4851d87a7702a6257624ec8f13
    # Parent  a4b82d791cfbdc8cf726c64ee3438f3c9a4cf6ed
    aded examples to docstrings- wdj
    
    diff -r a4b82d791cfb -r 6417e6c84a2a sage/groups/matrix_gps/matrix_group.py
    a b  
    637637
    638638    def as_permutation_group(self, method =None):
    639639        r"""
     640        This returns a permutation group representation for the group. In most cases
     641        occurring in practice, this is a permutation group of minimal degree (the degree
     642        begin determined from orbits under the group action). When these orbits are hard to
     643        compute, the procedure can be time-consuming and the degree may not be minimal.
     644        The "method=smaller" option tries return an isomorphic group of lower degree.
     645
    640646        EXAMPLES:
    641             sage: F = GF(7); MS = MatrixSpace(F,2,2)
    642             sage: gens = [MS([[0,1],[-1,0]]),MS([[1,1],[2,3]])]
    643             sage: G = MatrixGroup(gens)
     647            sage: MS = MatrixSpace( GF(2), 5, 5)
     648            sage: A = MS([[0,0,0,0,1],[0,0,0,1,0],[0,0,1,0,0],[0,1,0,0,0],[1,0,0,0,0]])
     649            sage: G = MatrixGroup([A])
    644650            sage: G.as_permutation_group()
    645             Permutation Group with generators [(1,2,4,8)(3,6,9,16)(5,10,15,25)(7,13,17,28)(11,19,26,37)(12,21,27,20)(14,24,29,18)(22,32,38,47)(23,34,39,33)(30,40,36,45)(31,42,46,41)(35,44,48,43), (1,3,7,14,4,9,17,29)(2,5,11,20,8,15,26,21)(6,12,22,33,16,27,38,34)(10,18,30,41,25,24,36,42)(13,23,35,40,28,39,48,45)(19,31,43,47,37,46,44,32)]
    646             sage: G.as_permutation_group(method="smaller")
    647             Permutation Group with generators [(1,2,4,8)(3,6,9,16)(5,10,15,25)(7,13,17,28)(11,19,26,37)(12,21,27,20)(14,24,29,18)(22,32,38,47)(23,34,39,33)(30,40,36,45)(31,42,46,41)(35,44,48,43), (1,3,7,14,4,9,17,29)(2,5,11,20,8,15,26,21)(6,12,22,33,16,27,38,34)(10,18,30,41,25,24,36,42)(13,23,35,40,28,39,48,45)(19,31,43,47,37,46,44,32)]
     651            Permutation Group with generators [(1,2)]
     652            sage: MS = MatrixSpace( GF(7), 12, 12)
     653            sage: GG = gap("ImfMatrixGroup( 12, 3 )")
     654            sage: GG.GeneratorsOfGroup().Length()
     655            3
     656            sage: g1 = MS(eval(str(GG.GeneratorsOfGroup()[1]).replace("\n","")))
     657            sage: g2 = MS(eval(str(GG.GeneratorsOfGroup()[2]).replace("\n","")))
     658            sage: g3 = MS(eval(str(GG.GeneratorsOfGroup()[3]).replace("\n","")))
     659            sage: G = MatrixGroup([g1, g2, g3])
     660            sage: G.order()
     661            21499084800
     662            sage: current_randstate().set_seed_gap() 
     663            sage: G.as_permutation_group()                      # random output 
     664            Permutation Group with generators [(1,2)(3,7,13,25,45,5,10,19,35,57)(8,16,31,56,87,11,22,41,71,91)(14,28,51,81,46,20,38,66,98,61)(17,33,59,39,69,23,43,73,29,54)(26,48,77,49,79,36,63,94,64,96)(52,83,108,123,102,67,84,110,126,88)(112,129,139,121,127,116,132,141,114,124), (1,3,8,17)(2,5,11,23)(7,14,29,48)(10,20,39,63)(13,26,49,69)(19,36,64,54)(25,46,31,57)(28,52,84,94)(35,61,41,45)(38,67,83,77)(51,59,91,116)(56,88,114,96)(66,73,87,112)(71,102,121,79)(108,124,110,127), (1,4)(2,6)(3,9)(5,12)(7,15)(8,18)(10,21)(11,24)(13,27)(14,30)(16,32)(17,34)(19,37)(20,40)(22,42)(23,44)(25,47)(26,50)(28,53)(29,55)(31,58)(33,60)(35,62)(36,65)(38,68)(39,70)(41,72)(43,74)(45,75)(46,76)(48,78)(49,80)(51,82)(52,85)(54,86)(56,89)(57,90)(59,92)(61,93)(63,95)(64,97)(66,99)(67,100)(69,101)(71,103)(73,104)(77,105)(79,106)(81,107)(83,109)(84,111)(87,113)(88,115)(91,117)(94,118)(96,119)(98,120)(102,122)(108,125)(110,128)(112,130)(114,131)(116,133)(121,134)(123,135)(124,136)(126,137)(127,138)(129,140)(132,142)(139,143)(141,144)]
     665            sage: G.as_permutation_group(method="smaller")          # random output
     666            Permutation Group with generators [(1,2)(3,7,13,25,45,5,10,19,35,60)(8,16,30,52,65,11,22,40,67,50)(14,23,43,72,53,20,17,33,57,68)(26,48,61,87,28,36,63,46,75,38)(31,55,73,96,103,41,70,58,84,99)(78,90), (1,3,8,17)(2,5,11,23)(7,14,28,50)(10,20,38,65)(13,26,16,31)(19,36,22,41)(25,46)(30,53)(33,58)(35,61)(40,68)(43,73)(45,75,99,70)(48,78,57,84)(52,67)(55,60,87,103)(63,90,72,96), (1,4)(2,6)(3,9)(5,12)(7,15)(8,18)(10,21)(11,24)(13,27)(14,29)(16,32)(17,34)(19,37)(20,39)(22,42)(23,44)(25,47)(26,49)(28,51)(30,54)(31,56)(33,59)(35,62)(36,64)(38,66)(40,69)(41,71)(43,74)(45,76)(46,77)(48,79)(50,80)(52,81)(53,82)(55,83)(57,85)(58,86)(60,88)(61,89)(63,91)(65,92)(67,93)(68,94)(70,95)(72,97)(73,98)(75,100)(78,101)(84,102)(87,104)(90,105)(96,106)(99,107)(103,108)]
    648667
    649         Sometimes the "smaller" option will return an isomorphic group of lower degree.
     668        In this case, the "smaller" option returned an isomorphic group of lower degree.
     669        The above example used GAP's library of irreducible maximal finite ("imf") integer matrix
     670        groups to construct the MatrixGroup G over GF(7). The section "Irreducible Maximal Finite
     671        Integral Matrix Groups" in the GAP reference manual has more details.
    650672        """       
    651673        from sage.groups.perm_gps.permgroup import PermutationGroup
    652674        F = self.base_ring()
     
    666688        gap.eval("M:=GModuleByMats("+mats_str+", GF("+str(q)+"))")
    667689        gap.eval("iso:=IsomorphismPermGroup(Group("+mats_str+"))")
    668690        C = gap("Image( iso )")
    669         if method == "smallest":
     691        if method == "smaller":
    670692            gap.eval("small:= SmallerDegreePermutationRepresentation( Image( iso ) );")
    671693            C = gap("Image( small )")
    672694        return PermutationGroup(C, from_group = True)
     
    678700        returns more information, but in Meataxe notation.
    679701
    680702        EXAMPLES:
     703            sage: F=GF(3);MS=MatrixSpace(F,4,4)
     704            sage: M=MS(0)
     705            sage: M[0,1]=1;M[1,2]=1;M[2,3]=1;M[3,0]=1
     706            sage: G = MatrixGroup([M])
     707            sage: G.module_composition_factors()
     708            [[Finite Field of size 3, 1, True],
     709             [Finite Field of size 3, 1, True],
     710             [Finite Field of size 3, 2, True]]
    681711            sage: F = GF(7); MS = MatrixSpace(F,2,2)
    682712            sage: gens = [MS([[0,1],[-1,0]]),MS([[1,1],[2,3]])]
    683713            sage: G = MatrixGroup(gens)