@@ -915,6 +915,18 @@ def normalize_coordinates(self, **kwds):
915
915
3-adic Field with capped relative precision 20
916
916
Defn: Defined on coordinates by sending (x : y) to
917
917
(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)
918
930
"""
919
931
# if ideal or valuation is specified, we scale according the norm defined by the ideal/valuation
920
932
ideal = kwds .pop ('ideal' , None )
@@ -967,12 +979,32 @@ def normalize_coordinates(self, **kwds):
967
979
self .scale_by (uniformizer ** (- 1 * min_val ))
968
980
return
969
981
970
- # clear any denominators from the coefficients
982
+ R = self .domain ().base_ring ()
983
+ K = self .base_ring ()
971
984
N = self .codomain ().ambient_space ().dimension_relative () + 1
972
- LCM = lcm ([self [i ].denominator () for i in range (N )])
973
- self .scale_by (LCM )
974
985
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 ))
976
1008
977
1009
# There are cases, such as the example above over GF(7),
978
1010
# where we want to compute GCDs, but NOT in the case
0 commit comments