def N(j, p=pp): """The number of degree j monic irreducibles in GF(p)[X]. """ global N_dict j = ZZ(j) if not j in N_dict: N_dict[j] = sum([moebius(d) * p**(j // d) for d in j.divisors()]) // j return N_dict[j]
def _dimension_formula(self,k,eps=1,cuspidal=1): ep = 0 N = self._N if (2*k) % 4 == 1: ep = 1 if (2*k) % 4 == 3: ep = -1 if ep==0: return 0,0 if eps==-1: ep = -ep twok = ZZ(2*k) K0 = 1 sqf = ZZ(N).divide_knowing_divisible_by(squarefree_part(N)) if sqf>12: b2 = max(sqf.divisors()) else: b2 = 1 b = sqrt(b2) if ep==1: K0 = floor(QQ(b+2)/QQ(2)) else: # print "b=",b K0 = floor(QQ(b-1)/QQ(2)) if is_even(N): e2 = ep*kronecker(2,twok)/QQ(4) else: e2 = 0 N2 = odd_part(N) N22 = ZZ(N).divide_knowing_divisible_by(N2) k3 = kronecker(3,twok) if gcd(3,N)>1: if eps==1: e3 = -ep*kronecker(-3,4*k+ep-1)/QQ(3) else: e3 = -1*ep*kronecker(-3,4*k+ep+1)/QQ(3) #e3 = -1/3*ep else: f1 = kronecker(3,2*N22)*kronecker(-12,N2) - ep f2 = kronecker(-3,twok+1) e3 = f1*f2/QQ(6) ID = QQ(N+ep)*(k-1)/QQ(12) P = 0 for d in ZZ(4*N).divisors(): dm4=d % 4 if dm4== 2 or dm4 == 1: h = 0 elif d == 3: h = QQ(1)/QQ(3) elif d == 4: h = QQ(1)/QQ(2) else: h = class_nr_pos_def_qf(-d) if self._verbose>1: print "h({0})={1}".format(d,h) if h<>0: P= P + h P = QQ(P)/QQ(4) if self._verbose>0: print "P=",P P=P + QQ(ep)*kronecker(-4,N)/QQ(8) if eps==-1: P = -P if self._verbose>0: print "P=",P # P = -2*N**2 + N*(twok+10-ep*3) +(twok+10)*ep-1 if self._verbose>0: print "ID=",ID P = P - QQ(1)/QQ(2*K0) # P = QQ(P)/QQ(24) - K0 # P = P - K0 res = ID + P + e2 + e3 if self._verbose>1: print "twok=",twok print "K0=",K0 print "ep=",ep print "e2=",e2 print "e3=",e3 print "P=",P if cuspidal==0: res = res + K0 return res #,ep
def _dimension_formula(self,k,eps=1,cuspidal=1): ep = 0 N = self._N if (2*k) % 4 == 1: ep = 1 if (2*k) % 4 == 3: ep = -1 if ep==0: return 0,0 if eps==-1: ep = -ep twok = ZZ(2*k) K0 = 1 sqf = ZZ(N).divide_knowing_divisible_by(squarefree_part(N)) if sqf>12: b2 = max(sqf.divisors()) else: b2 = 1 b = sqrt(b2) if ep==1: K0 = floor(QQ(b+2)/QQ(2)) else: # print "b=",b K0 = floor(QQ(b-1)/QQ(2)) if is_even(N): e2 = ep*kronecker(2,twok)/QQ(4) else: e2 = 0 N2 = odd_part(N) N22 = ZZ(N).divide_knowing_divisible_by(N2) k3 = kronecker(3,twok) if gcd(3,N)>1: if eps==1: e3 = -ep*kronecker(-3,4*k+ep-1)/QQ(3) else: e3 = -1*ep*kronecker(-3,4*k+ep+1)/QQ(3) #e3 = -1/3*ep else: f1 = kronecker(3,2*N22)*kronecker(-12,N2) - ep f2 = kronecker(-3,twok+1) e3 = f1*f2/QQ(6) ID = QQ(N+ep)*(k-1)/QQ(12) P = 0 for d in ZZ(4*N).divisors(): dm4=d % 4 if dm4== 2 or dm4 == 1: h = 0 elif d == 3: h = QQ(1)/QQ(3) elif d == 4: h = QQ(1)/QQ(2) else: h = class_nr_pos_def_qf(-d) if self._verbose>1: print("h({0})={1}".format(d,h)) if h!=0: P= P + h P = QQ(P)/QQ(4) if self._verbose>0: print("P={0}".format(P)) P=P + QQ(ep)*kronecker(-4,N)/QQ(8) if eps==-1: P = -P if self._verbose>0: print("P={0}".format(P)) # P = -2*N**2 + N*(twok+10-ep*3) +(twok+10)*ep-1 if self._verbose>0: print("ID={0}".format(ID)) P = P - QQ(1)/QQ(2*K0) # P = QQ(P)/QQ(24) - K0 # P = P - K0 res = ID + P + e2 + e3 if self._verbose>1: print("twok={0}".format(twok)) print("K0={0}".format(K0)) print("ep={0}".format(ep)) print("e2={0}".format(e2)) print("e3={0}".format(e3)) print("P={0}".format(P)) if cuspidal==0: res = res + K0 return res #,ep