Skip to content

Commit fb571d3

Browse files
committed
turn .scaling_factor() into a public function
1 parent 2e88ff0 commit fb571d3

File tree

4 files changed

+76
-21
lines changed

4 files changed

+76
-21
lines changed

src/sage/schemes/elliptic_curves/ell_curve_isogeny.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2768,19 +2768,26 @@ def x_rational_map(self):
27682768
self.__initialize_rational_maps()
27692769
return self.__X_coord_rational_map
27702770

2771-
def _scaling_factor(self):
2771+
def scaling_factor(self):
27722772
r"""
2773-
Return ``self.formal()[1]``, but faster.
2773+
Return the Weierstrass scaling factor associated to this
2774+
elliptic-curve isogeny.
2775+
2776+
The scaling factor is the constant `u` (in the base field)
2777+
such that `\varphi^* \omega_2 = u \omega_1`, where
2778+
`\varphi: E_1\to E_2` is this isogeny and `\omega_i` are
2779+
the standard Weierstrass differentials on `E_i` defined by
2780+
`\mathrm dx/(2y+a_1x+a_3)`.
27742781
27752782
EXAMPLES::
27762783
27772784
sage: E = EllipticCurve(GF(257^2), [0,1])
27782785
sage: phi = E.isogeny(E.lift_x(240))
27792786
sage: phi.degree()
27802787
43
2781-
sage: phi._scaling_factor()
2788+
sage: phi.scaling_factor()
27822789
1
2783-
sage: phi.dual()._scaling_factor()
2790+
sage: phi.dual().scaling_factor()
27842791
43
27852792
27862793
ALGORITHM: The "inner" isogeny is normalized by construction,
@@ -2789,9 +2796,9 @@ def _scaling_factor(self):
27892796
"""
27902797
sc = Integer(1)
27912798
if self.__pre_isomorphism is not None:
2792-
sc *= self.__pre_isomorphism._scaling_factor()
2799+
sc *= self.__pre_isomorphism.scaling_factor()
27932800
if self.__post_isomorphism is not None:
2794-
sc *= self.__post_isomorphism._scaling_factor()
2801+
sc *= self.__post_isomorphism.scaling_factor()
27952802
return sc
27962803

27972804
def kernel_polynomial(self):
@@ -3346,7 +3353,7 @@ def dual(self):
33463353

33473354
# trac 7096
33483355
# this should take care of the case when the isogeny is not normalized.
3349-
u = self._scaling_factor()
3356+
u = self.scaling_factor()
33503357
isom = WeierstrassIsomorphism(E2pr, (u/F(d), 0, 0, 0))
33513358

33523359
E2 = isom.codomain()
@@ -3369,7 +3376,7 @@ def dual(self):
33693376
# the composition has the degree as a leading coefficient in
33703377
# the formal expansion.
33713378

3372-
phihat_sc = phi_hat._scaling_factor()
3379+
phihat_sc = phi_hat.scaling_factor()
33733380

33743381
sc = u * phihat_sc/F(d)
33753382

src/sage/schemes/elliptic_curves/hom.py

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,36 @@ def x_rational_map(self):
266266
raise NotImplementedError('children must implement')
267267

268268

269+
def scaling_factor(self):
270+
r"""
271+
Return the Weierstrass scaling factor associated to this
272+
elliptic-curve morphism.
273+
274+
The scaling factor is the constant `u` (in the base field)
275+
such that `\varphi^* \omega_2 = u \omega_1`, where
276+
`\varphi: E_1\to E_2` is this morphism and `\omega_i` are
277+
the standard Weierstrass differentials on `E_i` defined by
278+
`\mathrm dx/(2y+a_1x+a_3)`.
279+
280+
Implemented by child classes. For examples, see:
281+
282+
- :meth:`EllipticCurveIsogeny.scaling_factor`
283+
- :meth:`sage.schemes.elliptic_curves.weierstrass_morphism.WeierstrassIsomorphism.scaling_factor`
284+
- :meth:`sage.schemes.elliptic_curves.hom_composite.EllipticCurveHom_composite.scaling_factor`
285+
286+
TESTS::
287+
288+
sage: from sage.schemes.elliptic_curves.hom import EllipticCurveHom
289+
sage: EllipticCurveHom.scaling_factor(None)
290+
Traceback (most recent call last):
291+
...
292+
NotImplementedError: ...
293+
"""
294+
#TODO: could have a default implementation that simply
295+
# returns .formal()[1], but it seems safer to fail
296+
# visibly to make sure we would notice regressions
297+
raise NotImplementedError('children must implement')
298+
269299
def formal(self, prec=20):
270300
r"""
271301
Return the formal isogeny associated to this elliptic-curve
@@ -326,11 +356,6 @@ def is_normalized(self):
326356
`\omega_2` are the invariant differentials on `E_1` and
327357
`E_2` corresponding to the given equation.
328358
329-
ALGORITHM:
330-
331-
The method checks if the leading term of the formal series
332-
associated to this isogeny equals `1`.
333-
334359
EXAMPLES::
335360
336361
sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism
@@ -393,8 +418,10 @@ def is_normalized(self):
393418
sage: phi = isom * phi
394419
sage: phi.is_normalized()
395420
True
421+
422+
ALGORITHM: We check if :meth:`scaling_factor` returns `1`.
396423
"""
397-
return self._scaling_factor() == 1
424+
return self.scaling_factor() == 1
398425

