Skip to content

Commit 2b792a1

Browse files
committed
projective_space.py: points_of_bounded_height function raise NotImplemented error when getting a ring too general
1 parent 8709112 commit 2b792a1

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

src/sage/schemes/projective/projective_space.py

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
9090
from sage.rings.rational_field import QQ, is_RationalField
9191
from sage.rings.fraction_field import FractionField
92+
from sage.rings.number_field.order import Order
9293

9394
from sage.categories.fields import Fields
9495
from sage.categories.rings import Rings
@@ -1112,9 +1113,28 @@ def points_of_bounded_height(self, **kwds):
11121113
sage: P.<w,z> = ProjectiveSpace(ZZ, 1)
11131114
sage: sorted(list(P.points_of_bounded_height(bound=2)))
11141115
[(-2 : -1), (-2 : 1), (-1 : -2), (-1 : -1),
1115-
(-1 : 0), (-1 : 1), (-1 : 2), (0 : -1),
1116-
(0 : 1), (1 : -2), (1 : -1), (1 : 0),
1117-
(1 : 1), (1 : 2), (2 : -1), (2 : 1)]
1116+
(-1 : 0), (-1 : 1), (-1 : 2), (0 : -1)]
1117+
1118+
::
1119+
1120+
sage: R.<x> = QQ[]
1121+
sage: P.<z,w> = ProjectiveSpace(R, 1)
1122+
sage: P.points_of_bounded_height(bound=2)
1123+
Traceback (most recent call last):
1124+
...
1125+
NotImplementedError: self must be a projective space over
1126+
a number field or a ring of integers
1127+
1128+
::
1129+
1130+
sage: K.<i> = NumberField(x^2 + 1)
1131+
sage: PK.<t> = K[]
1132+
sage: L.<a> = K.extension(t^4 - i)
1133+
sage: P.<z,w> = ProjectiveSpace(L, 1)
1134+
sage: sorted(list(P.points_of_bounded_height(bound=1)))
1135+
[(0 : 1), (1 : 0), (a : 1), (a^2 : 1), (a^3 : 1), (i : 1),
1136+
(i*a : 1), (i*a^2 : 1), (i*a^3 : 1), (-1 : 1), (-a : 1), (-a^2 : 1),
1137+
(-a^3 : 1), (-i : 1), (-i*a : 1), (-i*a^2 : 1), (-i*a^3 : 1), (1 : 1)]
11181138
"""
11191139
from sage.schemes.projective.proj_bdd_height import (
11201140
ZZ_points_of_bounded_height,
@@ -1134,8 +1154,10 @@ def points_of_bounded_height(self, **kwds):
11341154
elif R in NumberFields():
11351155
# True for the rational field as well, so check is_RationalField first
11361156
field_type = True
1137-
else:
1157+
elif (R is ZZ) or isinstance(R, Order):
11381158
is_ring_of_ints = True
1159+
else:
1160+
raise NotImplementedError("self must be a projective space over a number field or a ring of integers")
11391161

11401162
bound = kwds.pop('bound')
11411163
prec = kwds.pop('precision', 53)

0 commit comments

Comments
 (0)