Search code examples
paripari-gp

Mestre's sum with PARI/GP


I defined Mestre's sum as:

S(E, N) = {
    my (s = 0.0);
    forprime(p = 2, N,
        my (a = ellap(E, p));
        s += (2-a) / (p+1-a)
    );

    return (s);
}

and defined polynomials A(t) and B(t) and I wanted to calculate above sum for curves: y^2 = x^3 + A(t)x^2 + B(t)x for some -700 < t < 700 and then print it. So I wrote:

for(t = -700, 700, {
    E = ellinit([0, A(t), 0, B(t), 0]);
    if(E == [], , print(t, ": ", S(E, 50000)))
})

It works. Now I want to do the same for polynomials A(t, t') and B(t, t') with two variables which -n < t, t' < n for some arbitrary integer n and then print only the curves with S(E, 50000) > 5 (t and t' are independent). Can any tell me the right code for this? Thanks.


Solution

  • If I understand the problem correctly, the following PARI/GP code should work for you:

    n = 100
    forvec(P = [[-n, 0], [0, n]], {
        E = ellinit([0, A(P[1], P[2]), 0, B(P[1], P[2]), 0]);
        if (E == [], next());
    
        my (v = S(E, 50000));
        if (v > 5, print(P, ": ", v))
    })
    

    Please, note that the variable P denotes the intervals for your variables t and t'. I upper bounded the t by 0 and lower bounded the t' by 0 also.