----------------------------------------------------- ----------------------------------------------------- -- Packages we need to load ----------------------------------------------------- ----------------------------------------------------- needsPackage("gfanInterface"); ----------------------------------------------------- ----------------------------------------------------- -- Functions we wrote ----------------------------------------------------- ----------------------------------------------------- ----------------------------------------------------- -- complementaryHilbertPoint -- Computes the Hilbert point of a monomial ideal J -- as the sum of the exponent vectors of the monomials outside J complementaryHilbertPoint = (m,J) -> ( R:=ring(J); N:= numgens ring(J); s:=apply(N,i->0); L:= flatten entries basis(m,R/J); for i from 0 to #L-1 do s = s + sum(exponents(L_i)); return s ); -* -- Examples R=QQ[x_0..x_3]; J=ideal {x_1*x_3, x_0*x_3, x_0*x_2}; complementaryHilbertPoint(2,J) complementaryHilbertPoint(3,J) -- Tests R=QQ[x_0..x_3]; J=ideal {x_1*x_3, x_0*x_3, x_0*x_2}; assert(complementaryHilbertPoint(2,J)=={3,4,4,3}) assert(complementaryHilbertPoint(3,J)=={6,9,9,6}) *- ----------------------------------------------------- ----------------------------------------------------- --polynomialInterpolation -- Given a list of x values and a list of y values, -- compute the polynomial interpolating the points (x_i,y_i) -- Also enter the interpolation ring IR polynomialInterpolation = (x,y,IR) -> ( vdM:=matrix apply(x, k-> apply(#x, l -> k^(#x-l-1)/1)); N:=vdM^(-1); O:=N*(transpose matrix {y}); P:=matrix {apply(#x, l -> (IR_0)^(#x-l-1))}; (P*O)_(0,0) ); -* -- Example xvalues = {-5,-4,-3,-2,-1,0,1,2,3,4,5}; yvalues = {-345/2, -93, -83/2, -12, 3/2, 5, 9/2, 6, 31/2, 39, 165/2}; polynomialInterpolation(xvalues,yvalues,QQ[x]) -- Test xvalues = {-5,-4,-3,-2,-1,0,1,2,3,4,5}; yvalues = {-345/2, -93, -83/2, -12, 3/2, 5, 9/2, 6, 31/2, 39, 165/2}; f=polynomialInterpolation(xvalues,yvalues,QQ[x]); R = ring(f); assert(f==(R_0)^3-2*(R_0)^2+(1/2)*(R_0)+5) *- ----------------------------------------------------- ----------------------------------------------------- -- outerStatePolynomial -- Compute the coordinates of the complementary Hilbert points -- of a monomial ideal J as polynomials in m outerStatePolynomial = (J) -> ( d:=dim(J); R:=ring(J); n:=numgens(R); r:=degree(J); x:=apply(d+1, i -> r+i); y:={}; IR:=coefficientRing(R)[m]; CHPs:=apply(x, k -> complementaryHilbertPoint(k,J)); for i from 0 to n-1 list ( y = apply(CHPs, p -> p_i); polynomialInterpolation(x,y,IR) ) ); -* -- Examples R=QQ[x_0..x_3] outerStatePolynomial(ideal {x_1*x_3, x_0*x_3, x_0*x_2}) -- Tests R=QQ[x_0..x_3] v = outerStatePolynomial(ideal {x_1*x_3, x_0*x_3, x_0*x_2}) m=(ring(v_0))_0; assert(v == {(1/2)*m^2+(1/2)*m, m^2, m^2, (1/2)*m^2+(1/2)*m}) *- ----------------------------------------------------- ----------------------------------------------------- -- chowPoint -- Computes the Chow point of a monomial ideal chowPoint = (J) -> ( d:=dim J; OSP:=outerStatePolynomial(J); m:=(ring(first OSP))_0; apply(OSP, i -> d*coefficient(m^d,i)) ) -* -- Examples R=QQ[x_0..x_3] J = ideal {x_1*x_3, x_0*x_3, x_0*x_2}; chowPoint(J) -- Tests R=QQ[x_0..x_3] J = ideal {x_1*x_3, x_0*x_3, x_0*x_2}; assert(chowPoint(J)=={1,2,2,1}) *- ----------------------------------------------------- ----------------------------------------------------- -- chowPolytope -- Computes the Chow polytope of an ideal I chowPolytope = (I) -> ( initialIdeals := apply(gfan(I), i -> first i); d:= dim I; unique apply(#initialIdeals, k -> chowPoint(ideal(initialIdeals_k))) ) -* -- Examples R=QQ[x_0..x_3] I1 = minors(2,matrix {{x_0,x_1,x_2},{x_1,x_2,x_3}}) chowPolytope(I1) I2 = ideal {x_2^2-x_1*x_3, x_1^2-x_0*x_3}; chowPolytope(I2) -- Tests R=QQ[x_0..x_3]; I1 = minors(2,matrix {{x_0,x_1,x_2},{x_1,x_2,x_3}}); I2 = ideal {x_2^2-x_1*x_3, x_1^2-x_0*x_3}; assert(sort(chowPolytope(I1))=={{1, 2, 2, 1}, {1, 3, 0, 2}, {2, 0, 3, 1}, {3, 0, 0, 3}}) assert(sort(chowPolytope(I2))=={{2, 3, 2, 1}, {2, 4, 0, 2}, {3, 0, 4, 1}, {4, 0, 0, 4}}) *- ----------------------------------------------------- end load "ChowPolytope.m2"; R=QQ[s,t,x_0..x_3,MonomialOrder=>Eliminate(2)]; ElimI = ideal(x_0-s^4,x_1-s^2*t^2,x_2-s*t^3,x_3-t^4); flatten entries selectInSubring(1, gens gb ElimI) R=QQ[x_0..x_3]; I = ideal {x_2^2-x_1*x_3, x_1^2-x_0*x_3}; chowPolytope(I) initialIdeals = apply(gfan(I), i -> ideal(first i)) J=first initialIdeals apply({3,4,5}, m -> complementaryHilbertPoint(m,J)) outerStatePolynomial(J) chowPoint(J) apply(initialIdeals, J -> chowPoint(J)) -* Note: one published example that we used for our tests is the Chow polytope of the twisted cubic in Kapranov, Sturmfels, and Zelevinsky, "Chow polytopes and general resultants", 1992, Example 3.8 It refers back to Sturmfels, "Grobner bases of toric varieties", 1991, Section 4 I think there is a typo in the list of initial ideals in Sturmfels 1991 The second ideal on the list is printed as {a*b,b^2,b*d}, but I think it should be {a*d,b^2,b*d} Here is a Macaulay2 calculation establishing this claim Macaulay2, version 1.24.05 with packages: ConwayPolynomials, Elimination, IntegralClosure, InverseSystems, Isomorphism, LLLBases, MinimalPrimes, OnlineLookup, PrimaryDecomposition, ReesAlgebra, Saturation, TangentCone, Truncations, Varieties i1 : R=QQ[x_0..x_3,MonomialOrder=>{Weights=>{1,1,0,2}}]; i2 : I = minors(2,matrix {{x_0,x_1,x_2},{x_1,x_2,x_3}}) 2 2 o2 = ideal (- x + x x , x x - x x , x x - x ) 1 0 2 0 3 1 2 1 3 2 o2 : Ideal of R i3 : leadTerm I o3 = | x_1^2 x_1x_3 x_0x_3 | 1 3 o3 : Matrix R <-- R -- Thus, the corrected list of initial ideals is: SturmfelsList = { {a*c,a*d,b*d}, {a*d,b^2,b*d}, {a*d^2,b^2,b*c,b*d}, {b^2,b*c,b*d,c^3}, {b^2,b*c,c^2}, {a*c,b^3,b*c,c^2}, {a*c,a^2*d,b*c,c^2}, {a*c,a*d,c^2} }; *-