Skip to content

Commit 9bbd2d6

Browse files
committed
projective_space.py: Add two new tests for when the base ring is the ring of integers; Additional check when ring of integers
1 parent 18cb21c commit 9bbd2d6

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

src/sage/schemes/projective/projective_space.py

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@
8787
from sage.rings.polynomial.multi_polynomial_ring import is_MPolynomialRing
8888
from sage.rings.polynomial.polynomial_ring import is_PolynomialRing
8989
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
90-
from sage.rings.rational_field import is_RationalField
90+
from sage.rings.rational_field import QQ, is_RationalField
91+
from sage.rings.fraction_field import FractionField
9192

9293
from sage.categories.fields import Fields
9394
from sage.categories.rings import Rings
@@ -1096,8 +1097,24 @@ def points_of_bounded_height(self, **kwds):
10961097
sage: sorted(list(P.points_of_bounded_height(bound=1)))
10971098
[(-1 : 1), (-3/2*a - 1/2 : 1), (3/2*a - 1/2 : 1), (0 : 1),
10981099
(-3/2*a + 1/2 : 1), (3/2*a + 1/2 : 1), (1 : 0), (1 : 1)]
1100+
1101+
::
1102+
1103+
sage: R.<x> = QQ[]
1104+
sage: K.<a> = NumberField(3*x^2 + 1)
1105+
sage: O = K.maximal_order()
1106+
sage: P.<z,w> = ProjectiveSpace(O, 1)
1107+
sage: len(sorted(list(P.points_of_bounded_height(bound=2))))
1108+
44
1109+
1110+
::
1111+
1112+
sage: P.<z,w> = ProjectiveSpace(ZZ, 1) # TODO this is not implemented yet
1113+
sage: sorted(list(P.points_of_bounded_height(bound=2)))
1114+
[]
10991115
"""
11001116
from sage.schemes.projective.proj_bdd_height import (
1117+
ZZ_points_of_bounded_height,
11011118
QQ_points_of_bounded_height,
11021119
IQ_points_of_bounded_height,
11031120
points_of_bounded_height
@@ -1125,12 +1142,31 @@ def points_of_bounded_height(self, **kwds):
11251142

11261143
dim = self.dimension_relative()
11271144

1128-
# TODO bug, no `signature` for `order`
1145+
# When R is the ring of integers
11291146
if is_ring_of_ints:
1130-
return points_of_bounded_height(self, R, dim, bound, prec, normalize=True)
1147+
fraction_field = FractionField(R)
1148+
1149+
# Field of fraction is the rational field
1150+
if fraction_field == QQ:
1151+
return ZZ_points_of_bounded_height(dim, bound)
1152+
1153+
# Field of fraction is a number field
1154+
r1, r2 = fraction_field.signature()
1155+
r = r1 + r2 - 1
1156+
1157+
if fraction_field.is_relative():
1158+
deg = fraction_field.relative_degree()
1159+
else:
1160+
deg = fraction_field.degree()
1161+
1162+
if deg == 2 and r == 0:
1163+
return IQ_points_of_bounded_height(self, fraction_field, dim, bound, normalize=True)
1164+
1165+
return points_of_bounded_height(self, fraction_field, dim, bound, prec, normalize=True)
11311166

1167+
# When R is a field
11321168
if field_type:
1133-
# For imaginary quadratic field
1169+
# For checking whether R is imaginary quadratic field
11341170
r1, r2 = R.signature()
11351171
r = r1 + r2 - 1
11361172

0 commit comments

Comments
 (0)