Exemplo n.º 1
0
def to_polredabs(K):
    """

    INPUT: 

    * "K" - a number field
    
    OUTPUT:

    * "phi" - an isomorphism K -> L, where L = QQ['x']/f and f a polynomial such that f = polredabs(f)
    """
    R = PolynomialRing(QQ,'x')
    x = R.gen(0)
    if K == QQ:
        L = QQ.extension(x,'w')
        return QQ.hom(L)
    L = K.absolute_field('a')
    m1 = L.structure()[1]
    f = L.absolute_polynomial()
    g = pari(f).polredabs(1)
    g,h = g[0].sage(locals={'x':x}),g[1].lift().sage(locals={'x':x})
    if debug:
        print 'f',f
        print 'g',g
        print 'h',h
    M = QQ.extension(g,'w')
    m2 = L.hom([h(M.gen(0))])
    return m2*m1
def to_polredabs(K):
    """

    INPUT: 

    * "K" - a number field
    
    OUTPUT:

    * "phi" - an isomorphism K -> L, where L = QQ['x']/f and f a polynomial such that f = polredabs(f)
    """
    R = PolynomialRing(QQ, 'x')
    x = R.gen(0)
    if K == QQ:
        L = QQ.extension(x, 'w')
        return QQ.hom(L)
    L = K.absolute_field('a')
    m1 = L.structure()[1]
    f = L.absolute_polynomial()
    g = pari(f).polredabs(1)
    g, h = g[0].sage(locals={'x': x}), g[1].lift().sage(locals={'x': x})
    if debug:
        print('f', f)
        print('g', g)
        print('h', h)
    M = QQ.extension(g, 'w')
    m2 = L.hom([h(M.gen(0))])
    return m2 * m1
Exemplo n.º 3
0
def EllipticCurve_from_hoeij_data(line):
    """Given a line of the file "http://www.math.fsu.edu/~hoeij/files/X1N/LowDegreePlaces" 
    that is actually corresponding to an elliptic curve, this function returns the elliptic
    curve corresponding to this
    """
    Rx=PolynomialRing(QQ,'x')
    x = Rx.gen(0)
    Rxy = PolynomialRing(Rx,'y')
    y = Rxy.gen(0)
    
    N=ZZ(line.split(",")[0].split()[-1])
    x_rel=Rx(line.split(',')[-2][2:-4])
    assert x_rel.leading_coefficient()==1
    y_rel=line.split(',')[-1][1:-5]
    K = QQ.extension(x_rel,'x')
    x = K.gen(0)

    y_rel=Rxy(y_rel).change_ring(K)
    y_rel=y_rel/y_rel.leading_coefficient()
    if y_rel.degree()==1:
        y = - y_rel[0]
    else:
        #print "needing an extension!!!!"
        L = K.extension(y_rel,'y')
        y = L.gen(0)
        K = L
    #B=L.absolute_field('s')
    #f1,f2 = B.structure()
    #x,y=f2(x),f2(y)
    r = (x**2*y-x*y+y-1)/x/(x*y-1)
    s = (x*y-y+1)/x/y
    b = r*s*(r-1)
    c = s*(r-1)
    E=EllipticCurve([1-c,-b,-b,0,0])
    return N,E,K
def isogeny_primes(coeffs, **kwargs):
    del kwargs["label"]
    f = R(coeffs)
    K = QQ.extension(f, "a")
    kwargs = {**LMFDB_DEFAULTS, **kwargs}
    primes, _ = get_isogeny_primes(K, **kwargs)
    return sorted(EC_Q_ISOGENY_PRIMES) + sorted(primes.difference(EC_Q_ISOGENY_PRIMES))
def EllipticCurve_from_hoeij_data(line):
    """Given a line of the file "http://www.math.fsu.edu/~hoeij/files/X1N/LowDegreePlaces" 
    that is actually corresponding to an elliptic curve, this function returns the elliptic
    curve corresponding to this
    """
    Rx = PolynomialRing(QQ, 'x')
    x = Rx.gen(0)
    Rxy = PolynomialRing(Rx, 'y')
    y = Rxy.gen(0)

    N = ZZ(line.split(",")[0].split()[-1])
    x_rel = Rx(line.split(',')[-2][2:-4])
    assert x_rel.leading_coefficient() == 1
    y_rel = line.split(',')[-1][1:-5]
    K = QQ.extension(x_rel, 'x')
    x = K.gen(0)

    y_rel = Rxy(y_rel).change_ring(K)
    y_rel = y_rel / y_rel.leading_coefficient()
    if y_rel.degree() == 1:
        y = -y_rel[0]
    else:
        #print("needing an extension!!!!")
        L = K.extension(y_rel, 'y')
        y = L.gen(0)
        K = L
    #B=L.absolute_field('s')
    #f1,f2 = B.structure()
    #x,y=f2(x),f2(y)
    r = (x**2 * y - x * y + y - 1) / x / (x * y - 1)
    s = (x * y - y + 1) / x / y
    b = r * s * (r - 1)
    c = s * (r - 1)
    E = EllipticCurve([1 - c, -b, -b, 0, 0])
    return N, E, K
Exemplo n.º 6
0
def test_semi_stable_frobenius_polynomial_t():
    # an example where the frobenius polynomial depends on the purely ramified extension
    # we make
    x = polygen(QQ)
    K = QQ.extension(x - 1, "one")
    E = EllipticCurve(K, [49, 343])
    assert E.discriminant() == -(2**4) * 31 * 7**6
    assert E.j_invariant() == K(2**8 * 3**3) / 31
    f1 = semi_stable_frobenius_polynomial(E, K * 7, 1)
    f2 = semi_stable_frobenius_polynomial(E, K * 7, -1)(x=-x)
    assert f1 == f2
Exemplo n.º 7
0
def test_rational_isogeny_primes():
    x = polygen(QQ)
    K = QQ.extension(x - 1, "D")

    superset, _ = get_isogeny_primes(K, **TEST_SETTINGS)
    improperly_ruled_out = EC_Q_ISOGENY_PRIMES.difference(superset)
    assert improperly_ruled_out == set()
    todo = set(superset).difference(EC_Q_ISOGENY_PRIMES)
    # would be nice if we could automatically do QQ
    # i.e. we could rule out 23 as well.
    assert todo == set([23])
Exemplo n.º 8
0
def qexp_as_nf_elt(self, prec=None):
    assert self.has_exact_qexp
    if prec is None:
        qexp = self.qexp
    else:
        qexp = self.qexp[:prec + 1]
    if self.dim == 1:
        return [QQ(i[0]) for i in self.qexp]

    R = PolynomialRing(QQ, 'x')
    K = QQ.extension(R(self.field_poly), 'a')
    if self.hecke_ring_power_basis:
        return [K(c) for c in qexp]
    else:
        # need to add code to hande cyclotomic_generators
        assert self.hecke_ring_numerators, self.hecke_ring_denominators
        basis_data = zip(self.hecke_ring_numerators,
                         self.hecke_ring_denominators)
        betas = [K([ZZ(c) / den for c in num]) for num, den in basis_data]
        return [
            sum(c * beta for c, beta in zip(coeffs, betas)) for coeffs in qexp
        ]
Exemplo n.º 9
0
def test_get_isogeny_primes(coeffs):
    f = R(coeffs)
    K = QQ.extension(f, "a")
    _, _ = get_isogeny_primes(K, **TEST_SETTINGS)