def make_webchar(args): modulus = int(args['modulus']) if modulus < 10000: return WebDBDirichletCharacter(**args) elif modulus < 100000: return WebDirichletCharacter(**args) else: return WebSmallDirichletCharacter(**args)
def dc_calc(calc, modulus, number): val = request.args.get("val", []) args = {'type': 'Dirichlet', 'modulus': modulus, 'number': number} if not val: return abort(404) try: if calc == 'value': return WebSmallDirichletCharacter(**args).value(val) if calc == 'gauss': return WebSmallDirichletCharacter(**args).gauss_sum(val) elif calc == 'jacobi': return WebSmallDirichletCharacter(**args).jacobi_sum(val) elif calc == 'kloosterman': return WebSmallDirichletCharacter(**args).kloosterman_sum(val) else: return abort(404) except Warning as e: return "<span style='color:gray;'>%s</span>" % e except Exception: return "<span style='color:red;'>Error: bad input</span>"
def determinant(self): if self._data['Dets']: parts = self.label().split("c") thischar = str( self._data['Dets'][int(parts[1])-1] ) if self.dimension()==1: wc = thischar.split(r'.') self._data['central_character'] = WebSmallDirichletCharacter(modulus=wc[0], number=wc[1]) return self._data['central_character'] return(thischar) # Not in the database if self.dimension()==1: return self.central_character() return self.central_character_as_artin_rep().label()
def central_character(self): """ Returns the central character, i.e., determinant character as a web character. """ if 'central_character' in self._data: return self._data['central_character'] # Build it as a python function, id it, make a lmfdb character # But, if the conductor is too large, this can stall because # the function has to factor arbitrary integers modulo N if Integer(self.conductor()) > 10**40: return None myfunc = self.central_char_function() wc = id_dirichlet(myfunc, self.conductor(), 2 * self.character_field()) wc = WebSmallDirichletCharacter(modulus=wc[0], number=wc[1]) self._data['central_character'] = wc return wc
def galois_rep_from_path(p): if p[0] == 'EllipticCurve': # create the sage elliptic curve then create Galois rep object ainvs = db.ec_curvedata.lucky( {'lmfdb_label': p[2] + "." + p[3] + p[4]}, 'ainvs') E = EllipticCurve(ainvs) return GaloisRepresentation(E) elif (p[0] == 'Character' and p[1] == 'Dirichlet'): dirichletArgs = { 'type': 'Dirichlet', 'modulus': int(p[2]), 'number': int(p[3]) } chi = WebSmallDirichletCharacter(**dirichletArgs) return GaloisRepresentation(chi) elif (p[0] == 'ModularForm'): level = int(p[4]) weight = int(p[5]) conrey_label = p[6] # this should be zero; TODO check this is the case hecke_orbit = p[7] # this is a, b, c, etc.; chooses the galois orbit embedding = p[8] # this is the embedding of that galois orbit label = convert_newformlabel_from_conrey( str(level) + "." + str(weight) + "." + str(conrey_label) + "." + hecke_orbit) form = WebNewform(label) return GaloisRepresentation([form, ZZ(embedding)]) elif (p[0] == 'ArtinRepresentation'): dim = p[1] conductor = p[2] index = p[3] rho = ArtinRepresentation(dim, conductor, index) return GaloisRepresentation(rho) else: return