예제 #1
0
def attach_new_label(f):
    print f['label']
    F = hmf_fields.find_one({"label": f['field_label']})

    P = PolynomialRing(Rationals(), 'w')
    # P is used implicitly in the eval() calls below.  When these are
    # removed, this will not longer be neceesary, but until then the
    # assert statement is for pyflakes.
    assert P

    if type(f['level_ideal']) == str or type(f['level_ideal']) == unicode:
        N = eval(f['level_ideal'])
    else:
        N = f['level_ideal']
    if type(N) != list or len(N) != 3:
        print f, N, type(N)
        raise ValueError("{} does not define a valid level ideal".format(N))

    f['level_ideal'] = [N[0], N[1], str(N[2])]

    try:
        ideal_label = F['ideal_labels'][F['ideals'].index(f['level_ideal'])]
        f['level_ideal_label'] = ideal_label
        f['label'] = parse_label(f['field_label'], f['weight'],
                                 f['level_ideal_label'], f['label_suffix'])
        hmf_forms.save(f)
        print f['label']
    except ValueError:
        hmf_forms.remove(f)
        print "REMOVED!"
def attach_new_label(f):
    print(f['label'])
    F = hmf_fields.find_one({"label": f['field_label']})

    P = PolynomialRing(Rationals(), 'w')
    # P is used implicitly in the eval() calls below.  When these are
    # removed, this will not longer be necessary, but until then the
    # assert statement is for pyflakes.
    assert P

    if isinstance(f['level_ideal'], str):
        N = eval(f['level_ideal'])
    else:
        N = f['level_ideal']
    if type(N) != list or len(N) != 3:
        print(f, N, type(N))
        assert False

    f['level_ideal'] = [N[0], N[1], str(N[2])]

    try:
        ideal_label = F['ideal_labels'][F['ideals'].index(f['level_ideal'])]
        f['level_ideal_label'] = ideal_label
        f['label'] = construct_full_label(f['field_label'], f['weight'],
                                          f['level_ideal_label'],
                                          f['label_suffix'])
        hmf_forms.save(f)
        print(f['label'])
    except ValueError:
        hmf_forms.remove(f)
        print("REMOVED!")
예제 #3
0
def endomorphism_frob(f):
    r"""
    INPUT:

    -   ``f`` -- a Frobenius polynomial of an Abelian variety

    OUTPUT: A tuple:
            - dim_Q ( End(A^{al} )
            - k, the degree of field ext where all endomorphism are defined
            - a sorted list that represents the geometric isogeny decomposition
              over an algebraic closure.
              Let
                    A^{al} = (A_1)^n_1 x ... x (A_k)^n_t
              and write
                    det(1 - T Frob^k | H^1(Ai^n_i)) = c_i (T)^m_i.
              Then we return:
                    [ (m_i, m_i * deg(c_i), c_i) for i in range(1, t) ].

    """
    if f(0) != 1:
        f = f.reverse()
    assert f(0) == 1
    g = f.degree() / 2
    flist = f.list()
    q = Integers()(flist[-1]).nth_root(g)

    T = f.parent().gen()

    fof = tensor_charpoly(f, f)
    g = fof.change_ring(Rationals())(T / q)

    dimtotal = 0
    fieldext = 1

    for factor, power in g.factor():
        iscyclo = factor.is_cyclotomic(certificate=True)
        if iscyclo > 0:
            dimtotal += power * factor.degree()
            fieldext = LCM(fieldext, iscyclo)

    fext = power_charpoly(f, fieldext)

    endo = sorted([(power, power * factor.degree(), factor)
                   for factor, power in fext.factor()])

    return dimtotal, fieldext, endo
