# Computing Grobner basis when the input is n polynomials

To compute the grobner basis of two polynomials the command is well known: R.ideal(x^2+y^2-1, (x+y)^2-1).groebner_basis(), where the ring is defined as R.<x,y> = PolynomialRing(QQ). I want to compute this for n polynomials $f_1, f_2,\ldots,f_n$ where $n$ is as my choice, so how to use the loop for to solve this problem

edit retag close merge delete

Sort by » oldest newest most voted

This can be done exactly the same way for an arbitrary number of polynomials.

You didn't specify the number of variables ; I suppose you want as many variables as polynomials.

An example, using three polynomials of three variables :

sage: R1=PolynomialRing(QQ, "t", 3)
sage: S1=[R1.random_element() for u in range(3)] ; S1
[3/119*t1^2 - 3*t2^2 + 1/2*t0 + 5*t2,
-t0^2 - 1/21*t2^2 - t0 - 2*t1 + 1/3,
1/3*t0*t1 - t2^2 + t0]
sage: J1=R1.ideal(S1)
sage: B1=J1.groebner_basis() ; B1
[t2^4 - 85/132*t2^3 - 23258975/34848*t0*t2 - 595/22*t1*t2 - 46929213143/1463616*t2^2 + 2596929205/487872*t0 - 10833061/17424*t1 + 306569585/5808*t2 + 23211719/209088, t0*t2^2 - 85/132*t0*t2 + 273635/5544*t2^2 - 14929/1848*t0 + 85/66*t1 - 1785/22*t2 - 179/792, t1*t2^2 + 1785/44*t0*t2 + 171997/88*t2^2 - 28517/88*t0 + 833/22*t1 - 70805/22*t2 - 595/88, t0^2 + 1/21*t2^2 + t0 + 2*t1 - 1/3, t0*t1 - 3*t2^2 + 3*t0, t1^2 - 119*t2^2 + 119/6*t0 + 595/3*t2]


Writing a function generalizing to an arbitrary number of polynomials/variables is lazily left as an exercise to the reader.

HTH,

more