Skip to content

Commit 135b686

Browse files
committed
proj_bdd_height.py: Implement points of bounded height for projectives spaces over ZZ
1 parent 9bbd2d6 commit 135b686

File tree

1 file changed

+45
-10
lines changed

1 file changed

+45
-10
lines changed

src/sage/schemes/projective/proj_bdd_height.py

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,49 @@
3535
from sage.geometry.polyhedron.constructor import Polyhedron
3636

3737

38-
def ZZ_points_of_bounded_height(dim, bound, normalize=False):
39-
yield []
38+
def ZZ_points_of_bounded_height(dim, bound):
39+
r"""
40+
Return an iterator of the points in ``self`` of absolute multiplicative
41+
height of at most ``bound`` in the rational field.
42+
43+
INPUT:
44+
45+
- ``dim`` -- a positive integer
46+
47+
- ``bound`` -- a positive integer
48+
49+
OUTPUT:
50+
51+
- an iterator of points of bounded height
52+
53+
EXAMPLES:
54+
55+
sage: from sage.schemes.projective.proj_bdd_height import ZZ_points_of_bounded_height
56+
sage: sorted(list(ZZ_points_of_bounded_height(1, 1)))
57+
[(-1 : -1), (-1 : 0), (-1 : 1), (0 : -1), (0 : 1), (1 : -1), (1 : 0), (1 : 1)]
58+
sage: len(list(ZZ_points_of_bounded_height(1, 5)))
59+
80
60+
sage: sorted(list(ZZ_points_of_bounded_height(1, 2)))
61+
[(-2 : -1), (-2 : 1), (-1 : -2), (-1 : -1),
62+
(-1 : 0), (-1 : 1), (-1 : 2), (0 : -1),
63+
(0 : 1), (1 : -2), (1 : -1), (1 : 0),
64+
(1 : 1), (1 : 2), (2 : -1), (2 : 1)]
65+
66+
There are no points of negative height::
67+
68+
sage: from sage.schemes.projective.proj_bdd_height import ZZ_points_of_bounded_height
69+
sage: list(ZZ_points_of_bounded_height(1, -3))
70+
[]
71+
"""
72+
if bound < 1:
73+
return iter(set([]))
74+
75+
PN = ProjectiveSpace(ZZ, dim)
76+
77+
for i in range(-bound, bound + 1):
78+
for j in range(-bound, bound + 1):
79+
if gcd(i, j) == 1:
80+
yield PN((i, j))
4081

4182

4283
def QQ_points_of_bounded_height(dim, bound, normalize=False):
@@ -218,20 +259,14 @@ def points_of_bounded_height(PN, K, dim, bound, prec=53, normalize=False):
218259
(-1 : 0 : 1), (1 : 0 : 1), (1 : 1 : 0), (-1 : 1 : 0), (-1 : -1 : 1),
219260
(-1 : 1 : 1), (1 : -1 : 1), (1 : 1 : 1)]
220261
221-
::
222-
223-
sage: P.<z,w> = ProjectiveSpace(ZZ, 1)
224-
sage: sorted(list(P.points_of_bounded_height(bound=2)))
225-
[]
226-
227262
::
228263
229264
sage: R.<x> = QQ[]
230265
sage: K.<a> = NumberField(3*x^2 + 1)
231266
sage: O = K.maximal_order()
232267
sage: P.<z,w> = ProjectiveSpace(O, 1)
233-
sage: sorted(list(P.points_of_bounded_height(bound=2)))
234-
[]
268+
sage: len(list(P.points_of_bounded_height(bound=2)))
269+
44
235270
"""
236271
if bound < 1:
237272
return iter([])

0 commit comments

Comments
 (0)