-- The resultant of two polynomials (in one variable x) -- is always a combination of the two polynomials. It should -- thus occur in any GB eliminating the variable x. -- both f and g have degree 2 R=ZZ/101[x,a_0..a_2,b_0..b_2,MonomialOrder=>Lex] f=a_0+a_1*x+a_2*x^2 g=b_0+b_1*x+b_2*x^2 j=gens gb ideal(f,g) resultant=selectInSubring(1,j) -- f of degree 2 and g od degree 3 R=ZZ/101[x,a_0..a_3,b_0..b_2,MonomialOrder=>Lex] f=a_0+a_1*x+a_2*x^2+a_3*x^3 g=b_0+b_1*x+b_2*x^2 j=gens gb ideal(f,g); resultant=selectInSubring(1,j) --both of degree 3 R=ZZ/101[x,a_0..a_3,b_0..b_3,MonomialOrder=>Lex] f=a_0+a_1*x+a_2*x^2+a_3*x^3 g=b_0+b_1*x+b_2*x^2+b_3*x^3 j=gens gb ideal(f,g); resultant=selectInSubring(1,j) -- Sylvester's formula for the resultant -- Homework -- Bezout's formula for the resulatnt of two polynomials -- of the same degree in one variable -- The following function lists variables appearing in a monomial varsInMon = (mon) -> ( R:= ring mon; exps := flatten exponents (mon); T := apply(#exps, i-> (if (exps_i!=0) then R_i else 0)); select(T, r -> not T#?r)) EXAMPLE /// R=ZZ/101[x,y,z,w,v] exps = flatten exponents (x^2*y*v) apply(#exps, i-> (if (exps_i!=0) then R_i else 0)) varsInMon(x^2*y*v) /// coeffMonom = (mon, f) -> ( substitute(contract(mon, f),apply(varsInMon(mon), i->(i=>0)))) EXAMPLE /// R=ZZ/101[x,y,z,w,v] f=x^3*y*z+3*x^2*y mon = x^2*y varsInMon(mon) apply(varsInMon(mon), i->(i=>0)) contract(mon,f) coeffMonom(x^2*y, f) coeffMonom(x^3*y*z, f) coeffMonom(x*z, f) /// R=ZZ/101[x,y,a_0..a_3,b_0..b_3,MonomialOrder=>Lex] f = a_0+a_1*x+a_2*x^2+a_3*x^3 g = b_0+b_1*x+b_2*x^2+b_3*x^3 h = f*substitute(g, {x=> y}) - g*substitute(f, {x=>y}) hh = h// (x-y) bezout = matrix table(3,3, (i,j)->substitute(coeffMonom(x^i*y^j, hh),{x=>0, y=>0})) bezout = det bezout j=gens gb ideal(f,g); resultant = selectInSubring(2,j) resultant == bezout ------------------------------------------------ -- Eliminating two variables x, y from a system of 3 quadratic eqs -- The resultant should be this time a polynomial of degree 12 in 18 vars !! -- In fact out of reach of Macaulay R=ZZ/101[x,y,a_0..a_5, b_0..b_5, c_0..c_5, MonomialOrder=>Lex] f = a_0*x^2+a_1*x*y+a_2*y^2+a_3*x+a_4*y+a_5 g = b_0*x^2+b_1*x*y+b_2*y^2+b_3*x+b_4*y+b_5 h = c_0*x^2+c_1*x*y+c_2*y^2+c_3*x+c_4*y+c_5 j=gens gb(ideal(f,g,h), DegreeLimit => 12); betti j resultant=selectInSubring(2,j) -- The full expansion has 21894 terms but is out of reach of Macaulay!