Skip to content

Commit 8493ce2

Browse files
committed
projective_morphism.py: First impl for LCM in normalize_coordinates
1 parent 3230f00 commit 8493ce2

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

src/sage/schemes/projective/projective_morphism.py

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,18 @@ def normalize_coordinates(self, **kwds):
915915
3-adic Field with capped relative precision 20
916916
Defn: Defined on coordinates by sending (x : y) to
917917
(x^2 + (2 + O(3^20))*y^2 : (3 + O(3^21))*x*y)
918+
919+
::
920+
921+
sage: R.<x> = QQ[]
922+
sage: K.<a> = NumberField(3*x^2 + 1)
923+
sage: P.<z,w> = ProjectiveSpace(K, 1)
924+
sage: f = DynamicalSystem_projective([a*(z^2 + w^2), z*w])
925+
sage: f.normalize_coordinates(); f
926+
Dynamical System of Projective Space of dimension 1 over
927+
Number Field in a with defining polynomial 3*x^2 + 1
928+
Defn: Defined on coordinates by sending (z : w) to
929+
((3*a)*z^2 + (3*a)*w^2 : z*w)
918930
"""
919931
# if ideal or valuation is specified, we scale according the norm defined by the ideal/valuation
920932
ideal = kwds.pop('ideal', None)
@@ -967,12 +979,32 @@ def normalize_coordinates(self, **kwds):
967979
self.scale_by(uniformizer**(-1 * min_val))
968980
return
969981

970-
# clear any denominators from the coefficients
982+
R = self.domain().base_ring()
983+
K = self.base_ring()
971984
N = self.codomain().ambient_space().dimension_relative() + 1
972-
LCM = lcm([self[i].denominator() for i in range(N)])
973-
self.scale_by(LCM)
974985

975-
R = self.domain().base_ring()
986+
# Only clear denominators from the coefficients in the ring of integers
987+
if R in NumberFields():
988+
denom_list = []
989+
990+
for entry in self:
991+
if entry == 0:
992+
continue
993+
994+
O = R.maximal_order()
995+
996+
if O is ZZ:
997+
denom_list.append(entry.denominator())
998+
elif is_NumberFieldOrder(O):
999+
frac_ideal = O.fractional_ideal(entry)
1000+
if K.is_relative():
1001+
frac_ideal_norm = frac_ideal.absolute_norm()
1002+
else:
1003+
frac_ideal_norm = frac_ideal.norm()
1004+
1005+
denom_list.append(frac_ideal_norm.denominator())
1006+
1007+
self.scale_by(lcm(denom_list))
9761008

9771009
# There are cases, such as the example above over GF(7),
9781010
# where we want to compute GCDs, but NOT in the case

0 commit comments

Comments
 (0)