Ejemplo n.º 1
0
def get_dimension_cusp_forms(k, N=1, xi=0):
    r""" Return the dimension of S_k(N,xi).

    INPUT:
     - ''k'' -- positive integer : the weight
     - ''N'' -- positive integer (default 1) : level
     - ''xi''-- non-negative integer (default 0) : use character nr. xi in DirichletGroup(N)

    OUTPUT:
     - ''s'' -- string representation of d = dimension of S_k(N,xi)

    EXAMPLES::

        sage: get_dimension_cusp_forms(2,11)
        '1'
        sage: get_dimension_cusp_forms(3,14,3)
        '2'

    """
    # check input
    if (N <= 0 or k <= 0):
        raise ValueError("Need positive level and weight!")
    if (xi < 0):
        raise ValueError("Need positive character index!")
    elif (xi == 0):
        d = dimension_cusp_forms(N, k)
    else:
        DG = DirichletGroup(N)
        chi = list(DG)[xi]
        d = dimension_cusp_forms(chi, k)
    return str(d)
Ejemplo n.º 2
0
def get_dimension_cusp_forms(k, N=1, xi=0):
    r""" Return the dimension of S_k(N,xi).

    INPUT:
     - ''k'' -- positive integer : the weight
     - ''N'' -- positive integer (default 1) : level
     - ''xi''-- non-negative integer (default 0) : use character nr. xi in DirichletGroup(N)

    OUTPUT:
     - ''s'' -- string representation of d = dimension of S_k(N,xi)

    EXAMPLES::

        sage: get_dimension_cusp_forms(2,11)
        '1'
        sage: get_dimension_cusp_forms(3,14,3)
        '2'

    """
    # check input
    if(N <= 0 or k <= 0):
        raise ValueError("Need positive level and weight!")
    if(xi < 0):
        raise ValueError("Need positive character index!")
    elif(xi == 0):
        d = dimension_cusp_forms(N, k)
    else:
        DG = DirichletGroup(N)
        chi = list(DG)[xi]
        d = dimension_cusp_forms(chi, k)
    return str(d)
Ejemplo n.º 3
0
def return_dimension(level=None, weight=None, chi=None, **kwds):
    if request.method == 'GET':
        info = to_dict(request.args)
    else:
        info = to_dict(request.form)
    level = my_get(info, 'level', level, int)
    weight = my_get(info, 'weight', weight, int)
    chi = my_get(info, 'chi', chi, int)
    if level is None or weight is None:
        return emf_error("Please supply level weight (and optional character)!"), 500
    ttype = my_get(kwds, 'ttype', info.get('ttype', 'new'), str)
    emf_logger.debug("level,weight,chi: {0},{1},{2}, type={3}".format(level, weight, chi, ttype))
    if chi == 0 or chi is None:
        x = level
    else:
        x = DirichletGroup(level).list()[chi]
    if ttype == 'new':
        return str(dimension_new_cusp_forms(x, weight))
    if ttype == 'cusp':
        return str(dimension_cusp_forms(x, weight))
    if ttype == 'modular':
        return str(dimension_modular_forms(x, weight))
    if ttype == 'eisenstein':
        return str(dimension_eis(x, weight))
    s = "Please use one of the available table types: 'new', 'cusp','modular', 'eisenstein' Got:{0}".format(
        ttype)
    return emf_error(s), 500
Ejemplo n.º 4
0
def test_real_quadratic(minp=1, maxp=100, minwt=2, maxwt=1000):
    for p in prime_range(minp, maxp):
        if p % 4 == 1:
            print("p = ", p)
            gram = Matrix(ZZ, 2, 2, [2, 1, 1, (1 - p) / 2])
            M = VectorValuedModularForms(gram)
            if is_odd(minwt):
                minwt = minwt + 1
            for kk in range(minwt, round(maxwt / 2 - minwt)):
                k = minwt + 2 * kk
                if M.dimension_cusp_forms(k) - dimension_cusp_forms(
                        kronecker_character(p), k) / 2 != 0:
                    print("ERROR: {0},{1},{2}".format(
                        k, M.dimension_cusp_forms(k),
                        dimension_cusp_forms(kronecker_character(p), k / 2)))
                    return False
    return True
Ejemplo n.º 5
0
def gen_func_maybe_except_cusp(j):
    '''
    j: even nonnegative integer
    If j = 0, it returns the Hilbert series
    (as a rational function) of
    the space of Siegel-Eisenstein series and Klingen-Eisenstein series.
    If j > 0, it returns a Hilbert series
    which is equal to
    sum_{k > 0} dim N_{k, j} t^k
    up to a polynomial with degree < 5.
    Here N_{k, j} is the space of Klingen-Eisenstein series'.
    '''
    R = PolynomialRing(QQ, names="t")
    t = R.gen()
    h1 = t ** 12 / ((1 - t ** 4) * (1 - t ** 6))
    if j > 0:
        f = sum([t ** k * dimension_cusp_forms(1, k) for k in range(0, 5 + j)])
        return (h1 - f) * t ** (-j)
    elif j == 0:
        return h1 + R(1) / (1 - t ** 2) - t ** 2
    def set_dimensions(self):
        r"""
        The dimension of the subspace of newforms in self.
        """
        if self._chi != 1:
            x = self.character().sage_character()
        else:
            x = self.level()
        k = self.weight()
        # Ambient modular formsspace
        if self._dimension_modular_forms is None:
            self._dimension_modular_forms = int(dimension_modular_forms(x,k))
        # Cuspidal subspace
        if self._dimension_cusp_forms is None:
            self._dimension_cusp_forms = int(dimension_cusp_forms(x,k))
        # New cuspidal subspace 
        if self._dimension_new_cusp_forms is None:
            self._dimension_new_cusp_forms = int(dimension_new_cusp_forms(x,k))
        # New subspace of ambient space
        if self._dimension_newspace is None:
            if self._cuspidal == 1:
                self._dimension_newspace = self.dimension_new_cusp_forms()
            else:
                self._dimension_newspace = self._newspace.dimension()

        # Old subspace of self.
        if self._dimension_oldspace is None:
            if self._cuspidal == 1:
                self._dimension_oldspace = self.dimension_cusp_forms() - self.dimension_new_cusp_forms()
            else:
                self._dimension_oldspace = self.dimension_modular_forms() - self.dimension_newforms()
                
        if self._dimension is None:
            if self._cuspidal == 1:
                self._dimension = self.dimension_cusp_forms()
            elif self._cuspidal == 0:
                self._dimension = self.dimension_modular_forms()
