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.Mon, 12 Oct 2020 15:04:32 +0200How to define algebra via generators and relations?https://ask.sagemath.org/question/53782/how-to-define-algebra-via-generators-and-relations/Say I want to implement [Sweedler's Hopf algebra](https://en.wikipedia.org/wiki/Sweedler%27s_Hopf_algebra), just as an algebra, over an algebraically closed field.
I would define the free algebra on the generators, then the ideal by which I want to quotient, and the quotient should behave like I want to.
F.<x,g,ginv> = FreeAlgebra(QQbar)
I = F*[ x^2, g^2 - 1, g*ginv - 1, g*x + x*g ]*F
H = F.quo(I)
But if I now do
H(x*g + g*x)
the output is
xbar*gbar + gbar*xbar
instead of `0`.
How do I get sage to actually use the relations? The docs are not helpful here.
Thu, 08 Oct 2020 11:44:25 +0200https://ask.sagemath.org/question/53782/how-to-define-algebra-via-generators-and-relations/Comment by slelievre for <p>Say I want to implement <a href="https://en.wikipedia.org/wiki/Sweedler%27s_Hopf_algebra">Sweedler's Hopf algebra</a>, just as an algebra, over an algebraically closed field.</p>
<p>I would define the free algebra on the generators, then the ideal by which I want to quotient, and the quotient should behave like I want to.</p>
<pre><code>F.<x,g,ginv> = FreeAlgebra(QQbar)
I = F*[ x^2, g^2 - 1, g*ginv - 1, g*x + x*g ]*F
H = F.quo(I)
</code></pre>
<p>But if I now do</p>
<pre><code>H(x*g + g*x)
</code></pre>
<p>the output is</p>
<pre><code>xbar*gbar + gbar*xbar
</code></pre>
<p>instead of <code>0</code>.</p>
<p>How do I get sage to actually use the relations? The docs are not helpful here.</p>
https://ask.sagemath.org/question/53782/how-to-define-algebra-via-generators-and-relations/?comment=53789#post-id-53789Essentially you are asking for a [rewriting system](https://en.wikipedia.org/wiki/Rewriting#Term_rewriting_systems) for the algebra H.
Not sure Sage has that. Even `g*x + x*g in I` results in a "not implemented" error.Thu, 08 Oct 2020 19:23:30 +0200https://ask.sagemath.org/question/53782/how-to-define-algebra-via-generators-and-relations/?comment=53789#post-id-53789Comment by slelievre for <p>Say I want to implement <a href="https://en.wikipedia.org/wiki/Sweedler%27s_Hopf_algebra">Sweedler's Hopf algebra</a>, just as an algebra, over an algebraically closed field.</p>
<p>I would define the free algebra on the generators, then the ideal by which I want to quotient, and the quotient should behave like I want to.</p>
<pre><code>F.<x,g,ginv> = FreeAlgebra(QQbar)
I = F*[ x^2, g^2 - 1, g*ginv - 1, g*x + x*g ]*F
H = F.quo(I)
</code></pre>
<p>But if I now do</p>
<pre><code>H(x*g + g*x)
</code></pre>
<p>the output is</p>
<pre><code>xbar*gbar + gbar*xbar
</code></pre>
<p>instead of <code>0</code>.</p>
<p>How do I get sage to actually use the relations? The docs are not helpful here.</p>
https://ask.sagemath.org/question/53782/how-to-define-algebra-via-generators-and-relations/?comment=53809#post-id-53809Maybe sagbi can help? [Ask Sage query: sagbi](https://ask.sagemath.org/questions/query:sagbi/).Sat, 10 Oct 2020 12:49:01 +0200https://ask.sagemath.org/question/53782/how-to-define-algebra-via-generators-and-relations/?comment=53809#post-id-53809Answer by dan_fulea for <p>Say I want to implement <a href="https://en.wikipedia.org/wiki/Sweedler%27s_Hopf_algebra">Sweedler's Hopf algebra</a>, just as an algebra, over an algebraically closed field.</p>
<p>I would define the free algebra on the generators, then the ideal by which I want to quotient, and the quotient should behave like I want to.</p>
<pre><code>F.<x,g,ginv> = FreeAlgebra(QQbar)
I = F*[ x^2, g^2 - 1, g*ginv - 1, g*x + x*g ]*F
H = F.quo(I)
</code></pre>
<p>But if I now do</p>
<pre><code>H(x*g + g*x)
</code></pre>
<p>the output is</p>
<pre><code>xbar*gbar + gbar*xbar
</code></pre>
<p>instead of <code>0</code>.</p>
<p>How do I get sage to actually use the relations? The docs are not helpful here.</p>
https://ask.sagemath.org/question/53782/how-to-define-algebra-via-generators-and-relations/?answer=53865#post-id-53865One possibility to implement the algebra $H_4$ from *loc. cit.*, the one where we also use the relations $x^2=0$, $g^2=1$, $gx+xg=0$ (and there is no need for an inverse, since $g^{-1}=g$) would be:
A.<X,G> = FreeAlgebra(QQ, 2) # or over QQbar
F = A.monoid()
X, G = F.gens()
monomials = [F(1), X, G, X*G]
MS = MatrixSpace(QQ, len(monomials)) # or respectively over QQbar
matrices = [
# matrix showing the action of the first generator, X, on the monomials
MS([0, 1, 0, 0, # X*1 = X
0, 0, 0, 0, # X*X = 0
0, 0, 0, 1, # X*G = XG
0, 0, 0, 0, # X*XG = (XX)G = 0
]),
# matrix showing the action of the second generator, G, on the monomials
MS([0, 0, 1, 0, # G*1 = G
0, 0, 0, -1, # G*X = -XG
1, 0, 0, 0, # G*G = 1
0, -1, 0, 0, # G*XG = (GX)G = (-XG)G=-X(GG)=-X
]),
]
H4.<x,g> = A.quotient(monomials, matrices)
Then we have for instance:
sage: (x+g)^2
1
sage: (1+x*g)^2
1
sage: (1+x+g)^10
512 + 512*x + 512*g
*Note:* It would be interesting to have a full working algebraic setting for the Hopf algebra $H_4$ (including $S$ and $\Delta$). Well, posting as anonymous is not a good idea in general, but ok, here is the state of the art so far.Mon, 12 Oct 2020 15:04:32 +0200https://ask.sagemath.org/question/53782/how-to-define-algebra-via-generators-and-relations/?answer=53865#post-id-53865