CoCalc Public Filestutorial-2.ipynbOpen in with one click!
Authors: Joseph Hlavinka, Owen Lynch
Views : 42
Description: Macaulay2 Tutorial

Introduction and Objective

By the end of this presentation, you will know how to input a module into Macaulay2 and compute its free resolution. In order for this to be useful, you need to understand how mathematical objects in commutative algebra correspond to values on the computer.

The roadmap of how to get from 0 to free resolution is as follows.

  • Rings. You will learn how to construct and work with a finitely presented ring.
  • Free Modules and Matrices. You will learn how to construct a free module and work with its elements. Maps between free modules are matrices, and you will learn how to work with these.
  • Fancy Modules. You will learn to use images, kernels, and cokernels to construct more interesting modules.
  • Free Resolutions. The crowning jewel of this presentation will be when you compute the free resolution of kk as an k[x1,x2,x3,x4]k[x_1,x_2,x_3,x_4]-module.

Rings

Base Rings

  • ZZ = Z\mathbb{Z}
  • QQ = Q\mathbb{Q}
  • RR = R\mathbb{R}
  • CC = C\mathbb{C}

Note: many algorithms don't work with RR or CC because they are not exact

In [2]:
%%macaulay2 3 3/2 3.4 3.4+3*ii
3 3 - 2 QQ 3.4 RR (of precision 53) 3.4+3*ii CC (of precision 53)

Finite Fields

In [3]:
%%macaulay2 R = ZZ/5 27_R
R QuotientRing 2 R

Free Rings

We will later learn how to construct quotient rings, so combined with the ability to construct free rings, this allows us to make any finitely presented ring over ZZ or QQ.

In [4]:
%%macaulay2 R = QQ[x,y]
R PolynomialRing

This allows us to verify basic algebraic identities.

In [5]:
%%macaulay2 x^2 + 2*x*y + y^2 - (x+y)^2
0 R

Do it Yourself!

Compute that (x+y)p=xp+yp(x+y)^p = x^p + y^p in (Z/pZ)[x,y](\mathbb{Z}/p\mathbb{Z})[x,y], for p=101p=101

In [8]:
%%macaulay2 R = ZZ/101[x,y] (x+y)^101
R PolynomialRing 101 101 x + y R

Ideals

Any old computer algebra system can manipulate formulas. What sets Macaulay2 apart is manipulating algebraic objects, like ideals and modules.

Creating Ideals

In [9]:
%%macaulay2 R = QQ[x,y] I = ideal(x^2,x*y)
R PolynomialRing 2 ideal (x , x*y) Ideal of R

This is the first Macaulay procedure we have seen. ideal takes in several expressions, and returns the ideal generated by those expressions. We can then work with the returned ideal. For instance, we can compute its primary decomposition.

Operations on Ideals

In [10]:
%%macaulay2 primaryDecomposition(I)
2 {ideal x, ideal (x , y)} List

Or its radical

In [11]:
%%macaulay2 radical(I)
monomialIdeal x MonomialIdeal of R

If we have two ideals, we can also do operations with them.

Other common operations are also functions in Macaulay, like saturation, or computation of associated primes (though you can get that from the primary decomposition of course).

Do it Yourself!

Write down your favorite ideal and compute its radical.

In [13]:
%%macaulay2 I = ideal(x^3, y^2) radical(I)
3 2 ideal (x , y ) Ideal of R monomialIdeal (x, y) MonomialIdeal of R

Quotient Rings

You construct a quotient ring in exactly the way that you would expect.

In [16]:
%%macaulay2 R = QQ[x,y,z] I = ideal(x*y,x*z,y*z) A = R/I
R PolynomialRing ideal (x*y, x*z, y*z) Ideal of R A QuotientRing
In [17]:
%%macaulay2 (x_A + y_A) * y_A
2 y A

This was so easy that we are going to skip to modules without a Do it Yourself section.

Break for Philosophy

The theory of computer algebra is the theory of working with finite representations. Everything we work with is ultimately combinatorial in nature. This is why free modules and free rings are the bread and butter of Macaulay2.

Free Modules and Matrices

Free Modules

Free modules are very easy to write down

In [18]:
%%macaulay2 M = A^2
2 A A-module, free

Free modules have a preferred basis, which you can access easily, and writing down module elements is exactly as you would guess.

In [19]:
%%macaulay2 M_0 + 2*x*M_1
| 1 | | 2x | 2 A

Matrices

In order to do anything else with modules, we want to use matrices. This is because, as I said before, computer algebra is the study of finite representations. One way of finitely describing modules is by giving them as images, kernels, or cokernels of matrices, which are what it says on the tin: a rectangle of ring elements, in this case represented as a list of lists.

In [28]:
%%macaulay2 f = matrix({{x,y},{1,0}})
| x y | | 1 0 | 2 2 Matrix A <--- A

The important thing to get used to about Macaulay2 is that the domain of a function goes on the right, and the codomain goes on the left. The reason for this is that we put the argument to a function on the right hand side of the function, so intuitively the argument travels from right to left through the function. One imagines that the authors of Macaulay2 probably have strong opinions about why this is the correct way to write functions, that they would love to share with you if you went to their website.

Applying Matrices

In [21]:
%%macaulay2 f(y*M_0 + x*M_1)
| 0 | | y | 2 A

Do It Yourself!

Write down your favorite 3×33 \times 3 permutation matrix and apply it to something.

In [26]:
%%macaulay2 f = matrix({{1, 0, 0},{0, 0, 1},{0,1,0}}) Q = ZZ^3 f(Q_0 + 2*Q_1 + Q_2)
| 1 0 0 | | 0 0 1 | | 0 1 0 | 3 3 Matrix ZZ <--- ZZ 3 ZZ ZZ-module, free | 1 | | 1 | | 2 | 3 ZZ

More Interesting Modules

Like I promised, we can compute the image, kernel, and cokernel of a matrix. At this point, you can probably guess how.

In [29]:
%%macaulay2 {image(f),kernel(f),cokernel(f)}
{image | x y |, image {1} | 0 0 0 |, cokernel | x y |} | 1 0 | {1} | z x -x2 | | 1 0 | List

Final Challenge

Let k=Qk = \mathbb{Q}, and let A=Q[x1,x2,x3,x4]A = \mathbb{Q}[x_1,x_2,x_3,x_4]. Compute the free resolution for kk as an AA-module.

First, write down AA in Macaulay

In [30]:
%%macaulay2 A=QQ[x1, x2, x3, x4]
A PolynomialRing

To compute the free resolution of kk as a AA-module, we must first display kk as a AA-module. To this end, write down a map from A4A^4 to AA that has kk as its cokernel. Then assign k to the cokernel of this map.

In [31]:
%%macaulay2 f = matrix({{x1, x2, x3, x4}}) k = cokernel(f)
| x1 x2 x3 x4 | 1 4 Matrix A <--- A cokernel | x1 x2 x3 x4 | 1 A-module, quotient of A

Finally, apply the function resolution to k!

In [32]:
%%macaulay2 resolution(k)
1 4 6 4 1 A <-- A <-- A <-- A <-- A <-- 0 0 1 2 3 4 5 ChainComplex

If we want to learn more about the resolution than the degrees of the free modules, we have to learn how to work with a ChainComplex object. However, that is beyond the scope of this presentation.

Thank you!