Skip to content

Commit 89fde7a

Browse files
committed
projective_morphism.py: Restore LCM for elts not in number fields and create the right ideals for a list of polys
1 parent 50205e1 commit 89fde7a

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

src/sage/schemes/projective/projective_morphism.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,19 @@ def normalize_coordinates(self, **kwds):
926926
Dynamical System of Projective Space of dimension 1 over
927927
Number Field in a with defining polynomial 3*x^2 + 1
928928
Defn: Defined on coordinates by sending (z : w) to
929-
((3*a)*z^2 + (3*a)*w^2 : z*w)
929+
((-3/2*a + 1/2)*z^2 + (-3/2*a + 1/2)*w^2 : (-3/2*a - 3/2)*z*w)
930+
931+
::
932+
933+
sage: R.<a,b> = QQ[]
934+
sage: P.<x,y,z> = ProjectiveSpace(FractionField(R), 2)
935+
sage: H = End(P)
936+
sage: f = H([a/b*(x*z + y^2)*x^2, a*b*(x*z + y^2)*y^2, a*(x*z + y^2)*z^2])
937+
sage: f.normalize_coordinates(); f
938+
Scheme endomorphism of Projective Space of dimension 2 over Fraction
939+
Field of Multivariate Polynomial Ring in a, b over Rational Field
940+
Defn: Defined on coordinates by sending (x : y : z) to
941+
(x^2 : (b^2)*y^2 : b*z^2)
930942
"""
931943
# If ideal or valuation is specified, we scale according the norm
932944
# defined by the ideal/valuation
@@ -981,18 +993,22 @@ def normalize_coordinates(self, **kwds):
981993
self.scale_by(uniformizer**(-1 * min_val))
982994
return
983995

996+
N = self.codomain().ambient_space().dimension_relative() + 1
997+
984998
R = self.domain().base_ring()
985999

986-
# Only clear denominators from the coefficients in the ring of integers
1000+
# Clear any denominators from the coefficients
9871001
if R in NumberFields():
9881002
O = R.maximal_order()
9891003

9901004
if O is ZZ:
991-
denom = lcm([self[i].denominator() for i in range(len(list(self)))])
1005+
denom = lcm([self[i].denominator() for i in range(N)])
9921006
else:
993-
denom = R.ideal(list(self)).absolute_norm().denominator()
1007+
denom = R.ideal([c for poly in self for c in poly.coefficients()]).norm().denominator()
9941008

9951009
self.scale_by(denom)
1010+
else:
1011+
self.scale_by(lcm([self[i].denominator() for i in range(N)]))
9961012

9971013
# There are cases, such as the example above over GF(7),
9981014
# where we want to compute GCDs, but NOT in the case
@@ -1007,8 +1023,6 @@ def normalize_coordinates(self, **kwds):
10071023
GCD = gcd(self[0], self[1])
10081024
index = 2
10091025

1010-
N = self.codomain().ambient_space().dimension_relative() + 1
1011-
10121026
while GCD != 1 and index < N:
10131027
GCD = gcd(GCD, self[index])
10141028
index += +1

0 commit comments

Comments
 (0)