--author:Jessica Sidman
--4/26/05
--How do I do that in Macaulay 2?
--A presentation giving examples of how to compute:
--(1) the ideal of a toric variety
--(2) free resolutions
--(3) linear projections
--(4) resolution of singularities
--(1) Suppose that we're given a collection of lattice points in Z^n and we wish to find the ideal of the corresponding toric variety. Assume the list is
exponentList = {{1,1}, {1,0}, {1,2}, {1,3}}
--toMonomial is a function that takes an exponent vector in the form of a list L and a polynomial ring S. It returns a monomial m with exponent vector L.
toMonomial = (L,S) ->(
variableList := flatten entries vars S;
m := 1;
for i from 0 to (#L-1) do(
m = m*(variableList)_i^(L#i);
);
m
)
--We declare two rings. S is the rings where the monomials live. The coordinate ring of the toric variety will be the quotient of R by the binomial ideal giving
--relations on the monomials in our mapping.
S = ZZ/32003[s,t]
R = ZZ/32003[w..z, MonomialOrder => Eliminate 1]
--this will be our list of monomials
monomialList = {};
for i from 0 to (#exponentList - 1) do(
monomialList = append(monomialList, toMonomial(exponentList#i, S));
);
--create a ring map whose kernel is the ideal of the toric variety parameterized by the monomial mapping
f = map(S,R,monomialList);
--compute the kernel without printing the output
I = kernel f;
--print the output to a string that is ready for cut and paste
toString I
--(2) free resolutions:
--compute the minimal free resolution of I
C = res I
--get the betti diagram
betti res I
--get the matrices giving the differentials in the resolution
C.dd
--(3) linear projections: project this curve to the plane from the point (1, 0, 0, 0)
--We project by computing a groebner basis and selecting only elements that don't use the variable w.
--We get a matrix of groebner basis elements.
projectionMatrix = selectInSubring(1, gens gb I);
--We get the ideal generated by the elements of projectionMatrix
idealOfProjection = ideal (projectionMatrix)
-- Resolution of singularities
--the coordinate ring of P^2 x P^1
S = ZZ/32003[x,y,z, w0, w1]
--the coordinate ring of P^2 with an extra parameter
B = ZZ/32003[x,y,z,t]
--The blowup of [1:0:0] in P^2 is defined by the kernel of this map
blowupMap = map(B,S,{x,y,z,t*y, t*z})
K = kernel blowupMap
toString idealOfProjection
use S
J = ideal(y^3-x*z^2) + K
restart