  
  [1X4 Toric varieties X(Delta)[0X
  
  This  chapter  concerns  [5Xtoric[0m  commands  which  deal  with  certain objects
  associated to the (non-affine) toric varieties X(Delta).
  
  
  [1X4.1 Riemann-Roch spaces[0X
  
  Let Delta denote a complete nonsingular fan.
  
  [1X4.1-1 DivisorPolytope[0m
  
  [2X> DivisorPolytope( [0X[3XD, Rays[0X[2X ) _______________________________________[0Xfunction
  
  [13XInput[0m:  [3XRays[0m is the list of smallest integer vectors in the rays for the fan
  Delta which determine the Weil divisors of X(Delta).
  [3XD[0m is the list of coefficients for the a Weil divisor.
  [13XOutput[0m: the linear expressions in the affine coordinates of the space of the
  cone which must be positive for a point to be in the desired polytope.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> DivisorPolytope([6,6,0],[[2,-1],[-1,2],[-1,-1]]);[0X
    [4X[ 2*x_1-x_2+6, -x_1+2*x_2+6, -x_1-x_2 ][0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  See also Example 6.13 in [JV02].
  
  [1X4.1-2 DivisorPolytopeLatticePoints[0m
  
  [2X> DivisorPolytopeLatticePoints( [0X[3XD, Delta, Rays[0X[2X ) ___________________[0Xfunction
  
  [13XInput[0m: [3XDelta[0m is the fan
  [3XRays[0m is the [13Xordered[0m list of rays for [3XDelta[0m
  [3XD[0m is the list of coefficients for a Weil divisor.
  [13XOutput[0m:  the list of points in P_D cap L_0^* which parameterize the elements
  in  the Riemann-Roch space L(D), where P_D is the polytope associated to the
  divisor D (see [10XDivisorPolytope[0m).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> Div:=[6,6,0];; Rays:=[[2,-1],[-1,2],[-1,-1]];;[0X
    [4Xgap> Delta0:=[[[2,-1],[-1,2]],[[-1,2],[-1,-1]],[[-1,-1],[2,-1]]];;[0X
    [4Xgap> P_Div:=DivisorPolytopeLatticePoints(Div,Delta0,Rays);[0X
    [4X[ [ -6, -6 ], [ -5, -5 ], [ -5, -4 ], [ -4, -5 ], [ -4, -4 ], [ -4, -3 ],[0X
    [4X  [ -4, -2 ], [ -3, -4 ], [ -3, -3 ], [ -3, -2 ], [ -3, -1 ], [ -3, 0 ],[0X
    [4X  [ -2, -4 ], [ -2, -3 ], [ -2, -2 ], [ -2, -1 ], [ -2, 0 ], [ -2, 1 ],[0X
    [4X  [ -2, 2 ], [ -1, -3 ], [ -1, -2 ], [ -1, -1 ], [ -1, 0 ], [ -1, 1 ],[0X
    [4X  [ 0, -3 ], [ 0, -2 ], [ 0, -1 ], [ 0, 0 ], [ 1, -2 ], [ 1, -1 ], [ 2, -2 ] ][0X
    [4Xgap>[0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  [1X4.1-3 RiemannRochBasis[0m
  
  [2X> RiemannRochBasis( [0X[3XD, Delta, Rays[0X[2X ) _______________________________[0Xfunction
  
  [13XInput[0m: [3XDelta[0m is a complete and nonsingular fan
  [3XD[0m is the list of coefficients for the Weil divisor
  [3XRays[0m is a list of rays for the fan used to describe the Weil divisors.
  [13XOutput[0m:  A  basis  (a  list  of monomials) for the Riemann-Roch space of the
  divisor represented by [3XD[0m.
  
  For  details  on how the Weil divisors can be expressed in terms of the rays
  of the fan, please see section 3.3 in [Ful93]. This procedure does not check
  if the fan is complete and nonsingular.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> Div:=[6,6,0];; Rays:=[[2,-1],[-1,2],[-1,-1]];;[0X
    [4Xgap> Delta:=[[[2,-1],[-1,2]],[[-1,2],[-1,-1]],[[-1,-1],[2,-1]]];;[0X
    [4Xgap> RiemannRochBasis(Div,Delta,Rays);[0X
    [4X[ 1/(x_1^6*x_2^6), 1/(x_1^5*x_2^5), 1/(x_1^5*x_2^4), 1/(x_1^4*x_2^5),[0X
    [4X  1/(x_1^4*x_2^4), 1/(x_1^4*x_2^3), 1/(x_1^4*x_2^2), 1/(x_1^3*x_2^4),[0X
    [4X  1/(x_1^3*x_2^3), 1/(x_1^3*x_2^2), 1/(x_1^3*x_2), 1/x_1^3, 1/(x_1^2*x_2^4),[0X
    [4X  1/(x_1^2*x_2^3), 1/(x_1^2*x_2^2), 1/(x_1^2*x_2), 1/x_1^2, x_2/x_1^2,[0X
    [4X  x_2^2/x_1^2, 1/(x_1*x_2^3), 1/(x_1*x_2^2), 1/(x_1*x_2), 1/x_1, x_2/x_1,[0X
    [4X  1/x_2^3, 1/x_2^2, 1/x_2, 1, x_1/x_2^2, x_1/x_2, x_1^2/x_2^2 ][0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  
  [1X4.2 Topological invariants[0X
  
  Throughout this section, X(Delta) [13Xmust be non-singular[0m.
  
  [1X4.2-1 EulerCharacteristic[0m
  
  [2X> EulerCharacteristic( [0X[3XDelta[0X[2X ) _____________________________________[0Xfunction
  
  [13XInput[0m:  [3XDelta[0m  is  a  nonsingular  fan  of cones, represented by its list of
  maximal cones.
  [13XOutput[0m:  the Euler characteristic of the toric variety X(Delta), where Delta
  is a fan determined by [3XDelta[0m.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> Cones:=[[[2,-1],[-1,2]],[[-1,2],[-1,-1]],[[-1,-1],[2,-1]]];;[0X
    [4Xgap> EulerCharacteristic(Cones);[0X
    [4X3[0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  Note: X(Delta) [13Xmust be non-singular[0m here.
  
  [1X4.2-2 BettiNumberToric[0m
  
  [2X> BettiNumberToric( [0X[3XDelta, k[0X[2X ) _____________________________________[0Xfunction
  
  [13XInput[0m:  [3XDelta[0m  represents  a  nonsingular  fan Delta (represented by maximal
  cones),
  [3Xk[0m is an integer.
  [13XOutput[0m: the [3Xk[0m-th Betti number of the toric variety X(Delta).
  
  The [10XBettiNumberToric[0m procedure does not check if [3XDelta[0m is nonsingular. It is
  possible  that this procedure outputs nonsense when [3XDelta[0m is not represented
  by maximal cones or is nonsingular.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> Cones:=[[[2,-1],[-1,2]],[[-1,2],[-1,-1]],[[-1,-1],[2,-1]]];;[0X
    [4Xgap> BettiNumberToric(Cones,1);[0X
    [4X0[0X
    [4Xgap> BettiNumberToric(Cones,2);[0X
    [4X1[0X
    [4Xgap> Cones:=[[[2,-1],[-1,1]],[[-1,1],[-1,0]],[[-1,0],[2,-1]]];;[0X
    [4Xgap> BettiNumberToric(Cones,1);[0X
    [4X0[0X
    [4Xgap> BettiNumberToric(Cones,2);[0X
    [4X1[0X
  [4X------------------------------------------------------------------[0X
  
  Not  to  be  confused  with  the  Betti number of a polycyclically presented
  torsion free group, already available in [5XGAP[0m.
  
  
  [1X4.3 Points over a finite field[0X
  
  [1X4.3-1 CardinalityOfToricVariety[0m
  
  [2X> CardinalityOfToricVariety( [0X[3XCones, q[0X[2X ) ____________________________[0Xfunction
  
  [13XInput[0m:  [3XCones[0m  is  the  list  of  maximal cones of a fan Delta, [3Xq[0m is a prime
  power.
  [13XOutput[0m:  The  size  of the set of GF(q)-rational points of the toric variety
  X(Delta).
  
  Note: X(Delta) [13Xmust be non-singular[0m here.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> Cones:=[[[2,-1],[-1,2]],[[-1,2],[-1,-1]],[[-1,-1],[2,-1]]];;[0X
    [4Xgap> CardinalityOfToricVariety(Cones,3);[0X
    [4X13[0X
    [4Xgap> CardinalityOfToricVariety(Cones,4);[0X
    [4X21[0X
    [4Xgap> CardinalityOfToricVariety(Cones,5);[0X
    [4X31[0X
    [4Xgap> CardinalityOfToricVariety(Cones,7);[0X
    [4X57[0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
