def insert_dirichlet_L_functions(start, end): print "Putting Dirichlet L-functions into database." start = max(3, start) for q in range(start, end): print "Working on modulus", q sys.stdout.flush() G = DirichletGroup(q) for n in range(len(G)): chi = G[n] if chi.is_primitive(): L = lc.Lfunction_from_character(chi) z = L.find_zeros_via_N(1)[0] Lfunction_data = {} Lfunction_data['first_zero'] = float(z) Lfunction_data[ 'description'] = "Dirichlet L-function for character number " + str( n) + " modulo " + str(q) Lfunction_data['degree'] = 1 Lfunction_data['signature'] = (1, 0) if chi.is_odd(): Lfunction_data['mu'] = [ (1.0, 0.0), ] else: Lfunction_data['mu'] = [ (0.0, 0.0), ] Lfunction_data['level'] = q coeffs = [] for k in range(0, 10): coeffs.append(CC(chi(k))) Lfunction_data['coeffs'] = [(float(x.real()), float(x.imag())) for x in coeffs] Lfunction_data['special'] = { 'type': 'dirichlet', 'modulus': q, 'number': n } Lfunctions.insert(Lfunction_data)
import sys from sage.all import DirichletGroup import pymongo from pymongo import Connection import sage.libs.lcalc.lcalc_Lfunction as lc from lmfdb import base C = base.getDBConnection() db = C.Lfunctions first_zeros = db.first_zeros_testing first_zeros.drop() for q in range(3, 1500): print q sys.stdout.flush() G = DirichletGroup(q) for n in range(len(G)): if G[n].is_primitive(): L = lc.Lfunction_from_character(G[n]) z = L.find_zeros_via_N(1)[0] first_zeros.insert({ 'zero': float(z), 'modulus': int(q), 'character': int(n) })
def __init__(self, **args): #Check for compulsory arguments if not ('charactermodulus' in args.keys() and 'characternumber' in args.keys()): raise KeyError, "You have to supply charactermodulus and characternumber for the L-function of a Dirichlet character" # Initialize default values self.numcoeff = 30 # set default to 30 coefficients # Put the arguments into the object dictionary self.__dict__.update(args) self.charactermodulus = int(self.charactermodulus) self.characternumber = int(self.characternumber) self.numcoeff = int(self.numcoeff) # Create the Dirichlet character chi = DirichletGroup(self.charactermodulus)[self.characternumber] if chi.is_primitive(): # Extract the L-function information from the Dirichlet character # Warning: will give nonsense if character is not primitive aa = int((1-chi(-1))/2) # usually denoted \frak a self.quasidegree = 1 self.Q_fe = float(sqrt(self.charactermodulus)/sqrt(math.pi)) self.sign = 1/(I**aa * float(sqrt(self.charactermodulus))/(chi.gauss_sum_numerical())) self.kappa_fe = [0.5] self.lambda_fe = [0.5*aa] self.mu_fe = [aa] self.nu_fe = [] self.langlands = True self.primitive = True self.degree = 1 self.level = self.charactermodulus self.dirichlet_coefficients = [] for n in range(1,self.numcoeff): self.dirichlet_coefficients.append(chi(n).n()) self.poles = [] self.residues = [] self.coefficient_period = self.charactermodulus # Determine if the character is real (i.e., if the L-function is selfdual) chivals=chi.values_on_gens() self.selfdual = True for v in chivals: if abs(imag_part(v)) > 0.0001: self.selfdual = False if self.selfdual: self.coefficient_type = 1 else: self.coefficient_type = 2 self.texname = "L(s,\\chi)" self.texnamecompleteds = "\\Lambda(s,\\chi)" if self.selfdual: self.texnamecompleted1ms = "\\Lambda(1-s,\\chi)" else: self.texnamecompleted1ms = "\\Lambda(1-s,\\overline{\\chi})" self.credit = 'Sage' self.citation = '' self.title = "Dirichlet L-function: $L(s,\\chi)$" self.title = (self.title+", where $\\chi$ is the character modulo "+ str(self.charactermodulus) + ", number " + str(self.characternumber)) self.sageLfunction = lc.Lfunction_from_character(chi) else: #Character not primitive raise Exception("The dirichlet character you choose is " + "not primitive so it's Dirichlet series " + "is not an L-function." ,"UserError") constructor_logger(self,args)