ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 29 Aug 2016 05:10:36 -0500points on elliptic curve number fieldhttp://ask.sagemath.org/question/29867/points-on-elliptic-curve-number-field/I have the following elliptic curve : y^2=x^3-3267x+45630 and generator P=[-21,324].
I want to find the general formula to add any point (r,s) to the point ((-15/2)+(27/2)*B,0) where B^2=17.
PARI seems to be pretty straightforward in giving answer. And i think the mistake I did in SAGE is that I should define r and s in number field which I'm not sure how to do it.
The Pari code is as follows :
gp > elladd(E,[r,s],[(-15/2)+(27/2)*B,0])= [(-8*r^3 + (108*B - 60)*r^2 + (1458*B^2 - 1620*B + 450)*r + (8*s^2 + (-19683*B^3 + 32805*B^2 - 18225*B + 3375)))/(8*r^2 + (-216*B + 120)*r + (1458*B^2 - 1620*B + 450)), (-8*s*r^3 + (4374*B^2 - 4860*B + 1350)*s*r + (8*s^3 + (-39366*B^3 + 65610*B^2 - 36450*B + 6750)*s))/(-8*r^3 + (324*B - 180)*r^2 + (-4374*B^2 + 4860*B - 1350)*r + (19683*B^3 - 32805*B^2 + 18225*B - 3375))]
Fri, 09 Oct 2015 05:12:51 -0500http://ask.sagemath.org/question/29867/points-on-elliptic-curve-number-field/Answer by nbruin for <p>I have the following elliptic curve : y^2=x^3-3267x+45630 and generator P=[-21,324].</p>
<p>I want to find the general formula to add any point (r,s) to the point ((-15/2)+(27/2)*B,0) where B^2=17.</p>
<p>PARI seems to be pretty straightforward in giving answer. And i think the mistake I did in SAGE is that I should define r and s in number field which I'm not sure how to do it.</p>
<p>The Pari code is as follows :</p>
<pre><code>gp > elladd(E,[r,s],[(-15/2)+(27/2)*B,0])= [(-8*r^3 + (108*B - 60)*r^2 + (1458*B^2 - 1620*B + 450)*r + (8*s^2 + (-19683*B^3 + 32805*B^2 - 18225*B + 3375)))/(8*r^2 + (-216*B + 120)*r + (1458*B^2 - 1620*B + 450)), (-8*s*r^3 + (4374*B^2 - 4860*B + 1350)*s*r + (8*s^3 + (-39366*B^3 + 65610*B^2 - 36450*B + 6750)*s))/(-8*r^3 + (324*B - 180)*r^2 + (-4374*B^2 + 4860*B - 1350)*r + (19683*B^3 - 32805*B^2 + 18225*B - 3375))]
</code></pre>
http://ask.sagemath.org/question/29867/points-on-elliptic-curve-number-field/?answer=33652#post-id-33652You haven't told Pari that the point [r,s] actually does lie on E. So pari at this point really just fills in the generic formula with the parameters you've given. The general machinery in Sage is a little more picky (although the computation it does is the same). The good thing is that by the time you're done explaining the situation to sage, it will know that s^2=(r^3-3267*r+45630) and it can use that to simplify the expression more than pari does (note s occurs to higher powers in the answer that pari gives).
sage: E=EllipticCurve([-3267,45630])
sage: k.<B>=NumberField(x^2-17)
sage: kr.<r>=FunctionField(k);
sage: krS.<S>=kr[]
sage: R.<s>=krS.quo(S^2-(r^3-3267*r+45630))
sage: P=E(R)(-15/2+27/2*B,0)
sage: Q=E(R)(r,s)
sage: P,Q
((27/2*B - 15/2 : 0 : 1), (r : s : 1))
sage: P+Q
(((27/2*B - 15/2)*r - 405*B + 3042)/(r - 27/2*B + 15/2) : ((-1215/2*B + 12393/2)/(-r^2 + (27*B - 15)*r + 405/2*B - 6309/2))*s : 1)
As you can see, we need to define 3 fields (plus a polynomial ring to create the relevant function field) before we can properly talk about the points P and Q in the first place, but after that it's smooth sailing. And the formula you get is better simplified than what you'd obtain from pari.Thu, 02 Jun 2016 15:59:36 -0500http://ask.sagemath.org/question/29867/points-on-elliptic-curve-number-field/?answer=33652#post-id-33652Comment by Sha for <p>You haven't told Pari that the point [r,s] actually does lie on E. So pari at this point really just fills in the generic formula with the parameters you've given. The general machinery in Sage is a little more picky (although the computation it does is the same). The good thing is that by the time you're done explaining the situation to sage, it will know that s^2=(r^3-3267*r+45630) and it can use that to simplify the expression more than pari does (note s occurs to higher powers in the answer that pari gives).</p>
<pre><code>sage: E=EllipticCurve([-3267,45630])
sage: k.<B>=NumberField(x^2-17)
sage: kr.<r>=FunctionField(k);
sage: krS.<S>=kr[]
sage: R.<s>=krS.quo(S^2-(r^3-3267*r+45630))
sage: P=E(R)(-15/2+27/2*B,0)
sage: Q=E(R)(r,s)
sage: P,Q
((27/2*B - 15/2 : 0 : 1), (r : s : 1))
sage: P+Q
(((27/2*B - 15/2)*r - 405*B + 3042)/(r - 27/2*B + 15/2) : ((-1215/2*B + 12393/2)/(-r^2 + (27*B - 15)*r + 405/2*B - 6309/2))*s : 1)
</code></pre>
<p>As you can see, we need to define 3 fields (plus a polynomial ring to create the relevant function field) before we can properly talk about the points P and Q in the first place, but after that it's smooth sailing. And the formula you get is better simplified than what you'd obtain from pari.</p>
http://ask.sagemath.org/question/29867/points-on-elliptic-curve-number-field/?comment=34635#post-id-34635Thank you so much. This has been so useful to me and my calculation. Great answer.!Mon, 29 Aug 2016 05:10:36 -0500http://ask.sagemath.org/question/29867/points-on-elliptic-curve-number-field/?comment=34635#post-id-34635