# Revision history [back]

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):

E = EllipticCurve([1,0,1,-234,1352])
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) - 37/8, x <= 13/8*sqrt(65) - 37/8], [x >= 9]]


You can ask to which one a certain point P belongs:

P = E.gens()
px = P.xy();
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 (-16 : 40 : 1) lies on component [x >= -13/8*sqrt(65) - 37/8, x <= 13/8*sqrt(65) - 37/8]


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):

E = EllipticCurve([1,0,1,-234,1352])
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) - 37/8, x <= 13/8*sqrt(65) - 37/8], [x >= 9]]


You can ask to which one a certain point P belongs:

P = E.gens()
px = P.xy();
P.xy();
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 (-16 : 40 : 1) lies on component [x >= -13/8*sqrt(65) - 37/8, x <= 13/8*sqrt(65) - 37/8]


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):

E = EllipticCurve([1,0,1,-234,1352])
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) - 37/8, 221/8, x <= 13/8*sqrt(65) - 37/8], 221/8], [x >= 9]]
-14]]


You can ask to which one a certain point P belongs:

P = E.gens()
px = P.xy();
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 (-16 (-39 : 40 52 : 1) lies is on component [x >= -13/8*sqrt(65) - 37/8, 221/8, x <= 13/8*sqrt(65) - 37/8]
221/8]


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):

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()
px = P.xy();
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) is lies on component [x >= -13/8*sqrt(65) - 221/8, x <= 13/8*sqrt(65) - 221/8]