Introduction to Macaulay 2 at Rutgers

Macaulay 2 is a software program that does computations with polynomial rings and algebraic varieties. The Macaulay 2 home page contains documentation and information about the program. There is an online manual as well as an online copy of a recent book about Macaulay. The getting started page gives an introduction to the use of Macaulay. NOTE: Since polynomials in several variables are inherently long and troublesome to display you will find that running Macaulay 2 in emacs is by far the most convenient way to keep track of output. See running Macaulay 2 in emacs. If you wish to do this add the following line to your .emacs file

(load "/local/Macaulay2-0.9/lib/Macaulay2-0.9/emacs/M2-init.el")

and in a running emacs on a machine with Macaulay 2 installed type CTRL-c m and Macaulay will begin. The Rutgers copy of Macaulay 2 resides on the machine compute. After logging on to that machine, the program can be started by entering the command

M2

The program will print some version information then print an input prompt. The weekly Macaulay worksheets will be similar to this . You should place a copy in your working directory, then at the input prompt enter the following

i1 : input "work0.m2"

replacing "work0.m2" by the name of the script you wish to run, and Macaulay executes the commands in the file, echoing the output


i2 : --Week 0 Macaulay 2 script : Basics on rings and ideals
--Lines following two dashes are comments
--read this into Macaulay by placing this file in a directory and typing
-------input "week0.m2"
-----------------------------------------------------------
--Macaulay knows the rings RR, QQ, ZZ, ZZ/101, ZZ/32749 etc
--Construct a quotient ring by R/I for a ring R and Ideal I
--Create polynomial rings by listing the variables
---------------------------inside [] after the ring

R=QQ[x,y,z,w] --polynomials in 4 variables with rational coefficients

o2 = R

o2 : PolynomialRing

i3 :
--Create ideals by giving the generators
I=ideal(x^2-y,z*w)

             2
o3 = ideal (x - y, z*w)

o3 : Ideal of R

i4 : J=ideal(x*y*z,w^3)

                    3
o4 = ideal (x*y*z, w )

o4 : Ideal of R

i5 :
--Macaulay can do the usual ideal operations and return generators for the result
I*J

             3         2    2 3     3       2      4
o5 = ideal (x y*z - x*y z, x w - y*w , x*y*z w, z*w )

o5 : Ideal of R

i6 : intersect(I,J)

               3            2        3         2    2 3     3
o6 = ideal (z*w , x*y*z*w, x y*z*w, x y*z - x*y z, x w - y*w )

o6 : Ideal of R

i7 : I+J

             2                  3
o7 = ideal (x - y, z*w, x*y*z, w )

o7 : Ideal of R

i8 : I^2

             4    2     2   2              2 2
o8 = ideal (x - 2x y + y , x z*w - y*z*w, z w )

o8 : Ideal of R

i9 :
--Macaulay can compute the radical of an ideal
radical J

o9 = ideal (w, x*y*z)

o9 : Ideal of R

i10 : quit

The weekly worksheets will contain comments explaining the concepts to be explored. After inputting the file, read over the responses that Macaulay gives, and then answer the questions at the end. The worksheets are designed to minimize the typing required, as many of the relevant objects were defined in the file.

For a quick introduction to the syntax and commands of Macaulay 2 read the getting started page and the notes on using polynomials.