# Program for calculating cohomology

Does it exist a computer program which calculates the cohomology of projective algebraic varieties ? For example, smooth surface in $\mathbb{P}^3$? like $\sum_0^3 X_i^3=0$

-
If you mean sheaf cohomology, Macauley2 sometimes can do it. – Francesco Polizzi May 10 '14 at 7:05
In that generality, I'm pretty sure the answer is no. If you restrict the field of definition, the sheaf of coefficients, and the dimension of your variety, then something might be possible. Also, it probably helps if the variety is smooth. – jmc May 10 '14 at 8:01
I think this should be closed as an exact duplicate of mathoverflow.net/questions/81125/… but can't suggest it, as that only had an answer in a comment. – Allen Knutson May 10 '14 at 14:41
Technically speaking, not an exact duplicate. That question is about affine varieties, and the answer is only about affine opens in $\mathbb{A}^n$. – David Speyer May 10 '14 at 17:55

I will work out a couple of examples the Fermat cubic surface using MacAulay2. For instance we may compute the cohomology of the cotangent sheaf and of the tangent sheaf of the cubic surface $Z(x^3+y^3+z^3+w^3)\subset\mathbb{P}^3$ using MacAulay2.

Form this you can figure out how to compute sheaf cohomology for other sheaves using MacAulay2.

Form this example one gets already interesting informations about $X$. For instance $H^{0}(X,T_X) = T_{Id}Aut(X)$, and $h^{0}(X,T_X) = 0$ implies that $Aut(X)$ is finite. Furthermore $H^{1}(X,T_{X})$ parametrizes first order infinitesimal deformations of $X$. We get $h^{1}(X,T_{X}) = 4$. Ideed $X$ is the blow-up of $\mathbb{P}^2$ at six general points. We have $6\cdot 2 = 12$ possible choices for the six points, but we have to subtract the dimension of $Aut(\mathbb{P}^2)$. Finally $12-8 = 4$, as we expected.

Macaulay2, version 1.6
with packages: ConwayPolynomials, Elimination, IntegralClosure, LLLBases, PrimaryDecomposition, ReesAlgebra, TangentCone

i1 : P3 = QQ[x,y,z,w]
o1 = P3
o1 : PolynomialRing

i2 : I = ideal(x^3+y^3+z^3+w^3)
o2 = ideal(x^3  + y^3  + z^3  + w^3 )
o2 : Ideal of P3

i3 : X = variety(I)
o3 = X
o3 : ProjectiveVariety

i4 : CT = cotangentSheaf(X)
o4 = cokernel {2} | z  0  0  w  0   x2  y2 0  |
{2} | x  w  0  0  y2  -z2 0  0  |
{2} | -y 0  w  0  x2  0   z2 0  |
{2} | 0  y  x  0  -w2 0   0  z2 |
{2} | 0  -z 0  x  0   -w2 0  y2 |
{2} | 0  0  -z -y 0   0   w2 x2 |
o4 : coherent sheaf on X, quotient of OO^6_X  (-2)

i5 : cohomology(0,CT)
o5 = 0
o5 : QQ-module

i6 : cohomology(1,CT)
o6 = QQ^7
o6 : QQ-module, free

i7 : cohomology(2,CT)
o7 = 0
o7 : QQ-module

i8 : T = dual(CT)
o8 = image {-2} | -xz2  yz2    z3+w3 0     yw2    -xw2  |
{-2} | y3+z3 x2y    x2z   -yw2  0      zw2   |
{-2} | xy2   -y3-w3 -y2z  -xw2  zw2    0     |
{-2} | -y2w  -x2w   0     z3+w3 x2z    y2z   |
{-2} | z2w   0      x2w   yz2   x2y    y3+w3 |
{-2} | 0     z2w    -y2w  xz2   -y3-z3 xy2   |
o8 : coherent sheaf on X, subsheaf of OO^6_X  (2)

i9 : cohomology(0,T)
o9 = 0
o9 : QQ-module

i10 : cohomology(1,T)
o10 = QQ^4
o10 : QQ-module, free

i11 : cohomology(2,T)
o11 = 0
o11 : QQ-module


-