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.Sun, 05 Dec 2021 21:00:24 +0100Multiplying elements of D4https://ask.sagemath.org/question/60097/multiplying-elements-of-d4/I have the following group presentation $D_4 = \langle r,s | r^4 = s^2 = rsrs = 1 \rangle$.
This is written in sage as
F.<r,s> = FreeGroup()
D4 = F / [r^4, s^2, r*s*r*s, 1]
r,s = D4.gens()
Say I wanted to compute s^2, this should equal 1 but sage gives me just s^2.
s^2
output:
s^2
I am doing more involved calculations and I want to return the result in the simplified form. How do I simplify the expression in sage?Sun, 05 Dec 2021 09:51:11 +0100https://ask.sagemath.org/question/60097/multiplying-elements-of-d4/Answer by Max Alekseyev for <p>I have the following group presentation $D_4 = \langle r,s | r^4 = s^2 = rsrs = 1 \rangle$.</p>
<p>This is written in sage as </p>
<pre><code>F.<r,s> = FreeGroup()
D4 = F / [r^4, s^2, r*s*r*s, 1]
r,s = D4.gens()
</code></pre>
<p>Say I wanted to compute s^2, this should equal 1 but sage gives me just s^2.</p>
<pre><code>s^2
</code></pre>
<p>output:</p>
<pre><code>s^2
</code></pre>
<p>I am doing more involved calculations and I want to return the result in the simplified form. How do I simplify the expression in sage?</p>
https://ask.sagemath.org/question/60097/multiplying-elements-of-d4/?answer=60103#post-id-60103Reduction here can be performed via rewriting system - like:
R = D4.rewriting_system()
R.reduce(s^2)Sun, 05 Dec 2021 19:11:33 +0100https://ask.sagemath.org/question/60097/multiplying-elements-of-d4/?answer=60103#post-id-60103Comment by Max Alekseyev for <p>Reduction here can be performed via rewriting system - like:</p>
<pre><code>R = D4.rewriting_system()
R.reduce(s^2)
</code></pre>
https://ask.sagemath.org/question/60097/multiplying-elements-of-d4/?comment=60106#post-id-60106Perhaps, you'd need to explicitly apply reduce to the terms of `e^3` - like: `sum(c*A(R.reduce(t)) for t,c in e^3)`Sun, 05 Dec 2021 21:00:24 +0100https://ask.sagemath.org/question/60097/multiplying-elements-of-d4/?comment=60106#post-id-60106Comment by kev for <p>Reduction here can be performed via rewriting system - like:</p>
<pre><code>R = D4.rewriting_system()
R.reduce(s^2)
</code></pre>
https://ask.sagemath.org/question/60097/multiplying-elements-of-d4/?comment=60104#post-id-60104Thanks, this seems to work. However I got another problem when constructing my expression by using the generators of D4 in a group algebra:
F.<r,s> = FreeGroup()
D4 = F / [r^4, s^2, r*s*r*s, 1]
R = D4.rewriting_system()
A = D4.algebra(QQ)
r,s = A.gens()
e = r + s
R.reduce(e^3)
I get the error "unsupported operand parent(s) for >: 'Integer Ring' and '<class 'tuple'>'".
When using the permutation group instead of the presentation of the group it seems to give the simplified result directly without needing to use `R.reduce(...)`, but I don't want the result in cycle notation.Sun, 05 Dec 2021 19:50:01 +0100https://ask.sagemath.org/question/60097/multiplying-elements-of-d4/?comment=60104#post-id-60104