Exemple #1
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
Exemple #2
0
def render_Dirichletwebpage(modulus=None, number=None):

    if modulus == None:
        return render_DirichletNavigation()
    modulus = modulus.replace(' ','')
    if number == None and re.match('^[1-9][0-9]*\.[1-9][0-9]*$', modulus):
        return redirect(url_for(".render_Dirichletwebpage", label=modulus), 301)

    args={}
    args['type'] = 'Dirichlet'
    args['modulus'] = modulus
    args['number'] = number
    try:
        modulus = int(modulus)
    except ValueError:
        modulus = 0
    if modulus <= 0:
        flash_error ("%s is not a valid modulus for a Dirichlet character.  It should be a positive integer.", args['modulus'])
        return redirect(url_for(".render_Dirichletwebpage"))
    if modulus > 10**20:
        flash_error ("specified modulus %s is too large, it should be less than $10^{20}$.", modulus)
        return redirect(url_for(".render_Dirichletwebpage"))



    if number == None:
        if modulus < 10000:
            info = WebDBDirichletGroup(**args).to_dict()
            info['show_orbit_label'] = True
        elif modulus < 100000:
            info = WebDirichletGroup(**args).to_dict()
        else:
            info = WebSmallDirichletGroup(**args).to_dict()
        info['title'] = 'Group of Dirichlet Characters of Modulus ' + str(modulus)
        info['bread'] = [('Characters', url_for(".render_characterNavigation")),
                         ('Dirichlet', url_for(".render_Dirichletwebpage")),
                         ('%d'%modulus, url_for(".render_Dirichletwebpage", modulus=modulus))]
        info['learnmore'] = learn()
        info['code'] = dict([(k[4:],info[k]) for k in info if k[0:4] == "code"])
        info['code']['show'] = { lang:'' for lang in info['codelangs'] } # use default show names
        if 'gens' in info:
            info['generators'] = ', '.join([r'<a href="%s">$\chi_{%s}(%s,\cdot)$'%(url_for(".render_Dirichletwebpage",modulus=modulus,number=g),modulus,g) for g in info['gens']])
        return render_template('CharGroup.html', **info)

    try:
        number = int(number)
    except ValueError:
        number = 0;
    if number <= 0 or gcd(modulus,number) != 1 or number > modulus:
        flash_error("the value %s is invalid.  It should be a positive integer coprime to and no greater than the modulus %s.", args['number'],args['modulus'])
        return redirect(url_for(".render_Dirichletwebpage"))
    if modulus < 10000:
        webchar = WebDBDirichletCharacter(**args)
        info = webchar.to_dict()
    elif modulus < 100000:
        webchar = WebDirichletCharacter(**args)
        info = webchar.to_dict()
    else:
        info = WebSmallDirichletCharacter(**args).to_dict()
    info['bread'] = [('Characters', url_for(".render_characterNavigation")),
                     ('Dirichlet', url_for(".render_Dirichletwebpage")),
                     ('%s'%modulus, url_for(".render_Dirichletwebpage", modulus=modulus)),
                     ('%s'%number, url_for(".render_Dirichletwebpage", modulus=modulus, number=number)) ]
    info['learnmore'] = learn()
    info['code'] = dict([(k[4:],info[k]) for k in info if k[0:4] == "code"])
    info['code']['show'] = { lang:'' for lang in info['codelangs'] } # use default show names
    return render_template('Character.html', **info)