示例#1
0
文件: main.py 项目: sanni85/lmfdb
def set_navi(L):
    ''' Returns the data for navigation to previous/next
    L-function when this makes sense. If not it returns None
    '''
    prev_data = None
    if L.Ltype() == 'maass' and L.group == 'GL2':
        next_form_id = L.mf.next_maassform_id()
        if next_form_id:
            next_data = ("next",r"$L(s,f_{\text next})$", '/L' +
                         url_for('mwf.render_one_maass_waveform',
                         maass_id = next_form_id) )
        else:
            next_data = ('','','')
        prev_form_id = L.mf.prev_maassform_id()
        if prev_form_id:
            prev_data = ("previous", r"$L(s,f_{\text prev}$)", '/L' +
                         url_for('mwf.render_one_maass_waveform',
                         maass_id = prev_form_id) )
        else:
            prev_data = ('','','')

    elif L.Ltype() == 'dirichlet':
        mod, num = L.charactermodulus, L.characternumber
        Lpattern = r"\(L(s,\chi_{%s}(%s,·))\)"
        if mod > 1:
            pmod,pnum = WebDirichlet.prevprimchar(mod, num)
            prev_data = ("previous",Lpattern%(pmod,pnum) if pmod > 1 else r"\(\zeta(s)\)",
                     url_for('.l_function_dirichlet_page',
                             modulus=pmod,number=pnum))
        else:
            prev_data = ('','','')
        nmod,nnum = WebDirichlet.nextprimchar(mod, num)
        next_data = ("next",Lpattern%(nmod,nnum) if nmod > 1 else r"\(\zeta(s)\)",
                 url_for('.l_function_dirichlet_page',
                         modulus=nmod,number=nnum))

    if prev_data is None:
        return None
    else:
        return ( prev_data, next_data )
示例#2
0
def info_from_db_orbit(orbit):
    mod = orbit['modulus']
    conductor = orbit['conductor']
    orbit_index = orbit['orbit_index']
    orbit_letter = cremona_letter_code(orbit_index - 1)
    orbit_label = "{}.{}".format(mod, orbit_letter)
    order = orbit['order']
    is_odd = 'Odd' if _is_odd(orbit['parity']) else 'Even'
    is_prim = _is_primitive(orbit['is_primitive'])
    results = []
    for num in orbit['galois_orbit']:
        results.append(
            (mod, num, conductor, orbit_label, order, is_odd, is_prim,
             WebDirichlet.char2tex(mod, num)))
    return results
示例#3
0
def info_from_db_orbit(orbit):
    mod = orbit['modulus']
    conductor = orbit['conductor']
    orbit_index = orbit['orbit_index']
    orbit_letter = cremona_letter_code(orbit_index - 1)
    orbit_label = "{}.{}".format(mod, orbit_letter)
    order = orbit['order']
    is_odd = 'Odd' if _is_odd(orbit['parity']) else 'Even'
    is_prim = _is_primitive(orbit['is_primitive'])
    results = []
    for num in orbit['galois_orbit']:
        results.append((
            mod,
            num,
            conductor,
            orbit_label,
            order,
            is_odd,
            is_prim,
            WebDirichlet.char2tex(mod, num)
        ))
    return results
