Example #1
0
def set_info_for_navigation(info, is_set, sbar):
    r"""
    Set information for the navigation page.
    """
    (friends, lifts) = sbar
    ## We always print the list of weights
    info['initial_list_of_weights'] = print_list_of_weights()
# ajax_more2(print_list_of_weights,{'kstart':[0,10,25,50],'klen':[15,15,15]},text=['<<','>>'])
    ## And the  list of characters if we know the level.

    if(is_set['level']):
        s = "<option value=" + str(0) + ">Trivial character</option>"
        D = DirichletGroup(info['level'])
        if(is_set['weight'] and is_even(info['weight'])):
            if(is_fundamental_discriminant(info['level'])):
                x = kronecker_character(info['level'])
                xi = D.list().index(x)
                s = s + "<option value=" + str(xi) + ">Kronecker character</option>"
        for x in D:
            if(is_set['weight'] and is_even(info['weight']) and x.is_odd()):
                continue
            if(is_set['weight'] and is_odd(info['weight']) and x.is_even()):
                continue
            xi = D.list().index(x)
#                       s=s+"<option value="+str(xi)+">\(\chi_{"+str(xi)+"}\)</option>"
            s = s + "<option value=" + str(xi) + ">" + str(xi) + "</option>"
        info['list_of_characters'] = s
    friends.append(('L-function', '/Lfunction/ModularForm/GL2/Q/holomorphic/'))
    lifts.append(('Half-Integral Weight Forms', '/ModularForm/Mp2/Q'))
    lifts.append(('Siegel Modular Forms', '/ModularForm/GSp4/Q'))
    return (info, lifts)
Example #2
0
def set_info_for_navigation(info, is_set, sbar):
    r"""
    Set information for the navigation page.
    """
    (friends, lifts) = sbar
    ## We always print the list of weights
    info['initial_list_of_weights'] = print_list_of_weights()
    # ajax_more2(print_list_of_weights,{'kstart':[0,10,25,50],'klen':[15,15,15]},text=['<<','>>'])
    ## And the  list of characters if we know the level.

    if (is_set['level']):
        s = "<option value=" + str(0) + ">Trivial character</option>"
        D = DirichletGroup(info['level'])
        if (is_set['weight'] and is_even(info['weight'])):
            if (is_fundamental_discriminant(info['level'])):
                x = kronecker_character(info['level'])
                xi = D.list().index(x)
                s = s + "<option value=" + str(
                    xi) + ">Kronecker character</option>"
        for x in D:
            if (is_set['weight'] and is_even(info['weight']) and x.is_odd()):
                continue
            if (is_set['weight'] and is_odd(info['weight']) and x.is_even()):
                continue
            xi = D.list().index(x)
            #                       s=s+"<option value="+str(xi)+">\(\chi_{"+str(xi)+"}\)</option>"
            s = s + "<option value=" + str(xi) + ">" + str(xi) + "</option>"
        info['list_of_characters'] = s
    friends.append(('L-function', '/Lfunction/ModularForm/GL2/Q/holomorphic/'))
    lifts.append(('Half-Integral Weight Forms', '/ModularForm/Mp2/Q'))
    lifts.append(('Siegel Modular Forms', '/ModularForm/GSp4/Q'))
    return (info, lifts)
Example #3
0
def print_list_of_characters(level=1, weight=2):
    r"""
    Prints a list of characters compatible with the weight and level.
    """
    emf_logger.debug("print_list_of_chars")
    D = DirichletGroup(level)
    res = list()
    for j in range(len(D.list())):
        if D.list()[j].is_even() and is_even(weight):
            res.append(j)
        if D.list()[j].is_odd() and is_odd(weight):
            res.append(j)
    s = ""
    for j in res:
        s += "\(\chi_{" + str(j) + "}\)"
    return s
Example #4
0
def print_list_of_characters(level=1, weight=2):
    r"""
    Prints a list of characters compatible with the weight and level.
    """
    emf_logger.debug("print_list_of_chars")
    D = DirichletGroup(level)
    res = list()
    for j in range(len(D.list())):
        if D.list()[j].is_even() and is_even(weight):
            res.append(j)
        if D.list()[j].is_odd() and is_odd(weight):
            res.append(j)
    s = ""
    for j in res:
        s += "\(\chi_{" + str(j) + "}\)"
    return s
