-- This is code related to HW 2 for Math 615, Winter 2013
-- By: Daniel Erman
-- Exercise 1 doesn't need Macaualay2, but it might be helpful to look at an example.
S = QQ[a,b,c]
Kab = koszul matrix{{a,b}}
Kc = koszul matrix {{c}}
Kabc = koszul matrix {{a,b,c}}
-- here is how you take the tensor product of two complexes in Macaulay2
Kab ** Kc
-- For Exercise 2, you can compute these groups by hand. But
-- it might also be useful to try adapting this code to compute Koszul homology groups.
S = QQ[x,y]
K = koszul matrix {{x^2,x*y}}
-- note that Macaulay2's indexing is different than Eisenbud's!
-- For a Koszul complex on n elements, the correspondence Eisenbed <--> M2
-- is given by the formula H^i <--> HH_(n-i).
HH_0 K
HH_1 K
HH_2 K
-- For Exercise 3, you should use the Koszul complex to compute the depth of an ideal.
-- The M2 code ``depth'' is quite incomplete.
-- Here is an example that does not work.
S = QQ[x,y]
I = ideal(x^2,y^2)
-- first we compute depth(I,S) as follows:
K = koszul matrix {{x^2,y^2}}
HH_0 K == 0
HH_1 K == 0
HH_2 K == 0
-- thus the first nonzero group is HH_0. After adjusting for Eisenbud's different
-- indexing conventions (see above) and applying Eisenbud 17.4, we see that depth(I,S)=2.
-- computing codim(I,S) is easy:
codim(I)
-- codim(I) = 2 = depth(I,S), this example does not work.
-- Try to find an ideal I where these two invariants diverge.
-- If you don't know where to start in this search, feel free to ask me for a hint.
-- There is M2 code this week for helping with Exercise 4.
-- Exercise 5. Here is how to get K(1,1,1) in M2:
K = koszul matrix {{1,1,1}}
-- This might help you think about the correspondence.