Declaring constants in Sagemath

100 Views Asked by At

I want to find the Groebner base of a ideal,the ideal is generated by some polynomials with constant coefficients, but they do not have numerical values.

var('a')
R.<x,y> = PolynomialRing(CC, 2, order='lex')
I = ideal(y^4*a, y^2*x - y*a - x, y - x*a)

B = I.groebner_basis()
B

This is just a dummy example, I would like to have my Groebner base calculated, and having a treated as a constant. The code does not even compile. What should I do ?

1

There are 1 best solutions below

0
On

I think probably the fundamental issue is that in general, the form of the Groebner basis can depend on the exact value of $a$. Thus, it will not be able to do a generic calculation that will work no matter what $a$ is.

If you are interested in what happens "in the general case", i.e. you don't care what happens at finitely many values for $a$, then you can perform the calculation of the corresponding ideal of $\mathbb{C}(a)[x,y]$:

K.<a> = FunctionField(QQ)
R.<x,y> = PolynomialRing(K, order='lex')
I = ideal(y^4*a, y^2*x - y*a - x, y - x*a)
B = I.groebner_basis()
B
=> [x, y]

(Here I have chosen to work with coefficients in $\mathbb{Q}$ instead of in $\mathbb{C}$ in order to avoid possible rounding issues.)

The reason that this only shows the form of the Groebner basis in the general case is that working with coefficients in $\mathbb{Q}(a)$ allows the calculation to freely divide by any nonzero polynomials of $a$.

Now, suppose we are interested in more fine-grained detail of what exact values of $a$ this works for, and what happens in the exceptional cases. We can do this by instead doing a calculation for the corresponding ideal in $\mathbb{C}[a][x,y]$, where we choose an elimination order for $a$:

R.<x,y,a> = PolynomialRing(QQ, order='lex')
I = ideal(y^4*a, y^2*x - y*a - x, y - x*a)
B = I.groebner_basis()
B
=> [x + y*a^3 + 2*y*a, y^3 - y*a^2 - y, y^2*a^2 + y^2, y*a^4 + 2*y*a^2 + y]

From this, we can read that no matter the value of $a$, $x$ can be eliminated in terms of $y$. In the last entry, as it happens, $y a^4 + 2y a^2 + y = y (a^2+1)^2$. Therefore, if $a \ne \pm i$, then the Groebner basis is $\{ x, y \}$, giving more details on when the generic case happens.

If we want to see what happens in the case $a = \pm i$, let us add the minimal polynomial for $a$ to the basis:

J = I + ideal(a^2+1)
B2 = J.groebner_basis()
B2
=> [x + y*a, y^3, a^2 + 1]

This tells us that in this special case $a = \pm i$, the Groebner basis will be $\{ x + ay, y^3 \}$ instead.