O #Math 676 (Comp. Alg. Geom.) Lab 2 (Spring 2009) #Handy note: current one. [control]-k adds a new Maple input line above the O with(Groebner); O # Here's how you find leading terms w.r.t. various term orders O LeadingTerm(x^3*y^2*z + x^2*y^3*z^2 +x^2*y^4*z, plex(x,y,z)); #regular old lex (pure lex) O LeadingTerm(x^3*y^2*z + x^2*y^3*z^2 +x^2*y^4*z, grlex(x,y,z)); #graded lex O LeadingTerm(x^3*y^2*z + x^2*y^3*z^2 +x^2*y^4*z, tdeg(x,y,z)); #grevlex (total degree, for some reason) O sort(x^3*y^2*z + x^2*y^3*z^2 +x^2*y^4*z, [x,y,z], tdeg); #grevlex again, sorting this time O f := 3*x^2*y - 8*y^3 + 2*x*y^2 - 10*x^2 - y; #Here's another polynomial O InitialForm(f, grlex(x,y)); #We can grab all terms with maximal degree O #You can also mess around with weighted orders. Instead of considering just the sum of the exponents as the degree, we can take a weighted sum: O LeadingTerm(x^4*y^2*z + x^2*y^4*z, wdeg([1/2,2,1],[x,y,z])); #This makes y much more important (and x less). InitialForm(x^4*y^2*z + x^2*y^4*z, wdeg([1/2,2,1],[x,y,z])); #Here's the whole initial form - just one mon. O LeadingTerm(x^4*y^2*z + x^2*y^4*z, wdeg([2,1,1],[x,y,z])); #This makes x much more important than y,z. InitialForm(x^4*y^2*z + x^2*y^4*z, wdeg([2,1,1],[x,y,z])); #Now the initial form is just the other mon. O LeadingTerm(x^4*y^2*z + x^2*y^4*z, wdeg([1,1,1],[x,y,z])); #graded lex in a funny form. InitialForm(x^4*y^2*z + x^2*y^4*z, wdeg([1,1,1],[x,y,z])); #Here's the whole initial form - two monomials! #This is a boundary order, i.e., the leading #monomial changes with wdegs just above or below. O # 1. Cook up a polynomial that gives a different leading term for each of the three standard monomial orders. O O O O # Now for Groebner bases! O O O O F2 := [x^3-2*x*y, x^2*y-2*y^2+x]; Basis(F2, plex(x,y,z)); #Hey! Something nontrivial! Let's try a different order: G := Basis(F2, grlex(x,y,z)); #Here's graded lex. Here's one from class: F1 := [x-z,y-z]; Basis(F1, plex(x,y,z)); # OK, so that shows that our generators do give a Groebner basis. Let's try something harder: O #So, at least in Maple, different orders led to different Groebner bases. #We didn't get to this last time, but Maple is actually giving a reduced basis, which is unique (for a fixed #term order). Thus, a GB in one order won't be one in another: O Basis(G, plex(x,y,z)); O #2. Can you cook up an example (maybe in three variables) that has a different GB for plex, grlex, and tdeg? (NOTE: I haven't tried this, but I see no reason why there wouldn't be one....) O O O O #So how do we divide? NormalForm(x^2*y + x*y^2 + y^2, [y^2-1, x*y-1], plex(x,y)); NormalForm(x^2*y + x*y^2 + y^2, [x*y-1, y^2-1], plex(x,y)); # Right, it's that mean example from class. O #3. Is the polynomial above actually in the ideal generated by the divisors?? O # Let's see how fast we can go on something a little bigger. O # We'll wipe out the memory of the session, just in case there's something useful in there.... restart: with(Groebner): F := [a*b*c+d*e*f, a^2*b^2-c*d+e^2*f, a*b*c*d*e-f^4, a^2-b^2+c^2*d]: Basis(F, plex(a,b,c,d,e,f)); O restart: with(Groebner): F := [a*b*c+d*e*f, a^2*b^2-c*d+e^2*f, a*b*c*d*e-f^4, a^2-b^2+c^2*d]: Basis(F, tdeg(a,b,c,d,e,f)); O #Notice anything about how fast the above two lines took? Same ideal in each case - only the term order changed.... Strangely, plex usually provides a larger basis -- this is just a special case, I suppse. O #4. Can you cook up a gnarly example that takes Maple more than a few seconds? What if you try a different monomial order? (HINT: Try higher degrees and/or more variables/polynomials and/or nastier (rational) coefficients and/or coefficients with a bunch of different primes.) O #5. Write a short routine that chooses a random set of polynomials (in 3 variables, say) and checks whether the given basis is actually a GB. If you run this 100 (or 1000...) times, how often is your random choice a GB? For that matter, how can we check whether a given basis is indeed Groebner? (HINT: Maybe encode the S-criterion?) (NOTE: I don't know the answer for this one, but it's worth playing around.....) O #6. Try out some of the above operations over different fields, just for kicks. O #You could also check out the PolynomialIdeals package in the help pages -- in there, you can define an ideal, and it will automatically remember various characteristics like any Groebner bases that you have computed.... O #7. You could check out EliminationIdeal(). We will talk about elimination shortly, but the point is that from a lex GB, you can extract (hopefully) an equation in one variable, one in two, one in three, etc., so that a univariate solver can be employed for the univariate equation. See the next example. O with(PolynomialIdeals): TC := PolynomialIdeal([y-x^2, z-x^3]); #Here's an ideal for the twisted cubic. O BTC := Basis(TC, plex(x,y,z)); #Here's a lex GB for it. O IsZeroDimensional(TC); #Maple will tell you whether the variety is zero-dimensional. O EliminationIdeal(TC,{x}); #Here's how you intersect ideal TC with k[x] to get polynomial(s) in one variable, if there are any. Why aren't there? Now try {y} and {z}?? O EliminationIdeal(TC,{x,y}); #Here we intersect with {x,y}. This works better.... O # 8. Now try the previous with a zero-dimensional ideal. You can cook one up or try something from the notes or just use [3* x^2-4*y*z, x*z-y^3, x^2+z] (randomly chosen). Use a tree of elimination ideals ({x}, {x,y}, {x,y,z} and solve() (or similar) to "solve" the system. O #Here's a fun ideal: IllEx := PolynomialIdeal([(x^2+y^2+z^2-1)*(y-x^2)*(x-1/2), (x^2+ y^2+z^2-1)*(z-x^3)*(y-1/2), (x^2+y^2+z^2-1)*(y-x^2)*(z-x^3)* (z-1/2)], characteristic=0); O EqDecomp := EquidimensionalDecomposition(IllEx); #This cooks up a set of ideals, each with different dimension: O EqDecomp[1]; #Here's the 0-dim part. HilbertDimension(EqDecomp[1]); O EqDecomp[2]; #Dim 1. HilbertDimension(EqDecomp[2]); O EqDecomp[3]; #Dim 2. HilbertDimension(EqDecomp[3]); O # 9. Can we actually get to the isolated solutions? SED1 := Solve(EqDecomp[1]); O # 10. What does all that mean? If you want, mess around with the Groebner and PolynomialIdeals packages and see if you can find the actual solution(s) in dimension zero.... O # 11. Another approach would be to try some small system of linears for which you know the answer....