I guess the bottom line is I'm wondering how to enter the generators of the Rubik's cube group, eg at
http://www.gap-system.org/Doc/Examples/rubik.html or http://www.permutationpuzzles.org/rubik/webnotes/sm485_3b.txt Is there an easy way to do that? On Wed, Aug 29, 2012 at 7:11 PM, Chris Smith <[email protected]> wrote: >>>>> C = Cycle() >>>>> a = Cycle()*(1,2) >>>>> b = Cycle()*(2,3) >>>>> G = PermutationGroup([a, b]) >> Traceback (most recent call last): >> File "<console>", line 1, in <module> >> File >> "/Users/davidjoyner/pythonfiles/sympy/sympy/combinatorics/perm_groups.py", >> line 381, in __new__ >> obj._degree = obj._generators[0].size >> AttributeError: 'Cycle' object has no attribute 'size' > > Yes. Cycles are a really limited representation of a Permutation that > are nice for working with when multiplying them. The problem is that > each of them has whatever elements have been included thus far (so `a` > has 1 and 2 while b has 2 and s). Anything that works with > permutations wants them to be of equal length and that's where you > have to convert from Cycle to Permutation using size: > > PermutationGroup([Permutation(w, size=4) for w in (a,b)]) should work: > > ``` > >>>> from sympy.combinatorics.perm_groups import * >>>> from sympy.combinatorics import * >>>> a,b=Cycle(1,2),Cycle(2,3) >>>> PermutationGroup([Permutation(w, size=4) for w in (a,b)]) > PermutationGroup([Permutation([0, 2, 1, 3]), Permutation([0, 1, 3, 2])]) >>>> > > ``` > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > 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/sympy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sympy" group. 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/sympy?hl=en.
