On Sun, 07 Jan 2007 22:30:22 -0800, David Kohel <[EMAIL PROTECTED]> wrote:
Hi David J et al., There are two "natural" representations for permutations, cycles, and enumerated lists of images (or indices). In addition to this constructor: sage: G = SymmetricGroup(14) sage: G = SymmetricGroup(4) sage: g = G("(1,2,3,4)") sage: g(1) 2 sage: [ g(i+1) for i in range(4) ] [2, 3, 4, 1] it would be nice to be able to go sage: G([2,3,4,1]) (1,2,3,4) This representation at least can be represented in Python syntax, whereas the other constructor for permutations must be passed to GAP as a string. Does GAP have a similar constructor and conversions between cycle and image notation?
You don't have to use strings for creating permutations. You can use lists of tuples (or a single tuple for a cyclic permutation). sage: G = SymmetricGroup(14) sage: G = SymmetricGroup(4) sage: G((1,2,3,4)) (1,2,3,4) sage: G([(1,2), (3,4)]) (1,2)(3,4) The GAP function PermList described here: http://wwwmaths.anu.edu.au/research.groups/aat/GAP/www/Manual/C020S009.htm does the sort of thing you want. I've incorporated it into SAGE, so now the following works: sage: G([1,2,4,3]) (3,4) sage: G([2,3,4,1]) (1,2,3,4) This will be in sage-1.6 (to be released soon). Also, you can get it by doing hg_sage.pull(), though probably be sure to do a "sage -upgrade" first as always. I also added going the other way: sage: G = SymmetricGroup(4) sage: x = G([2,1,4,3]); x (1,2)(3,4) sage: v = x.list(); v [2, 1, 4, 3] sage: type(v[0]) <type 'int'> William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---