Hi,
I'm doing some work with groups. Using gap.Image() I can get a
permutation like this:
sage: x
(1,2)(3,7)(4,6)(5,8)
But to make a permutation group out of this element I have to enclose
the x in two sets of brackets:
sage: PermutationGroup([[x]])
Permutation Group with generators [(1,2)(3,7)(4,6)(5,8)]
On the other hand, the following command fails (see below for code and output):
sage: PermutationGroup([x])
In my mind the second version is clearer - x is a permutation so [x]
is a list of permutations and I should be able to use that to get a
group.
Should SAGE do a coercion here, or am I doing something in a strange way?
Code and output:
----------------------------------------------------------------------
| SAGE Version 2.8.11, Release Date: 2007-11-02 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: p = 2
sage: assert is_prime(p)
sage:
sage: F = gap.new("FreeGroup(3)")
sage:
sage: a = F.gen(1)
sage: b = F.gen(2)
sage: c = F.gen(3)
sage:
sage: rels = []
sage: rels.append( a**Integer(p) )
sage: rels.append( b**Integer(p) )
sage: rels.append( c**Integer(p) )
sage: rels.append( a*b*((b*a*c)**Integer(-1)) )
sage: rels.append( c*a*((a*c)**Integer(-1)) )
sage: rels.append( c*b*((b*c)**Integer(-1)) )
sage:
sage: N = gap.NormalClosure(F, gap.Subgroup(F, rels))
sage: niso = gap.NaturalHomomorphismByNormalSubgroupNC(F, N)
sage:
sage: x = gap.Image(niso, a)
sage: x
(1,2)(3,7)(4,6)(5,8)
sage: PermutationGroup([[x]])
Permutation Group with generators [(1,2)(3,7)(4,6)(5,8)]
sage:
sage: PermutationGroup([x])
---------------------------------------------------------------------------
<type 'exceptions.TypeError'> Traceback (most recent call last)
/home/carlo/<ipython console> in <module>()
/home/carlo/sage-source-current/local/lib/python2.5/site-packages/sage/groups/perm_gps/permgroup.py
in PermutationGroup(x, from_group, check)
167 if not is_ExpectElement(x) and hasattr(x, '_permgroup_'):
168 return x._permgroup_()
--> 169 return PermutationGroup_generic(x, from_group, check)
170
171
/home/carlo/sage-source-current/local/lib/python2.5/site-packages/sage/groups/perm_gps/permgroup.py
in __init__(self, gens, from_group, check)
212 elif not isinstance(gens, list):
213 raise TypeError, "gens must be a tuple or list"
--> 214 gens = [gap_format(x) for x in gens]
215
216 cmd = 'Group(%s)'%gens
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---