Ask Your Question

Revision history [back]

In a way, everything which is possible in GAP is also possible in Sage, as Sage starts up a GAP subprocess and communicates with it. So you need not have Sage bindings for every GAP function. E.g. you can do

sage: g=SymmetricGroup(7)  
sage: gap("Orbits("+str(g._gap_())+","+str(tuples([1..7],2))+",OnTuples)")
[ [ [ 1, 1 ], [ 2, 2 ], [ 3, 3 ], [ 4, 4 ], [ 5, 5 ], [ 6, 6 ], [ 7, 7 ] ], 
[ [ 1, 2 ], [ 2, 3 ], [ 2, 1 ], [ 3, 4 ], [ 1, 3 ], [ 3, 2 ], [ 4, 5 ], 
  [ 2, 4 ], [ 4, 3 ], [ 3, 1 ], [ 5, 6 ], [ 3, 5 ], [ 1, 4 ], [ 5, 4 ], 
  [ 4, 2 ], [ 6, 7 ], [ 4, 6 ], [ 2, 5 ], [ 6, 5 ], [ 5, 3 ], [ 4, 1 ], 
  [ 7, 1 ], [ 5, 7 ], [ 3, 6 ], [ 1, 5 ], [ 7, 6 ], [ 6, 4 ], [ 5, 2 ], 
  [ 7, 2 ], [ 6, 1 ], [ 4, 7 ], [ 2, 6 ], [ 1, 7 ], [ 7, 5 ], [ 6, 3 ], 
  [ 5, 1 ], [ 6, 2 ], [ 3, 7 ], [ 1, 6 ], [ 2, 7 ], [ 7, 4 ], [ 7, 3 ] ] ]

In a way, everything which is possible in GAP is also possible in Sage, as Sage starts up a GAP subprocess and communicates with it. So you need not have Sage bindings for every GAP function. E.g. you can do

sage: g=SymmetricGroup(7)  
sage: gap("Orbits("+str(g._gap_())+","+str(tuples([1..7],2))+",OnTuples)")
[ [ [ 1, 1 ], [ 2, 2 ], [ 3, 3 ], [ 4, 4 ], [ 5, 5 ], [ 6, 6 ], [ 7, 7 ] ], 
[ [ 1, 2 ], [ 2, 3 ], [ 2, 1 ], [ 3, 4 ], [ 1, 3 ], [ 3, 2 ], [ 4, 5 ], 
  [ 2, 4 ], [ 4, 3 ], [ 3, 1 ], [ 5, 6 ], [ 3, 5 ], [ 1, 4 ], [ 5, 4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