Exemple #1
0
def anlist_over_sqrt5(E, bound):
    """
    Compute the Dirichlet L-series coefficients, up to and including
    a_bound.  The i-th element of the return list is a[i].

    INPUT:
        - E -- elliptic curve over Q(sqrt(5)), which must have
          defining polynomial `x^2-x-1`.
        - ``bound`` -- integer

    OUTPUT:
        - list of integers of length bound + 1

    EXAMPLES::

        sage: from psage.ellcurve.lseries.lseries_nf import anlist_over_sqrt5
        sage: K.<a> = NumberField(x^2-x-1); E = EllipticCurve([0,-a,a,0,0])
        sage: v = anlist_over_sqrt5(E, 50); v
        [0, 1, 0, 0, -2, -1, 0, 0, 0, -4, 0, 3, 0, 0, 0, 0, 0, 0, 0, 5, 2, 0, 0, 0, 0, -4, 0, 0, 0, 11, 0, -6, 0, 0, 0, 0, 8, 0, 0, 0, 0, -1, 0, 0, -6, 4, 0, 0, 0, -6, 0]
        sage: len(v)
        51

    This function isn't super fast, but at least it will work in a few
    seconds up to `10^4`::

        sage: t = cputime()
        sage: v = anlist_over_sqrt5(E, 10^4)
        sage: assert cputime(t) < 5
    """
    from . import aplist_sqrt5
    from psage.number_fields.sqrt5.prime import primes_of_bounded_norm, Prime

    # Compute all of the prime ideals of the ring of integers up to the given bound
    primes = primes_of_bounded_norm(bound + 1)

    # Compute the traces of Frobenius: this is supposed to be the hard part
    v = aplist_sqrt5.aplist(E, bound + 1)

    # Compute information about the primes of bad reduction, in
    # particular the integers i such that primes[i] is a prime of bad
    # reduction.
    bad_primes = set([Prime(a.prime()) for a in E.local_data()])

    # We compute the local factors of the L-series as power series in ZZ[T].
    P = PowerSeriesRing(ZZ, 'T')
    T = P.gen()
    # Table of powers of T, so we don't have to compute T^4 (say) thousands of times.
    Tp = [T**i for i in range(5)]

    # For each prime, we write down the local factor.
    L_P = []
    for i, P in enumerate(primes):
        inertial_deg = 2 if P.is_inert() else 1
        a_p = v[i]
        if P in bad_primes:
            # bad reduction
            f = 1 - a_p * Tp[inertial_deg]
        else:
            # good reduction
            q = P.norm()
            f = 1 - a_p * Tp[inertial_deg] + q * Tp[2 * inertial_deg]
        L_P.append(f)

    # Use the local factors of the L-series to compute the Dirichlet
    # series coefficients of prime-power index.
    coefficients = [0, 1] + [0] * (bound - 1)
    i = 0
    while i < len(primes):
        P = primes[i]
        if P.is_split():
            s = L_P[i] * L_P[i + 1]
            i += 2
        else:
            s = L_P[i]
            i += 1
        p = P.p
        # We need enough terms t so that p^t > bound
        accuracy_p = int(math.floor(old_div(math.log(bound), math.log(p)))) + 1
        series_p = s.add_bigoh(accuracy_p)**(-1)
        for j in range(1, accuracy_p):
            coefficients[p**j] = series_p[j]

    # Using multiplicativity, fill in the non-prime power Dirichlet
    # series coefficients.
    extend_multiplicatively_generic(coefficients)
    return coefficients
def anlist_over_sqrt5(E, bound):
    """
    Compute the Dirichlet L-series coefficients, up to and including
    a_bound.  The i-th element of the return list is a[i].

    INPUT:
        - E -- elliptic curve over Q(sqrt(5)), which must have
          defining polynomial `x^2-x-1`.
        - ``bound`` -- integer

    OUTPUT:
        - list of integers of length bound + 1

    EXAMPLES::

        sage: from psage.ellcurve.lseries.lseries_nf import anlist_over_sqrt5
        sage: K.<a> = NumberField(x^2-x-1); E = EllipticCurve([0,-a,a,0,0])
        sage: v = anlist_over_sqrt5(E, 50); v
        [0, 1, 0, 0, -2, -1, 0, 0, 0, -4, 0, 3, 0, 0, 0, 0, 0, 0, 0, 5, 2, 0, 0, 0, 0, -4, 0, 0, 0, 11, 0, -6, 0, 0, 0, 0, 8, 0, 0, 0, 0, -1, 0, 0, -6, 4, 0, 0, 0, -6, 0]
        sage: len(v)
        51

    This function isn't super fast, but at least it will work in a few
    seconds up to `10^4`::

        sage: t = cputime()
        sage: v = anlist_over_sqrt5(E, 10^4)
        sage: assert cputime(t) < 5
    """
    import aplist_sqrt5
    from psage.number_fields.sqrt5.prime import primes_of_bounded_norm, Prime

    # Compute all of the prime ideals of the ring of integers up to the given bound
    primes = primes_of_bounded_norm(bound+1)

    # Compute the traces of Frobenius: this is supposed to be the hard part
    v      = aplist_sqrt5.aplist(E, bound+1)

    # Compute information about the primes of bad reduction, in
    # particular the integers i such that primes[i] is a prime of bad
    # reduction.
    bad_primes = set([Prime(a.prime()) for a in E.local_data()])


    # We compute the local factors of the L-series as power series in ZZ[T].
    P = PowerSeriesRing(ZZ, 'T')
    T = P.gen()
    # Table of powers of T, so we don't have to compute T^4 (say) thousands of times.
    Tp = [T**i for i in range(5)]

    # For each prime, we write down the local factor.
    L_P = []
    for i, P in enumerate(primes):
        inertial_deg = 2 if P.is_inert() else 1
        a_p = v[i]
        if P in bad_primes:
            # bad reduction
            f = 1 - a_p*Tp[inertial_deg]
        else:
            # good reduction
            q = P.norm()
            f = 1 - a_p*Tp[inertial_deg] + q*Tp[2*inertial_deg]
        L_P.append(f)

    # Use the local factors of the L-series to compute the Dirichlet
    # series coefficients of prime-power index.
    coefficients = [0,1] + [0]*(bound-1)
    i = 0
    while i < len(primes):
        P = primes[i]
        if P.is_split():
            s = L_P[i] * L_P[i+1]
            i += 2
        else:
            s = L_P[i]
            i += 1
        p = P.p
        # We need enough terms t so that p^t > bound
        accuracy_p = int(math.floor(math.log(bound)/math.log(p))) + 1
        series_p = s.add_bigoh(accuracy_p)**(-1)
        for j in range(1, accuracy_p):
            coefficients[p**j] = series_p[j]

    # Using multiplicativity, fill in the non-prime power Dirichlet
    # series coefficients.
    extend_multiplicatively_generic(coefficients)
    return coefficients