Exemplo n.º 1
0
def make_webchar(args, get_bread=False):
    modulus = int(args['modulus'])
    number = int(args['number']) if 'number' in args else None
    orbit_label = args.get('orbit_label', None)
    if modulus <= 10000:
        if number is None:
            if get_bread:
                bread_crumbs = bread(
                    [('%s' % modulus, url_for(".render_Dirichletwebpage", modulus=modulus)),
                     ('%s' % orbit_label, url_for(".render_Dirichletwebpage", modulus=modulus, orbit_label=orbit_label))])
                return WebDBDirichletOrbit(**args), bread_crumbs
            return WebDBDirichletOrbit(**args)
        if args.get('orbit_label') is None:
            db_orbit_label = db.char_dir_values.lookup("{}.{}".format(modulus, number), projection='orbit_label')
            orbit_label = cremona_letter_code(int(db_orbit_label.partition('.')[-1]) - 1)
            args['orbit_label'] = orbit_label
        if get_bread:
            bread_crumbs = bread(
                [('%s' % modulus, url_for(".render_Dirichletwebpage", modulus=modulus)),
                 ('%s' % orbit_label, url_for(".render_Dirichletwebpage", modulus=modulus, orbit_label=orbit_label)),
                 ('%s' % number, url_for(".render_Dirichletwebpage", modulus=modulus, orbit_label=orbit_label, number=number))])
            return WebDBDirichletCharacter(**args), bread_crumbs
        return WebDBDirichletCharacter(**args)
    else:
        if get_bread:
            bread_crumbs = bread(
                [('%s' % modulus, url_for(".render_Dirichletwebpage", modulus=modulus)),
                 ('%s' % number, url_for(".render_Dirichletwebpage", modulus=modulus, number=number))])
            return WebSmallDirichletCharacter(**args), bread_crumbs
        return WebSmallDirichletCharacter(**args)
Exemplo n.º 2
0
def galois_rep_from_path(p):
    if p[0]=='EllipticCurve':
        # create the sage elliptic curve then create Galois rep object
        ainvs = db.ec_curves.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
Exemplo n.º 3
0
def make_webchar(args):
    modulus = int(args['modulus'])
    if modulus < 10000:
        return WebDBDirichletCharacter(**args)
    elif modulus < 100000:
        return WebDirichletCharacter(**args)
    else:
        return WebSmallDirichletCharacter(**args)
Exemplo n.º 4
0
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>"
Exemplo n.º 5
0
 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()
Exemplo n.º 6
0
    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