Ejemplo n.º 7
0
def make_table_of_dimensions(level_start=1, level_stop=50, weight_start=1, weight_stop=24, char=0, **kwds):
    r"""
    make an html table with information about spaces of modular forms
    with parameters in the given ranges. using a fixed character.
    Should use database in the future...
    """
    D = 0
    rowlen = 15  # split into rows of this length...
    rowlen0 = rowlen
    rowlen1 = rowlen
    characters = dict()
    level = 'N'
    weight = 'k'
    print "char=", char
    if level_start == level_stop:
        level = level_start
        count_min = weight_start
        count_max = weight_stop
        if (weight_stop - weight_start + 1) < rowlen:
            rowlen0 = weight_stop - weight_start + 1
    if weight_start == weight_stop:
        weight = weight_start
        count_min = level_start
        count_max = level_stop
        if (level_stop - level_start + 1) < rowlen:
            rowlen0 = level_stop - level_start + 1
    # else:
    #    return ""
    tbl = dict()
    if(char == 0):
        tbl['header'] = ''  # Dimension of \( S_{'+str(weight)+'}('+str(level)+',\chi_{n})\)'
        charst = ""
    else:
        # s = 'Dimension of \( S_{'+str(weight)+'}('+str(level)+')\)'
        # s += ' (trivial character)'
        charst = ",\chi_{%s}" % char
        tbl['header'] = ''
    tbl['headersv'] = list()
    tbl['headersh'] = list()
    if weight == 'k':
        tbl['corner_label'] = "weight \(k\):"
    else:
        tbl['corner_label'] = "level \(N\):"
    tbl['data'] = list()
    tbl['data_format'] = 'html'
    tbl['class'] = "dimension_table"
    tbl['atts'] = "border=\"1\" class=\"nt_data\" padding=\"25\" width=\"100%\""
    num_rows = ceil(QQ(count_max - count_min + 1) / QQ(rowlen0))
    print "num_rows=", num_rows
    for i in range(1, rowlen0 + 1):
        tbl['headersh'].append(i + count_min - 1)
    if level_start == level_stop:
        st = "Dimension of \(S_{k}(%s%s) \):" % (level, charst)
        tbl['headersv'] = [st]
    else:
        st = "Dimension of \(S_{%s}(N%s) \):" % (weight, charst)
        tbl['headersv'] = [st]
    tbl['headersv'].append('Link to space:')
    # make a dummy table first
    # num_rows = (num_rows-1)*2
    for r in range(num_rows * 2):
        row = []
        for k in range(1, rowlen0 + 1):
            row.append("")
        tbl['data'].append(row)
    tbl['data_format'] = dict()
    for k in range(0, rowlen0):
        tbl['data_format'][k] = 'html'

    print "nu_rows=", len(tbl['data'])
    print "num_cols=", rowlen0
    print "num_cols=", [len(r) for r in tbl['data']]
    for r in range(num_rows):
        for k in range(0, rowlen0):
            cnt = count_min + r * rowlen0 + k
            if level_start == level_stop:
                weight = cnt
            else:
                level = cnt
            url = url_for('emf.render_elliptic_modular_forms', level=level, weight=weight)
            if(cnt > count_max or cnt < count_min):
                tbl['data'][2 * r][k] = ""
                continue
            # s="<a name=\"#%s,%s\"></a>" % (level,weight)
            if(char == 0):
                d = dimension_cusp_forms(level, weight)
            else:
                x = DirichletGroup(level)[char]
                d = dimension_cusp_forms(x, weight)
            tbl['data'][2 * r][k] = str(d)
            if d > 0:
                s = "\(S_{%s}(%s)\)" % (weight, level)
                ss = "<a  href=\"" + url + "\">" + s + "</a>"
                tbl['data'][2 * r + 1][k] = ss
    s = html_table(tbl)
    # s=s+"\n <br> \(N="+str(rowlen0)+"\cdot row+col\)"
    # print "SS=",s
    return s
Ejemplo n.º 8
0
def compare_formulas_3(D, k):
    d1 = dimension_cusp_forms(kronecker_character(D), k)
    d2 = RR(
        sqrt(abs(D)) * log(abs(D)) / pi + sqrt(abs(D)) * log(abs(D)) * 9 /
        (sqrt(3) * pi))
    return d1 - d2