ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 28 May 2020 11:26:10 -0500Determining Elliptic Curve Componentshttps://ask.sagemath.org/question/44274/determining-elliptic-curve-components/Say we have an elliptic curve:
R.<a,b,c> = QQ[]
cubic = a*(a+c)*(a+b)+b*(b+c)*(a+b)+c*(b+c)*(a+c)-4*(a+b)*(a+c)*(b+c)
E = EllipticCurve_from_cubic(cubic, morphism=False)
print(E)
print(E.minimal_model())
f = EllipticCurve_from_cubic(cubic, morphism=True)
finv = f.inverse()
generators = E.gens()
print
print("generators = %s" %(generators))
Output:
Elliptic Curve defined by y^2 + x*y = x^3 + 69*x^2 + 1365*x + 8281 over Rational Field
Elliptic Curve defined by y^2 + x*y + y = x^3 - 234*x + 1352 over Rational Field
generators = [(-39 : 52 : 1)]
How do we determine which of the two elliptic curve components a particular point is on? If we had this elliptic curve in the form $y^2 = x^3 + 109 x^2 + 234 x$ it'd be quite simple (if $x<0$ it's on the egg). Is there a nice way to automate this process in SageMath? For example, in this case the generator is on the egg.Tue, 13 Nov 2018 19:59:02 -0600https://ask.sagemath.org/question/44274/determining-elliptic-curve-components/Answer by John Cremona for <p>Say we have an elliptic curve:</p>
<pre><code>R.<a,b,c> = QQ[]
cubic = a*(a+c)*(a+b)+b*(b+c)*(a+b)+c*(b+c)*(a+c)-4*(a+b)*(a+c)*(b+c)
E = EllipticCurve_from_cubic(cubic, morphism=False)
print(E)
print(E.minimal_model())
f = EllipticCurve_from_cubic(cubic, morphism=True)
finv = f.inverse()
generators = E.gens()
print
print("generators = %s" %(generators))
</code></pre>
<p>Output:</p>
<pre><code>Elliptic Curve defined by y^2 + x*y = x^3 + 69*x^2 + 1365*x + 8281 over Rational Field
Elliptic Curve defined by y^2 + x*y + y = x^3 - 234*x + 1352 over Rational Field
generators = [(-39 : 52 : 1)]
</code></pre>
<p>How do we determine which of the two elliptic curve components a particular point is on? If we had this elliptic curve in the form $y^2 = x^3 + 109 x^2 + 234 x$ it'd be quite simple (if $x<0$ it's on the egg). Is there a nice way to automate this process in SageMath? For example, in this case the generator is on the egg.</p>
https://ask.sagemath.org/question/44274/determining-elliptic-curve-components/?answer=51615#post-id-51615If P is the generator, use this:
sage: P.is_on_identity_component()
False
You can also see it with E.plot()+P.plot()!Thu, 28 May 2020 11:26:10 -0500https://ask.sagemath.org/question/44274/determining-elliptic-curve-components/?answer=51615#post-id-51615Answer by rburing for <p>Say we have an elliptic curve:</p>
<pre><code>R.<a,b,c> = QQ[]
cubic = a*(a+c)*(a+b)+b*(b+c)*(a+b)+c*(b+c)*(a+c)-4*(a+b)*(a+c)*(b+c)
E = EllipticCurve_from_cubic(cubic, morphism=False)
print(E)
print(E.minimal_model())
f = EllipticCurve_from_cubic(cubic, morphism=True)
finv = f.inverse()
generators = E.gens()
print
print("generators = %s" %(generators))
</code></pre>
<p>Output:</p>
<pre><code>Elliptic Curve defined by y^2 + x*y = x^3 + 69*x^2 + 1365*x + 8281 over Rational Field
Elliptic Curve defined by y^2 + x*y + y = x^3 - 234*x + 1352 over Rational Field
generators = [(-39 : 52 : 1)]
</code></pre>
<p>How do we determine which of the two elliptic curve components a particular point is on? If we had this elliptic curve in the form $y^2 = x^3 + 109 x^2 + 234 x$ it'd be quite simple (if $x<0$ it's on the egg). Is there a nice way to automate this process in SageMath? For example, in this case the generator is on the egg.</p>
https://ask.sagemath.org/question/44274/determining-elliptic-curve-components/?answer=44279#post-id-44279We can consider the Weierstrass equation $f(x,y) = 0$ (which is quadratic in $y$) and ask when the discriminant with respect to $y$ (which is a polynomial in $x$) is nonnegative (so that there is a real solution):
E = EllipticCurve([1,69,0,1365,8281])
f = E.defining_polynomial().subs({f.parent().gen(2) : 1})
R.<x> = QQ[]
S.<y> = R[]
discr = S(f).discriminant()
components = solve(SR(discr) >= 0, x)
This gives a list of intervals, which describe the real connected components:
[[x >= -13/8*sqrt(65) - 221/8, x <= 13/8*sqrt(65) - 221/8], [x >= -14]]
You can ask to which one a certain point `P` belongs:
P = E.gens()[0]
px = P.xy()[0];
component_index = [all(bool(eqn.subs(x=px)) for eqn in component) for component in components].index(True)
print('The point {} lies on component {}'.format(P, components[component_index]))
In this case:
The point (-39 : 52 : 1) lies on component [x >= -13/8*sqrt(65) - 221/8, x <= 13/8*sqrt(65) - 221/8]Wed, 14 Nov 2018 07:48:39 -0600https://ask.sagemath.org/question/44274/determining-elliptic-curve-components/?answer=44279#post-id-44279Comment by octonion for <p>We can consider the Weierstrass equation $f(x,y) = 0$ (which is quadratic in $y$) and ask when the discriminant with respect to $y$ (which is a polynomial in $x$) is nonnegative (so that there is a real solution):</p>
<pre><code>E = EllipticCurve([1,69,0,1365,8281])
f = E.defining_polynomial().subs({f.parent().gen(2) : 1})
R.<x> = QQ[]
S.<y> = R[]
discr = S(f).discriminant()
components = solve(SR(discr) >= 0, x)
</code></pre>
<p>This gives a list of intervals, which describe the real connected components:</p>
<pre><code>[[x >= -13/8*sqrt(65) - 221/8, x <= 13/8*sqrt(65) - 221/8], [x >= -14]]
</code></pre>
<p>You can ask to which one a certain point <code>P</code> belongs:</p>
<pre><code>P = E.gens()[0]
px = P.xy()[0];
component_index = [all(bool(eqn.subs(x=px)) for eqn in component) for component in components].index(True)
print('The point {} lies on component {}'.format(P, components[component_index]))
</code></pre>
<p>In this case:</p>
<pre><code>The point (-39 : 52 : 1) lies on component [x >= -13/8*sqrt(65) - 221/8, x <= 13/8*sqrt(65) - 221/8]
</code></pre>
https://ask.sagemath.org/question/44274/determining-elliptic-curve-components/?comment=44284#post-id-44284Thanks! I found a slightly different method involving calculating the short Weierstrass form, then manually building and finding the roots of the cubic from the a2, a4 and a6 coefficients. But your method is much nicer and more general, and is greatly appreciated!Wed, 14 Nov 2018 14:44:43 -0600https://ask.sagemath.org/question/44274/determining-elliptic-curve-components/?comment=44284#post-id-44284