| Karim Belabas on Sat, 11 Feb 2023 08:40:05 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: Question on elliptic curves... |
* wraithx@morpheus.net [2023-02-11 04:59]:
> Hello,
>
> I was wondering how to convert the following sage code to Pari/GP?
> I already have a conversion of the first function FindGroupOrderA, but in
> the function FindGroupOrderParam2, I'm not sure how to do the following two
> lines in Pari/GP:
> P = s*E(-3,3)
> x,y = P.xy()
[x,y] = ellmul(E, [-3,3], s);
CAVEAT: If s is a multiple of the point order, so that s*E(-3,3) is the
point at infinity, you will get a 'non existent component' error instead
of a ZeroDivision error in Sage. If you intend to trap it somewhere,
this can be done using iferr(), producing an e_COMPONENT exception.
Cheers,
K.B.
> Thanks for any help you can provide!
>
> -David C.
>
> # Example SAGE code:
> def FindGroupOrderA(p,A):
> K = GF(p)
> d = K((A+2)/4)
> a = K(4*d-2)
> b = K(16*d+2)
> E = EllipticCurve(K,[0,a/b,0,1/b^2,0])
> return E.cardinality()
>
> # for parameter sigma = 2:s
> def FindGroupOrderParam2(p,s):
> K = GF(p)
> E = EllipticCurve(K,[0,36])
> P = s*E(-3,3)
> x,y = P.xy()
> x3 = (3*x+y+6)/(2*(y-3))
> A = -(3*x3^4+6*x3^2-1)/(4*x3^3)
> return FindGroupOrderA(p, A)
>
> #=================================
> # Conversion to Pari/GP:
> FindGroupOrderA(p,A)={
> my(K, d, a, b, E);
> K = Mod(1,p);
> d = K*((A+2)/4);
> a = K*(4*d-2);
> b = K*(16*d+2);
> E = ellinit([0,a/b,0,1/b^2,0],K);
> return(ellcard(E));
> }
>
> # for parameter sigma = 2:s
> FindGroupOrderParam2(p,s)={
> my(K,E,P,x,y,x3,A);
> K = Mod(1,p);
> E = ellinit([0,36],K);
> P = s*E(-3,3); //?????
> x,y = P.xy(); //?????
> x3 = (3*x+y+6)/(2*(y-3));
> A = -(3*x3^4+6*x3^2-1)/(4*x3^3);
> return(FindGroupOrderA(p, A));
> }
>
K.B.
--
Pr Karim Belabas, U. Bordeaux, Vice-président en charge du Numérique
Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
http://www.math.u-bordeaux.fr/~kbelabas/
`