A<x,y> := PolynomialRing(GF(5),2);
P,homogenize := Homogenization(A);
print("f := The polynomial from math.mit.edu/~drew/FFFc24.txt");
f := x^5*y^4 - 3*x^5*y^3 + 3*x^5*y^2 - 2*x^4*y^5 + 5*x^4*y^4 - 5*x^4*y^3 + x^3*y^6 - 
x^3*y^5 + x^3*y^4 - x^3*y^3 + 4*x^3*y^2 - 3*x^3*y - x^2*y^6 + x^2*y^5 - 
x^2*y^4 + x^2*y^3 - x^2*y^2 + x^2*y + 2*x*y^5 - 5*x*y^4 + 5*x*y^3 - 2*x*y^2 
- x*y + x - y^4 + 3*y^3 - 3*y^2 + y;
f := homogenize(f);
XF2 := Scheme(ProjectiveSpace(P),f);
FF := FunctionField(XF2);
AFF := AlgorithmicFunctionField(FF);
plc1 := Places(AFF,1);
divgrp := DivisorGroup(AFF);
div1 := [divgrp ! i : i in plc1];
cuspsum := &+ div1;

print("The number of places of degrees 1, 2, and 3 is:");
[#Places(AFF,i) : i in [1..3]];     

print("");
print("We simply take all divisors of degree < 4 as our set of divisors that");
print("dominate all functions of degree < 4.  We separate this into three");
print("cases: highest degree place has degree: 1, 2, 3.");

//type(D)=(3) and type(D)=(2,1) and type(D)=(1,1,1)
Max([Dimension(RiemannRochSpace(p+q+r)) : p,q,r in div1]);

//type(D)=((2,1),(1,1))
Max([Dimension(RiemannRochSpace(p+q)) : p in div1, q in Places(AFF,2)]);

//type(D)=((3,1))
Max([Dimension(RiemannRochSpace(p)) : p in Places(AFF,3)]);
