ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 12 Jun 2012 07:54:40 -0500Check that P3*P6=P4http://ask.sagemath.org/question/9063/check-that-p3p6p4/Here's elements of Symmetric group of 6th order: S3:
![The book says](http://farm8.staticflickr.com/7098/7358188294_242a16d3d7_z.jpg "The book says")
I want to check that P3*P6=P4.
G = SymmetricGroup(3)
BookNumbers = [1, 4, 2, 3, 6, 5]
P = [0]
for i in BookNumbers:
P.append(sorted(G.list())[i-1])
print (P[3] * P[6]).list(), P[4].list()
print (P[3] * P[6]) == P[4]
it gives:
[3, 2, 1] [2, 1, 3]
False
so they are the same actually. But how do I make sage say `True`?.Tue, 12 Jun 2012 07:18:09 -0500http://ask.sagemath.org/question/9063/check-that-p3p6p4/Answer by kcrisman for <p>Here's elements of Symmetric group of 6th order: S3:</p>
<p><img alt="The book says" src="http://farm8.staticflickr.com/7098/7358188294_242a16d3d7_z.jpg" title="The book says"/></p>
<p>I want to check that P3*P6=P4.</p>
<pre><code>G = SymmetricGroup(3)
BookNumbers = [1, 4, 2, 3, 6, 5]
P = [0]
for i in BookNumbers:
P.append(sorted(G.list())[i-1])
print (P[3] * P[6]).list(), P[4].list()
print (P[3] * P[6]) == P[4]
</code></pre>
<p>it gives:</p>
<pre><code>[3, 2, 1] [2, 1, 3]
False
</code></pre>
<p>so they are the same actually. But how do I make sage say <code>True</code>?.</p>
http://ask.sagemath.org/question/9063/check-that-p3p6p4/?answer=13695#post-id-13695The problem is that you are comparing *lists*, not Sage objects. achrzesz gives an answer which compares two Sage group elements, so they are equal. The lists you give are simple Python ordered lists, and as *ordered* things, certainly aren't the same. Why didn't you just compare `P[3]*P[6]` and `P[4]`?
By the way, they're not the same. But that's a different issue. They're using the notation of the second row of your notation in your original question, not cycle notation.
sage: P[3] * P[6]
(1,3)
sage: P[4]
(1,2)
Tue, 12 Jun 2012 07:54:40 -0500http://ask.sagemath.org/question/9063/check-that-p3p6p4/?answer=13695#post-id-13695Answer by achrzesz for <p>Here's elements of Symmetric group of 6th order: S3:</p>
<p><img alt="The book says" src="http://farm8.staticflickr.com/7098/7358188294_242a16d3d7_z.jpg" title="The book says"/></p>
<p>I want to check that P3*P6=P4.</p>
<pre><code>G = SymmetricGroup(3)
BookNumbers = [1, 4, 2, 3, 6, 5]
P = [0]
for i in BookNumbers:
P.append(sorted(G.list())[i-1])
print (P[3] * P[6]).list(), P[4].list()
print (P[3] * P[6]) == P[4]
</code></pre>
<p>it gives:</p>
<pre><code>[3, 2, 1] [2, 1, 3]
False
</code></pre>
<p>so they are the same actually. But how do I make sage say <code>True</code>?.</p>
http://ask.sagemath.org/question/9063/check-that-p3p6p4/?answer=13693#post-id-13693 sage: G = SymmetricGroup(3)
sage: P3=G((3,2))
sage: P6=G((3,1,2))
sage: P4=G((2,1))
sage: P3*P6==P4
True
Tue, 12 Jun 2012 07:30:51 -0500http://ask.sagemath.org/question/9063/check-that-p3p6p4/?answer=13693#post-id-13693Comment by bk322 for <pre><code>sage: G = SymmetricGroup(3)
sage: P3=G((3,2))
sage: P6=G((3,1,2))
sage: P4=G((2,1))
sage: P3*P6==P4
True
</code></pre>
http://ask.sagemath.org/question/9063/check-that-p3p6p4/?comment=19618#post-id-19618But mine are also the same. [3, 2, 1] is same as [2, 1, 3], isn't it?Tue, 12 Jun 2012 07:45:50 -0500http://ask.sagemath.org/question/9063/check-that-p3p6p4/?comment=19618#post-id-19618