-- This is code related to HW 3 for Math 615, Winter 2013
-- By: Daniel Erman
-- Exercise 1
-- The whole point of Exercise 1 is to do it by hand!
-- But it might be helpful to use M2 to check that you got the right answers.
-- Here is how to solve the "original version" of the problem on M2,
-- using things up with the lex term order.
S = QQ[x,y,z,w, MonomialOrder => Lex]
I = ideal(x*z-y^2, x*w-z^2, y*w-x*z)
f = x^2*y^2*w^2 - y^4*z^2
f % I
-- Since f % I does not equal 0, it follows that f does not lie in I.
-- Exercise 2
-- The syntax in M2 is pretty simple. Here is an example that does not work.
f = x^2+y^2
g_1 = x^2
g_2 = y^2
(f % g_1) % g_2 == (f % g_2) % g_1
-- Exercise 3
-- I think that this problem is best solved by experimenting on M2.
-- It should be solvable with any term order, though you can see
viewHelp MonomialOrder
-- If you don't specify a term order, then M2 will choose GRevLex.
viewHelp GRevLex
-- Exercise 4
-- There are many ways to solve this problem, and solving it by hand would be useful.
-- But it might also be useful to compute a Grobner Basis. Here is the syntax for
-- computing and viewing a grobner basis for a simple ideal.
S = QQ[x,y]
I = ideal(x^3,x^2*y+y^3)
G = gb I
-- Note that M2 suppresses the list of generators. If you want to see the actual elements in the
-- Grobner basis, try:
gens G
-- Or, if you want to realize this as a list you should do
flatten entries gens G
-- The "flatten" command drops a redundant set of parentheses.
-- Exercise 7
-- You're asked to do this by hand, but it is worth checking your answer in M2.
-- To get the lex order, use:
S = CC[x,y, MonomialOrder => Lex]
-- Of course, the computation would be the same if you replaced CC by QQ.