Skip to content

Commit 2c86c69

Browse files
committed
add ._scaling_factor() for .formal()[1]
1 parent bf6aeb9 commit 2c86c69

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

src/sage/schemes/elliptic_curves/ell_curve_isogeny.py

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

2771+
def _scaling_factor(self):
2772+
r"""
2773+
Return ``self.formal()[1]``, but faster.
2774+
2775+
EXAMPLES::
2776+
2777+
sage: E = EllipticCurve(GF(257^2), [0,1])
2778+
sage: phi = E.isogeny(E.lift_x(240))
2779+
sage: phi.degree()
2780+
43
2781+
sage: phi._scaling_factor()
2782+
1
2783+
sage: phi.dual()._scaling_factor()
2784+
43
2785+
2786+
ALGORITHM: The "inner" isogeny is normalized by construction,
2787+
so we only need to account for the scaling factors of a pre-
2788+
and post-isomorphism.
2789+
"""
2790+
sc = Integer(1)
2791+
if self.__pre_isomorphism is not None:
2792+
sc *= self.__pre_isomorphism._scaling_factor()
2793+
if self.__post_isomorphism is not None:
2794+
sc *= self.__post_isomorphism._scaling_factor()
2795+
return sc
2796+
27712797
def kernel_polynomial(self):
27722798
r"""
27732799
Return the kernel polynomial of this isogeny.

src/sage/schemes/elliptic_curves/hom_composite.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,25 @@ def formal(self, prec=20):
765765
res = res(phi.formal(prec=prec))
766766
return res
767767

768+
def _scaling_factor(self):
769+
r"""
770+
Return ``self.formal()[1]``, but faster.
771+
772+
EXAMPLES::
773+
774+
sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite
775+
sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism
776+
sage: E = EllipticCurve(GF(65537), [1,2,3,4,5])
777+
sage: P = E.lift_x(7321)
778+
sage: phi = EllipticCurveHom_composite(E, P)
779+
sage: phi = WeierstrassIsomorphism(phi.codomain(), [7,8,9,10]) * phi
780+
sage: phi.formal()
781+
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()
783+
7
784+
"""
785+
return prod(phi._scaling_factor() for phi in self._phis)
786+
768787
def is_injective(self):
769788
"""
770789
Determine whether this composite morphism has trivial kernel.

src/sage/schemes/elliptic_curves/weierstrass_morphism.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,3 +898,16 @@ def __neg__(self):
898898
w = baseWI(-1, 0, -a1, -a3)
899899
urst = baseWI.__mul__(self, w).tuple()
900900
return WeierstrassIsomorphism(self._domain, urst, self._codomain)
901+
902+
def _scaling_factor(self):
903+
r"""
904+
Return ``self.formal()[1]``, but faster.
905+
906+
EXAMPLES::
907+
908+
sage: E = EllipticCurve(QQbar, [0,1])
909+
sage: all(f._scaling_factor() == f.formal()[1] for f in E.automorphisms())
910+
True
911+
"""
912+
return self.u
913+

0 commit comments

Comments
 (0)