-- Jan 11, 2013 -- Math 615, Daniel Erman -- Some basics features in Macaulay2 -- Note: this code is just meant to give a taste of some -- of the capabilities of M2. S = QQ[x,y,z]; f = x^3+y^3+z^3; degree f jacobian f viewHelp jacobian -- the command "jacobian" wants to be applied to an ideal, not a polynomial I = ideal(f) jacobian I dim I dim (S/I) dim (S^1/I) dim S/I -- check that V(f) is a smooth planar curve: dim ideal(f,3*x^2,3*y^2,3*z^2) -- what is the genus of the curve? genus I -- Let's compute some free resolutions. phi = matrix{{2,3,7}} K = ker phi K = ker (phi**QQ) K = ker (phi**ZZ/7) phi = matrix{{x,y,z}} K = ker phi F = res coker phi F.dd_2 F.dd_3 phi = matrix{{x,y,z,0},{0,x,y,z}} K = ker phi F = res coker phi -- Here's the kind of experimentation that M2 is great for. -- Question: how often is a map ZZ^2 <-- ZZ^3 surjective? phi = random (ZZ^2,ZZ^3) coker phi == 0 experiment = ()->( phi := random(ZZ^2,ZZ^3); coker phi == 0 ) -- How often do you think this should happen? Any guesses? tally apply(10, i-> experiment()) tally apply(100, i-> experiment()) tally apply(1000, i-> experiment()) -- Caveat: this one takes 20 seconds or so. tally apply(100000, i-> experiment()) -- Why? Can anyone provide a heuristic for this formula? -- How will it change if we vary the parameters? -- In a different direction, we could delve deeper when the answer is "false". -- For instance, we could ask: how often is the cokernel annihilated by 2? or 4? mingens ann coker random(ZZ^2,ZZ^3) tally apply(100,i-> mingens ann coker random(ZZ^2,ZZ^3)) tally apply(1000,i-> mingens ann coker random(ZZ^2,ZZ^3))