def repair_fields(D):
    F = hmf_fields.find_one({"label": '2.2.' + str(D) + '.1'})

    P = PolynomialRing(Rationals(), 'w')
    # P is used implicitly in the eval() calls below.  When these are
    # removed, this will not longer be neceesary, but until then the
    # assert statement is for pyflakes.
    assert P

    primes = F['primes']
    primes = [[int(eval(p)[0]), int(eval(p)[1]), str(eval(p)[2])] for p in primes]
    F['primes'] = primes

    hmff = file("data_2_" + (4 - len(str(D))) * '0' + str(D))

    # Parse field data
    for i in range(7):
        v = hmff.readline()
    ideals = eval(v[10:][:-2])
    ideals = [[p[0], p[1], str(p[2])] for p in ideals]
    F['ideals'] = ideals
    hmf_fields.save(F)
예제 #5
0
# -*- coding: utf-8 -*-
from __future__ import print_function
from sage.misc.preparser import preparse
from sage.interfaces.magma import magma
from sage.all import PolynomialRing, Rationals
from lmfdb.base import getDBConnection
C = getDBConnection()

hmf_forms = C.hmfs.forms
hmf_fields = C.hmfs.fields
fields = C.numberfields.fields

P = PolynomialRing(Rationals(), 3, ['w', 'e', 'x'])
w, e, x = P.gens()


def recompute_AL(field_label=None, skip_odd=False):
    if field_label is None:
        S = hmf_forms.find({"AL_eigenvalues_fixed": None})
    else:
        S = hmf_forms.find({"field_label": field_label, "AL_eigenvalues_fixed": None})
    S = S.sort("label")

    field_label = None

    magma.eval('SetVerbose("ModFrmHil", 1);')

    v = S.next()
    while True:
        NN_label = v["level_label"]
        v_label = v["label"]
예제 #6
0
    The authors can be reached at: [email protected] and
    [email protected].

    ====================================================================

"""

from sage.all import PolynomialRing, Rationals, prod, oo
from sage.arith.misc import primes
from sage.combinat.permutation import Permutation
from sage.groups.additive_abelian.additive_abelian_group import AdditiveAbelianGroup
from sage.groups.perm_gps.permgroup import PermutationGroup
from sage.groups.perm_gps.permgroup_named import TransitiveGroup, SymmetricGroup

R = PolynomialRing(Rationals(), "x")
x = R.gen()
EC_Q_ISOGENY_PRIMES = {2, 3, 5, 7, 11, 13, 17, 19, 37, 43, 67, 163}
CLASS_NUMBER_ONE_DISCS = {-3, -4, -7, -8, -11, -19, -43, -67, -163}
SMALL_GONALITIES = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 47, 59, 71}

# Global methods


def weil_polynomial_is_elliptic(f, q, a):
    """
    On input of a polynomial f that is a weil polynomial of degree 2 and has constant
    term q^a we check if it actually comes from an elliptic curve over GF(q^a).
    This uses theorem 4.1 of http://archive.numdam.org/article/ASENS_1969_4_2_4_521_0.pdf
    """
    if f[1] % q != 0:
예제 #7
0
    QuadraticField,
    log,
    exp,
    find_root,
    ceil,
    NumberField,
    hilbert_class_polynomial,
    RR,
    EllipticCurve,
    lcm,
    gcd,
)

# Global constants

R = PolynomialRing(Rationals(), "x")  # used in many functions

# The constant which Momose calls Q_2
Q_2 = 7

# Various other Quantities
GENERIC_UPPER_BOUND = 10 ** 30
EC_Q_ISOGENY_PRIMES = {2, 3, 5, 7, 11, 13, 17, 19, 37, 43, 67, 163}
CLASS_NUMBER_ONE_DISCS = {-1, -2, -3, -7, -11, -19, -43, -67, -163}

# The NotTypeOneTwo epsilons, up to Galois and dual action, with their types
EPSILONS_NOT_TYPE_1_2 = {
    (0, 12): "quadratic",
    (0, 4): "sextic",
    (0, 8): "sextic",
    (4, 4): "sextic-constant",