|
87 | 87 | from sage.rings.polynomial.multi_polynomial_ring import is_MPolynomialRing
|
88 | 88 | from sage.rings.polynomial.polynomial_ring import is_PolynomialRing
|
89 | 89 | 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 |
91 | 92 |
|
92 | 93 | from sage.categories.fields import Fields
|
93 | 94 | from sage.categories.rings import Rings
|
@@ -1096,8 +1097,24 @@ def points_of_bounded_height(self, **kwds):
|
1096 | 1097 | sage: sorted(list(P.points_of_bounded_height(bound=1)))
|
1097 | 1098 | [(-1 : 1), (-3/2*a - 1/2 : 1), (3/2*a - 1/2 : 1), (0 : 1),
|
1098 | 1099 | (-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 | + [] |
1099 | 1115 | """
|
1100 | 1116 | from sage.schemes.projective.proj_bdd_height import (
|
| 1117 | + ZZ_points_of_bounded_height, |
1101 | 1118 | QQ_points_of_bounded_height,
|
1102 | 1119 | IQ_points_of_bounded_height,
|
1103 | 1120 | points_of_bounded_height
|
@@ -1125,12 +1142,31 @@ def points_of_bounded_height(self, **kwds):
|
1125 | 1142 |
|
1126 | 1143 | dim = self.dimension_relative()
|
1127 | 1144 |
|
1128 |
| - # TODO bug, no `signature` for `order` |
| 1145 | + # When R is the ring of integers |
1129 | 1146 | 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) |
1131 | 1166 |
|
| 1167 | + # When R is a field |
1132 | 1168 | if field_type:
|
1133 |
| - # For imaginary quadratic field |
| 1169 | + # For checking whether R is imaginary quadratic field |
1134 | 1170 | r1, r2 = R.signature()
|
1135 | 1171 | r = r1 + r2 - 1
|
1136 | 1172 |
|
|
0 commit comments