示例#4
0
def initLfunction(L, args, request):
    ''' Sets the properties to show on the homepage of an L-function page.
    '''

    info = {'title': L.title}
    try:
        info['citation'] = L.citation
    except AttributeError:
        info['citation'] = ""
    try:
        info['support'] = L.support
    except AttributeError:
        info['support'] = ""

    info['Ltype'] = L.Ltype()

    # Here we should decide which values are indeed special values
    # According to Brian, odd degree has special value at 1, and even
    # degree has special value at 1/2.
    # (however, I'm not sure this is true if L is not primitive -- GT)

    # Now we usually display both
    if L.Ltype() != "artin" or (L.Ltype() == "artin" and L.sign != 0):
    #    if is_even(L.degree) :
    #        info['sv12'] = specialValueString(L, 0.5, '1/2')
    #    if is_odd(L.degree):
    #        info['sv1'] = specialValueString(L, 1, '1')
        info['sv1'] = specialValueString(L, 1, '1')
        info['sv12'] = specialValueString(L, 0.5, '1/2')

    info['args'] = args

    info['credit'] = L.credit
    # info['citation'] = L.citation

    try:
        info['factorization'] = L.factorization
    except:
        pass

    try:
        info['url'] = L.url
    except:
        info['url'] = ''

    info['degree'] = int(L.degree)

    info['zeroeslink'] = (request.url.replace('/L/', '/L/Zeros/').
                          replace('/Lfunction/', '/L/Zeros/').
                          replace('/L-function/', '/L/Zeros/'))  # url_for('zeroesLfunction',  **args)

    info['plotlink'] = (request.url.replace('/L/', '/L/Plot/').
                        replace('/Lfunction/', '/L/Plot/').
                        replace('/L-function/', '/L/Plot/'))  # info['plotlink'] = url_for('plotLfunction',  **args)

    info['bread'] = []
    info['properties2'] = set_gaga_properties(L)

    # Create friendlink by removing 'L/' and ending '/'
    friendlink = request.url.replace('/L/', '/').replace('/L-function/', '/').replace('/Lfunction/', '/')
    splitlink = friendlink.rpartition('/')
    friendlink = splitlink[0] + splitlink[2]
    logger.debug(L.Ltype())

    if L.Ltype() == 'maass':
        if L.group == 'GL2':
            minNumberOfCoefficients = 100     # TODO: Fix this to take level into account

            if len(L.dirichlet_coefficients) < minNumberOfCoefficients:
                info['zeroeslink'] = ''
                info['plotlink'] = ''
            info['bread'] = get_bread(2, [('Maass Form',
                                           url_for('.l_function_maass_browse_page')),
                                          ('\(' + L.texname + '\)', request.url)])
            info['friends'] = [('Maass Form ', friendlink)]
        else:
            info['bread'] = get_bread(L.degree,
                                      [('Maass Form', url_for('.l_function_maass_gln_browse_page',
                                        degree='degree' + str(L.degree))),
                                     (L.dbid, request.url)])

    elif L.Ltype() == 'riemann':
        info['bread'] = get_bread(1, [('Riemann Zeta', request.url)])
        info['friends'] = [('\(\mathbb Q\)', url_for('number_fields.by_label', label='1.1.1.1')), ('Dirichlet Character \(\\chi_{1}(1,\\cdot)\)',
                           url_character(type='Dirichlet', modulus=1, number=1))]

    elif L.Ltype() == 'dirichlet':
        mod, num = L.charactermodulus, L.characternumber
        Lpattern = r"\(L(s,\chi_{%s}(%s,&middot;))\)"
        if mod > 1:
            pmod,pnum = WebDirichlet.prevprimchar(mod, num)
            Lprev = (Lpattern%(pmod,pnum),url_for('.l_function_dirichlet_page',modulus=pmod,number=pnum))
        else:
            Lprev = ('','')
        nmod,nnum = WebDirichlet.nextprimchar(mod, num)
        Lnext = (Lpattern%(nmod,nnum),url_for('.l_function_dirichlet_page',modulus=nmod,number=nnum))
        info['navi'] = (Lprev,Lnext)
        snum = str(L.characternumber)
        smod = str(L.charactermodulus)
        charname = WebDirichlet.char2tex(smod, snum)
        info['bread'] = get_bread(1, [(charname, request.url)])
        info['friends'] = [('Dirichlet Character ' + str(charname), friendlink)]

    elif L.Ltype() == 'ellipticcurveQ':
        label = L.label
        while friendlink[len(friendlink) - 1].isdigit():  # Remove any number at the end to get isogeny class url
            friendlink = friendlink[0:len(friendlink) - 1]

        info['friends'] = [('Isogeny class ' + label, friendlink)]
        for i in range(1, L.nr_of_curves_in_class + 1):
            info['friends'].append(('Elliptic curve ' + label + str(i), friendlink + str(i)))
        if L.modform:
            info['friends'].append(('Modular form ' + label.replace('.', '.2'), url_for("emf.render_elliptic_modular_forms",
                                                                                        level=L.modform['level'], weight=2, character=0, label=L.modform['iso'])))
            info['friends'].append(('L-function ' + label.replace('.', '.2'),
                                    url_for('.l_function_emf_page', level=L.modform['level'],
                                            weight=2, character=0, label=L.modform['iso'], number=0)))
        info['friends'].append(
            ('Symmetric square L-function', url_for(".l_function_ec_sym_page", power='2', label=label)))
        info['friends'].append(
            ('Symmetric cube L-function', url_for(".l_function_ec_sym_page", power='3', label=label)))
        info['bread'] = get_bread(2, [('Elliptic curve', url_for('.l_function_ec_browse_page')),
                                 (label, url_for('.l_function_ec_page', label=label))])

    elif L.Ltype() == 'ellipticmodularform':
        friendlink = friendlink + L.addToLink        # Strips off the embedding
        friendlink = friendlink.rpartition('/')[0]   # number for the L-function
        if L.character:
            info['friends'] = [('Modular form ' + str(
                L.level) + '.' + str(L.weight) + '.' + str(L.character) + str(L.label), friendlink)]
        else:
            info['friends'] = [('Modular form ' + str(L.level) + '.' + str(L.weight) + str(
                L.label), friendlink)]
        if L.ellipticcurve:
            info['friends'].append(
                ('EC isogeny class ' + L.ellipticcurve, url_for("by_ec_label", label=L.ellipticcurve)))
            info['friends'].append(('L-function ' + str(L.level) + '.' + str(L.label),
                                    url_for('.l_function_ec_page', label=L.ellipticcurve)))
            for i in range(1, L.nr_of_curves_in_class + 1):
                info['friends'].append(('Elliptic curve ' + L.ellipticcurve + str(i),
                                       url_for("by_ec_label", label=L.ellipticcurve + str(i))))
            info['friends'].append(
                ('Symmetric square L-function', url_for(".l_function_ec_sym_page", power='2', label=label)))
            info['friends'].append(
                ('Symmetric cube L-function', url_for(".l_function_ec_sym_page", power='3', label=label)))

    elif L.Ltype() == 'hilbertmodularform':
        friendlink = '/'.join(friendlink.split('/')[:-1])
        info['friends'] = [('Hilbert Modular Form', friendlink.rpartition('/')[0])]

    elif L.Ltype() == 'dedekindzeta':
        info['friends'] = [('Number Field', friendlink)]

    elif L.Ltype() in ['lcalcurl', 'lcalcfile']:
        info['bread'] = [('L-functions', url_for('.l_function_top_page'))]

    elif L.Ltype() == 'SymmetricPower':
        def ordinal(n):
            if n == 2:
                return "Square"
            elif n == 3:
                return "Cube"
            elif 10 <= n % 100 < 20:
                return str(n) + "th Power"
            else:
                return str(n) + {1: 'st', 2: 'nd', 3: 'rd'}.get(n % 10, "th") + " Power"

        if L.m == 2:
            info['bread'] = get_bread(3, [("Symmetric square of Elliptic curve",
                                    url_for('.l_function_ec_sym2_browse_page')),
                                 (L.label, url_for('.l_function_ec_sym_page',
                                                   label=L.label,power=L.m))])
        elif L.m == 3:
            info['bread'] = get_bread(4, [("Symmetric cube of Elliptic curve",
                                    url_for('.l_function_ec_sym3_browse_page')),
                                 (L.label, url_for('.l_function_ec_sym_page',
                                                   label=L.label,power=L.m))])
        else:
            info['bread'] = [('L-functions', url_for('.l_function_top_page')),
                                 ('Symmetric %s of Elliptic curve ' % ordinal(L.m)
                                   + str(L.label),
                                  url_for('.l_function_ec_sym_page',
                                                   label=L.label,power=L.m))]

        friendlink = request.url.replace('/L/SymmetricPower/%d/' % L.m, '/')
        splitlink = friendlink.rpartition('/')
        friendlink = splitlink[0] + splitlink[2]

        friendlink2 = request.url.replace('/L/SymmetricPower/%d/' % L.m, '/L/')
        splitlink = friendlink2.rpartition('/')
        friendlink2 = splitlink[0] + splitlink[2]

        info['friends'] = [('Isogeny class ' + L.label, friendlink), ('Symmetric 1st Power', friendlink2)]
        for j in range(2, L.m + 2):
            if j != L.m:
                friendlink3 = request.url.replace('/L/SymmetricPower/%d/' % L.m, '/L/SymmetricPower/%d/' % j)
                info['friends'].append(('Symmetric %s' % ordinal(j), friendlink3))

    elif L.Ltype() == 'siegelnonlift' or L.Ltype() == 'siegeleisenstein' or L.Ltype() == 'siegelklingeneisenstein' or L.Ltype() == 'siegelmaasslift':
        weight = str(L.weight)
        number = str(L.number)
        info['friends'] = [('Siegel Modular Form', friendlink)]

    elif L.Ltype() == "artin":
        # info['zeroeslink'] = ''
        # info['plotlink'] = ''
        info['friends'] = [('Artin representation', L.artin.url_for())]
        if L.sign == 0:           # The root number is now unknown
            info['zeroeslink'] = ''
            info['plotlink'] = ''

    info['dirichlet'] = lfuncDStex(L, "analytic")
    info['eulerproduct'] = lfuncEPtex(L, "abstract")
    info['functionalequation'] = lfuncFEtex(L, "analytic")
    info['functionalequationSelberg'] = lfuncFEtex(L, "selberg")

    if len(request.args) == 0:
        lcalcUrl = request.url + '?download=lcalcfile'
    else:
        lcalcUrl = request.url + '&download=lcalcfile'

    info['downloads'] = [('Lcalcfile', lcalcUrl)]

    return info
