ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 05 Oct 2012 04:00:07 -0500Order of elements in group multiplication?https://ask.sagemath.org/question/9386/order-of-elements-in-group-multiplication/This is probably a very simple mistake on my part, but can anyone please explain this error in Sage?
If I do this...
sage: G = SymmetricGroup(3)
sage: H = AlternatingGroup(3)
then this works as expected:
sage: [(g*h) for h in H for g in G]
[(), (2,3), (1,2), (1,2,3), (1,3,2), (1,3), (1,2,3), (1,2), (1,3), (1,3,2), (), (2,3), (1,3,2), (1,3), (2,3), (), (1,2,3), (1,2)]
but if I reverse the order of h and g I get an error
sage: [(h*g) for h in H for g in G]
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/Users/toby/<ipython console> in <module>()
/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.6/site-packages/sage/structure/element.so in sage.structure.element.MonoidElement.__mul__ (sage/structure/element.c:10197)()
/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.6/site-packages/sage/structure/element.so in sage.structure.element.MonoidElement.__mul__ (sage/structure/element.c:10056)()
/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.6/site-packages/sage/structure/coerce.so in sage.structure.coerce.CoercionModel_cache_maps.bin_op (sage/structure/coerce.c:7467)()
TypeError: unsupported operand parent(s) for '*': 'Alternating group of order 3!/2 as a permutation group' and 'Symmetric group of order 3! as a permutation group'
Can anyone explain what I am doing wrong? Thanks TobyThu, 04 Oct 2012 00:28:52 -0500https://ask.sagemath.org/question/9386/order-of-elements-in-group-multiplication/Answer by kcrisman for <p>This is probably a very simple mistake on my part, but can anyone please explain this error in Sage?</p>
<p>If I do this...</p>
<pre><code>sage: G = SymmetricGroup(3)
sage: H = AlternatingGroup(3)
</code></pre>
<p>then this works as expected:</p>
<pre><code>sage: [(g*h) for h in H for g in G]
[(), (2,3), (1,2), (1,2,3), (1,3,2), (1,3), (1,2,3), (1,2), (1,3), (1,3,2), (), (2,3), (1,3,2), (1,3), (2,3), (), (1,2,3), (1,2)]
</code></pre>
<p>but if I reverse the order of h and g I get an error</p>
<pre><code>sage: [(h*g) for h in H for g in G]
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/Users/toby/<ipython console> in <module>()
/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.6/site-packages/sage/structure/element.so in sage.structure.element.MonoidElement.__mul__ (sage/structure/element.c:10197)()
/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.6/site-packages/sage/structure/element.so in sage.structure.element.MonoidElement.__mul__ (sage/structure/element.c:10056)()
/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.6/site-packages/sage/structure/coerce.so in sage.structure.coerce.CoercionModel_cache_maps.bin_op (sage/structure/coerce.c:7467)()
TypeError: unsupported operand parent(s) for '*': 'Alternating group of order 3!/2 as a permutation group' and 'Symmetric group of order 3! as a permutation group'
</code></pre>
<p>Can anyone explain what I am doing wrong? Thanks Toby</p>
https://ask.sagemath.org/question/9386/order-of-elements-in-group-multiplication/?answer=14104#post-id-14104I've made this [Trac 13569](http://trac.sagemath.org/sage_trac/ticket/13569). Interestingly, sometimes this multiplication works - it's only if you repeat it that it eventually fails. Weird.Thu, 04 Oct 2012 05:41:38 -0500https://ask.sagemath.org/question/9386/order-of-elements-in-group-multiplication/?answer=14104#post-id-14104Answer by John Palmieri for <p>This is probably a very simple mistake on my part, but can anyone please explain this error in Sage?</p>
<p>If I do this...</p>
<pre><code>sage: G = SymmetricGroup(3)
sage: H = AlternatingGroup(3)
</code></pre>
<p>then this works as expected:</p>
<pre><code>sage: [(g*h) for h in H for g in G]
[(), (2,3), (1,2), (1,2,3), (1,3,2), (1,3), (1,2,3), (1,2), (1,3), (1,3,2), (), (2,3), (1,3,2), (1,3), (2,3), (), (1,2,3), (1,2)]
</code></pre>
<p>but if I reverse the order of h and g I get an error</p>
<pre><code>sage: [(h*g) for h in H for g in G]
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/Users/toby/<ipython console> in <module>()
/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.6/site-packages/sage/structure/element.so in sage.structure.element.MonoidElement.__mul__ (sage/structure/element.c:10197)()
/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.6/site-packages/sage/structure/element.so in sage.structure.element.MonoidElement.__mul__ (sage/structure/element.c:10056)()
/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.6/site-packages/sage/structure/coerce.so in sage.structure.coerce.CoercionModel_cache_maps.bin_op (sage/structure/coerce.c:7467)()
TypeError: unsupported operand parent(s) for '*': 'Alternating group of order 3!/2 as a permutation group' and 'Symmetric group of order 3! as a permutation group'
</code></pre>
<p>Can anyone explain what I am doing wrong? Thanks Toby</p>
https://ask.sagemath.org/question/9386/order-of-elements-in-group-multiplication/?answer=14103#post-id-14103I'm not sure why this doesn't work, but you can force the multiplication to take place in the larger group `G` by replacing `h` with `G(h)`, like this:
sage: [(G(h)*g) for h in H for g in G]
Thu, 04 Oct 2012 04:10:18 -0500https://ask.sagemath.org/question/9386/order-of-elements-in-group-multiplication/?answer=14103#post-id-14103Comment by Thruston for <p>I'm not sure why this doesn't work, but you can force the multiplication to take place in the larger group <code>G</code> by replacing <code>h</code> with <code>G(h)</code>, like this:</p>
<pre><code>sage: [(G(h)*g) for h in H for g in G]
</code></pre>
https://ask.sagemath.org/question/9386/order-of-elements-in-group-multiplication/?comment=18918#post-id-18918thank you. Fri, 05 Oct 2012 04:00:07 -0500https://ask.sagemath.org/question/9386/order-of-elements-in-group-multiplication/?comment=18918#post-id-18918