John Cremona on Wed, 25 Sep 2013 10:41:18 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: halving points on elliptic curve


PS It is not good programming to have your function set a global
variable Half instead of returning a list of points.

On 25 September 2013 09:03, somayeh didari <somayeh_didari@yahoo.com> wrote:
> thanks for your help, I wrote this program, which take elliptic curve e over
> the rational points and a point Q in e and returns (1/2)Q:
> halve(e,Q)={
> x_0=Q[1];
> Half=[];
> f=x^4-e.b4*x^2-2*e.b6*x-e.b8-x_0*(4*x^3+e.b2*x^2+2*e.b4*x+e.b6);
> g=factor(f);
> v=[];
>   for(i=1,#g~,
> if(poldegree(g[i,1])==1,
> v=concat(v,-polcoeff(g[i,1],0)/polcoeff(g[i,1],1));
>     );
> );
> for(i=1,#v~,
> x=v[i];
> y=ellordinate(e,x)[1];
> if(ellpow(e,[x,y],2)==Q,
> Half=concat(Half,[[x,y]]);
> );
> if(ellpow(e,[x,-1*y],2)==Q,
> Half=concat(Half,[[x,-1*y]]);
> );
> );
> }
> It works! But there is a problem, when I use
> e=ellinit([0,0,0,-1563056672958141,0]);
> P_1=[48408867,194361588954];
> P_2=[48432972,194700535386];
> Q=elladd(e,ellpow(e,P_1,2),ellpow(e,P_2,3));
> halve(e,Q);
> Then Half will be [], as I want. but when I use
> Q1=ellpow(e,Q,2)
> halve(e,Q1)
> Q1=Half[1]
> halve(e,Q1);
>
> Pari doesn't work. But we now Q1=Q! Why???????Is there an algorithm which
> computes (1/2)Q?
>
> somayeh didari