-
-
Notifications
You must be signed in to change notification settings - Fork 553
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trac #34644: minor details in schemes
some about E241 and E502 URL: https://trac.sagemath.org/34644 Reported by: chapoton Ticket author(s): Frédéric Chapoton Reviewer(s): Travis Scrimshaw
- Loading branch information
Showing
4 changed files
with
72 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,15 +6,13 @@ | |
- David Kohel (2006): initial version | ||
- Anna Somoza (2019-04): dynamic class creation | ||
""" | ||
|
||
#***************************************************************************** | ||
# **************************************************************************** | ||
# Copyright (C) 2006 David Kohel <[email protected]> | ||
# 2019 Anna Somoza <[email protected]> | ||
# Distributed under the terms of the GNU General Public License (GPL) | ||
# http://www.gnu.org/licenses/ | ||
#***************************************************************************** | ||
# https://www.gnu.org/licenses/ | ||
# **************************************************************************** | ||
|
||
from sage.schemes.projective.projective_space import ProjectiveSpace | ||
|
||
|
@@ -31,6 +29,7 @@ | |
|
||
from sage.structure.dynamic_class import dynamic_class | ||
|
||
|
||
def HyperellipticCurve(f, h=0, names=None, PP=None, check_squarefree=True): | ||
r""" | ||
Returns the hyperelliptic curve `y^2 + h y = f`, for | ||
|
@@ -216,40 +215,39 @@ def HyperellipticCurve(f, h=0, names=None, PP=None, check_squarefree=True): | |
if P(2) == 0: | ||
# characteristic 2 | ||
if h == 0: | ||
raise ValueError("In characteristic 2, argument h (= %s) must be non-zero."%h) | ||
raise ValueError("In characteristic 2, argument h (= %s) must be non-zero." % h) | ||
if h[g+1] == 0 and f[2*g+1]**2 == f[2*g+2]*h[g]**2: | ||
raise ValueError("Not a hyperelliptic curve: " \ | ||
"highly singular at infinity.") | ||
raise ValueError("Not a hyperelliptic curve: " | ||
"highly singular at infinity.") | ||
should_be_coprime = [h, f*h.derivative()**2+f.derivative()**2] | ||
else: | ||
# characteristic not 2 | ||
if not F.degree() in [2*g+1, 2*g+2]: | ||
raise ValueError("Not a hyperelliptic curve: " \ | ||
"highly singular at infinity.") | ||
raise ValueError("Not a hyperelliptic curve: " | ||
"highly singular at infinity.") | ||
should_be_coprime = [F, F.derivative()] | ||
try: | ||
smooth = should_be_coprime[0].gcd(should_be_coprime[1]).degree()==0 | ||
smooth = should_be_coprime[0].gcd(should_be_coprime[1]).degree() == 0 | ||
except (AttributeError, NotImplementedError, TypeError): | ||
try: | ||
smooth = should_be_coprime[0].resultant(should_be_coprime[1])!=0 | ||
smooth = should_be_coprime[0].resultant(should_be_coprime[1]) != 0 | ||
except (AttributeError, NotImplementedError, TypeError): | ||
raise NotImplementedError("Cannot determine whether " \ | ||
"polynomials %s have a common root. Use " \ | ||
"check_squarefree=False to skip this check." % \ | ||
raise NotImplementedError("Cannot determine whether " | ||
"polynomials %s have a common root. Use " | ||
"check_squarefree=False to skip this check." % | ||
should_be_coprime) | ||
if not smooth: | ||
raise ValueError("Not a hyperelliptic curve: " \ | ||
"singularity in the provided affine patch.") | ||
raise ValueError("Not a hyperelliptic curve: " | ||
"singularity in the provided affine patch.") | ||
R = P.base_ring() | ||
PP = ProjectiveSpace(2, R) | ||
if names is None: | ||
names = ["x","y"] | ||
names = ["x", "y"] | ||
|
||
superclass = [] | ||
cls_name = ["HyperellipticCurve"] | ||
|
||
genus_classes = { | ||
2 : HyperellipticCurve_g2} | ||
genus_classes = {2: HyperellipticCurve_g2} | ||
|
||
is_pAdicField = lambda x: isinstance(x, sage.rings.abc.pAdicField) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters