ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 26 Jan 2017 05:10:51 +0100points on elliptic curvehttps://ask.sagemath.org/question/36370/points-on-elliptic-curve/I have elliptic curve `E : [0,0,0,-3267,45630]`, point `P=[51,-108]`, as well as point `Q=[-57,432]` on elliptic curve `F : [0,27,0,-4077,51705]`. I want to find all `(m,n)` such that `x(mP)=x(nQ)`. I tried doing it using Pari-gp unfortunately it keeps giving error (I am not sure why). Is there a way I can build this code using Sage.
for(m=1,10,for(n=1,10,XX=ellpow(E,P,m);YY=ellpow(F,Q,n);X=XX[1];Y=YY[1];if(X==Y,print(m "\t" n))))Tue, 24 Jan 2017 09:48:54 +0100https://ask.sagemath.org/question/36370/points-on-elliptic-curve/Comment by slelievre for <p>I have elliptic curve <code>E : [0,0,0,-3267,45630]</code>, point <code>P=[51,-108]</code>, as well as point <code>Q=[-57,432]</code> on elliptic curve <code>F : [0,27,0,-4077,51705]</code>. I want to find all <code>(m,n)</code> such that <code>x(mP)=x(nQ)</code>. I tried doing it using Pari-gp unfortunately it keeps giving error (I am not sure why). Is there a way I can build this code using Sage. </p>
<pre><code>for(m=1,10,for(n=1,10,XX=ellpow(E,P,m);YY=ellpow(F,Q,n);X=XX[1];Y=YY[1];if(X==Y,print(m "\t" n))))
</code></pre>
https://ask.sagemath.org/question/36370/points-on-elliptic-curve/?comment=36372#post-id-36372@Sha - What have you tried?Tue, 24 Jan 2017 13:13:23 +0100https://ask.sagemath.org/question/36370/points-on-elliptic-curve/?comment=36372#post-id-36372Answer by castor for <p>I have elliptic curve <code>E : [0,0,0,-3267,45630]</code>, point <code>P=[51,-108]</code>, as well as point <code>Q=[-57,432]</code> on elliptic curve <code>F : [0,27,0,-4077,51705]</code>. I want to find all <code>(m,n)</code> such that <code>x(mP)=x(nQ)</code>. I tried doing it using Pari-gp unfortunately it keeps giving error (I am not sure why). Is there a way I can build this code using Sage. </p>
<pre><code>for(m=1,10,for(n=1,10,XX=ellpow(E,P,m);YY=ellpow(F,Q,n);X=XX[1];Y=YY[1];if(X==Y,print(m "\t" n))))
</code></pre>
https://ask.sagemath.org/question/36370/points-on-elliptic-curve/?answer=36379#post-id-36379I guess the second point Q is given by [-57,216]. I use it in what follows.
E=EllipticCurve([0,0,0,-3267,45630])
P=E([51,-108])
Q=E([-57,216])
[(m,n) for m in [1..10] for n in [1..10] if (m*P)[0]==(n*Q)[0]]
The result is:
[(2, 2), (4, 4), (6, 6), (8, 8), (10, 10)]
e.g. 2*P=(339 : 6156 : 1) and 2*Q=(339 : -6156 : 1).Tue, 24 Jan 2017 22:05:56 +0100https://ask.sagemath.org/question/36370/points-on-elliptic-curve/?answer=36379#post-id-36379Comment by nbruin for <p>I guess the second point Q is given by [-57,216]. I use it in what follows.</p>
<pre><code> E=EllipticCurve([0,0,0,-3267,45630])
P=E([51,-108])
Q=E([-57,216])
[(m,n) for m in [1..10] for n in [1..10] if (m*P)[0]==(n*Q)[0]]
</code></pre>
<p>The result is:</p>
<pre><code>[(2, 2), (4, 4), (6, 6), (8, 8), (10, 10)]
</code></pre>
<p>e.g. 2<em>P=(339 : 6156 : 1) and 2</em>Q=(339 : -6156 : 1).</p>
https://ask.sagemath.org/question/36370/points-on-elliptic-curve/?comment=36380#post-id-36380Be careful: Looking at P[0] doesn't give you the affine x-coordinate. For instance, if you set
E=EllipticCurve([0,1,0,1,0])
P=E([0,0])
Q=E(0)
the code above would erroneously report that P and Q have the same x-coordinate
You could instead use
T=lambda(P,Q): P[0]*Q[2]==P[2]*Q[0]
or test `(m*P).xy()[0] == (n*Q).xy()[0]` which does look at the affine coordinates.Wed, 25 Jan 2017 01:45:38 +0100https://ask.sagemath.org/question/36370/points-on-elliptic-curve/?comment=36380#post-id-36380Comment by Sha for <p>I guess the second point Q is given by [-57,216]. I use it in what follows.</p>
<pre><code> E=EllipticCurve([0,0,0,-3267,45630])
P=E([51,-108])
Q=E([-57,216])
[(m,n) for m in [1..10] for n in [1..10] if (m*P)[0]==(n*Q)[0]]
</code></pre>
<p>The result is:</p>
<pre><code>[(2, 2), (4, 4), (6, 6), (8, 8), (10, 10)]
</code></pre>
<p>e.g. 2<em>P=(339 : 6156 : 1) and 2</em>Q=(339 : -6156 : 1).</p>
https://ask.sagemath.org/question/36370/points-on-elliptic-curve/?comment=36381#post-id-36381@castor Sorry I may have to edit my question. Actually point Q is on elliptic curve F : ellinit([0,27,0,-4077,51705]). I overlooked that. Point P is on E, while Q is on elliptic curve F. I will edit my question.Wed, 25 Jan 2017 04:50:05 +0100https://ask.sagemath.org/question/36370/points-on-elliptic-curve/?comment=36381#post-id-36381Comment by castor for <p>I guess the second point Q is given by [-57,216]. I use it in what follows.</p>
<pre><code> E=EllipticCurve([0,0,0,-3267,45630])
P=E([51,-108])
Q=E([-57,216])
[(m,n) for m in [1..10] for n in [1..10] if (m*P)[0]==(n*Q)[0]]
</code></pre>
<p>The result is:</p>
<pre><code>[(2, 2), (4, 4), (6, 6), (8, 8), (10, 10)]
</code></pre>
<p>e.g. 2<em>P=(339 : 6156 : 1) and 2</em>Q=(339 : -6156 : 1).</p>
https://ask.sagemath.org/question/36370/points-on-elliptic-curve/?comment=36384#post-id-36384Thanks @nbruin for the correction, now using the second suggested test we may go as
E=EllipticCurve([0,0,0,-3267,45630])
P=E([51,-108])
F=EllipticCurve([0,27,0,-4077,51705])
Q=F([-57,432])
[(m,n) for m in [1..100] for n in [1..100] if (m*P).xy()[0] == (n*Q).xy()[0]]
the result is simply [].Wed, 25 Jan 2017 15:33:28 +0100https://ask.sagemath.org/question/36370/points-on-elliptic-curve/?comment=36384#post-id-36384Comment by Sha for <p>I guess the second point Q is given by [-57,216]. I use it in what follows.</p>
<pre><code> E=EllipticCurve([0,0,0,-3267,45630])
P=E([51,-108])
Q=E([-57,216])
[(m,n) for m in [1..10] for n in [1..10] if (m*P)[0]==(n*Q)[0]]
</code></pre>
<p>The result is:</p>
<pre><code>[(2, 2), (4, 4), (6, 6), (8, 8), (10, 10)]
</code></pre>
<p>e.g. 2<em>P=(339 : 6156 : 1) and 2</em>Q=(339 : -6156 : 1).</p>
https://ask.sagemath.org/question/36370/points-on-elliptic-curve/?comment=36395#post-id-36395Thank you so much. I can play around with [1..100] to get the desired output.Thu, 26 Jan 2017 05:10:51 +0100https://ask.sagemath.org/question/36370/points-on-elliptic-curve/?comment=36395#post-id-36395