--------------------------------------------------------------------------- -- PURPOSE : Computations of implicit equations of toric rational surfaces embedded in a projective space, by means of approximation complexes -- PROGRAMMER : Nicolás Botbol, Marc Dohm, Manuel Dubinsky -- UPDATE HISTORY : 20 August 2010 => 17 January 2011 => 19 April 2011 => 8 September 2011 --------------------------------------------------------------------------- newPackage("MatrixRepToric", Version => "1.4", Date => "8 September 2011", Authors => { {Name => "Nicolás Botbol", Email => "nbotbol@dm.uba.ar", HomePage => "http://mate.dm.uba.ar/~nbotbol/"}, {Name => "Marc Dohm"}, {Name => "Manuel Dubinsky"} }, Headline => "Implicit equations of toric rational surfaces embedded in a projective space, by means of approximation complexes", DebuggingMode => true ) export { isGoodDegree, degreeImplicitEq, ToricEmbedding, newToricEmbedding, teToricRing, teGetPolytope, teToricRationalMap, representationMatrix, implicitEq, maxMinor, polynomialsToPolytope, teLatticePotintsFromHomothethicPolytope } needsPackage "Polyhedra" --------------------------------------------------------------------------- -- DEFINING NEW TYPES --------------------------------------------------------------------------- -- Defining the new type ToricEmbedding ToricEmbedding = new Type of MutableHashTable globalAssignment ToricEmbedding -- Modifying the standard output for a ToricEmbedding to give an overview of its characteristica net ToricEmbedding := te -> ( horizontalJoin flatten ( "{", -- prints the parts vertically stack (horizontalJoin \ sort apply({userRing, tePolyhedron, teLattice, teLatticeLen, teRing}, key -> (net key, " => ", net te#key))), "}" )) --------------------------------------------------------------- --------------------------------------------------------------- -- PURPOSE : Auxiliary method that computes a new list 'l3' with only the elements of 'l1' that are not on 'l2' diffLists = method() -- INPUT : '(l1, l2)', two lists 'l1' and 'l2' of elements of the same type -- OUTPUT : 'l3' a new list with only the elements of 'l1' that are not on 'l2' diffLists (List, List) := (l1, l2) -> ( return select(l1, i -> toString(position(l2, j -> toString(j) == toString(i) )) == "null" ) ) --------------------------------------------------------------- -- FUNCTIONS TO CONSTRUCT TORIC EMBEDDINGS --------------------------------------------------------------- protect userRing; protect tePolyhedron; protect teLattice; protect teLatticeLen; protect teRing; u := symbol u; v := symbol v; w := symbol w; -- PURPOSE : Method that build the toric embedding of the affine space of dimension 2 from the ample divisor given by a polytope newToricEmbedding = method() -- INPUT : '(aPolyhedron, aRing)', a two-dimensional polyhedron 'aPolyhedron' and the two-variable PolynomialRing -- OUTPUT : A 'ToricEmbedding' corresponding to the toric embedding of spec(aRing) given by the ample divisor associated to 'aPolyhedron' newToricEmbedding (Polyhedron, Ring) := (aPolyhedron, aRing) -> ( lat := latticePoints aPolyhedron; latLen := length(lat) - 1; -- for indexing T := getSymbol "T"; new ToricEmbedding from { teRing => QQ[aRing_0,aRing_1,u,v,w,T_0..T_latLen,MonomialOrder=>Eliminate 5], userRing => aRing, tePolyhedron => aPolyhedron, teLattice => lat, teLatticeLen => latLen } ) newToricEmbedding (List) := (polynomialList) -> ( newToricEmbedding(polynomialsToPolytope (polynomialList), ring polynomialList_0) ) --------------------------------------------------------------------------- --------------------------------------------------------------------------- -- PURPOSE : Return the convexHull of the union of the Newton polytope of all the polynomial in the list polynomialsToPolytope = method(); -- INPUT : 'polynomialList' a list of polynomials -- OUTPUT : 'N' the Newton polytope of all polynomials in 'polynomialList' polynomialsToPolytope (List) := (polynomialList) -> ( aPolytope := newtonPolytope polynomialList_0; scan(polynomialList, i -> if i != 0 then { aPolytope = convexHull(aPolytope, newtonPolytope i) }); return aPolytope; ); --------------------------------------------------------------------------- --------------------------------------------------------------------------- -- PURPOSE : Auxiliary method that computes the maximal 'x' and 'y' coordinate of the Newton polytope associated to the toric embedding teMaxDegree = method() -- INPUT : '(te, indexVar)' a toric embedding 'te' and 0 for the 'x' coordinate and 1 for the 'y' coordinate -- OUTPUT : 'ZZ' an integer with the maximum degree on the corresponding coordinate 'x'or 'y' teMaxDegree (ToricEmbedding, ZZ) := (te, indexVar) -> ( max apply(0..te#teLatticeLen, i -> (te#teLattice_i_0_indexVar)) ); --------------------------------------------------------------------------- --------------------------------------------------------------------------- -- PURPOSE : Auxiliary method that bihomogenize all the monomials with exponents in the newton polytope of 'te'. teBigradedMonomials = method() -- INPUT : '(te)' a toric embedding. -- OUTPUT : 'bigradedMonomials' is a list that contains the biomogenization of all the monomials with exponents in the newton polytope of 'te'. teBigradedMonomials (ToricEmbedding) := (te) -> ( use te#teRing; maxDegreeS:= teMaxDegree(te, 0); -- max degree of all polynomials in S_0 maxDegreeT:= teMaxDegree(te, 1); -- idem S_1 LPP:= latticePoints P; bigradedMonomials := {}; for i from 0 to te#teLatticeLen do ( bigradedMonomials = bigradedMonomials | {((te#teRing_0)^(te#teLattice_i_0_0)) * ((te#teRing_1)^(te#teLattice_i_0_1)) * ((te#teRing_2)^(maxDegreeS - (te#teLattice_i_0_0))) * ((te#teRing_3)^(maxDegreeT - (te#teLattice_i_0_1)))}; ); bigradedMonomials ); --------------------------------------------------------------------------- --------------------------------------------------------------------------- -- PURPOSE : Method that computes the toric coordinate ring from a given polytope teToricRing = method() -- INPUT : 'te' a Toric Embedding that contains the information of the toric embedding -- OUTPUT : 'A' a QuotienRing which is the toric coordinate ring of 'te' teToricRing (ToricEmbedding) := (te) -> ( if ( not te#?teToricRing) then { use te#teRing; st := teBigradedMonomials(te); prodT := 1; scan((0..te#teLatticeLen), i -> prodT=prodT*te#teRing_(i+5)); -- Product of all Tt_i J:=ideal(1 - (te#teRing_4) * prodT); scan((0..te#teLatticeLen), i -> J=J+ideal (te#teRing_(i+5) - st_i)); -- ? J= selectInSubring(1,gens gb J); QofT:=QQ[te#teRing_(5)..te#teRing_(5+te#teLatticeLen)]; J=sub(J,QofT); te#teToricRing = QofT/ideal(J); }; return te#teToricRing; ); --------------------------------------------------------------------------- --------------------------------------------------------------------------- -- PURPOSE : Auxiliary method that gets the polytope from a ToricEmbedding teGetPolytope = method(); -- INPUT : 'te' a ToricEmbedding -- OUTPUT : 'P' the polytope of the embedding 'te' teGetPolytope(ToricEmbedding) := (te) -> ( return te#tePolyhedron; ); --------------------------------------------------------------------------- --------------------------------------------------------------------------- -- PURPOSE : Method that rewrites the lattice points of N in terms of some homothety of a different polytope P -- COMMENT : see Pennies, Nickels, Dimes and Quarters (Computations in algebraic geometry with Macaulay 2 Editors: D. Eisenbud, D. Grayson,M. Stillman, and B. Sturmfels) teLatticePotintsFromHomothethicPolytope = method(); -- INPUT : '(N,P)' two polytopes 'N' and 'P'. 'P' is expected to be smaller, but in such a way that some homothety of 'P' covers 'N'. -- OUTPUT : 'Mat' a matrix that rewrites the lattice points of 'N' in terms of some homothety of 'P' teLatticePotintsFromHomothethicPolytope(Polyhedron, Polyhedron) := (N,P) -> ( latticeP := latticePoints P; latticePLen := length latticeP; ones := {}; scan((0..latticePLen - 1), i -> ones = ones | {1}); T := getSymbol "T"; R := QQ[T_0..T_(latticePLen - 1), Degrees => transpose ({ones} | matrixToList matrix{latticeP})]; homothetyNAndP := homothety(N,P); latticeN := latticePoints N; coordinatesNinTs := basis({homothetyNAndP,latticeN_0_0_0,latticeN_0_0_1}, R); latticeNLen := length latticeN; for i from 1 to latticeNLen - 1 do ( coordinatesNinTs = coordinatesNinTs || matrix {{(basis({homothetyNAndP,latticeN_i_0_0,latticeN_i_0_1}, R))_0_0}}; ); return coordinatesNinTs; ); --------------------------------------------------------------------------- --------------------------------------------------------------------------- -- PURPOSE : Auxiliary method that computs the smallest integer 'h' such that 'N' is included in 'h.P' homothety = method(); -- INPUT : '(N,P)' two polytopes 'N' and 'P'. 'P' is spected to be smaller, but in such a way that some homothety of 'P' covers 'N'. -- OUTPUT : 'h' is the smallest integer such that 'N' is included in 'h.P' homothety (Polyhedron, Polyhedron) := (N,P) -> ( latticeP := latticePoints P; h := 1; while not contains(convexHull(h * latticeP), N) do ( h = h + 1; ); return h; ); --------------------------------------------------------------------------- --------------------------------------------------------------------------- -- PURPOSE : Computes the rational map G defined over the toric coordinate ring given by {f0,f1,f2,f3} teToricRationalMap = method(); -- INPUT : '{f0,f1,f2,f3}' a list of polynomials in two variables -- OUTPUT : 'G' is a 1x4-matrix that represents the rational map G defined over the toric coordinate ring 'te#teRing' of the toric variety associated to the Newton polytope of '{f0,f1,f2,f3}' teToricRationalMap(List) := (polynomialList) -> ( te := newToricEmbedding(polynomialList); use te#teRing; torVar := teToricRing(te); -- substitute monomials by variables Ti interpreted in the ring te#teRing (M,C) := coefficients( sub( matrix {polynomialList}, te#teRing), Variables=>{te#teRing_0, te#teRing_1}, Monomials=>teBigradedMonomials( te ) ); Ts := sub(matrix {gens torVar},te#teRing); G := Ts*C; G = matrix{{G_(0,0),G_(0,1),G_(0,2),G_(0,3)}}; return sub (G,torVar); ); -- INPUT : '({f0,f1,f2,f3}, P)' where '{f0,f1,f2,f3}' a list of polynomials in two variables and P is a Polyhedron. -- OUTPUT : 'G' is a 1x4-matrix that represents the rational map G defined over the toric coordinate ring 'te#teRing' of the toric variety associated to P teToricRationalMap(List, Polyhedron) := (polynomialList, P) -> ( te := newToricEmbedding(P, ring polynomialList_0); N := polynomialsToPolytope polynomialList; latticeN := latticePoints N; latticeNLen := length latticeN; teBigrMonNInTeRing := {sub( (teBigradedMonomials( newToricEmbedding(polynomialList) ))_0,te#teRing)}; scan((1..latticeNLen - 1), i -> (teBigrMonNInTeRing = teBigrMonNInTeRing | {sub((teBigradedMonomials( newToricEmbedding(polynomialList) ))_i,te#teRing)}) ); use te#teRing; torVar := teToricRing(te); -- substitute monomials by variables Ti interpreted in the ring te#teRing (M,C) := coefficients( sub( matrix {polynomialList}, te#teRing), Variables=>{te#teRing_0, te#teRing_1}, Monomials=>teBigrMonNInTeRing ); Ts := transpose sub(teLatticePotintsFromHomothethicPolytope(polynomialsToPolytope(polynomialList), P),te#teRing); G := Ts*C; G = matrix{{G_(0,0),G_(0,1),G_(0,2),G_(0,3)}}; return sub (G,torVar); ); --------------------------------------------------------------------------- --------------------------------------------------------------------------- -- PURPOSE : Method that converts a matrix to a list starting from the up-left corner and ending on the down-right corner matrixToList = method(); -- INPUT : 'm' a matrix -- OUTPUT : 'l' a list which has the elements of 'm' listed from the up-left corner to the down-right corner matrixToList(Matrix) := (m) -> ( l := {}; for i from 0 to (rank target m) - 1 do ( row := {}; for j from 0 to (rank source m) - 1 do ( row = row | {m_j_i}; ); l = l | {row}; ); return l; ) --------------------------------------------------------------------------- --------------------------------------------------------------------------- -- PURPOSE :Method that computes the right-most map of the Z-complex in degree nu representationMatrix = method(); -- INPUT : (G, nu) where 'G' is a 1x4-matrix that contains the four polynomials that parametrisez the rational map, and 'nu' is an integer that represents the degree in the grading of the toric ring. -- OUTPUT : 'RM' a matrix in 'X_0,X_1,X_2,X_3' whose rank drops when X_i = G_0_i representationMatrix(Matrix,ZZ) := (G,nu) -> ( Z1 := kernel koszul(1,G); toricRing := ring G; X := getSymbol "X"; toricRingAndXs := toricRing[X_0..X_((rank source G) - 1)]; -- create the nu strand of Z1 = kernel koszul(1,G) d := (degree G_0_0)_0; -- polynomials' degree Z1nu := super basis(nu+d, Z1); -- add d to compensate the natural shift in Z1 Xvars := vars toricRingAndXs; Xnu := matrix{{Xvars_0_0, Xvars_1_0, Xvars_2_0, Xvars_3_0}} * substitute(Z1nu, toricRingAndXs); -- matrix of the map Z1_nu -> A_nu[X] (m,MatInAXs) := coefficients(Xnu,Variables=>(matrixToList(sub(matrix{gens toricRing}, toricRingAndXs)))_0,Monomials=>substitute(basis(nu,toricRing),toricRingAndXs)); QofXs := QQ[Xvars_0_0,Xvars_1_0,Xvars_2_0,Xvars_3_0]; QXvars := vars QofXs; ListofTand0 := {QXvars_0_0,QXvars_1_0,QXvars_2_0,QXvars_3_0}; for i from 0 to (length gens toricRing) - 1 do { ListofTand0=append(ListofTand0,0) }; ppp := map(QofXs,toricRingAndXs,ListofTand0); M := ppp(MatInAXs); if (rank target M != rank M) then { print "WARNING: representation matrix is not of full rank (rank target M != rank M)."; }; return M; ); --------------------------------------------------------------------------- --------------------------------------------------------------------------- -- PURPOSE : Method that computes the gcd of the right-most map of the Z-complex in degree nu, implicitEq = method(); -- INPUT : '(polynomialList,nu)', where polynomialList with the polynomials {f0,f1,f2,f3} and 'nu' is an integer that represents the degree in the grading of the toric ring. -- OUTPUT : A polynomial in 'X_0,X_1,X_2,X_3' that vanishes when is evaluated on X_i = fi implicitEq(List, ZZ) := (polynomialList, nu) -> ( N := maxMinor(representationMatrix(teToricRationalMap (polynomialList),nu)); -- A multiple of the implicit equation (taking several minors we erase extra factors) return det(N) ); -- INPUT : '(polynomialList,nu,P)', where polynomialList with the polynomials {f0,f1,f2,f3}, 'nu' is an integer that represents the degree in the grading of the toric ring and 'P' is a polyhedron that determines the toric ring. -- OUTPUT : A polynomial in 'X_0,X_1,X_2,X_3' that vanishes when is evaluated on X_i = fi implicitEq(List, ZZ, Polyhedron) := (polynomialList, nu, aPolyhedra) -> ( N := maxMinor(representationMatrix(teToricRationalMap (polynomialList, aPolyhedra),nu)); -- A multiple of the implicit equation (taking several minors we erase extra factors) return det(N) ); --------------------------------------------------------------------------- --------------------------------------------------------------------------- -- PURPOSE : Method that verifies if the Euler Chrasteristric of the Z-complex is zero in the given degree isGoodDegree = method(); -- INPUT : '(polynomialList,nu)', where polynomialList with the polynomials {f0,f1,f2,f3} and 'nu' is an integer that represents the degree in the grading of the toric ring. -- OUTPUT : 'True/False' a Boolean that says if the Euler Chrasteristric of the Z-complex is zero in the given degree 'nu' -- We assume the matrix is of homogeneous polynomials isGoodDegree(Matrix, ZZ) := (polynomialList, nu) -> ( F := polynomialList; Z0 := (ring F)^1; Z1 := kernel koszul(1,F); Z2 := kernel koszul(2,F); Z3 := kernel koszul(3,F); d := (degree (polynomialList_0))_0; eulerChar := hilbertFunction(nu,Z0)-hilbertFunction(nu+d,Z1)+hilbertFunction(nu+2*d,Z2)-hilbertFunction(nu+3*d,Z3); return (eulerChar == 0) ); -- We assume the list is of inhomogeneous polynomials and that P is the polytope that defines the homogeneization. isGoodDegree(List, ZZ, Polyhedron) := (polynomialList, nu, P) -> ( return isGoodDegree (teToricRationalMap (polynomialList,P),nu) ); -- We assume the list is of inhomogeneous polynomials and that P=N, the Newton polytope, is the polytope that defines the homogeneization. isGoodDegree(List, ZZ) := (polynomialList, nu) -> ( return isGoodDegree (teToricRationalMap polynomialList,nu) ); --------------------------------------------------------------------------- --------------------------------------------------------------------------- -- PURPOSE :Method that computes the degree of the MacRae's invariant = degree of implicit equation = degree of det((Z)_nu) degreeImplicitEq = method(); -- INPUT : '(polynomialList,nu)', where polynomialList with the polynomials {f0,f1,f2,f3} and 'nu' is an integer that represents the degree in the grading of the toric ring. -- OUTPUT : 'd' an integer which is the degree of H^{deg(f)}.G, where H is the implicit equation, deg(f) is the degree of f={f0,f1,f2,f3}, and G is an extra factor that may appear. degreeImplicitEq(List, ZZ) := (polynomialList, nu) -> ( F := teToricRationalMap polynomialList; Z0 := (ring F)^1; Z1 := kernel koszul(1,F); Z2 := kernel koszul(2,F); Z3 := kernel koszul(3,F); d := (degree (F_0_0))_0; return (hilbertFunction(nu+d,Z1)-2*hilbertFunction(nu+2*d,Z2)+3*hilbertFunction(nu+3*d,Z3)) ); degreeImplicitEq(List, ZZ, Polyhedron) := (polynomialList, nu, P) -> ( F := teToricRationalMap (polynomialList,P); Z0 := (ring F)^1; Z1 := kernel koszul(1,F); Z2 := kernel koszul(2,F); Z3 := kernel koszul(3,F); d := (degree (F_0_0))_0; return (hilbertFunction(nu+d,Z1)-2*hilbertFunction(nu+2*d,Z2)+3*hilbertFunction(nu+3*d,Z3)) ); degreeImplicitEq(Matrix, ZZ) := (polynomialMatrix, nu) -> ( F := polynomialMatrix; Z0 := (ring F)^1; Z1 := kernel koszul(1,F); Z2 := kernel koszul(2,F); Z3 := kernel koszul(3,F); d := (degree (polynomialMatrix_0_0))_0; return (hilbertFunction(nu+d,Z1)-2*hilbertFunction(nu+2*d,Z2)+3*hilbertFunction(nu+3*d,Z3)) ); --------------------------------------------------------------------------- --------------------------------------------------------------------------- -- PURPOSE : Auxiliary method that takes from a given m x n - Matrix of rank r, a new full rank m x r - Matrix MaxCol = method(); -- INPUT : 'M' an m x n - Matrix of rank r -- OUTPUT : 'N' an m x r - Matrix of rank r MaxCol(Matrix) := (M) -> { --M is matrix in a Polynomial Ring --MaxCol returns a submatrix of M with rank M col, of rank M, --using generic substitution. rm:=rank(M); i:=0; c:={}; while #c { --Apply two times MaxCol to obtain a maximal minor --This is not very efficient... return (transpose MaxCol(transpose MaxCol(M)) ) }; ---------------------------------------------------- --------------- DOCUMENTATION ---------------------- ---------------------------------------------------- beginDocumentation() --------------------------------------------------------- --------------------------------------------------------- -- Simple Doc information --------------------------------------------------------- --------------------------------------------------------- --******************************************************* -- DOCUMENTATION FOR PACKAGE --******************************************************* doc /// Key MatrixRepToric Headline A package for computing implicit equations of bigraded rational surfaces by means of approximation complexes Description Text @EM "MatrixRepToric"@ is a package for computing implicit equations of toric rational surfaces embedded in a projective space, by means of approximation complexes. We provide a method for computing a matrix representation (see @TO representationMatrix @) and the implicit equation (see @TO implicitEq @ ) by means of the method developed in [BDD09] and [Bot10]. As it is probably the most interesting case from a practical point of view, we restrict our computations to parametrizations from toric surfaces embedded in some projective space. This implementation allows to compute small examples for the better understanding of the theory developed in [BDD09] and [Bot10]. The aim of the present package is to provide an algorithm for computing a matrix representation for a surface in P^3 parametrized over a 2-dimensional toric variety T embedded into a projective space. This algorithm follows the ideas of [BDD09] and [Bot10] and it is implemented in Macaulay2 [GS]. The authors show in [BDD09] that such a surface can be represented by a matrix of linear syzygies if the base points are finite in number and form locally a complete intersection, and in [Bot10] that this can be generalized to the case where the base locus is not necessarily a locally complete intersection, but locally an almost complete intersection. The key point consists in exploiting the sparse structure of the parametrization, which allows us to avoid non almost complete intersection points and to obtain significantly smaller matrices than in the homogeneous case. This implementation contributes to computing implicit equations for rational surfaces in P3, avoiding costly Groebner Bases methods and further, it permits to obtain matrix representations of such surfaces, which is better adapt to practical problems. References: [BDD10] Nicolas Botbol, Marc Dohm, and Manuel Dubinsky. A package for computing implicit equations of parametrizations from toric surfaces, 2010. @HREF "http://mate.dm.uba.ar/~nbotbol/pdfs/MatrixRepToric.pdf" @ [BDD09] Nicolas Botbol, Alicia Dickenstein, and Marc Dohm. Matrix representations for toric parametrizations. Comput. Aided Geom. Design, 26(7):757–771, 2009. [Bot10] Nicolas Botbol. Compactifications of rational maps and the implicit equations of their images. J. Pure and Applied Algebra. 215(5):1053–1068, 2011. [BC05] Laurent Buse and Marc Chardin. Implicitizing rational hypersurfaces using approximation complexes. J. Symbolic Comput, 40(4-5):1150–1168, 2005. [BCJ09] Laurent Buse, Marc Chardin, and Jean-Pierre Jouanolou. Torsion of the symmetric algebra and implicitization. Proc. Amer. Math. Soc, 137(6):1855–1865, 2009. [BCS10] Laurent Buse, Marc Chardin, and Aron Simis. Elimination and nonlinear equations of rees algebras. Journal of Algebra, 324(6):1314 – 1333, 2010. [BD07] Laurent Buse and Marc Dohm. Implicitization of bihomogeneous parametrizations of algebraic surfaces via linear syzygies. In ISSAC 2007, pages 69–76. ACM, New York, 2007. [BJ03] Laurent Buse and Jean-Pierre Jouanolou. On the closed image of a rational map and the implicitization problem. J. Algebra, 265(1):312–357, 2003. [Cha06] Marc Chardin. Implicitization using approximation complexes. In Algebraic geometry and geometric modeling, Math. Vis, pages 23–35. Springer, Berlin, 2006. [CLS11] David A. Cox, John B. Little, and Henry K. Schenck. Toric varieties. Providence, RI: American Mathematical Society (AMS), 2011. [Ful93] William Fulton. Introduction to toric varieties, volume 131 of Annals of Mathematics Studies. Princeton University Press, Princeton, NJ, 1993. The William H. Roever Lectures in Geometry. [GKZ94] Israel M Gel′fand, Mikhail M Kapranov, and Aandrei V Zelevinsky. Discriminants, resultants, and multidimen- sional determinants. Mathematics: Theory & Applications. Birkh ̈auser Boston Inc, Boston, MA, 1994. [KD06] Amit Khetan and Carlos D’Andrea. Implicitization of rational surfaces using toric varieties. J. Algebra, 303(2):543– 565, 2006. /// ------------------------ \ documentation isGoodDegree / ------------------------ document { Key => {(isGoodDegree,List, ZZ)}, Headline => "verifies if the Euler Chrasteristric of the Z-complex is zero in the given degree", Usage => " isGood = isGoodDegree(polynomialList,nu)", Inputs => { "polynomialList" => List => {"with polynomials {f0,f1,f2,f3}"}, "nu" => ZZ }, Outputs => { "Bool" => Boolean }, PARA {}, "The integer nu needs to be a good degree for the first parameter {f0,f1,f2,f3} that can be verified by doing isGoodDegree(polinomialList,nu).", PARA {}, TT "isGoodDegree", " verifies if the approximation complex Z associated to the polynomials given is acyclic in degree nu.", PARA {}, "Given a list of polynomials {f0,f1,f2,f3}, the approximation complex of cycles is bigraded. This funtion verifies if the strand of degree 'nu' is acyclic.", PARA {}, "Precisely, it computes the Euler characteristic of the nu-strand of the Z-complex, by computing the alternate sum of (-1)^i * hilbertFunction(nu+i*d,Z_i).", PARA {}, "Note: the polynomials must be the inhomogeneous polynomials defining the affine parametrization.", EXAMPLE { " S = QQ[s,t]; ", " f0 = s^2+s^3*t; ", " f1 = s^3*t^6+1; ", " f2 = s*t^2+2*s^3*t^5; ", " f3 = s^2+s^3*t^6; ", " l = {f0,f1,f2,f3}; ", "isGoodDegree (l,2)" }, SeeAlso => {"Polyhedra::Polyhedra"} } document { Key => {isGoodDegree}, Headline => "verifies if the Euler Chrasteristric of the Z-complex is zero in the given degree", Usage => " isGood = isGoodDegree(polynomialList,nu)", Inputs => { "polynomialList" => List => {"with polynomials {f0,f1,f2,f3}"}, "nu" => ZZ, "P" => Polyhedron => {"the polytope to be considered for the toric compactification"} }, Outputs => { "Bool" => Boolean }, PARA {}, "The integer nu needs to be a good degree for the first parameter {f0,f1,f2,f3} that can be verified by doing isGoodDegree(polinomialList,nu,P).", PARA {}, TT "isGoodDegree", " verifies if the approximation complex Z associated to the homogeneous polynomials (wrt P) given is acyclic in degree nu.", PARA {}, "Given a list of polynomials {f0,f1,f2,f3}, the method homoneizes the polynomials wrt P. Now, the approximation complex of cycles Z is bigraded. This funtion verifies if the strand of degree 'nu' of Z is acyclic.", PARA {}, "Precisely, it computes the Euler characteristic of the nu-strand of the Z-complex, by computing the alternate sum of (-1)^i * hilbertFunction(nu+i*d,Z_i).", PARA {}, "Note: the polynomials must be the inhomogeneous polynomials defining the affine parametrization.", EXAMPLE { /// needsPackage "Polyhedra"///, /// S = QQ[s,t]; ///, /// f0 = s^2+s^3*t; ///, /// f1 = s^3*t^6+1; ///, /// f2 = s*t^2+2*s^3*t^5; ///, /// f3 = s^2+s^3*t^6; ///, /// l = {f0,f1,f2,f3};///, /// P = convexHull(matrix{{0,0,1},{0,1,0}});///, /// isGoodDegree (l,2,P)/// }, SeeAlso => {"Polyhedra::Polyhedra"} } document { Key => {(isGoodDegree,Matrix,ZZ)}, Headline => "verifies if the Euler Chrasteristric of the Z-complex is zero in the given degree", Usage => " isGood = isGoodDegree(polynomialMatrix,nu)", Inputs => { "polynomialMatrix" => Matrix => {"a row matrix with polynomials {f0,f1,f2,f3}"}, "nu" => ZZ }, Outputs => { "Bool" => Boolean }, PARA {}, "The integer nu needs to be a good degree for the first parameter {f0,f1,f2,f3} that can be verified by doing isGoodDegree(polinomialMatrix,nu).", PARA {}, TT "isGoodDegree", " verifies if the approximation complex Z associated to the polynomials given is acyclic in degree nu.", PARA {}, "Given a row-matrix of polynomials matrix{{f0,f1,f2,f3}}, the approximation complex of cycles is bigraded. This funtion verifies if the strand of degree 'nu' is acyclic.", PARA {}, "Precisely, it computes the Euler characteristic of the nu-strand of the Z-complex, by computing the alternate sum of (-1)^i * hilbertFunction(nu+i*d,Z_i).", PARA {}, "Note: the polynomials must be the homogeneous polynomials from which we construct the Z-complex, defining the toric parametrization.", EXAMPLE { " S = QQ[s,t]; ", " f0 = s^2+s^3*t; ", " f1 = s^3*t^6+1; ", " f2 = s*t^2+2*s^3*t^5; ", " f3 = s^2+s^3*t^6; ", " l = {f0,f1,f2,f3}; ", " G = teToricRationalMap(l); ", "isGoodDegree (G,2)" }, SeeAlso => {"Polyhedra::Polyhedra"} } ------------------------ \ documentation degreeImplicitEq / ------------------------ document { Key => {degreeImplicitEq}, Headline => "computes the degree of det((Z)_nu)", Usage => " isGood = isGoodDegree(polynomialList,nu,P)", Inputs => { "polynomialList" => List => {"with polynomials {f0,f1,f2,f3}"}, "nu" => ZZ, "P" => Polyhedron => {"the polytope to be considered for the toric compactification"} }, Outputs => { "degH" => ZZ }, PARA {}, " The integer 'nu' needs to be a 'good degree' for the first parameter '{f0,f1,f2,f3}' that can be verified by doing isGoodDegree(polinomialList,nu,P) ", PARA {}, TT "degreeImplicitEq", " computes the degree of the gcd of the maximal minors of the matrix representation of {f0,f1,f2,f3} in degree 'nu' after homogeneization wrt P, equivalently, the degree of determinant of the Z-complex associated to {f0,f1,f2,f3} in degree 'nu'. This is:", PARA {}, " degreeImplicitEq({f0,f1,f2,f3}, nu,P) = degree(representationMatrix(teToricRationalMap({f0,f1,f2,f3},P),nu) that computes 'deg(det((Z(f0,f1,f2,f3))_nu))'", PARA {}, " Given a list of polynomials {f0,f1,f2,f3}, it computes the degree of the gcd of the maximal minors of the right-most map of the strand of degree 'nu'.", PARA {}, " Precisely, 'degreeImplicitEq' returns an integer which is the degree of H^{deg(f)}.G, where H is the implicit equation, deg(f) is the degree of f={f0,f1,f2,f3}, and G is an extra factor that may appear.", EXAMPLE { /// needsPackage "Polyhedra"///, /// S = QQ[s,t]; ///, /// f0 = s^2+s^3*t; ///, /// f1 = s^3*t^6+1; ///, /// f2 = s*t^2+2*s^3*t^5; ///, /// f3 = s^2+s^3*t^6; ///, /// l = {f0,f1,f2,f3};///, /// P = convexHull(matrix{{0,0,1},{0,1,0}});///, /// degreeImplicitEq (l,2,P)/// }, EXAMPLE {" S = QQ[s,t]; ", " f0 = s^2+s^3*t; ", " f1 = s^3*t^6+1; ", " f2 = s*t^2+2*s^3*t^5; ", " f3 = s^2+s^3*t^6; ", "degreeImplicitEq ( {f0,f1,f2,f3} ,2, polynomialsToPolytope {f0,f1,f2,f3})" }, SeeAlso => {"Polyhedra::Polyhedra", representationMatrix, degree, teToricRationalMap, isGoodDegree} } document { Key => {(degreeImplicitEq,List,ZZ)}, Headline => "computes the degree of det((Z)_nu)", Usage => " isGood = isGoodDegree(polynomialList,nu)", Inputs => { "polynomialList" => List => {"with polynomials {f0,f1,f2,f3}"}, "nu" => ZZ }, Outputs => { "degH" => ZZ }, PARA {}, " The integer 'nu' needs to be a 'good degree' for the first parameter '{f0,f1,f2,f3}' that can be verified by doing isGoodDegree(polinomialList,nu) ", PARA {}, TT "degreeImplicitEq", " computes the degree of the gcd of the maximal minors of the matrix representation of {f0,f1,f2,f3} in degree 'nu', equivalently, the degree of determinant of the Z-complex associated to {f0,f1,f2,f3} in degree 'nu'. This is:", PARA {}, " degreeImplicitEq({f0,f1,f2,f3}, nu) = degree(representationMatrix(teToricRationalMap({f0,f1,f2,f3}),nu) that computes 'deg(det((Z(f0,f1,f2,f3))_nu))'", PARA {}, "Implicitely, it uses the Newton polytope of {f0,f1,f2,f3}, that can be obtained by doing", TO polynomialsToPolytope, PARA {}, " Given a list of polynomials {f0,f1,f2,f3}, it computes the degree of the gcd of the maximal minors of the right-most map of the strand of degree 'nu'.", PARA {}, " Precisely, 'degreeImplicitEq' returns an integer which is the degree of H^{deg(f)}.G, where H is the implicit equation, deg(f) is the degree of f={f0,f1,f2,f3}, and G is an extra factor that may appear.", EXAMPLE {" S = QQ[s,t]; ", " f0 = s^2+s^3*t; ", " f1 = s^3*t^6+1; ", " f2 = s*t^2+2*s^3*t^5; ", " f3 = s^2+s^3*t^6; ", "degreeImplicitEq ({f0,f1,f2,f3},2)" }, SeeAlso => {representationMatrix, degree, polynomialsToPolytope, teToricRationalMap, isGoodDegree} } document { Key => {(degreeImplicitEq,Matrix,ZZ)}, Headline => "computes the degree of det((Z)_nu)", Usage => " isGood = isGoodDegree(polynomialList,nu)", Inputs => { "polynomialMatrix" => Matrix => {"a row matrix with homogeneous polynomials g0,g1,g2,g3 defining the toric map"}, "nu" => ZZ }, Outputs => { "degH" => ZZ }, PARA {}, " The integer 'nu' needs to be a 'good degree' for the first parameter 'polynomialMatrix' that can be verified by doing isGoodDegree(polynomialMatrix,nu) ", PARA {}, TT "degreeImplicitEq", " computes the degree of the gcd of the maximal minors of the matrix representation of the homogeneous polynomials in 'polynomialMatrix' in degree 'nu', equivalently, the degree of determinant of the Z-complex associated to 'polynomialMatrix' in degree 'nu'. This is:", PARA {}, " degreeImplicitEq(polynomialMatrix, nu) = degree(representationMatrix(polynomialMatrix,nu) that computes 'deg(det((Z(g0,g1,g2,g3))_nu))'", PARA {}, " Precisely, 'degreeImplicitEq' returns an integer which is the degree of H^{deg(f)}.G, where H is the implicit equation, deg(f) is the degree of f={f0,f1,f2,f3}, and G is an extra factor that may appear.", EXAMPLE {" S = QQ[s,t]; ", " f0 = s^2+s^3*t; ", " f1 = s^3*t^6+1; ", " f2 = s*t^2+2*s^3*t^5; ", " f3 = s^2+s^3*t^6; ", "degreeImplicitEq (teToricRationalMap{f0,f1,f2,f3},2)" }, SeeAlso => {representationMatrix, degree, polynomialsToPolytope, teToricRationalMap, isGoodDegree} } ------------------------ \ documentation ToricEmbedding / ------------------------ document { Key => {ToricEmbedding}, Headline => "Embedding of a variety with ambient space A^2 in an n-dimensional projective espace.", PARA {}, " Class that builds an embedding of the affine plane into an n-dimensional projective espace." } ------------------------ \ documentation newToricEmbedding / ------------------------ document { Key => {newToricEmbedding, (newToricEmbedding,List)}, Headline => "constructs a ToricEmbedding", Usage => " TE = newToricEmbedding(polynomialList)", Inputs => { "polynomialList" => List => {"with polynomials {f0,f1,f2,f3}"}, }, Outputs => { "degH" => ToricEmbedding }, PARA {}, " Given a list of four polynomials {f0,f1,f2,f3} in a polynomial ring in two variables, namely QQ[s,t] we can compute its Newton polytope, namely, the", TO convexHull, " of the union of the Newton polytope of all the polynomial in the list, with the method", TO polynomialsToPolytope, ". Take N= polynomialsToPolytope ({f0,f1,f2,f3}). Then", TO ToricEmbedding, " of {f0,f1,f2,f3} can be defined as", TO ToricEmbedding, " of N.", PARA {}, " Given a polynedron P we construc the ambient ring for building the coordinate ring of the toric variety associated to P. Precisely, assume P has p+1 lattice points, this is length latticePoints P = p+1, and denote with T_0 ... T_p the lattice points of P. Consider the ring QQ[T_0..T_p]. Let J be the toric ideal of P, then newToricEmbedding provides the ring 'QQ[s,t,u,v,w,T_0..T_p,MonomialOrder=>Eliminate 5]' which has all the information of the coordinate ring QQ[T_0..T_p]/J.", PARA {}, " METHODS: teLattice, teLatticeLen,teRing", PARA {}, "teLattice: returns the list of lattice points of the polytope associated to the toric embedding. Precisely, when tEmb = newToricEmbedding(P), tEmb#teLattice = latticePoints P.", PARA {}, "teLatticeLen: returns the length list ''of lattice points of the polytope associated to the toric embedding. Precisely, when tEmb = newToricEmbedding(P), tEmb#teLattice = length latticePoints P.", PARA {}, "teRing: returns the ring 'QQ[s,t,u,v,w,T_0..T_tEmb#teLatticeLen,MonomialOrder=>Eliminate 5]'.", EXAMPLE {" S = QQ[s,t]; ", " f0 = s^2+s^3*t; ", " f1 = s^3*t^6+1; ", " f2 = s*t^2+2*s^3*t^5; ", " f3 = s^2+s^3*t^6; ", " l = {f0,f1,f2,f3};", " teFromPolyList = newToricEmbedding(l);" }, SeeAlso => {teToricRing, teToricRationalMap, polynomialsToPolytope} } ------------------------ \ documentation teToricRing / ------------------------ document { Key => {teToricRing, (teToricRing,ToricEmbedding)}, Headline => "Returns the coordinate ring of the toric variety", Usage => " A = teToricRing(TE)", Inputs => { "TE" => ToricEmbedding }, Outputs => { "degH" => QuotientRing }, PARA {}, TT "teToricRing", " constructs from a",TO ToricEmbedding, " the associated coordinate ring.", PARA {}, " Given a polyhedron P we construc the coordinate ring of the toric variety associated to P. Precisely, assume P has p+1 lattice points, this is", TO length, TO latticePoints, " P = p+1, and denote with T_0 ... T_p the lattice points of P. Consider the ring QQ[T_0..T_p]. Let J be the toric ideal of P, then teToricRing gives coordinate ring QQ[T_0..T_p]/J.", EXAMPLE {" S = QQ[s,t]; ", " f0 = s^2+s^3*t; ", " f1 = s^3*t^6+1; ", " f2 = s*t^2+2*s^3*t^5; ", " f3 = s^2+s^3*t^6; ", " l = {f0,f1,f2,f3};", " TE = newToricEmbedding(l);", " V = teToricRing(TE);"}, SeeAlso => {newToricEmbedding, teToricRationalMap } } ------------------------ \ documentation teGetPolytope / ------------------------ document { Key => {teGetPolytope, (teGetPolytope,ToricEmbedding)}, Headline => "returns the Polytope associated to the ToricEmbedding", Usage => " P = teGetPolytope(TE)", Inputs => { "TE" => ToricEmbedding }, Outputs => { "P" => Polyhedron, }, PARA {}, TT "teGetPolytope", "returns the polytope used for building the", TO ToricEmbedding ,"TE.", EXAMPLE {" S = QQ[s,t]; ", " f0 = s^2+s^3*t; ", " f1 = s^3*t^6+1; ", " f2 = s*t^2+2*s^3*t^5; ", " f3 = s^2+s^3*t^6; ", " l = {f0,f1,f2,f3}; ", " TE = newToricEmbedding(l); ", " teGetPolytope TE " }, SeeAlso => {newToricEmbedding} } ------------------------ \ documentation teToricRationalMap / ------------------------ document { Key => {(teToricRationalMap, List)}, Headline => "Computes the rational map G defined over the toric coordinate ring given by {f0,f1,f2,f3}", Usage => " G = teToricRationalMap(polynomialList)", Inputs => { "polynomialList" => List => {"with polynomials {f0,f1,f2,f3}"} }, Outputs => { "G" => Matrix }, PARA {}, " Given a polynedron P we can associate a Toric variety Tv_P with coordinate ring A. Precisely A can be computed as 'A = teToricRing (newToricEmbedding {f0,...,f3})'. Assume P has p+1 lattice points, this is length latticePoints P = p+1, and denote with T_0 ... T_p the lattice points of P. Consider the ring QQ[T_0..T_p]. Let J be the toric ideal of P, then teToricRing gives coordinate ring QQ[T_0..T_p]/J", PARA {}, "The polynomials f0,...,f3 induces a map homogeneous g=(g_0:...:g_3):Tv_P --> P^3", PARA {}, "teToricRationalMap ({f0,...,f3},P) gives the map g=(g_0:...:g_3):Tv_P --> P^3 induced by the polynomials f0,...,f3", PARA {}, "teToricRationalMap ({f0,...,f3}) gives the map g=(g_0:...:g_3):Tv_N --> P^3 induced by the polynomials f0,...,f3, where N = polynomialsToPolytope({f0,...,f3}).", PARA {}, "teToricRationalMap ({f0,...,f3}) == teToricRationalMap ({f0,...,f3}, polynomialsToPolytope({f0,...,f3})).", EXAMPLE {" S = QQ[s,t]; ", " f0 = s^2+s^3*t; ", " f1 = s^3*t^6+1; ", " f2 = s*t^2+2*s^3*t^5; ", " f3 = s^2+s^3*t^6; ", " l = {f0,f1,f2,f3}; ", " G = teToricRationalMap(l); ", }, SeeAlso => {newToricEmbedding, teToricRing, polynomialsToPolytope} } document { Key => {teToricRationalMap}, Headline => "Computes the rational map G defined by {f0,f1,f2,f3} over the toric coordinate ring associated to a polytope P ", Usage => " G = teToricRationalMap(polynomialList)", Inputs => { "polynomialList" => List => {"with polynomials {f0,f1,f2,f3}"}, "P" => Polyhedron }, Outputs => { "G" => Matrix }, PARA {}, " Given a polynedron P we can associate a Toric variety Tv_P with coordinate ring A. Precisely A can be computed as 'A = teToricRing (newToricEmbedding {f0,...,f3})'. Assume P has p+1 lattice points, this is length latticePoints P = p+1, and denote with T_0 ... T_p the lattice points of P. Consider the ring QQ[T_0..T_p]. Let J be the toric ideal of P, then teToricRing gives coordinate ring QQ[T_0..T_p]/J", PARA {}, "The polynomials f0,...,f3 induces a map homogeneous g=(g_0:...:g_3):Tv_P --> P^3", PARA {}, "teToricRationalMap ({f0,...,f3},P) gives the map g=(g_0:...:g_3):Tv_P --> P^3 induced by the polynomials f0,...,f3", PARA {}, "teToricRationalMap ({f0,...,f3}) gives the map g=(g_0:...:g_3):Tv_N --> P^3 induced by the polynomials f0,...,f3, where N = polynomialsToPolytope({f0,...,f3}).", PARA {}, "teToricRationalMap ({f0,...,f3}) == teToricRationalMap ({f0,...,f3}, polynomialsToPolytope({f0,...,f3})).", EXAMPLE { /// needsPackage "Polyhedra"///, /// S = QQ[s,t]; ///, /// f0 = s^2+s^3*t; ///, /// f1 = s^3*t^6+1; ///, /// f2 = s*t^2+2*s^3*t^5; ///, /// f3 = s^2+s^3*t^6; ///, /// l = {f0,f1,f2,f3};///, /// P = convexHull(matrix{{0,0,1},{0,1,0}});///, /// teToricRationalMap (l,P)/// }, EXAMPLE {" S = QQ[s,t]; ", " f0 = s^2+s^3*t; ", " f1 = s^3*t^6+1; ", " f2 = s*t^2+2*s^3*t^5; ", " f3 = s^2+s^3*t^6; ", " l = {f0,f1,f2,f3}; ", " G = teToricRationalMap(l, polynomialsToPolytope l); ", }, SeeAlso => {newToricEmbedding, teToricRing, polynomialsToPolytope} } ------------------------ \ documentation representationMatrix / ------------------------ document { Key => {representationMatrix, (representationMatrix,Matrix,ZZ)}, Headline => "computes the right-most map of the Z-complex in degree nu)", Usage => " RM = representationMatrix(G,nu)", Inputs => { "G" => Matrix, "nu" => ZZ }, Outputs => { "G" => Matrix }, PARA {}, " NOTE: the first imput need to be a list or a matrix of homogenous polynomials. It is usually composed with 'teToricRationalMap'", PARA {}, " The integer 'nu' needs to be a 'good degree' for the first parameter '{f0,f1,f2,f3}' that can be verified by doing isGoodDegree(polinomialList,nu) ", PARA {}, "representationMatrix(teToricRationalMap{f0,f1,f2,f3},nu) computes the right-most map of the Z-complex in degree nu. Its determinant vanishes on the implicit equation of the image of the map given by (f0:...:fn) in P^n. The output matrix in 'X_0,X_1,X_2,X_3' whose rank drops when X_i = fi", EXAMPLE {" S = QQ[s,t]; ", " f0 = s^2+s^3*t; ", " f1 = s^3*t^6+1; ", " f2 = s*t^2+2*s^3*t^5; ", " f3 = s^2+s^3*t^6; ", " l = {f0,f1,f2,f3}; ", "representationMatrix (teToricRationalMap(l),2)" }, SeeAlso => { implicitEq } } ------------------------ \ documentation implicitEq / ------------------------ document { Key => {implicitEq}, Headline => "computes the gcd of the right-most map of the Z-complex in degree nu)", Usage => " iEq = implicitEq(polynomialList,nu,P)", Inputs => { "polynomialList" => List => {"with polynomials {f0,f1,f2,f3}"}, "nu" => ZZ, "P" => Polyhedron }, Outputs => { "G" => RingElement }, PARA {}, " The integer 'nu' needs to be a 'good degree' for the first parameter '{f0,f1,f2,f3}' that can be verified by doing isGoodDegree(polinomialList,nu,P) ", PARA {}, "implicitEq({f0,f1,f2,f3},nu,P) computes the determinant of the maximal minors of representationMatrix({f0,f1,f2,f3},nu,P). Equivalently, it computes the determinant of the Z-complex in degree 'nu'. This is:", PARA {}, "implicitEq({f0,f1,f2,f3}, nu,P)=det((Z(f0,f1,f2,f3))_nu)", PARA {}, "We also have that: degree(implicitEq({f0,f1,f2,f3}, nu))=degreeImplicitEq({f0,f1,f2,f3}, nu,P)", EXAMPLE { /// needsPackage "Polyhedra"///, /// S = QQ[s,t]; ///, /// f0 = s^2+s^3*t; ///, /// f1 = s^3*t^6+1; ///, /// f2 = s*t^2+2*s^3*t^5; ///, /// f3 = s^2+s^3*t^6; ///, /// l = {f0,f1,f2,f3};///, /// P = convexHull(matrix{{0,0,1},{0,1,0}});///, /// implicitEq ({f0,f1,f2,f3},2,P)/// }, PARA {}, "For the programmer: it computes the determinant of a maximal minor of 'representationMatrix (teToricRationalMap({f0,f1,f2,f3},P),2)' using the function 'maxMinor'", SeeAlso => { representationMatrix, degreeImplicitEq, maxMinor} } document { Key => {(implicitEq, List,ZZ)}, Headline => "computes the gcd of the right-most map of the Z-complex in degree nu)", Usage => " iEq = implicitEq(polynomialList,nu,P)", Inputs => { "polynomialList" => List => {"with polynomials {f0,f1,f2,f3}"}, "nu" => ZZ, }, Outputs => { "G" => RingElement }, PARA {}, " The integer 'nu' needs to be a 'good degree' for the first parameter '{f0,f1,f2,f3}' that can be verified by doing isGoodDegree(polinomialList,nu) ", PARA {}, "implicitEq({f0,f1,f2,f3},nu) computes the determinant of the maximal minors of representationMatrix({f0,f1,f2,f3},nu). Equivalently, it computes the determinant of the Z-complex in degree 'nu'. This is:", PARA {}, "implicitEq({f0,f1,f2,f3}, nu)=det((Z(f0,f1,f2,f3))_nu)", PARA {}, "We also have that: degree(implicitEq({f0,f1,f2,f3}, nu))=degreeImplicitEq({f0,f1,f2,f3}, nu)", EXAMPLE {" S = QQ[s,t]; ", " f0 = 2*s+s^2*t; ", " f1 = s^4*t^2+2*s; ", " f2 = s^2*t-3*t; ", " f3 = s*t+5*s^4*t^2 ", "implicitEq ({f0,f1,f2,f3},2)" }, PARA {}, "For the programmer: it computes the determinant of a maximal minor of 'representationMatrix (teToricRationalMap{f0,f1,f2,f3},2)' using the function 'maxMinor'", SeeAlso => { representationMatrix, degreeImplicitEq, maxMinor} } ------------------------ \ documentation maxMinor / ------------------------ document { Key => {maxMinor, (maxMinor,Matrix)}, Headline => "Returns a maximal minor of the matrix of full rank.", Usage => " MM = maxMinor(Mat)", Inputs => { "Mat" => Matrix }, Outputs => { "MM" => Matrix }, PARA {}, " From a given m x n - Matrix of rank r, ", TO maxMinor, " returns an r x r full rank Matrix.", EXAMPLE { " M = matrix {{1,2,3},{1,2,3},{4,5,6},{4,5,6}}", " maxMinor M"}, PARA {}, "NOTE: because of the necessity of ", TO rank," the base field need to be QQ for doing generic evaluation. If not, one gets the message: expected an affine ring (consider Generic=>true to work over QQ).", EXAMPLE { " R=QQ[a..g]", " M = matrix {{a,a,b},{c,c,d},{e,e,f},{g,g,g}}", " maxMinor M"}, SeeAlso => {rank} } ------------------------ \ documentation polynomialsToPolytope / ------------------------ document { Key => {polynomialsToPolytope, (polynomialsToPolytope, List)}, Headline => "Return the convexHull of the union of the Newton polytope of all the polynomial in the list", Usage => " N = polynomialsToPolytope(polynomialList)", Inputs => { "polynomialList" => List => {"with polynomials {f0,f1,f2,f3}"} }, Outputs => { "N" => Polyhedron }, PARA {}, " Given a list l={f_0..f_n} of polynomials in two variables this method computes the convexHull of the union of the Newton polytope of all the polynomial in the list. This is, if N_i= newtonPolytope(f_i), then polynomialsToPolytope(l)= convexHull(N_0,...,N_n).", EXAMPLE {" S = QQ[s,t]; ", " f0 = s^2+s^3*t; ", " f1 = s^3*t^6+1; ", " f2 = s*t^2+2*s^3*t^5; ", " f3 = s^2+s^3*t^6; ", " l = {f0,f1,f2,f3};", " N = polynomialsToPolytope(l);" }, SeeAlso => {teToricRing, teToricRationalMap, representationMatrix} } ------------------------ \ documentation teLatticePotintsFromHomothethicPolytope / ------------------------ document { Key => "teLatticePotintsFromHomothethicPolytope", Headline => "Returns the list of coordinates of N based on the smallest homothety of P containing N.", Usage => " N = polynomialsToPolytope(polynomialList)", Inputs => { "N" => Polyhedron, "P" => Polyhedron }, Outputs => { "Mat" => Matrix }, PARA {}, " Assume we are given two polyheda, N and P, such that there exists a positive integer k such that kP contains N. Take the minimun k with this prpoerty. Asumme P has p+1 lattice points, this is length latticePoints P = p+1. Now denote with T_0 ... T_p the lattice points of P, and consider the ring QQ[T_0..T_p]. The method 'teLatticePotintsFromHomothethicPolytope(N,P)' gives a 1-column matrix with entries homogeneous elements of QQ[T_0..T_p] of degree k. The i-th row has the information of how the ih point in N can be written as a product of k T's, this is, as a sum of k points of P.", EXAMPLE { /// needsPackage "Polyhedra"///, /// S = QQ[s,t]; ///, /// f0 = s^2+s^3*t; ///, /// f1 = s^3*t^6+1; ///, /// f2 = s*t^2+2*s^3*t^5; ///, /// f3 = s^2+s^3*t^6; ///, /// l = {f0,f1,f2,f3};///, /// P = convexHull(matrix{{0,0,1},{0,1,0}});///, /// rNP = teLatticePotintsFromHomothethicPolytope(polynomialsToPolytope(l),P)/// }, PARA {}, "For the programmer: we use a simiular algorithm of that used in 'Pennies, Nickels, Dimes and Quarters (Computations in algebraic geometry with Macaulay 2 Editors: D. Eisenbud, D. Grayson,M. Stillman, and B. Sturmfels)'", SeeAlso => {teToricRing, teToricRationalMap, representationMatrix, polynomialsToPolytope} } ------------------------ \ net / ------------------------ document { Key => {(net,ToricEmbedding)}, Headline => "Defines the new type ToricEmbedding", Usage => " net(aToricEmbedding)", SeeAlso => {net, ToricEmbedding, newToricEmbedding} } --------------------------------------- -- TESTS --------------------------------------- -- Test 0 -- Checking polynomialsToPolytope TEST /// needsPackage "Polyhedra" S=QQ[s,t]; f0=s*t^6+2; f1=s*t^5-3*s*t^3; f2=s*t^4+5*s^2*t^6; f3=2+s^2*t^6; l = {f0,f1,f2,f3}; LATTICE = latticePoints polynomialsToPolytope(l); assert(LATTICE_0 == matrix{{0},{0}}) assert(LATTICE_1 == matrix{{1},{3}}) assert(LATTICE_2 == matrix{{1},{4}}) assert(LATTICE_3 == matrix{{1},{5}}) assert(LATTICE_4 == matrix{{1},{6}}) assert(LATTICE_5 == matrix{{2},{6}}) /// -- Test 1 -- Checking lattice points of the Newton polytope TEST /// needsPackage "Polyhedra" S=QQ[s,t]; f0=s*t^6+2; f1=s*t^5-3*s*t^3; f2=s*t^4+5*s^2*t^6; f3=2+s^2*t^6; l = {f0,f1,f2,f3}; TE = newToricEmbedding(l); assert(length(latticePoints teGetPolytope TE) == 6) /// -- Test 2 -- Checking that rings with different vars coincide TEST /// needsPackage "Polyhedra" S=QQ[s,t]; f0=s*t^6+2; f1=s*t^5-3*s*t^3; f2=s*t^4+5*s^2*t^6; f3=2+s^2*t^6; l1 = {f0,f1,f2,f3}; TE1 = newToricEmbedding(l1); R=QQ[a,b]; g0=a*b^6+2; g1=a*b^5-3*a*b^3; g2=a*b^4+5*a^2*b^6; g3=2+a^2*b^6; l2 = {g0,g1,g2,g3}; TE2 = newToricEmbedding(l2); assert(latticePoints teGetPolytope TE1 == latticePoints teGetPolytope TE2) /// -- Test 3 -- Test teLatticePotintsFromHomothethicPolytope TEST /// needsPackage "Polyhedra" S=QQ[s,t]; f0=s*t^6+2; f1=s*t^5-3*s*t^3; f2=s*t^4+5*s^2*t^6; f3=2+s^2*t^6; l1 = {f0,f1,f2,f3}; N = polynomialsToPolytope(l1) P = convexHull(matrix{{0,0,1},{0,2,2}}); matNandP = teLatticePotintsFromHomothethicPolytope(N,P); R := ring matNandP; expected = matrix{{R_0^3},{R_0*R_1*R_3},{R_0*R_2*R_3},{R_1*R_2*R_3},{R_2^2*R_3},{R_2*R_3^2}} -- verifies by hand the construction of the monomials written on s,t and rewritten on T_0,T_1,T_2,T_3, by interpreting the points of N in 3*P. assert(matNandP_0_0 == expected_0_0) assert(matNandP_0_1 == expected_0_1) assert(matNandP_0_2 == expected_0_2) assert(matNandP_0_3 == expected_0_3) assert(matNandP_0_4 == expected_0_4) assert(matNandP_0_5 == expected_0_5) /// -- Test 4 -- Test teToricRing TEST /// needsPackage "Polyhedra" S=QQ[s,t]; f0=s*t^6+2; f1=s*t^5-3*s*t^3; f2=s*t^4+5*s^2*t^6; f3=2+s^2*t^6; l = {f0,f1,f2,f3}; TE = newToricEmbedding(l); A = teToricRing(TE); -- verifies by hand that the variables and the relations are the correct ones. Thus, if the quotient is correct. gensSet = gens gb ideal A; assert(gensSet_0_0 == A_3^2-A_2*A_4) assert(gensSet_1_0 == A_2*A_3-A_1*A_4) assert(gensSet_2_0 == A_2^2-A_1*A_3) assert(gensSet_3_0 == A_1^2-A_0*A_5) ambientVars = vars ambient A assert(ambientVars_0_0 == A_0) assert(ambientVars_1_0 == A_1) assert(ambientVars_2_0 == A_2) assert(ambientVars_3_0 == A_3) assert(ambientVars_4_0 == A_4) assert(ambientVars_5_0 == A_5) /// -- Test 5 -- Test teToricRationalMap TEST /// needsPackage "Polyhedra" S=QQ[s,t]; f0=s*t^6+2; f1=s*t^5-3*s*t^3; f2=s*t^4+5*s^2*t^6; f3=2+s^2*t^6; l = {f0,f1,f2,f3}; P := convexHull(matrix{{0,0,1},{0,2,2}}); myG := teToricRationalMap(l,P); -- the number d is the relation between the sizes of the polytope P defining the toric variety and the Newton polytope of f0,f1,f2,f3. d := 3 --This number is computed as: homothety (polynomialsToPolytope(l), P) -- verifies that the degree of the rational map G defined over the toric coordinate ring is given by homogeneous polynomials of degree d. assert(rank source myG == 4) assert((degree myG_0_0)_0 == d) assert((degree myG_1_0)_0 == d) assert((degree myG_2_0)_0 == d) assert((degree myG_3_0)_0 == d) assert(isHomogeneous myG_0_0) assert(isHomogeneous myG_1_0) assert(isHomogeneous myG_2_0) assert(isHomogeneous myG_3_0) /// -- ACA -- Test 6 -- Test teToricRationalMap TEST /// needsPackage "Polyhedra" S=QQ[s,t]; f0=s*t^6+2; f1=s*t^5-3*s*t^3; f2=s*t^4+5*s^2*t^6; f3=2+s^2*t^6; l = {f0,f1,f2,f3}; myG := teToricRationalMap(l); -- verifies that the Representation matrix RM drops its rank when is evaluated on f0,f1,f2,f3. RM=representationMatrix (myG,2); R=QQ[s,t,X_0..X_3]; FinRM=sub(sub(RM,R), {X_0=>(sub(f0,R)), X_1=>(sub(f1,R)), X_2=>(sub(f2,R)), X_3=>(sub(f3,R))}); assert(rank FinRM < rank RM) -- verifies if the number of rows corresponds to the dimension of the toric coordinate ring in degree 2, which coincides with the number of lattice points in 2 times the newton polytope. assert(rank target RM == length latticePoints(2*polynomialsToPolytope(l))) /// ---------------- TESTS with EXAMPLE 8-bis -- Test 0 -- Checking polynomialsToPolytope TEST /// needsPackage "Polyhedra" S = QQ[s,t]; f0 = 3*s^2*t^2-2*s*t^3-s^2*t+s*t^2-3*s*t-t^2+4*t-1; f1 = 3*s^2*t^2-s^2*t-3*s*t^2-s*t+t^2+1+t^3+s^2; f2 = 2*s^2*t^3-3*s^2*t^2-s^2*t+s*t^2+3*s*t-3*t^2+2*t-1; f3 = 2*s^2*t^3-3*s^2*t^2-2*s*t^3+s^2*t+5*s*t^2-3*s*t-3*t^2+4*t-1; l = {f0,f1,f2,f3}; LATTICE = latticePoints polynomialsToPolytope(l); assert(LATTICE_0 == matrix{{0},{0}}) assert(LATTICE_1 == matrix{{0},{1}}) assert(LATTICE_2 == matrix{{0},{2}}) assert(LATTICE_3 == matrix{{0},{3}}) assert(LATTICE_4 == matrix{{1},{0}}) assert(LATTICE_5 == matrix{{1},{1}}) assert(LATTICE_6 == matrix{{1},{2}}) assert(LATTICE_7 == matrix{{1},{3}}) assert(LATTICE_8 == matrix{{2},{0}}) assert(LATTICE_9 == matrix{{2},{1}}) assert(LATTICE_10 == matrix{{2},{2}}) assert(LATTICE_11 == matrix{{2},{3}}) /// -- Test 1 -- Checking lattice points of the Newton polytope TEST /// needsPackage "Polyhedra" S = QQ[s,t]; f0 = 3*s^2*t^2-2*s*t^3-s^2*t+s*t^2-3*s*t-t^2+4*t-1; f1 = 3*s^2*t^2-s^2*t-3*s*t^2-s*t+t^2+1+t^3+s^2; f2 = 2*s^2*t^3-3*s^2*t^2-s^2*t+s*t^2+3*s*t-3*t^2+2*t-1; f3 = 2*s^2*t^3-3*s^2*t^2-2*s*t^3+s^2*t+5*s*t^2-3*s*t-3*t^2+4*t-1; l = {f0,f1,f2,f3}; TE = newToricEmbedding(l); assert(length(latticePoints teGetPolytope TE) == 12) /// -- Test 2 -- Checking that rings with different vars coincide TEST /// needsPackage "Polyhedra" S = QQ[s,t]; f0 = 3*s^2*t^2-2*s*t^3-s^2*t+s*t^2-3*s*t-t^2+4*t-1; f1 = 3*s^2*t^2-s^2*t-3*s*t^2-s*t+t^2+1+t^3+s^2; f2 = 2*s^2*t^3-3*s^2*t^2-s^2*t+s*t^2+3*s*t-3*t^2+2*t-1; f3 = 2*s^2*t^3-3*s^2*t^2-2*s*t^3+s^2*t+5*s*t^2-3*s*t-3*t^2+4*t-1; l1 = {f0,f1,f2,f3}; TE1 = newToricEmbedding(l1); S = QQ[a,b]; g0 = 3*a^2*b^2-2*a*b^3-a^2*b+a*b^2-3*a*b-b^2+4*b-1; g1 = 3*a^2*b^2-a^2*b-3*a*b^2-a*b+b^2+1+b^3+a^2; g2 = 2*a^2*b^3-3*a^2*b^2-a^2*b+a*b^2+3*a*b-3*b^2+2*b-1; g3 = 2*a^2*b^3-3*a^2*b^2-2*a*b^3+a^2*b+5*a*b^2-3*a*b-3*b^2+4*b-1; l2 = {g0,g1,g2,g3}; TE2 = newToricEmbedding(l2); assert(latticePoints teGetPolytope TE1 == latticePoints teGetPolytope TE2) /// -- Test 3 -- Test teLatticePotintsFromHomothethicPolytope TEST /// needsPackage "Polyhedra" S = QQ[s,t]; f0 = 3*s^2*t^2-2*s*t^3-s^2*t+s*t^2-3*s*t-t^2+4*t-1; f1 = 3*s^2*t^2-s^2*t-3*s*t^2-s*t+t^2+1+t^3+s^2; f2 = 2*s^2*t^3-3*s^2*t^2-s^2*t+s*t^2+3*s*t-3*t^2+2*t-1; f3 = 2*s^2*t^3-3*s^2*t^2-2*s*t^3+s^2*t+5*s*t^2-3*s*t-3*t^2+4*t-1; l1 = {f0,f1,f2,f3}; N = polynomialsToPolytope(l1) P = convexHull(matrix{{0,0,1,1},{0,1,0,1}}); matNandP = teLatticePotintsFromHomothethicPolytope(N,P); expected = matrix{{T_0^3},{T_0^2*T_1},{T_0*T_1^2},{T_1^3},{T_0^2*T_2},{T_0^2*T_3},{T_0*T_1*T_3},{T_1^2*T_3},{T_0*T_2^2},{T_0*T_2*T_3},{T_0*T_3^2},{T_1*T_3^2}} -- verifies by hand the construction of the monomials written on s,t and rewritten on T_0,T_1,T_2,T_3, by interpreting the points of N in 3*P. assert(matNandP_0 == expected_0) /// -- Test 4 -- Test teToricRing TEST /// needsPackage "Polyhedra" S = QQ[s,t]; f0 = 3*s^2*t^2-2*s*t^3-s^2*t+s*t^2-3*s*t-t^2+4*t-1; f1 = 3*s^2*t^2-s^2*t-3*s*t^2-s*t+t^2+1+t^3+s^2; f2 = 2*s^2*t^3-3*s^2*t^2-s^2*t+s*t^2+3*s*t-3*t^2+2*t-1; f3 = 2*s^2*t^3-3*s^2*t^2-2*s*t^3+s^2*t+5*s*t^2-3*s*t-3*t^2+4*t-1; l = {f0,f1,f2,f3}; TE = newToricEmbedding(l); A = teToricRing(TE); -- verifies by hand that the variables and the relations are the correct ones. Thus, if the quotient is correct. gensSet = gens gb ideal A; assert(gensSet_0_0 == T_10^2-T_9*T_11) assert(gensSet_1_0 == T_9*T_10-T_8*T_11) assert(gensSet_2_0 == T_7*T_10-T_6*T_11) assert(gensSet_3_0 == T_6*T_10-T_5*T_11) assert(gensSet_4_0 == T_5*T_10-T_4*T_11) assert(gensSet_5_0 == T_3*T_10-T_2*T_11) assert(gensSet_6_0 == T_2*T_10-T_1*T_11) assert(gensSet_7_0 == T_1*T_10-T_0*T_11) assert(gensSet_8_0 == T_9^2-T_8*T_10) assert(gensSet_9_0 == T_7*T_9-T_5*T_11) assert(gensSet_10_0 == T_6*T_9-T_4*T_11) assert(gensSet_11_0 == T_5*T_9-T_4*T_10) assert(gensSet_12_0 == T_3*T_9-T_1*T_11) assert(gensSet_13_0 == T_2*T_9-T_0*T_11) assert(gensSet_14_0 == T_1*T_9-T_0*T_10) assert(gensSet_15_0 == T_7*T_8-T_4*T_11) assert(gensSet_16_0 == T_6*T_8-T_4*T_10) assert(gensSet_17_0 == T_5*T_8-T_4*T_9) assert(gensSet_18_0 == T_3*T_8-T_0*T_11) assert(gensSet_19_0 == T_2*T_8-T_0*T_10) assert(gensSet_20_0 == T_1*T_8-T_0*T_9) assert(gensSet_21_0 == T_7^2-T_3*T_11) assert(gensSet_22_0 == T_6*T_7-T_2*T_11) assert(gensSet_23_0 == T_5*T_7-T_1*T_11) assert(gensSet_24_0 == T_4*T_7-T_0*T_11) assert(gensSet_25_0 == T_6^2-T_1*T_11) assert(gensSet_26_0 == T_5*T_6-T_0*T_11) assert(gensSet_27_0 == T_4*T_6-T_0*T_10) assert(gensSet_28_0 == T_3*T_6-T_2*T_7) assert(gensSet_29_0 == T_2*T_6-T_1*T_7) assert(gensSet_30_0 == T_1*T_6-T_0*T_7) assert(gensSet_31_0 == T_5^2-T_0*T_10) assert(gensSet_32_0 == T_4*T_5-T_0*T_9) assert(gensSet_33_0 == T_3*T_5-T_1*T_7) assert(gensSet_34_0 == T_2*T_5-T_0*T_7) assert(gensSet_35_0 == T_1*T_5-T_0*T_6) assert(gensSet_36_0 == T_4^2-T_0*T_8) assert(gensSet_37_0 == T_3*T_4-T_0*T_7) assert(gensSet_38_0 == T_2*T_4-T_0*T_6) assert(gensSet_39_0 == T_1*T_4-T_0*T_5) assert(gensSet_40_0 == T_2^2-T_1*T_3) assert(gensSet_41_0 == T_1*T_2-T_0*T_3) assert(gensSet_42_0 == T_1^2-T_0*T_2) ambientVars = vars ambient A assert(ambientVars_0_0 == T_0) assert(ambientVars_1_0 == T_1) assert(ambientVars_2_0 == T_2) assert(ambientVars_3_0 == T_3) assert(ambientVars_4_0 == T_4) assert(ambientVars_5_0 == T_5) assert(ambientVars_6_0 == T_6) assert(ambientVars_7_0 == T_7) assert(ambientVars_8_0 == T_8) assert(ambientVars_9_0 == T_9) assert(ambientVars_10_0 == T_10) assert(ambientVars_11_0 == T_11) /// -- Test 5 -- Test teToricRationalMap TEST /// needsPackage "Polyhedra" S = QQ[s,t]; f0 = 3*s^2*t^2-2*s*t^3-s^2*t+s*t^2-3*s*t-t^2+4*t-1; f1 = 3*s^2*t^2-s^2*t-3*s*t^2-s*t+t^2+1+t^3+s^2; f2 = 2*s^2*t^3-3*s^2*t^2-s^2*t+s*t^2+3*s*t-3*t^2+2*t-1; f3 = 2*s^2*t^3-3*s^2*t^2-2*s*t^3+s^2*t+5*s*t^2-3*s*t-3*t^2+4*t-1; l = {f0,f1,f2,f3}; P = convexHull(matrix{{0,0,1,1},{0,1,0,1}}); myG := teToricRationalMap(l,P); -- the number d is the relation between the sizes of the polytope P defining the toric variety and the Newton polytope of f0,f1,f2,f3. d := 3 --This number is computed as: homothety (polynomialsToPolytope(l), P) -- verifies that the degree of the rational map G defined over the toric coordinate ring is given by homogeneous polynomials of degree d. assert(rank source myG == 4) assert((degree myG_0_0)_0 == d) assert((degree myG_1_0)_0 == d) assert((degree myG_2_0)_0 == d) assert((degree myG_3_0)_0 == d) assert(isHomogeneous myG_0_0) assert(isHomogeneous myG_1_0) assert(isHomogeneous myG_2_0) assert(isHomogeneous myG_3_0) /// -- Test 6 -- Test teToricRationalMap in a simplest example. cf. Example six below. TEST /// needsPackage "Polyhedra" S = QQ[s,t]; f0 = s^2+t^4 f1 = s^2*t^4+1 f2 = t^2+2*s*t^3^1 f3 = s*t+s^2*t^4 l = {f0,f1,f2,f3}; myG := teToricRationalMap(l); -- verifies that the Representation matrix RM drops its rank when is evaluated on f0,f1,f2,f3. RM=representationMatrix (myG,2); R=QQ[s,t,X_0..X_3]; FinRM=sub(sub(RM,R), {X_0=>(sub(f0,R)), X_1=>(sub(f1,R)), X_2=>(sub(f2,R)), X_3=>(sub(f3,R))}); assert(rank FinRM < rank RM) -- verifies if the number of rows corresponds to the dimension of the toric coordinate ring in degree 2, which coincides with the number of lattice points in 2 times the newton polytope. assert(rank target RM == length latticePoints(2*polynomialsToPolytope(l))) /// -- Test 7 -- Test degreeImplicitEq in a simplest example. TEST /// needsPackage "Polyhedra" S = QQ[s,t]; f0 = s^2+s^3*t; f1 = s^3*t^6+1; f2 = s*t^2+2*s^3*t^5; f3 = s^2+s^3*t^6; l = {f0,f1,f2,f3} M = teToricRationalMap(l) assert(degreeImplicitEq (M,2)==17) P = polynomialsToPolytope(l) assert(degreeImplicitEq (l,2)==17) assert(degreeImplicitEq (l,2,P)==17) /// end --******************************************************* -- EXAMPLES FOR PACKAGE --******************************************************* ----------------------------------------------- -- Example 0th example (2,2) ----------------------------------------------- S = QQ[s,t]; f0 = s*t+t; f1 = s; f2 = t^2*s+t^2; f3 = s^2*t+s*t; ----------------------------------------------- -- Example first example (2,3) ----------------------------------------------- S = QQ[s,t]; f0 = s^2*t^2 f1 = t^2+s^2*t f2 = t^3+s f3 = s^2+s^2*t^3 ----------------------------------------------- -- Example second example (1,3) ----------------------------------------------- S = QQ[s,t]; f0 = s*t^2 f1 = t^2+s*t f2 = t^3+s f3 = s+s*t^3 ----------------------------------------------- -- Example third example (1,3) ----------------------------------------------- S = QQ[s,t]; f0 = t^2+3*s*t^2 f1 = t^2+2*t f2 = t^3-s*t f3 = s+s*t^3 ----------------------------------------------- -- Example fourth example (4,6) -- gcd is not 1 ----------------------------------------------- S = QQ[s,t]; f0 = s^4*t^2 f1 = s^4*t^6-s^3*t^2 f2 = t^3+2*s^2*t^4 f3 = s^5*t+s^3*t^5 ----------------------------------------------- -- Example fifth example (4,5) without basepoints ----------------------------------------------- S = QQ[s,t]; f0 = s^4^5-2+t^5 f1 = s^4*t^5+1 f2 = t^3+2*s^2*t^3 f3 = s*t+s^3*t^5 ----------------------------------------------- -- Example sixth example (2,4) ----------------------------------------------- S = QQ[s,t]; f0 = s^2+t^4 f1 = s^2*t^4+1 f2 = t^2+2*s*t^3^1 f3 = s*t+s^2*t^4 ----------------------------------------------- -- Example seventh example (4,6) ----------------------------------------------- S = QQ[s,t]; f0 = s^4+t^6 f1 = s^4*t^6+1 f2 = t^3+2*s^3*t^5^1 f3 = s^5*t+s^4*t^6 ----------------------------------------------- -- Example eighth example (3,6) ----------------------------------------------- S = QQ[s,t]; f0 = s^3^6+t^6 f1 = s^3*t^6+1 f2 = t^3+2*s^2*t^5 f3 = s^5*t+s^3*t^6 ----------------------------------------------- -- Example eighth (bis) example (3,6) ----------------------------------------------- S = QQ[s,t]; f0 = s^2+s^3*t; f1 = s^3*t^6+1; f2 = s*t^2+2*s^3*t^5; f3 = s^2+s^3*t^6; needsPackage "Polyhedra"; load "MatrixRepToric.m2"; L={f0,f1,f2,f3}; ----- latticePoints polynomialsToPolytope L tEmb=newToricEmbedding L; ----- g = teToricRationalMap L; rM=representationMatrix (teToricRationalMap L,2); R=QQ[s,t,X_0..X_3]; Eq=sub(sub(rM,R), {X_0=>(sub(f0,R)), X_1=>(sub(f1,R)), X_2=>(sub(f2,R)), X_3=>(sub(f3,R))}); rank rM rank Eq ----- Q1=convexHull matrix{{0,0,1,1},{0,1,0,2}} gQ1 = teToricRationalMap (L,Q1) rMQ1=representationMatrix (gQ1,5); R=QQ[s,t,X_0..X_3]; EqQ1=sub(sub(rMQ1,R), {X_0=>(sub(f0,R)), X_1=>(sub(f1,R)), X_2=>(sub(f2,R)), X_3=>(sub(f3,R))}); rank rMQ1 rank EqQ1 ----- Q2=convexHull matrix{{0,0,1},{0,1,0}} gQ2 = teToricRationalMap (L,Q2) rMQ2=representationMatrix (gQ2,16); R=QQ[s,t,X_0..X_3]; EqQ2=sub(sub(rMQ2,R), {X_0=>(sub(f0,R)), X_1=>(sub(f1,R)), X_2=>(sub(f2,R)), X_3=>(sub(f3,R))}); rank rMQ2 rank EqQ2 ----- Q3=convexHull matrix{{0,0,1,1},{0,1,0,1}} gQ3 = teToricRationalMap (L,Q3) rMQ3=representationMatrix (gQ3,5); R=QQ[s,t,X_0..X_3]; EqQ3=sub(sub(rMQ3,R), {X_0=>(sub(f0,R)), X_1=>(sub(f1,R)), X_2=>(sub(f2,R)), X_3=>(sub(f3,R))}); rank rMQ3 rank EqQ3 ----------------------------------------------- -- Example ninth example (2,3) ----------------------------------------------- S = QQ[s,t]; f0 = 3*s^2*t^2-2*s*t^3-s^2*t+s*t^2-3*s*t-t^2+4*t-1 f1 = 3*s^2*t^2-s^2*t-3*s*t^2-s*t+t^2+1 f2 = 2*s^2*t^3-3*s^2*t^2-s^2*t+s*t^2+3*s*t-3*t^2+2*t-1 f3 = 2*s^2*t^3-3*s^2*t^2-2*s*t^3+s^2*t+5*s*t^2-3*s*t-3*t^2+4*t-1 nu=1 ----------------------------------------------- -- Example ninth-bis example (2,3) ----------------------------------------------- S = QQ[s,t]; f0 = 3*s^2*t^2-2*s*t^3-s^2*t+s*t^2-3*s*t-t^2+4*t-1; f1 = 3*s^2*t^2-s^2*t-3*s*t^2-s*t+t^2+1+t^3+s^2; f2 = 2*s^2*t^3-3*s^2*t^2-s^2*t+s*t^2+3*s*t-3*t^2+2*t-1; f3 = 2*s^2*t^3-3*s^2*t^2-2*s*t^3+s^2*t+5*s*t^2-3*s*t-3*t^2+4*t-1; load "MatrixRepToric.m2" nu=2; L={f0,f1,f2,f3}; rM=representationMatrix (teToricRationalMap ((newToricEmbedding L),L),nu); R=QQ[s,t,X_0..X_3]; Eq=sub(sub(rM,R), {X_0=>(sub(f0,R)), X_1=>(sub(f1,R)), X_2=>(sub(f2,R)), X_3=>(sub(f3,R))}); rank rM rank Eq ----------------------------------------------- -- Example tenth example (3,4) -- from D'Andrea/Khetan Example 11 ----------------------------------------------- S = QQ[s,t]; f0 = (t+t^2)*(s-1)^2+(-1-s*t-s^2*t)*(t-1)^2+(t+s*t+s*t^2)*(s-1)*(t-1) f1 = (t+t^2)*(s-1)^2+(1+s*t-s^2*t)*(t-1)^2+(t+s*t+s*t^2)*(s-1)*(t-1) f2 = (-t-t^2)*(s-1)^2+(-1+s*t+s^2*t)*(t-1)^2+(t+s*t+s*t^2)*(s-1)*(t-1) f3 = (t-t^2)*(s-1)^2+(-1-s*t+s^2*t)*(t-1)^2+(t+s*t+s*t^2)*(s-1)*(t-1) ----------------------------------------------- -- Example eleventh example (3,4) -- from D'Andrea/Khetan Example 10 and I S SAC paper ----------------------------------------------- S = QQ[s,t]; f0 = (t+t^2)*(s-1)^2+(-1-s*t-s^2*t)*(t-1)^2 f1 = (t+t^2)*(s-1)^2+(1+s*t-s^2*t)*(t-1)^2 f2 = (-t-t^2)*(s-1)^2+(-1+s*t+s^2*t)*(t-1)^2 f3 = (t-t^2)*(s-1)^2+(-1-s*t+s^2*t)*(t-1)^2 ----------------------------------------------- -- Example twelfth example (6,9) ----------------------------------------------- S = QQ[s,t]; f0 = (s^2+t^2)*t^6*s^4+(-1-s^3*t^4-s^4*t^4)*(t-1)^5*(s^2-1) f1 = (s^2+t^2)*t^6*s^4+(1+s^3*t^4-s^4*t^4)*(t-1)^5*(s^2-1) f2 = (-s^2-t^2)*t^6*s^4+(-1+s^3*t^4+s^4*t^4)*(t-1)^5*(s^2-1) f3 = (s^2-t^2)*t^6*s^4+(-1-s^3*t^4+s^4*t^4)*(t-1)^5*(s^2-1) ----------------------------------------------- -- Example 13th example (4,4) -- ----------------------------------------------- S = QQ[s,t]; f0 = (s^2+t^2)*t*s^2+(-1-s*t^2-s^2*t^2)*(t-1)^2*(s^2-1) f1 = (s^2+t^2)*t*s^2+(1+s*t^2-s^2*t^2)*(t-1)^2*(s^2-1) f2 = (-s^2-t^2)*t*s^2+(-1+s*t^2+s^2*t^2)*(t-1)^2*(s^2-1) f3 = (s^2-t^2)*t*s^2+(-1-s*t^2+s^2*t^2)*(t-1)^2*(s^2-1) ----------------------------------------------- -- Example 14th example (6,6) -- -- \\!***!// *** buffer overflow detected ***: M2 terminated ----------------------------------------------- S = QQ[s,t]; f0 = (-s^3*t+s^6)*(t-1)^4+(1+s^2*t^5-s^2*t^6)*(s-1)^2 f1 = (s^3*t-s^6)*(t-1)^4+(1+s^2*t^5+s^2*t^6)*(s-1)^2 f2 = (s^3*t+s^6)*(t-1)^4+(-1+s^2*t^5+s^2*t^6)*(s-1)^2 f3 = (-s^3*t-s^6)*(t-1)^4+(1-s^2*t^5+s^2*t^6)*(s-1)^2 ----------------------------------------------- -- Example 15th example (6,6) ----------------------------------------------- S = QQ[s,t]; f0 = (-s^3*t^5+s^6^6)*(t-1)^4+(1+s^2*t^7-s^2*t^10)*(s-1)^2 f1 = (s^3*t^5-s^6^6)*(t-1)^4+(1+s^2*t^7+s^2*t^10)*(s-1)^2 f2 = (s^3*t^5+s^6^6)*(t-1)^4+(-1+s^2*t^7+s^2*t^10)*(s-1)^2 f3 = (-s^3*t^5-s^6^6)*(t-1)^4+(1-s^2*t^7+s^2*t^10)*(s-1)^2 ----------------------------------------------- -- Example 16th example (4,8) ----------------------------------------------- S = QQ[s,t]; f0 = (-2*s^3*t^5+s*t^3)*(s+1)*(t-1)^3+(-s^2*t^3+3)*(t+1)^4 f1 = (2*s^3*t^5-s*t^3)*(s+1)*(t-1)^3+(s^2*t^3+3)*(t+1)^4 f2 = (-2*s^3*t^5-s*t^3)*(s+1)*(t-1)^3+(s^2*t^3-3)*(t+1)^4 f3 = (2*s^3*t^5+s*t^3)*(s+1)*(t-1)^3+(-s^2*t^3-3)*(t+1)^4 ----------------------------------------------- -- Example 17th example (4,8) ----------------------------------------------- S = QQ[s,t]; f0 = (-s^4*t^6+s^2*t^2)*(t-1)^2+(-s^2*t^3+2*s)*(t+1)^4 f1 = (s^4*t^6-s^2*t^2)*(t-1)^2+(s^2*t^3+2*s)*(t+1)^4 f2 = (-s^4*t^6-s^2*t^2)*(t-1)^2+(s^2*t^3-2*s)*(t+1)^4 f3 = (s^4*t^6+s^2*t^2)*(t-1)^2+(-s^2*t^3-2*s)*(t+1)^4 ----------------------------------------------- -- Example 18th example (4,6) -- very sparse ----------------------------------------------- S = QQ[s,t]; f0 = 2*s^4*t^4+s^2*t^3 f1 = s^2*t^6+2^6 f2 = s*t^3-3*s^4*t^4 f3 = s^5*t+5*s^3*t^5 ----------------------------------------------- -- Example 19th example (4,6) -- very sparse ----------------------------------------------- S = QQ[s,t]; f0 = 2*s*t^3+s*t f1 = s*t^3+2 f2 = s*t^2-3*s^2*t^2 f3 = s*t+5*s^2*t^2 ----------------------------------------------- -- Example 20th example (2,6) -- very sparse ----------------------------------------------- S = QQ[s,t]; f0 = 2^6+s^2*t^6 f1 = s*t^6+2^6 f2 = s*t^5-3*s*t^3 f3 = s*t^4+5*s^2*t^6 ----------------------------------------------- -- Example 21st example (4,2) -- very sparse ----------------------------------------------- S = QQ[s,t]; f0 = 2*s+s^2*t f1 = s^4*t^2+2*s f2 = s^2*t-3*t f3 = s*t+5*s^4*t^2 ----------------------------------------------- -- Example 22nd example (3,3) -- very sparse ----------------------------------------------- S = QQ[s,t]; f0 = 2*s+s^2*t^2 f1 = s^3*t^3+2*s f2 = s^2*t^2-3*s*t f3 = t+5*s^3*t^3 ----------------------------------------------- -- Example 23st (?) example (2,2) -- I S SAC example (almost dense) ----------------------------------------------- S = QQ[s,t]; f0 = s^2*t f1 = t+s^2*t f2 = t^2+s f3 = s^2+s^2*t^2 ----------------------------------------------- -- Ex2 from PerezDiaz (8,4) -- non-proper ----------------------------------------------- S = QQ[s,t]; f0 = (t^4+2*t^2+5)*(s^4+1) f1 = (s^4*t^4+2*s^4*t^2+5*s^4+2*t^4+4*t^2+11)*(s^4+1) f2 = (s^4*t^4+2*s^4*t^2+5*s^4+t^4+2*t^2+6) f3 = -(s^4*t^4+2*s^4*t^2+5*s^4+t^4+2*t^2+3)*(s^4+1) ----------------------------------------------- -- Ex2 from PerezDiaz (2,2) -- proper ----------------------------------------------- S = QQ[s,t]; f0 = (t-5)*(s-1) f1 = -(11+s*t-5*s-2*t)*(s-1) f2 = (6-t-5*s+s*t) f3 = (-t+s*t-5*s+3)*(s-1)