{{{id=12| def Cartier_matrix(E,p,b): r""" INPUT: - 'E' - Hyperelliptic Curve of the form y^2 = f(x) - 'p' - a prime number - 'b' - q=p^b OUTPUT: - 'M' The matrix M = (c_(pi-j)), f(x)^((p-1)/2) = \sum c_i x^i """ #checks if not p.is_prime(): return 'p must be prime' Fq=GF(p^b,'a'); g = E.genus() if p < 2*g-1: return 'that weird error' C=E.change_ring(Fq) f,h = C.hyperelliptic_polynomials() if h != 0: return 'E must be of the form y^2 = f(x)' d = f.degree() if d%2 == 0: return 'the degree of f is even' df=f.derivative() R=df.resultant(f) if R == 0: return 'so curve is not smooth' F = f^((p-1)/2) #coefficients returns a_0, ... , a_n where f(x) = a_n x^n + ... + a_0 Coeff = F.list() M=[]; for j in range(1,g+1): H=[Coeff[i] for i in range((p*j-g), (p*j))] H.reverse() M.append(H); return matrix(Fq,M), Coeff, g /// }}} {{{id=13| def Hasse_Vitt(M,Coeffs,g,p,b): r""" INPUT: - 'M'- Cartier matrix. - 'g' -genus - 'p' -over the field of char p - 'b' - power of p, Fq, OUTPUT: - 'N' - The matrix N = M M^(p)...M^(p^(g-1)) where M = (c_(pi-j)), f(x)^((p-1)/2) = \sum c_i x^i """ Fq=GF(p^b,'c'); def frob_mat(Coeffs, k): a = p^k mat = [] Coeffs_pow = [c^a for c in Coeffs] for j in range(1,g+1): H=[(Coeffs[i]) for i in range((p*j-g), (p*j))] H.reverse() mat.append(H); return matrix(Fq,mat) Mall = [M] + [frob_mat(Coeffs,k) for k in range(1,g)] #multiply to create the identity matrix N = identity_matrix(Fq,g) for l in Mall: N = N*l; return N /// }}} {{{id=6| V = VectorSpace(GF(103),10) /// }}} {{{id=3| f.=QQ[] for v in V: E=HyperellipticCurve(f([v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],1]),0); #print E for p in srange(5,100): if p.is_prime(): Mresult=Cartier_matrix(E,p,1); if is_Matrix(Mresult[0]): a=Mresult[2]-rank(Mresult[0]); if a==1: #print E,'a is 1'; Nresult=Hasse_Vitt(Mresult[0],Mresult[1],Mresult[2],p,1); p_rank=rank(Nresult); if p_rank==0: print f([v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],1]),p, p_rank, a; /// WARNING: Output truncated! full_output.txt x^9 + x + 2 11 0 1 x^9 + x + 9 11 0 1 x^9 + x + 13 11 0 1 x^9 + x + 20 11 0 1 x^9 + x + 24 11 0 1 x^9 + x + 31 11 0 1 x^9 + x + 35 11 0 1 x^9 + x + 42 11 0 1 x^9 + x + 46 11 0 1 x^9 + x + 53 11 0 1 x^9 + x + 57 11 0 1 x^9 + x + 64 11 0 1 x^9 + x + 68 11 0 1 x^9 + x + 75 11 0 1 x^9 + x + 79 11 0 1 x^9 + x + 86 11 0 1 x^9 + x + 90 11 0 1 x^9 + x + 97 11 0 1 x^9 + x + 101 11 0 1 x^9 + 3*x + 1 11 0 1 x^9 + 3*x + 10 11 0 1 x^9 + 3*x + 12 11 0 1 x^9 + 3*x + 21 11 0 1 x^9 + 3*x + 23 11 0 1 x^9 + 3*x + 32 11 0 1 x^9 + 3*x + 34 11 0 1 x^9 + 3*x + 43 11 0 1 x^9 + 3*x + 45 11 0 1 x^9 + 3*x + 54 11 0 1 x^9 + 3*x + 56 11 0 1 x^9 + 3*x + 65 11 0 1 x^9 + 3*x + 67 11 0 1 x^9 + 3*x + 76 11 0 1 x^9 + 3*x + 78 11 0 1 x^9 + 3*x + 87 11 0 1 x^9 + 3*x + 89 11 0 1 x^9 + 3*x + 98 11 0 1 x^9 + 3*x + 100 11 0 1 x^9 + 4*x + 4 11 0 1 x^9 + 4*x + 7 11 0 1 x^9 + 4*x + 15 11 0 1 x^9 + 4*x + 18 11 0 1 x^9 + 4*x + 26 11 0 1 x^9 + 4*x + 29 11 0 1 x^9 + 4*x + 37 11 0 1 x^9 + 4*x + 40 11 0 1 x^9 + 4*x + 48 11 0 1 x^9 + 4*x + 51 11 0 1 x^9 + 4*x + 59 11 0 1 x^9 + 4*x + 62 11 0 1 x^9 + 4*x + 70 11 0 1 x^9 + 4*x + 73 11 0 1 x^9 + 4*x + 81 11 0 1 x^9 + 4*x + 84 11 0 1 x^9 + 4*x + 92 11 0 1 x^9 + 4*x + 95 11 0 1 x^9 + 5*x + 3 11 0 1 x^9 + 5*x + 8 11 0 1 x^9 + 5*x + 14 11 0 1 ... x^9 + 47*x + 87 11 0 1 x^9 + 47*x + 89 11 0 1 x^9 + 47*x + 98 11 0 1 x^9 + 47*x + 100 11 0 1 x^9 + 48*x + 4 11 0 1 x^9 + 48*x + 7 11 0 1 x^9 + 48*x + 15 11 0 1 x^9 + 48*x + 18 11 0 1 x^9 + 48*x + 26 11 0 1 x^9 + 48*x + 29 11 0 1 x^9 + 48*x + 37 11 0 1 x^9 + 48*x + 40 11 0 1 x^9 + 48*x + 48 11 0 1 x^9 + 48*x + 51 11 0 1 x^9 + 48*x + 59 11 0 1 x^9 + 48*x + 62 11 0 1 x^9 + 48*x + 70 11 0 1 x^9 + 48*x + 73 11 0 1 x^9 + 48*x + 81 11 0 1 x^9 + 48*x + 84 11 0 1 x^9 + 48*x + 92 11 0 1 x^9 + 48*x + 95 11 0 1 x^9 + 49*x + 3 11 0 1 x^9 + 49*x + 8 11 0 1 x^9 + 49*x + 14 11 0 1 x^9 + 49*x + 19 11 0 1 ^CTraceback (most recent call last): Mresult=Cartier_matrix(E,p,1); File "", line 1, in File "/private/var/folders/rt/rtyQ7RPsHRCDmvOBf9SYwU+++TI/-Tmp-/tmpubVsEp/___code___.py", line 4, in exec compile(u"for v in V:\n E=HyperellipticCurve(f([v[_sage_const_0 ],v[_sage_const_1 ],v[_sage_const_2 ],v[_sage_const_3 ],v[_sage_const_4 ],v[_sage_const_5 ],v[_sage_const_6 ],v[_sage_const_7 ],v[_sage_const_8 ],_sage_const_1 ]),_sage_const_0 );\n #print E\n for p in srange(_sage_const_5 ,_sage_const_100 ):\n if p.is_prime():\n Mresult=Cartier_matrix(E,p,_sage_const_1 );\n if is_Matrix(Mresult[_sage_const_0 ]):\n a=Mresult[_sage_const_2 ]-rank(Mresult[_sage_const_0 ]);\n if a==_sage_const_1 :\n #print E,'a is 1';\n Nresult=Hasse_Vitt(Mresult[_sage_const_0 ],Mresult[_sage_const_1 ],Mresult[_sage_const_2 ],p,_sage_const_1 );\n p_rank=rank(Nresult);\n if p_rank==_sage_const_0 :\n print f([v[_sage_const_0 ],v[_sage_const_1 ],v[_sage_const_2 ],v[_sage_const_3 ],v[_sage_const_4 ],v[_sage_const_5 ],v[_sage_const_6 ],v[_sage_const_7 ],v[_sage_const_8 ],_sage_const_1 ]),p, p_rank, a;" + '\n', '', 'single') File "", line 6, in File "/private/var/folders/rt/rtyQ7RPsHRCDmvOBf9SYwU+++TI/-Tmp-/tmpV64Md2/___code___.py", line 25, in Cartier_matrix C=E.change_ring(Fq) File "/Applications/sage/local/lib/python2.6/site-packages/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py", line 93, in change_ring return HyperellipticCurve(f.change_ring(R), h, "%s,%s"%(x,y)) File "/Applications/sage/local/lib/python2.6/site-packages/sage/schemes/hyperelliptic_curves/constructor.py", line 96, in HyperellipticCurve return HyperellipticCurve_finite_field(PP, f, h, names=names, genus=g) File "/Applications/sage/local/lib/python2.6/site-packages/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py", line 69, in __init__ P2 = PolynomialRing(P1,name=names[1]) File "/Applications/sage/local/lib/python2.6/site-packages/sage/rings/polynomial/polynomial_ring_constructor.py", line 343, in PolynomialRing R = _single_variate(base_ring, name, sparse, implementation) File "/Applications/sage/local/lib/python2.6/site-packages/sage/rings/polynomial/polynomial_ring_constructor.py", line 397, in _single_variate R = _get_from_cache(key) File "/Applications/sage/local/lib/python2.6/site-packages/sage/rings/polynomial/polynomial_ring_constructor.py", line 379, in _get_from_cache if _cache.has_key(key): File "ring.pyx", line 845, in sage.rings.ring.Ring.__hash__ (sage/rings/ring.c:6275) File "sage_object.pyx", line 101, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1341) File "/Applications/sage/local/lib/python2.6/site-packages/sage/rings/polynomial/polynomial_ring.py", line 1198, in _repr_ s = PolynomialRing_commutative._repr_(self) File "/Applications/sage/local/lib/python2.6/site-packages/sage/rings/polynomial/polynomial_ring.py", line 557, in _repr_ self.variable_name(), self.base_ring()) File "finite_field_base.pyx", line 104, in sage.rings.finite_rings.finite_field_base.FiniteField.__repr__ (sage/rings/finite_rings/finite_field_base.c:1905) File "/Applications/sage/local/lib/python2.6/site-packages/sage/rings/finite_rings/finite_field_prime_modn.py", line 157, in characteristic def characteristic(self): File "/Applications/sage/local/lib/python2.6/site-packages/sage/interfaces/get_sigs.py", line 9, in my_sigint raise KeyboardInterrupt KeyboardInterrupt __SAGE__ }}} {{{id=8| /// }}} {{{id=7| /// }}}