示例#5
0
def charinfo(chi):
    """ return data associated to the WebDirichletCharacter chi """
    return (chi.modulus(), chi.number(), chi.conductor(),
            chi.multiplicative_order(), chi.is_odd(), chi.is_primitive(),
            WebDirichlet.char2tex(chi.modulus(), chi.number()))
示例#6
0
def charinfo(chi):
    """ return data associated to the WebDirichletCharacter chi """
    return (chi.modulus(), chi.number(), chi.conductor(), chi.multiplicative_order(), chi.is_odd(), chi.is_primitive(), WebDirichlet.char2tex(chi.modulus(), chi.number()))
示例#7
0
文件: main.py 项目: sanni85/lmfdb
def set_bread_and_friends(L, request):
    ''' Returns the list of friends to link to and the bread crumbs.
    Depends on the type of L-function and needs to be added to for new types
    '''
    bread = []
    friends = []
    origins = []
    factors = []
    instances = []

    # Create default friendlink by removing 'L/' and ending '/'
    friendlink = request.path.replace('/L/', '/').replace('/L-function/', '/').replace('/Lfunction/', '/')
    splitlink = friendlink.rpartition('/')
    friendlink = splitlink[0] + splitlink[2]

    if L.Ltype() == 'riemann':
        friends = [('\(\mathbb Q\)', url_for('number_fields.by_label', label='1.1.1.1')),
                           ('Dirichlet Character \(\\chi_{1}(1,\\cdot)\)',url_for('characters.render_Dirichletwebpage',
                                                                                  modulus=1, number=1))]
        bread = get_bread(1, [('Riemann Zeta', request.path)])

    elif L.Ltype() == 'dirichlet':
        snum = str(L.characternumber)
        smod = str(L.charactermodulus)
        charname = WebDirichlet.char2tex(smod, snum)
        friends = [('Dirichlet Character ' + str(charname), friendlink)]
        if L.fromDB and not L.selfdual:
            friends.append(('Dual L-function', L.dual_link))
        bread = get_bread(1, [(charname, request.path)])

    elif L.Ltype() == 'ellipticcurve':
        bread = L.bread
        origins = L.origins
        friends = L.friends
        factors = L.factors
        instances = L.instances

    elif L.Ltype() == 'ellipticmodularform':
        friendlink = friendlink.rpartition('/')[0] # Strips off the embedding
                                                   # number for the L-function
        if L.character:  # TODO: Probably always true now
            full_label = ( str(L.level) + '.' + str(L.weight) + '.' + str(L.character) +
                                str(L.label) )
        else:
            full_label = str(L.level) + '.' + str(L.weight) + str(L.label)

        origins = [('Modular form ' + full_label, friendlink)]

        if L.ellipticcurve:
            origins.append(
                ('Isogeny class ' + L.ellipticcurve,
                 url_for("ec.by_ec_label", label=L.ellipticcurve)))
            # DEPRECATED
            #for i in range(1, L.nr_of_curves_in_class + 1):
            #    friends.append(('Elliptic curve ' + L.ellipticcurve + str(i),
            #                            url_for("ec.by_ec_label", label=L.ellipticcurve + str(i))))
            if not isogeny_class_cm(L.ellipticcurve):
                friends.append(
                    ('Symmetric square L-function',
                     url_for(".l_function_ec_sym_page_label", power='2',
                             label=L.ellipticcurve)))
                friends.append(
                    ('Symmetric cube L-function',
                     url_for(".l_function_ec_sym_page_label", power='3',
                             label=L.ellipticcurve)))
        bread = get_bread(2, [('Cusp Form', url_for('.l_function_cuspform_browse_page')),
                                      (full_label, request.path)])

    elif L.Ltype() == 'maass':
        if L.group == 'GL2':
            friends = [('Maass Form ', friendlink)]
            bread = get_bread(2, [('Maass Form',
                                           url_for('.l_function_maass_browse_page')),
                                          ('\(' + L.texname + '\)', request.path)])

        else:
            if L.fromDB and not L.selfdual:
                friends = [('Dual L-function', L.dual_link)]

            bread = get_bread(L.degree,
                                      [('Maass Form', url_for('.l_function_maass_gln_browse_page',
                                                              degree='degree' + str(L.degree))),
                                       (L.maass_id.partition('/')[2], request.path)])


    elif L.Ltype() == 'hilbertmodularform':
        friendlink = '/'.join(friendlink.split('/')[:-1])
        friends = [('Hilbert modular form ' + L.label, friendlink.rpartition('/')[0])]
        if L.degree == 4:
            bread = get_bread(4, [(L.label, request.path)])
        else:
            bread = [('L-functions', url_for('.l_function_top_page'))]

    elif (L.Ltype() == 'siegelnonlift' or L.Ltype() == 'siegeleisenstein' or
          L.Ltype() == 'siegelklingeneisenstein' or L.Ltype() == 'siegelmaasslift'):
        weight = str(L.weight)
        label = 'Sp4Z.' + weight + '_' + L.orbit
        friendlink = '/'.join(friendlink.split('/')[:-3]) + '.' + weight + '_' + L.orbit
        friends = [('Siegel Modular Form ' + label, friendlink)]
        if L.degree == 4:
            bread = get_bread(4, [(label, request.path)])
        else:
            bread = [('L-functions', url_for('.l_function_top_page'))]

    elif L.Ltype() == 'genus2curveQ':
        (cond, dummy, alpha) = L.label.partition('.')
        friends = [('Isogeny class ' + L.label,  url_for('g2c.by_url_isogeny_class_label',
                                                         cond = cond, alpha = alpha))]
        bread = get_bread(4, [(L.label, request.path)])

    elif L.Ltype() == 'dedekindzeta':
        friends = [('Number Field', friendlink)]
        if L.degree <= 4:
            bread = get_bread(L.degree, [(L.label, request.path)])
        else:
            bread = [('L-functions', url_for('.l_function_top_page'))]

    elif L.Ltype() == "artin":
        friends = [('Artin representation', L.artin.url_for())]
        if L.degree <= 4:
            bread = get_bread(L.degree, [(L.label, request.path)])
        else:
            bread = [('L-functions', url_for('.l_function_top_page'))]

    elif L.Ltype() == "hgmQ":
        # The /L/ trick breaks down for motives,
        # because we have a scheme for the L-functions themselves
        newlink = friendlink.rpartition('t')
        friendlink = newlink[0]+'/t'+newlink[2]
        friends = [('Hypergeometric motive ', friendlink)]
        if L.degree <= 4:
            bread = get_bread(L.degree, [(L.label, request.path)])
        else:
            bread = [('L-functions', url_for('.l_function_top_page'))]


    elif L.Ltype() == 'SymmetricPower':
        def ordinal(n):
            if n == 2:
                return "Square"
            elif n == 3:
                return "Cube"
            elif 10 <= n % 100 < 20:
                return str(n) + "th Power"
            else:
                return str(n) + {1: 'st', 2: 'nd', 3: 'rd'}.get(n % 10, "th") + " Power"

        if L.m == 2:
            bread = get_bread(3, [("Symmetric square of Elliptic curve",
                                           url_for('.l_function_ec_sym2_browse_page')),
                                          (L.label, url_for('.l_function_ec_sym_page_label',
                                                            label=L.label,power=L.m))])
        elif L.m == 3:
            bread = get_bread(4, [("Symmetric Cube of Elliptic Curve",
                                           url_for('.l_function_ec_sym3_browse_page')),
                                          (L.label, url_for('.l_function_ec_sym_page_label',
                                                            label=L.label,power=L.m))])
        else:
            bread = [('L-functions', url_for('.l_function_top_page')),
                             ('Symmetric %s of Elliptic Curve ' % ordinal(L.m)
                              + str(L.label),
                              url_for('.l_function_ec_sym_page_label',
                                      label=L.label,power=L.m))]

        friendlink = request.path.replace('/L/SymmetricPower/%d/' % L.m, '/')
        splitlink = friendlink.rpartition('/')
        friendlink = splitlink[0] + splitlink[2]

        friendlink2 = request.path.replace('/L/SymmetricPower/%d/' % L.m, '/L/')
        splitlink = friendlink2.rpartition('/')
        friendlink2 = splitlink[0] + splitlink[2]

        friends = [('Isogeny class ' + L.label, friendlink), ('Symmetric 1st Power', friendlink2)]
        for j in range(2, L.m + 2):
            if j != L.m:
                friendlink3 = request.path.replace('/L/SymmetricPower/%d/' % L.m, '/L/SymmetricPower/%d/' % j)
                friends.append(('Symmetric %s' % ordinal(j), friendlink3))

    elif L.Ltype() in ['lcalcurl', 'lcalcfile']:
        if L.degree <= 4:
            bread = get_bread(L.degree, [])
        else:
            bread = [('L-functions', url_for('.l_function_top_page'))]

    elif L.Ltype() == "general":
        bread = L.bread
        origins = L.origins
        friends = L.friends
        factors = L.factors
        instances = L.instances

    return (bread, origins, friends, factors, instances)
