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   9        7 2   3       7         2   7               5       3 2   7       3       2                  2    7       6        3       10       3       7 2  5 3     2     6   2   8 3   2 2     5         9 2     4   2   10   2   5 3   5 2     5         2 2     3                   1 2     5   2   5   2   10   2   7 3   7 2     5         9 2      9         1         8 2     5         1         8           2         2   1   2   9   2   4   2   4 3   2 2      1         1 2     4          9            2     6         7         3          7 2     5         5         3          9         1 2     2   2   3   2       2   3   2   7   2   10 3
o2 = ideal (-x  + -x x  + --x  + -x x  + -x x  + 6x  + -x x  + 7x x  + -x x  + -x  + -x x  + -x x  + -x x  + 5x 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  + 4x 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  + 5x x  + 6x x  + -x x  + -x x  + -x x  + -x  + -x x  + --x x x  + -x x  + -x x x  + --x x x  + 10x 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 x  + -x x  + --x )
            2 0   4 0 1   10 1   4 0 2   3 1 2     2   4 0 3     1 3   4 2 3   7 3   9 0 4   7 1 4   9 2 4     3 4      4   10 0 5   7 1 5   10 2 5    9 3 5   2 4 5   8 5  6 0     0 1   5 0 1   5 1   5 0 2   7 0 1 2   4 1 2   3 0 2    3 1 2   2 2   3 0 3   9 0 1 3   9 1 3   7 0 2 3     1 2 3   6 2 3   9 0 3   4 1 3    9 2 3   5 3   2 0 4   3 0 1 4   8 1 4   10 0 2 4   3 1 2 4   5 2 4   9 0 3 4   7 1 3 4   3 2 3 4     3 4     0 4   5 1 4   5 2 4   9 3 4   3 4   5 0 5   10 0 1 5   8 1 5   7 0 2 5   10 1 2 5      2 5   7 0 3 5   5 1 3 5   4 2 3 5   10 3 5   4 0 4 5   7 1 4 5   5 2 4 5   10 3 4 5   8 4 5   9 0 5   8 1 5     2 5   2 3 5   8 4 5    9 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 WeilDivisors package does a great job of this:

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

o8 = -Div(x_5)

o8 : WeilDivisor on S/((9/2)*x_0^2+(9/4)*x_0*x_1+(7/10)*x_1^2+(3/4)*x_0*x_2+(7/3)*x_1*x_2+6*x_2^2+(7/4)*x_0*x_3+7*x_1*x_3+(5/4)*x_2*x_3+(3/7)*x_3^2+(7/9)*x_0*x_4+(3/7)*x_1*x_4+(2/9)*x_2*x_4+5*x_3*x_4+10*x_4^2+(7/10)*x_0*x_5+(6/7)*x_1*x_5+(3/10)*x_2*x_5+(10/9)*x_3*x_5+(3/2)*x_4*x_5+(7/8)*x_5^2,(5/6)*x_0^3+5*x_0^2*x_1+(6/5)*x_0*x_1^2+(8/5)*x_1^3+(2/5)*x_0^2*x_2+(5/7)*x_0*x_1*x_2+(9/4)*x_1^2*x_2+(4/3)*x_0*x_2^2+(10/3)*x_1*x_2^2+(5/2)*x_2^3+(5/3)*x_0^2*x_3+(5/9)*x_0*x_1*x_3+(2/9)*x_1^2*x_3+(3/7)*x_0*x_2*x_3+4*x_1*x_2*x_3+(1/6)*x_2^2*x_3+(5/9)*x_0*x_3^2+(5/4)*x_1*x_3^2+(10/9)*x_2*x_3^2+(7/5)*x_3^3+(7/2)*x_0^2*x_4+(5/3)*x_0*x_1*x_4+(9/8)*x_1^2*x_4+(9/10)*x_0*x_2*x_4+(1/3)*x_1*x_2*x_4+(8/5)*x_2^2*x_4+(5/9)*x_0*x_3*x_4+(1/7)*x_1*x_3*x_4+(8/3)*x_2*x_3*x_4+5*x_3^2*x_4+6*x_0*x_4^2+(1/5)*x_1*x_4^2+(9/5)*x_2*x_4^2+(4/9)*x_3*x_4^2+(4/3)*x_4^3+(2/5)*x_0^2*x_5+(1/10)*x_0*x_1*x_5+(1/8)*x_1^2*x_5+(4/7)*x_0*x_2*x_5+(9/10)*x_1*x_2*x_5+10*x_2^2*x_5+(6/7)*x_0*x_3*x_5+(7/5)*x_1*x_3*x_5+(3/4)*x_2*x_3*x_5+(7/10)*x_3^2*x_5+(5/4)*x_0*x_4*x_5+(5/7)*x_1*x_4*x_5+(3/5)*x_2*x_4*x_5+(9/10)*x_3*x_4*x_5+(1/8)*x_4^2*x_5+(2/9)*x_0*x_5^2+(3/8)*x_1*x_5^2+4*x_2*x_5^2+(3/2)*x_3*x_5^2+(7/8)*x_4*x_5^2+(10/9)*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.