Example #5
0
    def _Weyl_law_consts(self):
        r"""
        Compute constants for the Weyl law on self._G

        OUTPUT:

        - tuple of real numbers

        EXAMPLES::


            sage: M=MaassWaveForms(MySubgroup(Gamma0(1)))
            sage: M._Weyl_law_consts()
            (0, 2/pi, (log(pi) - log(2) + 2)/pi, 0, -2)
        """
        import mpmath
        pi=mpmath.fp.pi
        ix=Integer(self._G.index())
        nc=Integer(len(self._G.cusps()))
        if(self._G.is_congruence()):
            lvl=Integer(self._G.level())
        else:
            lvl=0
        n2=Integer(self._G.nu2())
        n3=Integer(self._G.nu3())
        c1=ix/Integer(12)
        c2=Integer(2)*nc/pi
        c3=nc*(Integer(2)-ln(Integer(2))+ln(pi))/pi
        if(lvl<>0):
            A=1
            for q in divisors(lvl):
                num_prim_dc=0
                DG=DirichletGroup(q)
                for chi in DG.list():
                    if(chi.is_primitive()):
                        num_prim_dc=num_prim_dc+1
                for m in divisors(lvl):
                    if(lvl % (m*q) == 0   and m % q ==0 ): 
                        fak=(q*lvl)/gcd(m,lvl/m)
                        A=A*Integer(fak)**num_prim_dc        
            c4=-ln(A)/pi
        else:
            c4=Integer(0)
        # constant term
        c5=-ix/144+n2/8+n3*2/9-nc/4-1
        return (c1,c2,c3,c4,c5)
