A<X,Y> := PolynomialRing(GF(7),2);
P,homogenize := Homogenization(A);
print("f := An improved equation for X1(30).");
f := 3*X^2*Y^6+Y^6+2*X*Y^5+6*X^3*Y^5+4*Y^4-5*X^2*Y^4-3*X^4*Y^4-6*X^5*Y^3-10*X*Y^3-5*X^4*Y^2-2*X^2*Y^2+3*X^6*Y^2-2*X^5*Y+10*X^3*Y-1+X^6+4*X^4;
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-5 is:");
[#Places(AFF,i) : i in [1..5]];

print("");
print("We simply take all divisors D of degree = 5 as set of divisors");
print("that dominate all functions of degree < 6.");
print("");
print("type(D) = (5), (4,1), (3,2), (3,1,1), (2,2,1) and (2,1,1,1):");
Max([Dimension(RiemannRochSpace(2*p+q+r+s)): p,q,r,s in div1]); 

print("type(D) = (1,1,1,1,1):");
Max([Dimension(RiemannRochSpace(&+PQRST)) : PQRST in Subsets(SequenceToSet(div1),5)]); 

print("type(D) = ((2,1),(1,3)), ((2,1),(1,2),(1,1)) and ((2,1),3(1,1)):");
Max([Dimension(RiemannRochSpace(p+q+r+s)) : p in Places(AFF,2), q,r,s in div1]); 

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

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

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

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

print("type(D) = ((5,1)):");
Max([Dimension(RiemannRochSpace(p)) : p in Places(AFF,5)]); 