示例#8
0
 def texname(self):
     from lmfdb.WebCharacter import WebDirichlet
     return WebDirichlet.char2tex(self.modulus, self.number)
示例#9
0
 def test_Dirichletmethods(self):
     modlabel, numlabel = 14, 5
     mod = WebDirichlet.label2ideal(modlabel)
     assert WebDirichlet.ideal2label(mod) == modlabel
     num = WebDirichlet.label2number(numlabel)
     assert WebDirichlet.number2label(num) == numlabel
示例#10
0
 def test_Dirichletmethods(self):
     modlabel, numlabel = 14, 5
     mod = WebDirichlet.label2ideal(modlabel)
     assert WebDirichlet.ideal2label(mod) == modlabel
     num = WebDirichlet.label2number(numlabel)
     assert WebDirichlet.number2label(num) == numlabel
示例#11
0
 def texname(self):
     from lmfdb.WebCharacter import WebDirichlet
     return WebDirichlet.char2tex(self.modulus, self.number)
示例#12
0
def initLfunction(L, args, request):
    ''' Sets the properties to show on the homepage of an L-function page.
    '''

    info = {'title': L.title}
    try:
        info['citation'] = L.citation
    except AttributeError:
        info['citation'] = ""
    try:
        info['support'] = L.support
    except AttributeError:
        info['support'] = ""

    info['Ltype'] = L.Ltype()

    # Here we should decide which values are indeed special values
    # According to Brian, odd degree has special value at 1, and even
    # degree has special value at 1/2.
    # (however, I'm not sure this is true if L is not primitive -- GT)

    # Now we usually display both
    if L.Ltype() != "artin" or (L.Ltype() == "artin" and L.sign != 0):
        #    if is_even(L.degree) :
        #        info['sv12'] = specialValueString(L, 0.5, '1/2')
        #    if is_odd(L.degree):
        #        info['sv1'] = specialValueString(L, 1, '1')
        info['sv1'] = specialValueString(L, 1, '1')
        info['sv12'] = specialValueString(L, 0.5, '1/2')

    info['args'] = args

    info['credit'] = L.credit
    # info['citation'] = L.citation

    try:
        info['factorization'] = L.factorization
    except:
        pass

    try:
        info['url'] = L.url
    except:
        info['url'] = ''

    info['degree'] = int(L.degree)

    info['zeroeslink'] = (request.url.replace('/L/', '/L/Zeros/').replace(
        '/Lfunction/', '/L/Zeros/').replace('/L-function/', '/L/Zeros/')
                          )  # url_for('zeroesLfunction',  **args)

    info['plotlink'] = (
        request.url.replace('/L/', '/L/Plot/').replace(
            '/Lfunction/', '/L/Plot/').replace('/L-function/', '/L/Plot/')
    )  # info['plotlink'] = url_for('plotLfunction',  **args)

    info['bread'] = []
    info['properties2'] = set_gaga_properties(L)

    # Create friendlink by removing 'L/' and ending '/'
    friendlink = request.url.replace('/L/',
                                     '/').replace('/L-function/', '/').replace(
                                         '/Lfunction/', '/')
    splitlink = friendlink.rpartition('/')
    friendlink = splitlink[0] + splitlink[2]
    logger.debug(L.Ltype())

    if L.Ltype() == 'maass':
        if L.group == 'GL2':
            minNumberOfCoefficients = 100  # TODO: Fix this to take level into account

            if len(L.dirichlet_coefficients) < minNumberOfCoefficients:
                info['zeroeslink'] = ''
                info['plotlink'] = ''
            info['bread'] = get_bread(
                2, [('Maass Form', url_for('.l_function_maass_browse_page')),
                    ('\(' + L.texname + '\)', request.url)])
            info['friends'] = [('Maass Form ', friendlink)]
        else:
            info['bread'] = get_bread(
                L.degree, [('Maass Form',
                            url_for('.l_function_maass_gln_browse_page',
                                    degree='degree' + str(L.degree))),
                           (L.dbid, request.url)])

    elif L.Ltype() == 'riemann':
        info['bread'] = get_bread(1, [('Riemann Zeta', request.url)])
        info['friends'] = [('\(\mathbb Q\)',
                            url_for('number_fields.by_label',
                                    label='1.1.1.1')),
                           ('Dirichlet Character \(\\chi_{1}(1,\\cdot)\)',
                            url_character(type='Dirichlet',
                                          modulus=1,
                                          number=1))]

    elif L.Ltype() == 'dirichlet':
        mod, num = L.charactermodulus, L.characternumber
        Lpattern = r"\(L(s,\chi_{%s}(%s,&middot;))\)"
        if mod > 1:
            pmod, pnum = WebDirichlet.prevprimchar(mod, num)
            Lprev = (Lpattern % (pmod, pnum),
                     url_for('.l_function_dirichlet_page',
                             modulus=pmod,
                             number=pnum))
        else:
            Lprev = ('', '')
        nmod, nnum = WebDirichlet.nextprimchar(mod, num)
        Lnext = (Lpattern % (nmod, nnum),
                 url_for('.l_function_dirichlet_page',
                         modulus=nmod,
                         number=nnum))
        info['navi'] = (Lprev, Lnext)
        snum = str(L.characternumber)
        smod = str(L.charactermodulus)
        charname = WebDirichlet.char2tex(smod, snum)
        info['bread'] = get_bread(1, [(charname, request.url)])
        info['friends'] = [('Dirichlet Character ' + str(charname), friendlink)
                           ]

    elif L.Ltype() == 'ellipticcurveQ':
        label = L.label
        while friendlink[len(friendlink) - 1].isdigit(
        ):  # Remove any number at the end to get isogeny class url
            friendlink = friendlink[0:len(friendlink) - 1]

        info['friends'] = [('Isogeny class ' + label, friendlink)]
        for i in range(1, L.nr_of_curves_in_class + 1):
            info['friends'].append(
                ('Elliptic curve ' + label + str(i), friendlink + str(i)))
        if L.modform:
            info['friends'].append(
                ('Modular form ' + label.replace('.', '.2'),
                 url_for("emf.render_elliptic_modular_forms",
                         level=L.modform['level'],
                         weight=2,
                         character=0,
                         label=L.modform['iso'])))
            info['friends'].append(('L-function ' + label.replace('.', '.2'),
                                    url_for('.l_function_emf_page',
                                            level=L.modform['level'],
                                            weight=2,
                                            character=0,
                                            label=L.modform['iso'],
                                            number=0)))
        info['friends'].append(('Symmetric square L-function',
                                url_for(".l_function_ec_sym_page",
                                        power='2',
                                        label=label)))
        info['friends'].append(('Symmetric cube L-function',
                                url_for(".l_function_ec_sym_page",
                                        power='3',
                                        label=label)))
        info['bread'] = get_bread(
            2, [('Elliptic curve', url_for('.l_function_ec_browse_page')),
                (label, url_for('.l_function_ec_page', label=label))])

    elif L.Ltype() == 'ellipticmodularform':
        friendlink = friendlink + L.addToLink  # Strips off the embedding
        friendlink = friendlink.rpartition('/')[0]  # number for the L-function
        if L.character:
            info['friends'] = [
                ('Modular form ' + str(L.level) + '.' + str(L.weight) + '.' +
                 str(L.character) + str(L.label), friendlink)
            ]
        else:
            info['friends'] = [('Modular form ' + str(L.level) + '.' +
                                str(L.weight) + str(L.label), friendlink)]
        if L.ellipticcurve:
            info['friends'].append(('EC isogeny class ' + L.ellipticcurve,
                                    url_for("by_ec_label",
                                            label=L.ellipticcurve)))
            info['friends'].append(
                ('L-function ' + str(L.level) + '.' + str(L.label),
                 url_for('.l_function_ec_page', label=L.ellipticcurve)))
            for i in range(1, L.nr_of_curves_in_class + 1):
                info['friends'].append(
                    ('Elliptic curve ' + L.ellipticcurve + str(i),
                     url_for("by_ec_label", label=L.ellipticcurve + str(i))))
            info['friends'].append(('Symmetric square L-function',
                                    url_for(".l_function_ec_sym_page",
                                            power='2',
                                            label=label)))
            info['friends'].append(('Symmetric cube L-function',
                                    url_for(".l_function_ec_sym_page",
                                            power='3',
                                            label=label)))

    elif L.Ltype() == 'hilbertmodularform':
        friendlink = '/'.join(friendlink.split('/')[:-1])
        info['friends'] = [('Hilbert Modular Form',
                            friendlink.rpartition('/')[0])]

    elif L.Ltype() == 'dedekindzeta':
        info['friends'] = [('Number Field', friendlink)]

    elif L.Ltype() in ['lcalcurl', 'lcalcfile']:
        info['bread'] = [('L-functions', url_for('.l_function_top_page'))]

    elif L.Ltype() == 'SymmetricPower':

        def ordinal(n):
            if n == 2:
                return "Square"
            elif n == 3:
                return "Cube"
            elif 10 <= n % 100 < 20:
                return str(n) + "th Power"
            else:
                return str(n) + {
                    1: 'st',
                    2: 'nd',
                    3: 'rd'
                }.get(n % 10, "th") + " Power"

        if L.m == 2:
            info['bread'] = get_bread(3, [
                ("Symmetric square of Elliptic curve",
                 url_for('.l_function_ec_sym2_browse_page')),
                (L.label,
                 url_for('.l_function_ec_sym_page', label=L.label, power=L.m))
            ])
        elif L.m == 3:
            info['bread'] = get_bread(4, [
                ("Symmetric cube of Elliptic curve",
                 url_for('.l_function_ec_sym3_browse_page')),
                (L.label,
                 url_for('.l_function_ec_sym_page', label=L.label, power=L.m))
            ])
        else:
            info['bread'] = [
                ('L-functions', url_for('.l_function_top_page')),
                ('Symmetric %s of Elliptic curve ' % ordinal(L.m) +
                 str(L.label),
                 url_for('.l_function_ec_sym_page', label=L.label, power=L.m))
            ]

        friendlink = request.url.replace('/L/SymmetricPower/%d/' % L.m, '/')
        splitlink = friendlink.rpartition('/')
        friendlink = splitlink[0] + splitlink[2]

        friendlink2 = request.url.replace('/L/SymmetricPower/%d/' % L.m, '/L/')
        splitlink = friendlink2.rpartition('/')
        friendlink2 = splitlink[0] + splitlink[2]

        info['friends'] = [('Isogeny class ' + L.label, friendlink),
                           ('Symmetric 1st Power', friendlink2)]
        for j in range(2, L.m + 2):
            if j != L.m:
                friendlink3 = request.url.replace(
                    '/L/SymmetricPower/%d/' % L.m, '/L/SymmetricPower/%d/' % j)
                info['friends'].append(
                    ('Symmetric %s' % ordinal(j), friendlink3))

    elif L.Ltype() == 'siegelnonlift' or L.Ltype(
    ) == 'siegeleisenstein' or L.Ltype(
    ) == 'siegelklingeneisenstein' or L.Ltype() == 'siegelmaasslift':
        weight = str(L.weight)
        number = str(L.number)
        info['friends'] = [('Siegel Modular Form', friendlink)]

    elif L.Ltype() == "artin":
        # info['zeroeslink'] = ''
        # info['plotlink'] = ''
        info['friends'] = [('Artin representation', L.artin.url_for())]
        if L.sign == 0:  # The root number is now unknown
            info['zeroeslink'] = ''
            info['plotlink'] = ''

    info['dirichlet'] = lfuncDStex(L, "analytic")
    info['eulerproduct'] = lfuncEPtex(L, "abstract")
    info['functionalequation'] = lfuncFEtex(L, "analytic")
    info['functionalequationSelberg'] = lfuncFEtex(L, "selberg")

    if len(request.args) == 0:
        lcalcUrl = request.url + '?download=lcalcfile'
    else:
        lcalcUrl = request.url + '&download=lcalcfile'

    info['downloads'] = [('Lcalcfile', lcalcUrl)]

    return info