Changeset 6218:13d465b1abc8


Ignore:
Timestamp:
09/06/07 13:10:45 (6 years ago)
Author:
Robert Bradshaw <robertwb@…>
Branch:
default
Message:

fix permgroup_element.word_problem() to coerce self into group generated by words

Location:
sage/groups/perm_gps
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sage/groups/perm_gps/cubegroup.py

    r6217 r6218  
    1111          Products of moves are read {\it right to left}, so for example, 
    1212          R*U means move U first and then R. 
     13           
     14See \code{CubeGroup.parse()} for all possible input notations.  
    1315           
    1416The "Singmaster notation":  
     
    10651067        soln = hom.PreImagesRepresentative(gap(str(g))) 
    10661068        # print soln 
    1067         sol1 = str(soln).replace("x1","B") 
    1068         sol2 = sol1.replace("x2","D") 
    1069         sol3 = sol2.replace("x3","F") 
    1070         sol4 = sol3.replace("x4","L") 
    1071         sol5 = sol4.replace("x5","R") 
    1072         sol6 = sol5.replace("x6","U") 
    1073         return sol6 
    1074  
     1069        sol = str(soln) 
     1070        names = self.gen_names() 
     1071        for i in range(6): 
     1072            sol = sol.replace("x%s" % (i+1), names[i]) 
     1073        return sol 
    10751074 
    10761075 
  • sage/groups/perm_gps/permgroup_element.py

    r5489 r6218  
    535535        from sage.groups.perm_gps.permgroup import PermutationGroup 
    536536        from sage.interfaces.all import gap 
    537         G = g.parent() 
    538         #print G 
    539         gap.eval("l:=One(Rationals)") 
    540         s1 = "gens := GeneratorsOfGroup(%s)"%G._gap_init_() 
    541         #print s1 
    542         gap.eval(s1) 
    543         s2 = "g0:=%s; gensH:=%s"%(gap(g),words) 
    544         gap.eval(s2) 
    545         s3 = 'G:=Group(gens); H:=Group(gensH)' 
    546         #print s3 
    547         gap.eval(s3) 
    548         phi = gap.eval("hom:=EpimorphismFromFreeGroup(G)") 
    549         #print phi 
    550         l1 = gap.eval("ans:=PreImagesRepresentative(hom,g0)") 
     537         
     538        G = gap(words[0].parent()) 
     539        g = words[0].parent()(g) 
     540        gensH = gap(words) 
     541        H = gensH.Group() 
     542        hom = G.EpimorphismFromFreeGroup() 
     543        ans = hom.PreImagesRepresentative(gap(g)) 
     544         
     545        l1 = str(ans) 
    551546        l2 = copy.copy(l1) 
    552547        l4 = [] 
     
    554549        for i in range(1,len(words)+1): 
    555550            l2 = l2.replace("x"+str(i),str(words[i-1])) 
     551 
    556552        if display: 
    557553            for i in range(len(l3)):    ## parsing the word for display 
Note: See TracChangeset for help on using the changeset viewer.