Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make _multiple_x_*() methods work for all n≠0 #35035

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions src/sage/schemes/elliptic_curves/ell_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1991,6 +1991,14 @@ def _multiple_x_numerator(self, n, x=None):

EXAMPLES::

sage: E = EllipticCurve([1,2])
sage: E._multiple_x_numerator(3)
x^9 - 12*x^7 - 192*x^6 + 30*x^5 - 48*x^4 + 228*x^3 + 96*x^2 + 393*x + 528
sage: E._multiple_x_numerator(-3)
x^9 - 12*x^7 - 192*x^6 + 30*x^5 - 48*x^4 + 228*x^3 + 96*x^2 + 393*x + 528

::

sage: E = EllipticCurve("37a")
sage: P = E.gens()[0]
sage: x = P[0]
Expand Down Expand Up @@ -2043,9 +2051,9 @@ def _multiple_x_numerator(self, n, x=None):
sage: E._multiple_x_numerator(5)
x^25 + 65037*x^23 + 55137*x^22 + ... + 813*x^2 + 10220*x + 42539
"""
n = rings.Integer(n)
if n < 2:
raise ValueError("n must be at least 2")
n = rings.Integer(n).abs()
if not n:
raise ValueError("n must be nonzero")

if x is None:
try:
Expand All @@ -2061,6 +2069,9 @@ def _multiple_x_numerator(self, n, x=None):
cache = None
xx = x

if n == 1:
return xx

polys = self.division_polynomial_0([-2,-1,n-1,n,n+1], x)

if n % 2 == 0:
Expand Down Expand Up @@ -2101,6 +2112,14 @@ def _multiple_x_denominator(self, n, x=None):

EXAMPLES::

sage: E = EllipticCurve([1,2])
sage: E._multiple_x_denominator(3)
9*x^8 + 36*x^6 + 144*x^5 + 30*x^4 + 288*x^3 + 564*x^2 - 48*x + 1
sage: E._multiple_x_denominator(-3)
9*x^8 + 36*x^6 + 144*x^5 + 30*x^4 + 288*x^3 + 564*x^2 - 48*x + 1

::

sage: E = EllipticCurve("43a")
sage: P = E.gens()[0]
sage: x = P[0]
Expand Down Expand Up @@ -2128,9 +2147,9 @@ def _multiple_x_denominator(self, n, x=None):
sage: E._multiple_x_denominator(5)
25*x^24 + 3100*x^22 + 19000*x^21 + ... + 24111*x^2 + 52039*x + 56726
"""
n = rings.Integer(n)
if n < 2:
raise ValueError("n must be at least 2")
n = rings.Integer(n).abs()
if not n:
raise ValueError("n must be nonzero")

if x is None:
try:
Expand Down