399426

400427
def is_separable(self):

src/sage/schemes/elliptic_curves/hom_composite.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -765,9 +765,16 @@ def formal(self, prec=20):
765765
res = res(phi.formal(prec=prec))
766766
return res
767767

768-
def _scaling_factor(self):
768+
def scaling_factor(self):
769769
r"""
770-
Return ``self.formal()[1]``, but faster.
770+
Return the Weierstrass scaling factor associated to this
771+
composite morphism.
772+
773+
The scaling factor is the constant `u` (in the base field)
774+
such that `\varphi^* \omega_2 = u \omega_1`, where
775+
`\varphi: E_1\to E_2` is this morphism and `\omega_i` are
776+
the standard Weierstrass differentials on `E_i` defined by
777+
`\mathrm dx/(2y+a_1x+a_3)`.
771778
772779
EXAMPLES::
773780
@@ -779,10 +786,14 @@ def _scaling_factor(self):
779786
sage: phi = WeierstrassIsomorphism(phi.codomain(), [7,8,9,10]) * phi
780787
sage: phi.formal()
781788
7*t + 65474*t^2 + 511*t^3 + 61316*t^4 + 20548*t^5 + 45511*t^6 + 37285*t^7 + 48414*t^8 + 9022*t^9 + 24025*t^10 + 35986*t^11 + 55397*t^12 + 25199*t^13 + 18744*t^14 + 46142*t^15 + 9078*t^16 + 18030*t^17 + 47599*t^18 + 12158*t^19 + 50630*t^20 + 56449*t^21 + 43320*t^22 + O(t^23)
782-
sage: phi._scaling_factor()
789+
sage: phi.scaling_factor()
783790
7
791+
792+
ALGORITHM: The scaling factor is multiplicative under
793+
composition, so we return the product of the individual
794+
scaling factors associated to each factor.
784795
"""
785-
return prod(phi._scaling_factor() for phi in self._phis)
796+
return prod(phi.scaling_factor() for phi in self._phis)
786797

787798
def is_injective(self):
788799
"""

src/sage/schemes/elliptic_curves/weierstrass_morphism.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -899,15 +899,25 @@ def __neg__(self):
899899
urst = baseWI.__mul__(self, w).tuple()
900900
return WeierstrassIsomorphism(self._domain, urst, self._codomain)
901901

902-
def _scaling_factor(self):
902+
def scaling_factor(self):
903903
r"""
904-
Return ``self.formal()[1]``, but faster.
904+
Return the Weierstrass scaling factor associated to this
905+
Weierstrass isomorphism.
906+
907+
The scaling factor is the constant `u` (in the base field)
908+
such that `\varphi^* \omega_2 = u \omega_1`, where
909+
`\varphi: E_1\to E_2` is this isomorphism and `\omega_i` are
910+
the standard Weierstrass differentials on `E_i` defined by
911+
`\mathrm dx/(2y+a_1x+a_3)`.
905912
906913
EXAMPLES::
907914
908915
sage: E = EllipticCurve(QQbar, [0,1])
909-
sage: all(f._scaling_factor() == f.formal()[1] for f in E.automorphisms())
916+
sage: all(f.scaling_factor() == f.formal()[1] for f in E.automorphisms())
910917
True
918+
919+
ALGORITHM: The scaling factor equals the `u` component of
920+
the tuple `(u,r,s,t)` defining the isomorphism.
911921
"""
912922
return self.u
913923

0 commit comments

Comments
 (0)