Ask Your Question
2

point addition on elliptic curve

asked 2016-11-02 09:40:58 +0100

Sha gravatar image

I have the following code where I want to add a 4-torsion point given by P=[15+36*B, 27*a*(a^2-4*B-5)] with B^2=-2 and a^4-5*a^2-32=0 and Q=[r,s] on my elliptic curve E as given below:

E=EllipticCurve([-3267,45630])
k.<B>=NumberField(x^2-2)
k.<a>=NumberField(x^4-5*x^2-32)
kr.<r>=FunctionField(k);
krS.<S>=kr[]
R.<s>=krS.quo(S^2-(r^3-3267*r+45630))
P=E(R)(15+36*B, 27*a*(a^2-4*B-5))
Q=E(R)(r,s)
P+Q

but it keeps giving error such as :

TypeError: unsupported operand parent(s) for '-': 'Number Field in a with defining polynomial x^4 - 5*x^2 - 32' and 'Number Field in B with defining polynomial x^2 - 2'

Can someone please advise me what is wrong in my coding.

edit retag flag offensive close merge delete

Comments

I am not sure if this is appropriate but I think @nbruin perhaps knows how to answer this because you helped me in this kind of question before and it was so helpful.

Sha gravatar imageSha ( 2016-11-02 13:10:11 +0100 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2016-11-02 16:54:48 +0100

slelievre gravatar image

updated 2016-11-03 11:27:22 +0100

The problem is adding expressions involving a and B.

The second coordinate of P in your code is 27*a*(a^2-4*B-5).

Here is a simpler incarnation of your problem.

sage: k.<B> = NumberField(x^2 - 2)
sage: k.<a> = NumberField(x^4 - 5*x^2 - 32)
sage: a^2-4*B
Traceback (most recent call last)
...
TypeError: unsupported operand parent(s) for '-': 'Number Field in a with defining polynomial x^4 - 5*x^2 - 32' and 'Number Field in B with defining polynomial x^2 - 2'

Maybe you need to use relative number fields?

See the documentation for relative number fields at http://doc.sagemath.org/html/en/reference/number_fields/sage/rings/number_field/number_field_rel.html

If instead of the above you define a relative number fields, this works.

sage: k.<a> = NumberField(x^4 - 5*x^2 - 32)
sage: K.<B> = k.extension(x^2+2)
sage: a^2-4*B
-4*B + a^2
edit flag offensive delete link more

Comments

Great!! This worked. I got my answer as I wanted. Thank you so much Sir for your help and explanation.

Sha gravatar imageSha ( 2016-11-03 12:17:42 +0100 )edit

I tried this and it worked :

k.<a> = NumberField(x^4 - 5*x^2 - 32)
K.<B> = k.extension(x^2+2)
E=EllipticCurve(K,[0,0,0,-3267,45630])
Kr.<r>=FunctionField(K);
KrS.<S>=Kr[]
R.<s>=KrS.quo(S^2-(r^3-3267*r+45630))
P=E(R)(15+36*B, 27*a*(a^2-4*B-5))
Q=E(R)(51,108)
P+Q

and got answer :

((-a^3 + 3*a - 38)*B + 1/2*a^3 - 21/2*a + 7 : (-20*a^3 + 78*a - 58)*B + 11/2*a^3 - 375/2*a - 304 : 1)

which is exactly what I am looking for. But somehow when I try to compute 2*P+Q it gives the following error:

AttributeError: 'SchemeHomset_points_abelian_variety_field_with_category' object has no attribute 'zero
Sha gravatar imageSha ( 2016-11-03 13:18:28 +0100 )edit

Maybe you can make this a new question. Note: you don't need the ";" in the 4th line. Note: PEP8 style guide encourages spaces around equal signs for assignment. See https://www.python.org/dev/peps/pep-0008/.

slelievre gravatar imageslelievre ( 2016-11-03 15:40:33 +0100 )edit
1

answered 2016-11-02 20:58:08 +0100

castor gravatar image

Something that may help:

k.<a,b>=NumberField([x^2 - 30*x + 2817,x^4 + 30*x^3 - 18252*x^2 + 280530*x +6465339])
kX.<X>=FunctionField(k)
R.<Y> = kX[]
kY.<Y> = kX.extension(Y^2-X^3+3267*X-45630)
E=EllipticCurve(kY,[-3267,45630])
Q=E([X,Y])
P1=E([15,0])
P2=E([1/5184*(-b^3 - 45*b^2 + 14985*b - 133515),0])
print(P1+Q)
print(P2+Q)

Here the answer is as follows:

((15*X - 2817)/(X - 15) : ((-2592)/(-X^2 + 30*X - 225))*Y : 1)

and

(((-1/5184*b^3 - 5/576*b^2 + 185/64*b - 4945/192)*X + 5/864*b^3 +
25/96*b^2 - 2775/32*b + 114869/32)/(X + 1/5184*b^3 + 5/576*b^2 -
185/64*b + 4945/192) : ((5/576*b^3 + 25/64*b^2 - 8325/64*b +
449151/64)/(-X^2 + (-1/2592*b^3 - 5/288*b^2 + 185/32*b - 4945/96)*X -
5/1728*b^3 - 25/192*b^2 + 2775/64*b - 219413/64))*Y : 1).
edit flag offensive delete link more

Comments

@castor Can you help me explain about P1 and P2, aren't they 2-torsion point? I am actually trying to work out the addition of P+Q where P is my 4-torsion point and Q=[51,108]

Sha gravatar imageSha ( 2016-11-03 02:54:27 +0100 )edit

In fact I just picked up some points to demonstrate point addition over this domain. As I see now your point Q is given, it is not a general point (X,Y) so I am not sure if you really need this FunctionField stuff. Anyway, you can combine @slelievre code with mine:

k.<a> = NumberField(x^4 - 5*x^2 - 32)
K.<B> = k.extension(x^2+2)
kX.<X>=FunctionField(K)
R.<Y> = kX[]
kY.<Y> = kX.extension(Y^2-X^3+3267*X-45630)
E=EllipticCurve(kY,[0,0,0,-3267,45630])
P=E(15+36*B, 27*a*(a^2-4*B-5))
Q=E(51,108)
P+Q

that provides

((-a^3 + 3*a - 38)*B + 1/2*a^3 - 21/2*a + 7 : (-20*a^3 + 78*a - 58)*B +
11/2*a^3 - 375/2*a - 304 : 1)

and 2*P+Q is a nice point

(-57 : 216 ...
(more)
castor gravatar imagecastor ( 2016-11-03 17:59:49 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-11-02 09:40:58 +0100

Seen: 1,213 times

Last updated: Nov 03 '16