Beispiel #1
0
def test_tensprod_121_chi():
    C121=[1,2,-1,2,1,-2,2,0,-2,2,0,-2,-4,4,-1,-4,2,-4,0,2,-2,0,\
    -1,0,-4,-8,5,4,0,-2,7,-8,0,4,2,-4,3,0,4,0,8,-4,6,0,-2,-2,\
    8,4,-3,-8,-2,-8,-6,10,0,0,0,0,5,-2,-12,14,-4,-8,-4,0,-7,4,\
    1,4,-3,0,-4,6,4,0,0,8,10,-4,1,16,6,-4,2,12,0,0,15,-4,-8,\
    -2,-7,16,0,8,-7,-6,0,-8,-2,-4,-16,0,-2,-12,-18,10,-10,0,-3,\
    -8,9,0,-1,0,8,10,4,0,0,-24,-8,14,-9,-8,-8,0,-6,-8,18,0,0,\
    -14,5,0,-7,2,-10,4,-8,-6,0,8,0,-8,3,6,10,8,-2,0,-4,0,7,8,\
    -7,20,6,-8,-2,2,4,16,0,12,12,0,3,4,0,12,6,0,-8,0,-5,30,\
    -15,-4,7,-16,12,0,3,-14,0,16,10,0,17,8,-4,-14,4,-6,2,0,0,0]
    chi=[1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,\
    1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,\
    -1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,\
    1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,\
    1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,\
    1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,\
    -1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,\
    -1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,\
    -1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1]
    ANS=[1,-2,-1,2,1,2,-2,0,-2,-2,1,-2,4,4,-1,-4,-2,4,0,2,2,-2,\
    -1,0,-4,-8,5,-4,0,2,7,8,-1,4,-2,-4,3,0,-4,0,-8,-4,-6,2,-2,\
    2,8,4,-3,8,2,8,-6,-10,1,0,0,0,5,-2,12,-14,4,-8,4,2,-7,-4,\
    1,4,-3,0,4,-6,4,0,-2,8,-10,-4,1,16,-6,4,-2,12,0,0,15,4,-8,\
    -2,-7,-16,0,-8,-7,6,-2,-8,2,-4,-16,0,2,12,18,10,10,-2,-3,8,\
    9,0,-1,0,-8,-10,4,0,1,-24,8,14,-9,-8,8,0,6,-8,-18,-2,0,14,\
    5,0,-7,-2,10,-4,-8,6,4,8,0,-8,3,6,-10,-8,2,0,4,4,7,-8,-7,\
    20,6,8,2,-2,4,-16,-1,12,-12,0,3,4,0,-12,-6,0,8,-4,-5,-30,\
    -15,-4,7,16,-12,0,3,14,-2,16,-10,0,17,8,4,14,-4,-6,-2,4,0,0]
    R = PowerSeriesRing(ZZ, "T")
    T = R.gens()[0]
    assert ANS == tensor_get_an_deg1(C121, chi, [[11, 1 - T]])
    assert ANS == tensor_get_an(C121, chi, 2, 1, [[11, 1 - T, 1 - T]])
    assert get_euler_factor(ANS, 2) == (1 + 2 * T + 2 * T**2 + O(T**8))
    assert get_euler_factor(ANS, 3) == (1 + T + 3 * T**2 + O(T**5))
    assert get_euler_factor(ANS, 5) == (1 - T + 5 * T**2 + O(T**4))
Beispiel #2
0
def euler_p_factor(root_list, PREC):
    ''' computes the coefficients of the pth Euler factor expanded as a geometric series
      ax^n is the Dirichlet series coefficient p^(-ns)
    '''
    PREC = floor(PREC)
    # return satake_list
    R = LaurentSeriesRing(CF, 'x')
    x = R.gens()[0]
    ep = prod([1 / (1 - a * x) for a in root_list])
    return ep + O(x ** (PREC + 1))
Beispiel #3
0
def hilbert_series_using_dimension_formula(i, prec=10):
    '''
    This assumes dimension formula is true for weight (2, k) where k > 2
    and the dimesion for (1, k) k > 2 is zero.
    If one believes magma, the assumption for (2, k) can be checked for some cases.
    And the assumption for (1, k) can be checked by the construction.
    '''
    ps = PowerSeriesRing(QQ, names='t', default_prec=prec + 1)
    t = ps.gen()
    return (sum(dimension_cuspforms_sqrt5(a, a + 2 * i) * t**a for a in range(2, prec + 1)) +
            O(t**(prec + 1)))
Beispiel #4
0
def hilbert_series_using_dimension_formula(i, parity, prec=10):
    ps = PowerSeriesRing(QQ, names='t', default_prec=prec + 1)
    t = ps.gen()
    return (sum(
        cuspforms_dimension((a, a + 2 * i)) * t**a
        for a in range(2, prec + 1) if is_even(a + parity)) + O(t**(prec + 1)))
