ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 21 Sep 2022 14:24:51 +0200Group element multiplication in symmetric grouphttps://ask.sagemath.org/question/64130/group-element-multiplication-in-symmetric-group/ I think this is elementary, but how do we just multiply two elements in the symmetric group. For example, I have a list of elements as
G=SymmetricGroup(5)
A=[(1,2), (1,3,2), (1,4), (1,4)(2,3),(2,4),(2,4,3),(3,4),(2,3,4)]
b=[G(1,5)*G(a) for a in A]
b
When I implement in the above code on the compiler, I get the error `'tuple' object is not callable`. Anyway to overcome this error and multiply two elements in the group, or, in any other group? Thanks beforehand. Wed, 21 Sep 2022 13:09:01 +0200https://ask.sagemath.org/question/64130/group-element-multiplication-in-symmetric-group/Answer by tmonteil for <p>I think this is elementary, but how do we just multiply two elements in the symmetric group. For example, I have a list of elements as </p>
<pre><code>G=SymmetricGroup(5)
A=[(1,2), (1,3,2), (1,4), (1,4)(2,3),(2,4),(2,4,3),(3,4),(2,3,4)]
b=[G(1,5)*G(a) for a in A]
b
</code></pre>
<p>When I implement in the above code on the compiler, I get the error <code>'tuple' object is not callable</code>. Anyway to overcome this error and multiply two elements in the group, or, in any other group? Thanks beforehand. </p>
https://ask.sagemath.org/question/64130/group-element-multiplication-in-symmetric-group/?answer=64133#post-id-64133When you define `A`, the `(1,4)(2,3)` looks using the tuple `(1,4)` as a function to be called at `(2,3)`, which explains your error.
If you want `A` be a list of elements of `G` you must make it explicit:
sage: A=[G((1,2)), G((1,3,2)), G((1,4)), G([(1,4),(2,3)]),G((2,4)),G((2,4,3)),G((3,4)),G((2,3,4))]
sage: A
[(1,2), (1,3,2), (1,4), (1,4)(2,3), (2,4), (2,4,3), (3,4), (2,3,4)]
Then, you can do:
sage: b=[G((1,5))*a for a in A]
sage: b
[(1,5,2),
(1,5,3,2),
(1,5,4),
(1,5,4)(2,3),
(1,5)(2,4),
(1,5)(2,4,3),
(1,5)(3,4),
(1,5)(2,3,4)]
Wed, 21 Sep 2022 14:24:51 +0200https://ask.sagemath.org/question/64130/group-element-multiplication-in-symmetric-group/?answer=64133#post-id-64133