# Hyperelliptic Curve Point Finding, via ratpoints (deprecated)¶

This module is deprecated, use PARI instead:

sage: pari(EllipticCurve("389a1")).ellratpoints(4)
[[-2, 0], [-2, -1], [-1, 1], [-1, -2], [0, 0], [0, -1], [1, 0], [1, -1], [3, 5], [3, -6], [4, 8], [4, -9], [-3/4, 7/8], [-3/4, -15/8]]
sage: pari("[x^3 + x^2 - 2*x, 1]").hyperellratpoints(4)
[[-2, 0], [-2, -1], [-1, 1], [-1, -2], [0, 0], [0, -1], [1, 0], [1, -1], [3, 5], [3, -6], [4, 8], [4, -9], [-3/4, 7/8], [-3/4, -15/8]]

sage.libs.ratpoints.ratpoints(coeffs, H, verbose=False, max=0, min_x_denom=None, max_x_denom=None, intervals=[])

Access the ratpoints library to find points on the hyperelliptic curve:

$$y^2 = a_n x^n + \cdots + a_1 x + a_0.$$

INPUT:

• coeffs – list of integer coefficients $$a_0$$ , $$a_1$$, …, $$a_n$$
• H – the bound for the denominator and the absolute value of the numerator of the $$x$$-coordinate
• verbose – if True, ratpoints will print comments about its progress
• max – maximum number of points to find (if 0, find all of them)

OUTPUT:

The points output by this program are points in (1, ceil(n/2), 1)-weighted projective space. If n is even, then the associated homogeneous equation is $$y^2 = a_n x^n + \cdots + a_1 x z^{n-1} + a_0 z^n$$ while if n is odd, it is $$y^2 = a_n x^n z + \cdots + a_1 x z^n + a_0 z^{n+1}$$.

EXAMPLES:

sage: from sage.libs.ratpoints import ratpoints
doctest:...: DeprecationWarning: the module sage.libs.ratpoints is deprecated; use pari.ellratpoints or pari.hyperellratpoints instead
See http://trac.sagemath.org/24531 for details.
sage: for x,y,z in ratpoints([1..6], 200):
....:     print(-1*y^2 + 1*z^6 + 2*x*z^5 + 3*x^2*z^4 + 4*x^3*z^3 + 5*x^4*z^2 + 6*x^5*z)
0
0
0
0
0
0
0
sage: for x,y,z in ratpoints([1..5], 200):
....:    print(-1*y^2 + 1*z^4 + 2*x*z^3 + 3*x^2*z^2 + 4*x^3*z + 5*x^4)
0
0
0
0
0
0
0
0

sage: for x,y,z in ratpoints([1..200], 1000):
....:    print("{} {} {}".format(x,y,z))
1 0 0
0 1 1
0 -1 1
201 25353012004564588029934064107520000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 200
201 -25353012004564588029934064107520000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 200


The denominator of $$x$$ can be restricted, for example to find integral points:

sage: from sage.libs.ratpoints import ratpoints
sage: coeffs = [400, -112, 0, 1]
sage: ratpoints(coeffs, 10^6, max_x_denom=1, intervals=[[-10,0],[1000,2000]])
[(1, 0, 0), (-8, 28, 1), (-8, -28, 1), (-7, 29, 1), (-7, -29, 1),
(-4, 28, 1), (-4, -28, 1), (0, 20, 1), (0, -20, 1), (1368, 50596, 1),
(1368, -50596, 1), (1624, 65444, 1), (1624, -65444, 1)]

sage: ratpoints(coeffs, 1000, min_x_denom=100, max_x_denom=200)
[(1, 0, 0),
(-656, 426316, 121),
(-656, -426316, 121),
(452, 85052, 121),
(452, -85052, 121),
(988, 80036, 121),
(988, -80036, 121),
(-556, 773188, 169),
(-556, -773188, 169),
(264, 432068, 169),
(264, -432068, 169)]


Finding the integral points on the compact component of an elliptic curve:

sage: E = EllipticCurve([0,1,0,-35220,-1346400])
sage: e1, e2, e3 = E.division_polynomial(2).roots(multiplicities=False)
sage: coeffs = [E.a6(),E.a4(),E.a2(),1]
sage: ratpoints(coeffs, 1000, max_x_denom=1, intervals=[[e3,e2]])
[(1, 0, 0),
(-165, 0, 1),
(-162, 366, 1),
(-162, -366, 1),
(-120, 1080, 1),
(-120, -1080, 1),
(-90, 1050, 1),
(-90, -1050, 1),
(-85, 1020, 1),
(-85, -1020, 1),
(-42, 246, 1),
(-42, -246, 1),
(-40, 0, 1)]