def newton_linear(P0, P1, P2, f, alpha, PSring, prec):
    assert P0.base_ring() is P1.base_ring()
    assert P1.base_ring() is P2.base_ring()
    assert P0.base_ring() is alpha.base_ring()
    assert P0.base_ring() is PSring.base_ring()
    assert f.base_ring() in [QQ, ZZ, P0.base_ring()]
    T = PSring.gen()
    #xi_0 = xi(0)
    x0_0 = PSring(P0[0])
    x1_0 = PSring(P1[0])
    x2_0 = PSring(P2[0])

    y0_0 = P0[1]
    y1_0 = P1[1]
    y2_0 = P2[1]

    b0, b1, b2 = 1, 1, 1

    py0_0 = sqrt(f(x0_0 + T)).list()[0]
    py1_0 = sqrt(f(x1_0 + T)).list()[0]
    py2_0 = sqrt(f(x2_0 + T)).list()[0]

    if PSring.base_ring().is_exact():
        if y0_0 != py0_0:
            b0 = -1
        if y1_0 != py1_0:
            b1 = -1
        if y2_0 != py2_0:
            b2 = -1
        assert y0_0 == b0 * py0_0, "wrong branch at P0? %s != %s" % (y0_0, b0 *
                                                                     py0_0)
        assert y1_0 == b1 * py1_0, "wrong branch at P1? %s != %s" % (y1_0, b1 *
                                                                     py1_0)
        assert y2_0 == b2 * py2_0, "wrong branch at P2? %s != %s" % (y2_0, b2 *
                                                                     py2_0)
    else:
        if norm(y0_0 - py0_0) > norm(y0_0 + py0_0):
            b0 = -1
        if norm(y1_0 - py1_0) > norm(y1_0 + py1_0):
            b1 = -1
        if norm(y2_0 - py2_0) > norm(y2_0 + py2_0):
            b2 = -1
        closetozero = 2**(-0.8 * PSring.base_ring().prec())
        assert norm(y0_0 +
                    b0 * py0_0) > norm(y0_0), "%.3e vs %.3e wrong branch?" % (
                        norm(y0_0 - b0 * py0_0), norm(y0_0 + b0 * py0_0))
        assert norm(y0_0 - b0 * py0_0) < norm(
            y0_0) * closetozero, "%.3e vs %.3e wrong branch?" % (
                norm(y0_0 - b0 * py0_0), norm(y0_0 + b0 * py0_0))

        assert norm(y1_0 +
                    b1 * py1_0) > norm(y1_0), "%.3e vs %.3e wrong branch?" % (
                        norm(y1_0 - b1 * py1_0), norm(y1_0 + b1 * py1_0))
        assert norm(y1_0 - b1 * py1_0) < norm(
            y1_0) * closetozero, "%.3e vs %.3e wrong branch?" % (
                norm(y1_0 - b1 * py1_0), norm(y1_0 + b1 * py1_0))

        assert norm(y2_0 +
                    b2 * py2_0) > norm(y2_0), "%.3e vs %.3e wrong branch?" % (
                        norm(y2_0 - b2 * py2_0), norm(y2_0 + b2 * py2_0))
        assert norm(y2_0 - b2 * py2_0) < norm(
            y2_0) * closetozero, "%.3e vs %.3e wrong branch?" % (
                norm(y2_0 - b2 * py2_0), norm(y2_0 + b2 * py2_0))

    x1 = x1_0 + O(T)
    x2 = x2_0 + O(T)

    p = 1

    Tsub = x0_0 + T
    fps = PSring(f)(Tsub)
    sqrtfps = sqrt(fps)

    row0 = PSring(alpha.row(0).list())(Tsub)
    row1 = PSring(alpha.row(1).list())(Tsub)

    if x1_0 != x2_0:
        # Iteration to solve the differential equation, gains 1 term
        # alternatively we could solve a linear ODE to double the number of terms
        while p < prec:
            m = b0 / ((x2 - x1) * sqrtfps)
            dx1 = m * b1 * sqrt(f(x1)) * (row0 * x2 - row1)
            dx2 = m * b2 * sqrt(f(x2)) * (row1 - row0 * x1)
            p += 1
            x1 = x1_0 + dx1.integral() + O(T**p)
            x2 = x2_0 + dx2.integral() + O(T**p)
    else:
        #the degenerate case
        row0_y = row0 * b0 / sqrtfps
        half = P0.base_ring()(1 / 2)
        while p < prec:
            dx1 = half * b1 * sqrt(f(x1)) * row0_y
            x1 = x1_0 + dx1.integral() + O(T**p)
            p += 1
        # check second equation
        if 2 * x1 * x1.derivative() * b1 / sqrt(f(x1)) != row1 * b0 / sqrtfps:
            print "x1(0) = x2(0), but x1 != x2"
            raise ZeroDivisionError

        x2 = x1

    return x1, x2