Example #6
0
def set_table(info, is_set, make_link=True):  # level_min,level_max,weight=2,chi=0,make_link=True):
    r"""
    make a bunch of html tables with information about spaces of modular forms
    with parameters in the given ranges.
    Should use database in the future...
    """
    D = 0
    rowlen = 10  # split into rows of this length...
    rowlen0 = rowlen
    rowlen1 = rowlen
    characters = dict()
    if('level_min' in info):
        level_min = int(info['level_min'])
    else:
        level_min = 1
    if('level_max' in info):
        level_max = int(info['level_max'])
    else:
        level_max = 50
    if (level_max - level_min + 1) < rowlen:
        rowlen0 = level_max - level_min + 1
    if(info['list_chars'] != '0'):
        char1 = 1
    else:
        char1 = 0
    if(is_set['weight']):
        weight = int(info['weight'])
    else:
        weight = 2
    ## setup the table
    # print "char11=",char1
    tbl = dict()
    if(char1 == 1):
        tbl['header'] = 'Dimension of \( S_{' + str(weight) + '}(N,\chi_{n})\)'
    else:
        tbl['header'] = 'Dimension of \( S_{' + str(weight) + '}(N)\)'
    tbl['headersv'] = list()
    tbl['headersh'] = list()
    tbl['corner_label'] = ""
    tbl['data'] = list()
    tbl['data_format'] = 'html'
    tbl['class'] = "dimension_table"
    tbl['atts'] = "border=\"0\" class=\"data_table\""
    num_rows = ceil(QQ(level_max - level_min + 1) / QQ(rowlen0))
    print "num_rows=", num_rows
    for i in range(1, rowlen0 + 1):
        tbl['headersh'].append(i + level_min - 1)

    for r in range(num_rows):
        tbl['headersv'].append(r * rowlen0)
    print "level_min=", level_min
    print "level_max=", level_max
    print "char=", char1
    for r in range(num_rows):
        row = list()
        for k in range(1, rowlen0 + 1):
            row.append("")
        # print "row nr. ",r
        for k in range(1, rowlen0 + 1):
            N = level_min - 1 + r * rowlen0 + k
            s = "<a name=\"#" + str(N) + "\"></a>"
            # print "col ",k,"=",N
            if(N > level_max or N < 1):
                continue
            if(char1 == 0):
                d = dimension_cusp_forms(N, weight)
                print "d=", d
                if(make_link):
                    url = "?weight=" + str(weight) + "&level=" + str(N) + "&character=0"
                    row.append(s + "<a target=\"mainWindow\" href=\"" + url + "\">" + str(d) + "</a>")
                else:
                    row.append(s + str(d))

                # print "dim(",N,weight,")=",d
            else:

                D = DirichletGroup(N)
                print "D=", D
                s = "<a name=\"#" + str(N) + "\"></a>"
                small_tbl = dict()
                # small_tbl['header']='Dimension of \( S_{'+str(weight)+'}(N)\)'
                small_tbl['headersv'] = ['\( d \)']
                small_tbl['headersh'] = list()
                small_tbl['corner_label'] = "\( n \)"
                small_tbl['data'] = list()
                small_tbl['atts'] = "border=\"1\" padding=\"1\""
                small_tbl['data_format'] = 'html'
                row1 = list()
                # num_small_rows = ceil(QQ(level_max) / QQ(rowlen))
                ii = 0
                for chi in range(0, len(D.list())):
                    x = D[chi]
                    S = CuspForms(x, weight)
                    d = S.dimension()
                    if(d == 0):
                        continue
                    small_tbl['headersh'].append(chi)
                    if(make_link):
                        url = "?weight=" + str(weight) + "&level=" + str(N) + "&character=" + str(chi)
                        row1.append("<a target=\"mainWindow\" href=\"" + url + "\">" + str(d) + "</a>")
                    else:
                        row1.append(d)
                    ii = ii + 1
                    print "d=", d
                    if(ii > rowlen1 and len(row1) > 0):
                        ## we make a new table since we may not have regularly dstributed labels
                        # print "Break line! Make new table!"
                        small_tbl['data'].append(row1)
                        s = s + html_table(small_tbl)
                        small_tbl['headersh'] = list()
                        small_tbl['data'] = list()
                        row1 = list()
                        ii = 0

                if(len(row1) > 0):
                    small_tbl['data'].append(row1)
                if(len(row1) > 0 or len(small_tbl['data']) > 0):
                    # print "small_tbl=",small_tbl
                    ss = html_table(small_tbl)
                    # print "ss=",ss
                    s = s + ss
                    # s=s+"\( \chi_{"+str(chi)+"}\) :"+str(d)

                    # print N,k,chi,d
                # print s
                else:
                    s = "All spaces are zero-dimensional!"
                row.append(s)
        print "row=", row
        tbl['data'].append(row)
    s = html_table(tbl)
    s = s + "\n <br> \(N=" + str(rowlen0) + "\cdot row+col\)"
    print "Whole table=", s
    ## ugly solution. but we have latex in the data fields...
    ss = re.sub('texttt', '', s)
    info['popup_table'] = ss
    # info['sidebar']=set_sidebar([navigation,parents,siblings,friends,lifts])
    return info
