# Working with finitely presented algebras

I am trying to work with finitely presented algebras in SageMath. But apparently, I am doing something wrong.

For a simple example, I want to construct A = Q[x]/<x^2>. The image a of x in that algebra should satisfy a^2 = 0. But SageMath tells me that this is not the case. (EDIT: the code has been updated below.)

sage: F.<x> = FreeAlgebra(QQ,1)
sage: F
Free Algebra on 1 generators (x,) over Rational Field
sage: x in F
True
sage: I = F.ideal([x^2])
sage: A = F.quotient(I)
sage: A
Quotient of Free Algebra on 1 generators (x,) over Rational Field by the ideal (x^2)
sage: a = A.gen()
sage: a^2 == 0
False
sage: a^2 == A.zero()
False


What am I doing wrong here?

When the ideal is <1>, the quotient should be trivial. But again, SageMath does not believe this.

It seems that this bug has been reported here before:

edit retag close merge delete

Apparently, it works when F is defined as a polynomial ring. The free algebra on one generator should equal the polynomial ring. But SageMath thinks differently.

( 2023-10-02 14:00:55 +0200 )edit

Sort by ยป oldest newest most voted

First you're doing something mysterious, because the code you wrote doesn't work.

sage: F = FreeAlgebra(QQ,1,'x')
sage: x in F
True ???


The first line does not define x as an element of F, so the second line will return False. Furthermore, if I do x = F.gen(0) to define x appropriately, then F.quotient(I) raises an error, saying that "a twosided ideal is required". Maybe for this second issue you're using an old version of Sage and the behavior has changed since then.

Your actual question is sound, though, so let's address that. Here is what I would do:

sage: F.<x> = FreeAlgebra(QQ, implementation='letterplace')
sage: x in F
True
sage: I = F.ideal([x^2], side='twosided')
sage: A = F.quotient(I)
sage: a = A.gen()
sage: a^2
0
sage: a^2 == 0
True


The key is to use the "letterplace" implementation for free algebras (https://doc.sagemath.org/html/en/refe...). Those seem to work better when handling ideals and quotients, at least in my experience.

more

Thanks a lot for your answer. Actually, I encountered the same problem with F.<x>, but apparently I wrote it wrong above. Is side="twosided" required? I assumed that SageMath has ideals twosided by default. But I am not sure. I tried with implementation="letterplace", and it indeed works. But the problem is that the ideal that I need for my actual problem (this here was just a toy example) is not homogeneous. And when I want to quotient out non-homogeneous ideals with implementation="letterplace", I get an error. This seems to be confirmed by the SageMath documentation. Having said this, I have a really hard time to read and understand the documentation. Have you any idea how to work with quotients of non-homogenous ideals? PS: On my Ubuntu server I have installed SageMath version 9.5.

( 2023-10-02 10:11:26 +0200 )edit

sage: F.<x> = FreeAlgebra(QQ,implementation="letterplace")

sage: F.quotient(Ideal(F,[x+1]))

throws this error:

ArithmeticError: Can only add elements of the same weighted degree

( 2023-10-02 10:13:58 +0200 )edit

As you note in the edited question, this has been reported, and the ticket with the bug (https://github.com/sagemath/sage/issu...) is still open. You may be able to work around the nonhomogeneous elements by homogenizing (?) everything: introduce a new variable t and just multiply each summand by the appropriate power of t to make everything the same degree: replace x^2+1 by x^2+t^2. Not perfect, but that may be the best workaround.

( 2023-10-02 19:44:57 +0200 )edit

Regarding side='twosided': I get an error if I do F.<x> = FreeAlgebra(QQ); I = F.quotient([x^2+1]); F.quotient(I). I don't get the error if F has more than one generator, so singly generated algebras are handled differently apparently, than with multiple generators.

( 2023-10-02 19:47:59 +0200 )edit

Thanks! I will try to work with the homogenization then.

( 2023-10-03 01:52:56 +0200 )edit