//first example: AG codes over the function field F/F7 where F is given by the curve y-x^2 F7:=FiniteField(7); A7:=AffineSpace(F7,2); f1:=y-x^2; C1:=Curve(A7,f1); Div1:=DivisorGroup(C1); P1:=Places(C1,1); //places of F of degree 1 Q1:=5*Div1!P1[1]; P1:=Exclude(P1,P1[1]); //the sum of the remaining places will be D R,phi:=RiemannRochSpace(Q1); B:=phi(Basis(R)); AG1:=AGCode(P1,Q1); //C_L(D,Q1) AG1; AGD1:=AGDualCode(P1,Q1); //C_Omega(D,Q1) AGD1; //as g = genus(C1) = 0, AG1 and AGD1 are MDS codes (i.e. they hit the Singleton bound) Genus(C1); Degree(Q1); //deg Q1 < n, therefore we have to check //d >= n - deg Q1 = 7 - 5 = 2 MinimumDistance(AG1); //k = l(Q1) Dimension(AG1); Dimension(R); //now for AGD1 //d' >= deg Q1 - (2g - 2) = 7 MinimumDistance(AGD1); //as n > deg Q1 >= 2g - 2 = -2 we have k' = i(G - D) = n + g - 1 - deg Q1 = 7 + 0 - 1 - 5 = 1 Dimension(AGD1); //second example: BCH codes and rational AG codes (over F7[z]/F7 in this case) //f = y yields the desired field f2:=y; C2:=Curve(A7,f2); Div2:=DivisorGroup(C2); P2:=Places(C2,1); //P2[1] is the pole of z and P2[2] is the zero of z //we now choose a = b = 1 Q2:=Div2!(P2[1]+P2[2]); P2:=Exclude(P2,P2[1]); P2:=Exclude(P2,P2[1]); //now we need C_Omega(D,Q2) where D is the sum of the places in P2 AGD2:=AGDualCode(P2,Q2); //we define the BCH Code with parameters n = 6, delta = 4, l = -1 BCH:=BCHCode(F7,6,4,-1); //now it holds AGD2 = BCH AGD2 eq BCH; AGD2; BCH; //third example: Goppa codes and rational AG Codes (over F32[z]/F32) F32:=FiniteField(2^5); A32:=AffineSpace(F32,2); P:=PolynomialRing(F32); f3:=Y; C3:=Curve(A32,f3); //g will be the goppa polynomial g:=Z^3+Z+1; L:=[w^i : i in [0 .. 2^5-2]]; GC:=GoppaCode(L,g); Div3:=DivisorGroup(C3); //now we need the places P_i where P_i is the zero of z - a_i for all a_i in L Pl:=[Place(C3![i,0]) : i in L]; //Q3 will be (g)_0 - P_infty where P_infty is the pole of z //P_infty is the first place in the list we get when Places(C3,1) is called //there is only one zero of g so we put Q3:=Div3!Zeros(C3,g)[1] - Div3!Places(C3,1)[1]; //we need C_Omega(D,Q3) where D is the sum over the places in Pl AGD3:=AGDualCode(Pl,Q3); //now we need the subfield subcode AGD3 restricted to F2 CS:=SubfieldSubcode(AGD3, FiniteField(2)); //it holds CS = GC CS eq GC; CS; GC;