Example #7
0
def set_table(
        info,
        is_set,
        make_link=True):  # level_min,level_max,weight=2,chi=0,make_link=True):
    r"""
    make a bunch of html tables with information about spaces of modular forms
    with parameters in the given ranges.
    Should use database in the future...
    """
    D = 0
    rowlen = 10  # split into rows of this length...
    rowlen0 = rowlen
    rowlen1 = rowlen
    characters = dict()
    if ('level_min' in info):
        level_min = int(info['level_min'])
    else:
        level_min = 1
    if ('level_max' in info):
        level_max = int(info['level_max'])
    else:
        level_max = 50
    if (level_max - level_min + 1) < rowlen:
        rowlen0 = level_max - level_min + 1
    if (info['list_chars'] != '0'):
        char1 = 1
    else:
        char1 = 0
    if (is_set['weight']):
        weight = int(info['weight'])
    else:
        weight = 2
    ## setup the table
    # print "char11=",char1
    tbl = dict()
    if (char1 == 1):
        tbl['header'] = 'Dimension of \( S_{' + str(weight) + '}(N,\chi_{n})\)'
    else:
        tbl['header'] = 'Dimension of \( S_{' + str(weight) + '}(N)\)'
    tbl['headersv'] = list()
    tbl['headersh'] = list()
    tbl['corner_label'] = ""
    tbl['data'] = list()
    tbl['data_format'] = 'html'
    tbl['class'] = "dimension_table"
    tbl['atts'] = "border=\"0\" class=\"data_table\""
    num_rows = ceil(QQ(level_max - level_min + 1) / QQ(rowlen0))
    print "num_rows=", num_rows
    for i in range(1, rowlen0 + 1):
        tbl['headersh'].append(i + level_min - 1)

    for r in range(num_rows):
        tbl['headersv'].append(r * rowlen0)
    print "level_min=", level_min
    print "level_max=", level_max
    print "char=", char1
    for r in range(num_rows):
        row = list()
        for k in range(1, rowlen0 + 1):
            row.append("")
        # print "row nr. ",r
        for k in range(1, rowlen0 + 1):
            N = level_min - 1 + r * rowlen0 + k
            s = "<a name=\"#" + str(N) + "\"></a>"
            # print "col ",k,"=",N
            if (N > level_max or N < 1):
                continue
            if (char1 == 0):
                d = dimension_cusp_forms(N, weight)
                print "d=", d
                if (make_link):
                    url = "?weight=" + str(weight) + "&level=" + str(
                        N) + "&character=0"
                    row.append(s + "<a target=\"mainWindow\" href=\"" + url +
                               "\">" + str(d) + "</a>")
                else:
                    row.append(s + str(d))

                # print "dim(",N,weight,")=",d
            else:

                D = DirichletGroup(N)
                print "D=", D
                s = "<a name=\"#" + str(N) + "\"></a>"
                small_tbl = dict()
                # small_tbl['header']='Dimension of \( S_{'+str(weight)+'}(N)\)'
                small_tbl['headersv'] = ['\( d \)']
                small_tbl['headersh'] = list()
                small_tbl['corner_label'] = "\( n \)"
                small_tbl['data'] = list()
                small_tbl['atts'] = "border=\"1\" padding=\"1\""
                small_tbl['data_format'] = 'html'
                row1 = list()
                # num_small_rows = ceil(QQ(level_max) / QQ(rowlen))
                ii = 0
                for chi in range(0, len(D.list())):
                    x = D[chi]
                    S = CuspForms(x, weight)
                    d = S.dimension()
                    if (d == 0):
                        continue
                    small_tbl['headersh'].append(chi)
                    if (make_link):
                        url = "?weight=" + str(weight) + "&level=" + str(
                            N) + "&character=" + str(chi)
                        row1.append("<a target=\"mainWindow\" href=\"" + url +
                                    "\">" + str(d) + "</a>")
                    else:
                        row1.append(d)
                    ii = ii + 1
                    print "d=", d
                    if (ii > rowlen1 and len(row1) > 0):
                        ## we make a new table since we may not have regularly dstributed labels
                        # print "Break line! Make new table!"
                        small_tbl['data'].append(row1)
                        s = s + html_table(small_tbl)
                        small_tbl['headersh'] = list()
                        small_tbl['data'] = list()
                        row1 = list()
                        ii = 0

                if (len(row1) > 0):
                    small_tbl['data'].append(row1)
                if (len(row1) > 0 or len(small_tbl['data']) > 0):
                    # print "small_tbl=",small_tbl
                    ss = html_table(small_tbl)
                    # print "ss=",ss
                    s = s + ss
                    # s=s+"\( \chi_{"+str(chi)+"}\) :"+str(d)

                    # print N,k,chi,d
                # print s
                else:
                    s = "All spaces are zero-dimensional!"
                row.append(s)
        print "row=", row
        tbl['data'].append(row)
    s = html_table(tbl)
    s = s + "\n <br> \(N=" + str(rowlen0) + "\cdot row+col\)"
    print "Whole table=", s
    ## ugly solution. but we have latex in the data fields...
    ss = re.sub('texttt', '', s)
    info['popup_table'] = ss
    # info['sidebar']=set_sidebar([navigation,parents,siblings,friends,lifts])
    return info