-- MATH 531 -- Sept 27 -- HW 1 solutions -- HW: reduced GB algorithm completeReduce = (f,G) -> ( r := 0; while f!=0 do ( f = reduce(f,G); if f!=0 then ( r = r + leadTerm f; f = f - leadTerm f; ) ); r ) reduceGB = G -> ( H := {}; while #G>0 do ( f := first G; G = drop(G,1); if all(G|H, g->leadTerm(f)%leadTerm(g)!=0) then H = H | {completeReduce(f,G|H)}; ); H ) -- HW: quotient ideal myIntersect = (I,J) -> ( t := symbol t; R := ring I; -- create a new ring S := (coefficientRing R)[t, first entries vars R, MonomialOrder=>Eliminate 1]; -- use substitute to bring your ideals to the new ring tI := t*substitute(I,S); tJ := (1-t)*substitute(J,S); G := selectInSubring(1, gens gb(tI+tJ)); use R; -- restore R as the current ring ideal substitute(G,R) ) quotientIdeal = (I,h) -> ( -- get the list of generators of I intersected with G := first entries gens myIntersect(I,ideal h); ideal (G/(g->g//h)) ) /// restart M2dir = "/home/x/leykin/M2/" load (M2dir|"lab2.m2") load (M2dir|"hw1.m2") -- test reduceGB R = QQ[x,y]; Buchberger {x^3, x^2*y-y^3} F = {y^5-x*y^3, x^3, x^2*y-y^3, x^5-y^5}; B = Buchberger F reduceGB B -- test quotientIdeal R = QQ[x,y,z]; I = ideal{x^2+y^2+z^2-1, x*z, y*z}; h = z*(z+1); quotientIdeal(I,h) ///