0

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.

Piotr Semenov
  • 1,761
  • 16
  • 24
user371596
  • 75
  • 3

1 Answers1

2

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.

Piotr Semenov
  • 1,761
  • 16
  • 24
  • thanks Piotr! good job. how can i know the time of calculations before pari hangs? and if it hangs how can stop calculations without closing pari? cause i should inpute all data again – user371596 Feb 22 '17 at 07:20
  • @user371596 Unfortunately, you cannot learn the time of calculations without running your code. You can print out the progress to clarify the time to complete the left piece of work. Also you can dump the recent result to external file in order not to miss it. – Piotr Semenov Feb 22 '17 at 08:16
  • what if i want to do it for t=(r^2 − s^2 − 2u^2 + 2v^2r^2 − s^2 − 2u^2 + 2v^2)/2(ru + sv) and t'=(rs − 2uv)/(ru + sv) where r,u,s,v are integers in region: |s|+|r|+|u|+|v|<400 ? i have 2 problems with that: first: how i can compute ellap(E,p) for rational curves?(i mean curves with rational coefficients.it would be nice if pari change it to integer coefficients automatically.) second: how can i impose this region? many thanks – user371596 Feb 24 '17 at 12:03
  • 1
    @user371596: You can impose the region you need with code like `forvec(P=[[0,400],[0,400],[0,400],[0,400]], if(vecsum(P)<400, ...))`. – Piotr Semenov Feb 25 '17 at 20:43