Source: Question by Chris Dare, answered by Devlin Mallory. The following is only edited for clarify.

What is an efficient way to compute the anticanonical bundle $-K_X$?

I want to compute the anticanonical bundle $H = -K_X$ of a $(2, 3)$-complete intersection in $\PP^5$.

My setup is as follows:

i1 : S = QQ[x_0..x_5];
i2 : I = ideal(random(2, S), random(3, S))

            9 2   1       3 2   9       3       1 2   1       7        7       3 2          7       7       5       2 2   3        7               6                2    3   5 2     3   2   2 3   2 2               6 2         2   5   2   6 3     2     10         5 2               4           2     7   2   3   2       2     3    3 2     1         5 2     3          1          2     5          9         5         9 2     2   2   5   2   8   2   1   2     3    2                5 2     4         4         2 2               4         2         1 2     5         5         9         10         1 2     7   2   5   2   2   2   3   2   1   2   4 3
o2 = ideal (-x  + -x x  + -x  + -x x  + -x x  + -x  + -x x  + -x x  + --x x  + -x  + x x  + -x x  + -x x  + -x x  + -x  + -x x  + --x x  + 7x x  + -x x  + x x  + 2x , 6x  + -x x  + -x x  + -x  + -x x  + 5x x x  + -x x  + 3x x  + -x x  + -x  + 5x x  + --x x x  + -x x  + 3x x x  + -x x x  + 2x x  + -x x  + -x x  + 6x x  + 3x  + --x x  + -x x x  + -x x  + -x x x  + --x x x  + x x  + -x x x  + --x x x  + -x x x  + -x x  + -x x  + -x x  + -x x  + -x x  + 4x  + x x  + 10x x x  + -x x  + -x x x  + -x x x  + -x x  + 5x x x  + -x x x  + -x x x  + -x x  + -x x x  + -x x x  + -x x x  + --x x x  + -x x  + -x x  + -x x  + -x x  + -x x  + -x x  + -x )
            2 0   2 0 1   2 1   4 0 2   4 1 2   2 2   2 0 3   4 1 3   10 2 3   7 3    0 4   9 1 4   3 2 4   2 3 4   3 4   4 0 5   10 1 5     2 5   7 3 5    4 5     5    0   4 0 1   7 0 1   5 1   9 0 2     0 1 2   5 1 2     0 2   3 1 2   7 2     0 3    9 0 1 3   4 1 3     0 2 3   5 1 2 3     2 3   8 0 3   7 1 3     2 3     3   10 0 4   2 0 1 4   7 1 4   2 0 2 4   10 1 2 4    2 4   6 0 3 4   10 1 3 4   4 2 3 4   8 3 4   5 0 4   2 1 4   5 2 4   8 3 4     4    0 5      0 1 5   9 1 5   3 0 2 5   3 1 2 5   3 2 5     0 3 5   7 1 3 5   9 2 3 5   2 3 5   3 0 4 5   9 1 4 5   4 2 4 5    3 3 4 5   4 4 5   2 0 5   9 1 5   9 2 5   4 3 5   3 4 5   3 5

o2 : Ideal of S
i3 : X = Proj(S/I);

We can check that this is a complete intersection using the TorAlgebra package:

i4 : loadPackage "TorAlgebra";
i5 : isCI I

o5 = true

After ensuring this is indeed non-singular (see here), this (basically every time) yields a smooth prime Fano threefold of degree 6. In particular, $\operatorname{Pic} X$ should be generated by the anticanonical bundle $H$, so I would like to explicitly compute this $H$ to do some homological computations (e.g. what is $\operatorname{RHom}(\mathcal O, \mathcal O(H))$?). I first compute:

i6 : omega = cotangentSheaf(3, X);

This seems like a pretty huge rank to actually compute things over, so it doesnt come as much a surprise that when i try:

H = dual omega

My Mac runs for hours without producing any result. Is there a more efficient approach than what I’m doing?

Solution #1

The Divisor package does a great job of this:

i7 : loadPackage "Divisor";
i8 : KX = canonicalDivisor(S/I, IsGraded => true)

o8 = -Div(x_0)

o8 : WeilDivisor on S/((9/2)*x_0^2+(1/2)*x_0*x_1+(3/2)*x_1^2+(9/4)*x_0*x_2+(3/4)*x_1*x_2+(1/2)*x_2^2+(1/2)*x_0*x_3+(7/4)*x_1*x_3+(7/10)*x_2*x_3+(3/7)*x_3^2+x_0*x_4+(7/9)*x_1*x_4+(7/3)*x_2*x_4+(5/2)*x_3*x_4+(2/3)*x_4^2+(3/4)*x_0*x_5+(7/10)*x_1*x_5+7*x_2*x_5+(6/7)*x_3*x_5+x_4*x_5+2*x_5^2,6*x_0^3+(5/4)*x_0^2*x_1+(3/7)*x_0*x_1^2+(2/5)*x_1^3+(2/9)*x_0^2*x_2+5*x_0*x_1*x_2+(6/5)*x_1^2*x_2+3*x_0*x_2^2+(5/3)*x_1*x_2^2+(6/7)*x_2^3+5*x_0^2*x_3+(10/9)*x_0*x_1*x_3+(5/4)*x_1^2*x_3+3*x_0*x_2*x_3+(4/5)*x_1*x_2*x_3+2*x_2^2*x_3+(7/8)*x_0*x_3^2+(3/7)*x_1*x_3^2+6*x_2*x_3^2+3*x_3^3+(3/10)*x_0^2*x_4+(1/2)*x_0*x_1*x_4+(5/7)*x_1^2*x_4+(3/2)*x_0*x_2*x_4+(1/10)*x_1*x_2*x_4+x_2^2*x_4+(5/6)*x_0*x_3*x_4+(9/10)*x_1*x_3*x_4+(5/4)*x_2*x_3*x_4+(9/8)*x_3^2*x_4+(2/5)*x_0*x_4^2+(5/2)*x_1*x_4^2+(8/5)*x_2*x_4^2+(1/8)*x_3*x_4^2+4*x_4^3+x_0^2*x_5+10*x_0*x_1*x_5+(5/9)*x_1^2*x_5+(4/3)*x_0*x_2*x_5+(4/3)*x_1*x_2*x_5+(2/3)*x_2^2*x_5+5*x_0*x_3*x_5+(4/7)*x_1*x_3*x_5+(2/9)*x_2*x_3*x_5+(1/2)*x_3^2*x_5+(5/3)*x_0*x_4*x_5+(5/9)*x_1*x_4*x_5+(9/4)*x_2*x_4*x_5+(10/3)*x_3*x_4*x_5+(1/4)*x_4^2*x_5+(7/2)*x_0*x_5^2+(5/9)*x_1*x_5^2+(2/9)*x_2*x_5^2+(3/4)*x_3*x_5^2+(1/3)*x_4*x_5^2+(4/3)*x_5^3)
i9 : H = sheaf OO(-KX)

        1
o9 = OO  (1)
       X

o9 : coherent sheaf on X, free of rank 1

You can then compute the various cohomologies you want to.

Solution #2

In your case, you know already from the adjunction formula that the anticanonical bundle will be the hyperplane section, so you can also do the following:

i10 : use S/I;
i11 : H = dual sheaf module ideal(x_0)

              1
o11 = OO       (1)
        Proj S

o11 : coherent sheaf on Proj S, free of rank 1

(You can use any linear form in place of x_0.)

In general, for a non-complete-intersection, where adjunction doesn’t tell you what the anticanonical is immediately, the Divisor package approach above will work as long as the computation doesn’t time out.