From 0fc0bc5db03bf099a8ef47c29d3c5b8c0fe10873 Mon Sep 17 00:00:00 2001 From: Daniel Bump <75940445+dwbmscz@users.noreply.github.com> Date: Wed, 1 Mar 2023 22:02:40 -0800 Subject: [PATCH 001/135] SmallPermutationGroups --- src/sage/groups/perm_gps/all.py | 2 +- src/sage/groups/perm_gps/permgroup.py | 2 + src/sage/groups/perm_gps/permgroup_named.py | 70 +++++++++++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-) diff --git a/src/sage/groups/perm_gps/all.py b/src/sage/groups/perm_gps/all.py index 83afad7c691..ae405f298a2 100644 --- a/src/sage/groups/perm_gps/all.py +++ b/src/sage/groups/perm_gps/all.py @@ -6,7 +6,7 @@ MathieuGroup, KleinFourGroup, QuaternionGroup, PrimitiveGroup, PrimitiveGroups, SuzukiGroup, TransitiveGroups, - GeneralDihedralGroup) + GeneralDihedralGroup, SmallPermutationGroup) from .permgroup import PermutationGroup, PermutationGroup_generic, PermutationGroup_subgroup, direct_product_permgroups diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py index a7372d3d77e..81ed1d5308e 100644 --- a/src/sage/groups/perm_gps/permgroup.py +++ b/src/sage/groups/perm_gps/permgroup.py @@ -247,6 +247,8 @@ def from_gap_list(G, src): """ # src is a list of strings, each of which is a permutation of # integers in cycle notation. It may contain \n and spaces. + if G is None: + return [eval(("[%s]"%g).replace(" ","").replace("\n","").replace(")(","),(")) for g in src] src = [str(g)[1:].split(")(") for g in str(src).replace(" ","").replace("\n","")[1:-2].split("),")] diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index 0381e1912a1..95cfa94a82c 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -61,6 +61,8 @@ -- ComplexReflectionGroup, the complex reflection group `G(m, p, n)` or the exceptional complex reflection group `G_m` +-- SmallPermutationGroup, a permutation realization of an group specified by its GAP id. + AUTHOR: - David Joyner (2007-06): split from permgp.py (suggested by Nick Alexander) @@ -87,7 +89,9 @@ from pathlib import Path from sage.rings.all import Integer +from sage.interfaces.gap import gap from sage.libs.gap.libgap import libgap +from sage.groups.perm_gps.permgroup import from_gap_list from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF from sage.arith.all import factor, valuation from sage.groups.abelian_gps.abelian_group import AbelianGroup @@ -3435,3 +3439,69 @@ def codegrees(self): ret = [self._m * i for i in reversed(range(self._n-1))] ret.append((self._n-1)*self._m - self._n) return tuple(sorted(ret, reverse=True)) + +class SmallPermutationGroup(PermutationGroup_unique): + def __init__(self, order, gap_id): + r""" + A GAP SmallGroup, returned as a permutation group. GAP + contains a database of groups, identified by a GAP id, + a pair ``[n,k]`` consisting of ``n``, the order of the + group, and ``k``, an index determining the group + specifically. This class can construct the group + as a permutation group from this data. + + INPUT: + + - ``order`` -- the order of the group + + - ``gap_id`` -- the numerical index in the GAP Id of the group + + EXAMPLES:: + + sage: G = SmallPermutationGroup(12,4); G + Group of order 12 and GAP Id 4 as a permutation group + sage: G.gens() + ((1,2)(3,5)(4,10)(6,8)(7,12)(9,11), + (1,3)(2,5)(4,7)(6,9)(8,11)(10,12), + (1,4,8)(2,6,10)(3,7,11)(5,9,12)) + sage: G.character_table() + [ 1 1 1 1 1 1] + [ 1 -1 -1 1 1 -1] + [ 1 -1 1 1 -1 1] + [ 1 1 -1 1 -1 -1] + [ 2 0 -2 -1 0 1] + [ 2 0 2 -1 0 -1] + sage: all(SmallPermutationGroup(n,k).id()==[n,k] for n in [1..64] for k in [1..oeis(1)[n]]) + True + """ + self._order = order + self._gap_id = gap_id + self._gap_small_group = gap.SmallGroup(order,gap_id) + self._gap_permutation_group = self._gap_small_group.IsomorphismPermGroup().Image() + gens = from_gap_list(None, self._gap_permutation_group.GeneratorsOfGroup()) + PermutationGroup_generic.__init__(self, gens, self._gap_permutation_group.NrMovedPoints()) + + def _repr_(self): + r""" + EXAMPLES:: + + sage: G = SmallPermutationGroup(12,4); G + Group of order 12 and GAP Id 4 as a permutation group + """ + return "Group of order %s and GAP Id %s as a permutation group"%(self._order, self._gap_id) + + def gap_small_group(self): + r""" + Gap realizes some small groups as PermutationGroup, others as PcGroups + (polycyclic groups). The :class:`SmallPermutationGroup` class always + returns a PermutationGroup, but in the process of creating this group + a gap SmallGroup is generated. This method returns that group. + + EXAMPLES:: + + sage: SmallPermutationGroup(168,41).gap_small_group() + Group( [ f1, f2, f3, f4, f5 ] ) + sage: SmallPermutationGroup(168,42).gap_small_group() + Group( [ (3,4)(5,6), (1,2,3)(4,5,7) ] ) + """ + return self._gap_small_group From b8eacecb2f0013a5d6245ecfa273d17e9db3e3b2 Mon Sep 17 00:00:00 2001 From: Daniel Bump <75940445+dwbmscz@users.noreply.github.com> Date: Thu, 2 Mar 2023 11:18:49 -0800 Subject: [PATCH 002/135] added doctest that is broken if we change to libgap --- src/sage/groups/perm_gps/permgroup_named.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index 95cfa94a82c..514b6efe293 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -3440,7 +3440,7 @@ def codegrees(self): ret.append((self._n-1)*self._m - self._n) return tuple(sorted(ret, reverse=True)) -class SmallPermutationGroup(PermutationGroup_unique): +class SmallPermutationGroup(PermutationGroup_generic): def __init__(self, order, gap_id): r""" A GAP SmallGroup, returned as a permutation group. GAP @@ -3473,10 +3473,18 @@ def __init__(self, order, gap_id): [ 2 0 2 -1 0 -1] sage: all(SmallPermutationGroup(n,k).id()==[n,k] for n in [1..64] for k in [1..oeis(1)[n]]) True + sage: H = SmallPermutationGroup(6,1) + sage: H.is_abelian() + False + sage: [H.centralizer(g) for g in H.conjugacy_classes_representatives()] + [Subgroup generated by [(1,2)(3,6)(4,5), (1,3,5)(2,4,6)] of (Group of order 6 and GAP Id 1 as a permutation group), + Subgroup generated by [(1,2)(3,6)(4,5)] of (Group of order 6 and GAP Id 1 as a permutation group), + Subgroup generated by [(1,3,5)(2,4,6), (1,5,3)(2,6,4)] of (Group of order 6 and GAP Id 1 as a permutation group)] """ self._order = order self._gap_id = gap_id self._gap_small_group = gap.SmallGroup(order,gap_id) + # self._gap_small_group = libgap.SmallGroup(order,gap_id) # Change requested by Dima self._gap_permutation_group = self._gap_small_group.IsomorphismPermGroup().Image() gens = from_gap_list(None, self._gap_permutation_group.GeneratorsOfGroup()) PermutationGroup_generic.__init__(self, gens, self._gap_permutation_group.NrMovedPoints()) From 353abd4bfdaf671fcedff91edeab9e285886d0a4 Mon Sep 17 00:00:00 2001 From: Daniel Bump <75940445+dwbmscz@users.noreply.github.com> Date: Wed, 1 Mar 2023 22:02:40 -0800 Subject: [PATCH 003/135] SmallPermutationGroups --- src/sage/groups/perm_gps/all.py | 2 +- src/sage/groups/perm_gps/permgroup.py | 2 + src/sage/groups/perm_gps/permgroup_named.py | 70 +++++++++++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-) diff --git a/src/sage/groups/perm_gps/all.py b/src/sage/groups/perm_gps/all.py index 83afad7c691..ae405f298a2 100644 --- a/src/sage/groups/perm_gps/all.py +++ b/src/sage/groups/perm_gps/all.py @@ -6,7 +6,7 @@ MathieuGroup, KleinFourGroup, QuaternionGroup, PrimitiveGroup, PrimitiveGroups, SuzukiGroup, TransitiveGroups, - GeneralDihedralGroup) + GeneralDihedralGroup, SmallPermutationGroup) from .permgroup import PermutationGroup, PermutationGroup_generic, PermutationGroup_subgroup, direct_product_permgroups diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py index a7372d3d77e..81ed1d5308e 100644 --- a/src/sage/groups/perm_gps/permgroup.py +++ b/src/sage/groups/perm_gps/permgroup.py @@ -247,6 +247,8 @@ def from_gap_list(G, src): """ # src is a list of strings, each of which is a permutation of # integers in cycle notation. It may contain \n and spaces. + if G is None: + return [eval(("[%s]"%g).replace(" ","").replace("\n","").replace(")(","),(")) for g in src] src = [str(g)[1:].split(")(") for g in str(src).replace(" ","").replace("\n","")[1:-2].split("),")] diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index 0381e1912a1..95cfa94a82c 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -61,6 +61,8 @@ -- ComplexReflectionGroup, the complex reflection group `G(m, p, n)` or the exceptional complex reflection group `G_m` +-- SmallPermutationGroup, a permutation realization of an group specified by its GAP id. + AUTHOR: - David Joyner (2007-06): split from permgp.py (suggested by Nick Alexander) @@ -87,7 +89,9 @@ from pathlib import Path from sage.rings.all import Integer +from sage.interfaces.gap import gap from sage.libs.gap.libgap import libgap +from sage.groups.perm_gps.permgroup import from_gap_list from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF from sage.arith.all import factor, valuation from sage.groups.abelian_gps.abelian_group import AbelianGroup @@ -3435,3 +3439,69 @@ def codegrees(self): ret = [self._m * i for i in reversed(range(self._n-1))] ret.append((self._n-1)*self._m - self._n) return tuple(sorted(ret, reverse=True)) + +class SmallPermutationGroup(PermutationGroup_unique): + def __init__(self, order, gap_id): + r""" + A GAP SmallGroup, returned as a permutation group. GAP + contains a database of groups, identified by a GAP id, + a pair ``[n,k]`` consisting of ``n``, the order of the + group, and ``k``, an index determining the group + specifically. This class can construct the group + as a permutation group from this data. + + INPUT: + + - ``order`` -- the order of the group + + - ``gap_id`` -- the numerical index in the GAP Id of the group + + EXAMPLES:: + + sage: G = SmallPermutationGroup(12,4); G + Group of order 12 and GAP Id 4 as a permutation group + sage: G.gens() + ((1,2)(3,5)(4,10)(6,8)(7,12)(9,11), + (1,3)(2,5)(4,7)(6,9)(8,11)(10,12), + (1,4,8)(2,6,10)(3,7,11)(5,9,12)) + sage: G.character_table() + [ 1 1 1 1 1 1] + [ 1 -1 -1 1 1 -1] + [ 1 -1 1 1 -1 1] + [ 1 1 -1 1 -1 -1] + [ 2 0 -2 -1 0 1] + [ 2 0 2 -1 0 -1] + sage: all(SmallPermutationGroup(n,k).id()==[n,k] for n in [1..64] for k in [1..oeis(1)[n]]) + True + """ + self._order = order + self._gap_id = gap_id + self._gap_small_group = gap.SmallGroup(order,gap_id) + self._gap_permutation_group = self._gap_small_group.IsomorphismPermGroup().Image() + gens = from_gap_list(None, self._gap_permutation_group.GeneratorsOfGroup()) + PermutationGroup_generic.__init__(self, gens, self._gap_permutation_group.NrMovedPoints()) + + def _repr_(self): + r""" + EXAMPLES:: + + sage: G = SmallPermutationGroup(12,4); G + Group of order 12 and GAP Id 4 as a permutation group + """ + return "Group of order %s and GAP Id %s as a permutation group"%(self._order, self._gap_id) + + def gap_small_group(self): + r""" + Gap realizes some small groups as PermutationGroup, others as PcGroups + (polycyclic groups). The :class:`SmallPermutationGroup` class always + returns a PermutationGroup, but in the process of creating this group + a gap SmallGroup is generated. This method returns that group. + + EXAMPLES:: + + sage: SmallPermutationGroup(168,41).gap_small_group() + Group( [ f1, f2, f3, f4, f5 ] ) + sage: SmallPermutationGroup(168,42).gap_small_group() + Group( [ (3,4)(5,6), (1,2,3)(4,5,7) ] ) + """ + return self._gap_small_group From a1a30847d158570b0157458d99b5690667f09111 Mon Sep 17 00:00:00 2001 From: Daniel Bump <75940445+dwbmscz@users.noreply.github.com> Date: Thu, 2 Mar 2023 11:18:49 -0800 Subject: [PATCH 004/135] added doctest that is broken if we change to libgap --- src/sage/groups/perm_gps/permgroup_named.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index 95cfa94a82c..514b6efe293 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -3440,7 +3440,7 @@ def codegrees(self): ret.append((self._n-1)*self._m - self._n) return tuple(sorted(ret, reverse=True)) -class SmallPermutationGroup(PermutationGroup_unique): +class SmallPermutationGroup(PermutationGroup_generic): def __init__(self, order, gap_id): r""" A GAP SmallGroup, returned as a permutation group. GAP @@ -3473,10 +3473,18 @@ def __init__(self, order, gap_id): [ 2 0 2 -1 0 -1] sage: all(SmallPermutationGroup(n,k).id()==[n,k] for n in [1..64] for k in [1..oeis(1)[n]]) True + sage: H = SmallPermutationGroup(6,1) + sage: H.is_abelian() + False + sage: [H.centralizer(g) for g in H.conjugacy_classes_representatives()] + [Subgroup generated by [(1,2)(3,6)(4,5), (1,3,5)(2,4,6)] of (Group of order 6 and GAP Id 1 as a permutation group), + Subgroup generated by [(1,2)(3,6)(4,5)] of (Group of order 6 and GAP Id 1 as a permutation group), + Subgroup generated by [(1,3,5)(2,4,6), (1,5,3)(2,6,4)] of (Group of order 6 and GAP Id 1 as a permutation group)] """ self._order = order self._gap_id = gap_id self._gap_small_group = gap.SmallGroup(order,gap_id) + # self._gap_small_group = libgap.SmallGroup(order,gap_id) # Change requested by Dima self._gap_permutation_group = self._gap_small_group.IsomorphismPermGroup().Image() gens = from_gap_list(None, self._gap_permutation_group.GeneratorsOfGroup()) PermutationGroup_generic.__init__(self, gens, self._gap_permutation_group.NrMovedPoints()) From a57a9c0ca0d38669491f284fe15e0d37b82cfddd Mon Sep 17 00:00:00 2001 From: Dima Pasechnik Date: Fri, 3 Mar 2023 11:21:47 +0000 Subject: [PATCH 005/135] safely compute Image as explained by @ChrisJefferson: Image(IsomorphismPermGroup(g)) doesn't return what you want (always) -- as it can return a larger group (this behaviour may be changed in a future version of GAP to what you want, but it isn't that right now -- gap-system/gap#5355 ). Instead you want to call Image(IsomorphismPermGroup(g),g) --- src/sage/groups/perm_gps/permgroup_named.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index 514b6efe293..3dc237d8fee 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -3485,7 +3485,7 @@ def __init__(self, order, gap_id): self._gap_id = gap_id self._gap_small_group = gap.SmallGroup(order,gap_id) # self._gap_small_group = libgap.SmallGroup(order,gap_id) # Change requested by Dima - self._gap_permutation_group = self._gap_small_group.IsomorphismPermGroup().Image() + self._gap_permutation_group = self._gap_small_group.IsomorphismPermGroup().Image(self._gap_small_group) gens = from_gap_list(None, self._gap_permutation_group.GeneratorsOfGroup()) PermutationGroup_generic.__init__(self, gens, self._gap_permutation_group.NrMovedPoints()) From aaad4d8e3a9b8d42955fecc9ffec407eb57ad0b0 Mon Sep 17 00:00:00 2001 From: Daniel Bump <75940445+dwbmscz@users.noreply.github.com> Date: Fri, 3 Mar 2023 10:49:46 -0800 Subject: [PATCH 006/135] pass correct parameters to libgap group __init__ --- src/sage/groups/perm_gps/permgroup_named.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index 872a09bac81..c416ff7944e 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -89,7 +89,6 @@ from pathlib import Path from sage.rings.all import Integer -from sage.interfaces.gap import gap from sage.libs.gap.libgap import libgap from sage.groups.perm_gps.permgroup import from_gap_list from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF @@ -3489,11 +3488,10 @@ def __init__(self, order, gap_id): """ self._order = order self._gap_id = gap_id - self._gap_small_group = gap.SmallGroup(order,gap_id) - # self._gap_small_group = libgap.SmallGroup(order,gap_id) # Change requested by Dima + self._gap_small_group = libgap.SmallGroup(order,gap_id) self._gap_permutation_group = self._gap_small_group.IsomorphismPermGroup().Image(self._gap_small_group) gens = from_gap_list(None, self._gap_permutation_group.GeneratorsOfGroup()) - PermutationGroup_generic.__init__(self, gens, self._gap_permutation_group.NrMovedPoints()) + PermutationGroup_generic.__init__(self, gens, self._gap_permutation_group) def _repr_(self): r""" @@ -3514,8 +3512,8 @@ def gap_small_group(self): EXAMPLES:: sage: SmallPermutationGroup(168,41).gap_small_group() - Group( [ f1, f2, f3, f4, f5 ] ) + sage: SmallPermutationGroup(168,42).gap_small_group() - Group( [ (3,4)(5,6), (1,2,3)(4,5,7) ] ) + Group([ (3,4)(5,6), (1,2,3)(4,5,7) ]) """ return self._gap_small_group From eb662ba3f967c96691a4f523c23ccc0811304cd0 Mon Sep 17 00:00:00 2001 From: Dima Pasechnik Date: Fri, 3 Mar 2023 20:01:03 +0000 Subject: [PATCH 007/135] no need to pass gens --- src/sage/groups/perm_gps/permgroup_named.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index c416ff7944e..640637ce69f 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -3490,8 +3490,7 @@ def __init__(self, order, gap_id): self._gap_id = gap_id self._gap_small_group = libgap.SmallGroup(order,gap_id) self._gap_permutation_group = self._gap_small_group.IsomorphismPermGroup().Image(self._gap_small_group) - gens = from_gap_list(None, self._gap_permutation_group.GeneratorsOfGroup()) - PermutationGroup_generic.__init__(self, gens, self._gap_permutation_group) + PermutationGroup_generic.__init__(self, gap_group=self._gap_permutation_group) def _repr_(self): r""" From c1246dd63d2626dee589ca0751262f11aa688c5c Mon Sep 17 00:00:00 2001 From: Daniel Bump <75940445+dwbmscz@users.noreply.github.com> Date: Fri, 3 Mar 2023 21:22:25 -0800 Subject: [PATCH 008/135] Changes requested by Travis Scrimshaw --- src/sage/groups/perm_gps/permgroup.py | 2 - src/sage/groups/perm_gps/permgroup_named.py | 88 ++++++++++++--------- 2 files changed, 49 insertions(+), 41 deletions(-) diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py index 81ed1d5308e..a7372d3d77e 100644 --- a/src/sage/groups/perm_gps/permgroup.py +++ b/src/sage/groups/perm_gps/permgroup.py @@ -247,8 +247,6 @@ def from_gap_list(G, src): """ # src is a list of strings, each of which is a permutation of # integers in cycle notation. It may contain \n and spaces. - if G is None: - return [eval(("[%s]"%g).replace(" ","").replace("\n","").replace(")(","),(")) for g in src] src = [str(g)[1:].split(")(") for g in str(src).replace(" ","").replace("\n","")[1:-2].split("),")] diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index 640637ce69f..bdfb604cf17 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -3440,51 +3440,59 @@ def codegrees(self): return tuple(sorted(ret, reverse=True)) class SmallPermutationGroup(PermutationGroup_generic): - def __init__(self, order, gap_id): - r""" - A GAP SmallGroup, returned as a permutation group. GAP - contains a database of groups, identified by a GAP id, - a pair ``[n,k]`` consisting of ``n``, the order of the - group, and ``k``, an index determining the group - specifically. This class can construct the group - as a permutation group from this data. + r""" + A GAP SmallGroup, returned as a permutation group. - INPUT: + GAP contains a database of groups, each identified by its GAP id. + This is a pair ``[n,k]`` consisting of ``n``, the order of the + group, and ``k``, an index determining the group specifically. + This class can construct the group as a permutation group from this data. - - ``order`` -- the order of the group + INPUT: - - ``gap_id`` -- the numerical index in the GAP Id of the group + - ``order`` -- the order of the group - Generators may be obtained through the :meth:`gens` method. - These could change for a particular group in later releases - of GAP. In many instances the degree of the constructed group - ``SmallPermutationGroup(n,k)`` will be a permutation group on - `n` letters, but this will not always be true. + - ``gap_id`` -- the numerical index in the GAP Id of the group - EXAMPLES:: + Generators may be obtained through the :meth:`gens` method. + These could change for a particular group in later releases + of GAP. In many instances the degree of the constructed group + ``SmallPermutationGroup(n,k)`` will be a permutation group on + `n` letters, but this will not always be true. - sage: G = SmallPermutationGroup(12,4); G - Group of order 12 and GAP Id 4 as a permutation group - sage: G.gens() - ((1,2)(3,5)(4,10)(6,8)(7,12)(9,11), - (1,3)(2,5)(4,7)(6,9)(8,11)(10,12), - (1,4,8)(2,6,10)(3,7,11)(5,9,12)) - sage: G.character_table() - [ 1 1 1 1 1 1] - [ 1 -1 -1 1 1 -1] - [ 1 -1 1 1 -1 1] - [ 1 1 -1 1 -1 -1] - [ 2 0 -2 -1 0 1] - [ 2 0 2 -1 0 -1] - sage: all(SmallPermutationGroup(n,k).id()==[n,k] for n in [1..64] for k in [1..oeis(1)[n]]) - True - sage: H = SmallPermutationGroup(6,1) - sage: H.is_abelian() - False - sage: [H.centralizer(g) for g in H.conjugacy_classes_representatives()] - [Subgroup generated by [(1,2)(3,6)(4,5), (1,3,5)(2,4,6)] of (Group of order 6 and GAP Id 1 as a permutation group), - Subgroup generated by [(1,2)(3,6)(4,5)] of (Group of order 6 and GAP Id 1 as a permutation group), - Subgroup generated by [(1,3,5)(2,4,6), (1,5,3)(2,6,4)] of (Group of order 6 and GAP Id 1 as a permutation group)] + EXAMPLES:: + + sage: G = SmallPermutationGroup(12,4); G + Group of order 12 and GAP Id 4 as a permutation group + sage: G.gens() + ((1,2)(3,5)(4,10)(6,8)(7,12)(9,11), + (1,3)(2,5)(4,7)(6,9)(8,11)(10,12), + (1,4,8)(2,6,10)(3,7,11)(5,9,12)) + sage: G.character_table() + [ 1 1 1 1 1 1] + [ 1 -1 -1 1 1 -1] + [ 1 -1 1 1 -1 1] + [ 1 1 -1 1 -1 -1] + [ 2 0 -2 -1 0 1] + [ 2 0 2 -1 0 -1] + sage: all(SmallPermutationGroup(n,k).id()==[n,k] for n in [1..64] for k in [1..oeis(1)[n]]) + True + sage: H = SmallPermutationGroup(6,1) + sage: H.is_abelian() + False + sage: [H.centralizer(g) for g in H.conjugacy_classes_representatives()] + [Subgroup generated by [(1,2)(3,6)(4,5), (1,3,5)(2,4,6)] of (Group of order 6 and GAP Id 1 as a permutation group), + Subgroup generated by [(1,2)(3,6)(4,5)] of (Group of order 6 and GAP Id 1 as a permutation group), + Subgroup generated by [(1,3,5)(2,4,6), (1,5,3)(2,6,4)] of (Group of order 6 and GAP Id 1 as a permutation group)] + """ + + def __init__(self, order, gap_id): + """ + Initialize ``self``. + + TESTS:: + + # sage: TestSuite(SmallPermutationGroup(60,5)).run() """ self._order = order self._gap_id = gap_id @@ -3503,6 +3511,8 @@ def _repr_(self): def gap_small_group(self): r""" + Return the GAP small group object corresponding to ``self``. + Gap realizes some small groups as PermutationGroup, others as PcGroups (polycyclic groups). The :class:`SmallPermutationGroup` class always returns a PermutationGroup, but in the process of creating this group From 89c866740bf0dac1261ad3a8e98b7f34d7e38411 Mon Sep 17 00:00:00 2001 From: Daniel Bump <75940445+dwbmscz@users.noreply.github.com> Date: Sat, 4 Mar 2023 03:47:31 -0800 Subject: [PATCH 009/135] fix underindented block --- src/sage/groups/perm_gps/permgroup_named.py | 44 ++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index bdfb604cf17..ab879e6b8dd 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -3462,28 +3462,28 @@ class SmallPermutationGroup(PermutationGroup_generic): EXAMPLES:: - sage: G = SmallPermutationGroup(12,4); G - Group of order 12 and GAP Id 4 as a permutation group - sage: G.gens() - ((1,2)(3,5)(4,10)(6,8)(7,12)(9,11), - (1,3)(2,5)(4,7)(6,9)(8,11)(10,12), - (1,4,8)(2,6,10)(3,7,11)(5,9,12)) - sage: G.character_table() - [ 1 1 1 1 1 1] - [ 1 -1 -1 1 1 -1] - [ 1 -1 1 1 -1 1] - [ 1 1 -1 1 -1 -1] - [ 2 0 -2 -1 0 1] - [ 2 0 2 -1 0 -1] - sage: all(SmallPermutationGroup(n,k).id()==[n,k] for n in [1..64] for k in [1..oeis(1)[n]]) - True - sage: H = SmallPermutationGroup(6,1) - sage: H.is_abelian() - False - sage: [H.centralizer(g) for g in H.conjugacy_classes_representatives()] - [Subgroup generated by [(1,2)(3,6)(4,5), (1,3,5)(2,4,6)] of (Group of order 6 and GAP Id 1 as a permutation group), - Subgroup generated by [(1,2)(3,6)(4,5)] of (Group of order 6 and GAP Id 1 as a permutation group), - Subgroup generated by [(1,3,5)(2,4,6), (1,5,3)(2,6,4)] of (Group of order 6 and GAP Id 1 as a permutation group)] + sage: G = SmallPermutationGroup(12,4); G + Group of order 12 and GAP Id 4 as a permutation group + sage: G.gens() + ((1,2)(3,5)(4,10)(6,8)(7,12)(9,11), + (1,3)(2,5)(4,7)(6,9)(8,11)(10,12), + (1,4,8)(2,6,10)(3,7,11)(5,9,12)) + sage: G.character_table() + [ 1 1 1 1 1 1] + [ 1 -1 -1 1 1 -1] + [ 1 -1 1 1 -1 1] + [ 1 1 -1 1 -1 -1] + [ 2 0 -2 -1 0 1] + [ 2 0 2 -1 0 -1] + sage: all(SmallPermutationGroup(n,k).id()==[n,k] for n in [1..64] for k in [1..oeis(1)[n]]) + True + sage: H = SmallPermutationGroup(6,1) + sage: H.is_abelian() + False + sage: [H.centralizer(g) for g in H.conjugacy_classes_representatives()] + [Subgroup generated by [(1,2)(3,6)(4,5), (1,3,5)(2,4,6)] of (Group of order 6 and GAP Id 1 as a permutation group), + Subgroup generated by [(1,2)(3,6)(4,5)] of (Group of order 6 and GAP Id 1 as a permutation group), + Subgroup generated by [(1,3,5)(2,4,6), (1,5,3)(2,6,4)] of (Group of order 6 and GAP Id 1 as a permutation group)] """ def __init__(self, order, gap_id): From df0d0ee947d84fcb1d78181b8e19cb12c4c7b894 Mon Sep 17 00:00:00 2001 From: Daniel Bump <75940445+dwbmscz@users.noreply.github.com> Date: Sat, 4 Mar 2023 07:28:39 -0800 Subject: [PATCH 010/135] SmallPermutationGroup attribute must not be called _order --- src/sage/groups/perm_gps/permgroup_named.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index ab879e6b8dd..4f6e2bacce2 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -3492,9 +3492,9 @@ def __init__(self, order, gap_id): TESTS:: - # sage: TestSuite(SmallPermutationGroup(60,5)).run() + sage: TestSuite(SmallPermutationGroup(60,5)).run() """ - self._order = order + self._n = order self._gap_id = gap_id self._gap_small_group = libgap.SmallGroup(order,gap_id) self._gap_permutation_group = self._gap_small_group.IsomorphismPermGroup().Image(self._gap_small_group) @@ -3507,7 +3507,7 @@ def _repr_(self): sage: G = SmallPermutationGroup(12,4); G Group of order 12 and GAP Id 4 as a permutation group """ - return "Group of order %s and GAP Id %s as a permutation group"%(self._order, self._gap_id) + return "Group of order %s and GAP Id %s as a permutation group"%(self._n, self._gap_id) def gap_small_group(self): r""" From a24642c2e05ca14cf0543630da4d3711a960fefc Mon Sep 17 00:00:00 2001 From: Daniel Bump <75940445+dwbmscz@users.noreply.github.com> Date: Sat, 4 Mar 2023 15:11:48 -0800 Subject: [PATCH 011/135] make gap_permutation_group a local variable --- src/sage/groups/perm_gps/permgroup_named.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index 4f6e2bacce2..c4165a8a58c 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -3497,8 +3497,8 @@ def __init__(self, order, gap_id): self._n = order self._gap_id = gap_id self._gap_small_group = libgap.SmallGroup(order,gap_id) - self._gap_permutation_group = self._gap_small_group.IsomorphismPermGroup().Image(self._gap_small_group) - PermutationGroup_generic.__init__(self, gap_group=self._gap_permutation_group) + gap_permutation_group = self._gap_small_group.IsomorphismPermGroup().Image(self._gap_small_group) + PermutationGroup_generic.__init__(self, gap_group=gap_permutation_group) def _repr_(self): r""" From 3a6c6ecc9e123f8d7a77738dc9e17ad3e815c309 Mon Sep 17 00:00:00 2001 From: Dima Pasechnik Date: Sun, 5 Mar 2023 09:40:55 +0000 Subject: [PATCH 012/135] remove unneeded import --- src/sage/groups/perm_gps/permgroup_named.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index c4165a8a58c..7b8c3bdaf95 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -90,7 +90,6 @@ from sage.rings.all import Integer from sage.libs.gap.libgap import libgap -from sage.groups.perm_gps.permgroup import from_gap_list from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF from sage.arith.all import factor, valuation from sage.groups.abelian_gps.abelian_group import AbelianGroup From 72cd15a887e99dfc2e780cc3f761b9cfbab212ae Mon Sep 17 00:00:00 2001 From: Daniel Bump Date: Wed, 8 Mar 2023 05:47:57 -0800 Subject: [PATCH 013/135] Update src/sage/groups/perm_gps/permgroup_named.py Docstring revision in SmallPermutationGroup: Gap -> GAP Co-authored-by: Max Horn --- src/sage/groups/perm_gps/permgroup_named.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index 7b8c3bdaf95..64bf05bc4cd 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -3512,7 +3512,7 @@ def gap_small_group(self): r""" Return the GAP small group object corresponding to ``self``. - Gap realizes some small groups as PermutationGroup, others as PcGroups + GAP realizes some small groups as PermutationGroup, others as PcGroups (polycyclic groups). The :class:`SmallPermutationGroup` class always returns a PermutationGroup, but in the process of creating this group a gap SmallGroup is generated. This method returns that group. From 93a410848368c958b737815dec6f1441b5b599f3 Mon Sep 17 00:00:00 2001 From: Daniel Bump Date: Wed, 8 Mar 2023 05:51:09 -0800 Subject: [PATCH 014/135] Update src/sage/groups/perm_gps/permgroup_named.py Docstring revision in gap_small_group method of SmallPermutationGroup: gap -> GAP Co-authored-by: Max Horn --- src/sage/groups/perm_gps/permgroup_named.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index 64bf05bc4cd..c694f716813 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -3515,7 +3515,7 @@ def gap_small_group(self): GAP realizes some small groups as PermutationGroup, others as PcGroups (polycyclic groups). The :class:`SmallPermutationGroup` class always returns a PermutationGroup, but in the process of creating this group - a gap SmallGroup is generated. This method returns that group. + a GAP SmallGroup is generated. This method returns that group. EXAMPLES:: From 29f0659fd2dd1682b3ff768d325aa18098b59426 Mon Sep 17 00:00:00 2001 From: Daniel Bump <75940445+dwbmscz@users.noreply.github.com> Date: Wed, 8 Mar 2023 05:56:20 -0800 Subject: [PATCH 015/135] Docstring revisions in SmallPermutationGroup recommended by fingolfin. --- src/sage/groups/perm_gps/permgroup_named.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index c694f716813..223b3735329 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -3442,16 +3442,18 @@ class SmallPermutationGroup(PermutationGroup_generic): r""" A GAP SmallGroup, returned as a permutation group. - GAP contains a database of groups, each identified by its GAP id. - This is a pair ``[n,k]`` consisting of ``n``, the order of the - group, and ``k``, an index determining the group specifically. - This class can construct the group as a permutation group from this data. + GAP contains a library SGL of small groups, each identified by + its GAP SmallGroup id. (MAGMA uses the same identifiers). + The GAP SmallGroup id is a pair ``[n,k]`` consisting of + ``n``, the order of the group, and ``k``, an index determining + the group specifically. This class can construct the group as a + permutation group from this data. INPUT: - ``order`` -- the order of the group - - ``gap_id`` -- the numerical index in the GAP Id of the group + - ``gap_id`` -- the numerical index in the GAP id of the group Generators may be obtained through the :meth:`gens` method. These could change for a particular group in later releases From 3589032b5fcd7291a060427a871b4c3f34b3bfb5 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 20 Mar 2023 01:16:59 -0400 Subject: [PATCH 016/135] Make `data_structures/bitset_base.pxd` use explicit integer division I had an issue when trying to compile a Cython project using Cython's `language_level` compiler directive ([see Cython docs](https://cython.readthedocs.io/en/latest/src/userguide/source_files_and_compilation.html#compiler-directives) as well as [an issue I opened](/~https://github.com/sagemath/sage/issues/34768) for more info) set to `3`, and was getting issues because Python2's `/` operator yielded floor division in this file (float division wouldn't make sense in this context), whereas in Python3 it is always float division. This commit converts the implicit floor divisions to explicit ones, so that bitsets are able to be used for Cython `language_level=3`-compiled projects. This should not cause any backwards compatibility issues either, as `//` explicitly designates floor division in both versions of Python. --- src/sage/data_structures/bitset_base.pxd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/data_structures/bitset_base.pxd b/src/sage/data_structures/bitset_base.pxd index f932e894efe..6c1d69364c9 100644 --- a/src/sage/data_structures/bitset_base.pxd +++ b/src/sage/data_structures/bitset_base.pxd @@ -174,15 +174,15 @@ cdef inline bint bitset_init(fused_bitset_t bits, mp_bitcnt_t size) except -1: bits.size = size if fused_bitset_t is bitset_t: - bits.limbs = (size - 1) / (8 * LIMB_SIZE) + 1 + bits.limbs = (size - 1) // (8 * LIMB_SIZE) + 1 bits.bits = check_calloc(bits.limbs, LIMB_SIZE) else: - bits.limbs = ((size - 1) / (8*ALIGNMENT) + 1) * (ALIGNMENT/LIMB_SIZE) + bits.limbs = ((size - 1) // (8*ALIGNMENT) + 1) * (ALIGNMENT//LIMB_SIZE) extra = (ALIGNMENT + LIMB_SIZE - 2) // LIMB_SIZE bits.mem = check_calloc(bits.limbs + extra, LIMB_SIZE) bits.bits = align(bits.mem, ALIGNMENT) bits.non_zero_chunks_are_initialized = False - bits.non_zero_chunks = check_allocarray((bits.limbs*LIMB_SIZE) / ALIGNMENT, sizeof(mp_bitcnt_t)) + bits.non_zero_chunks = check_allocarray((bits.limbs*LIMB_SIZE) // ALIGNMENT, sizeof(mp_bitcnt_t)) cdef inline bint bitset_check_alignment(fused_bitset_t bits): """ @@ -203,7 +203,7 @@ cdef inline int bitset_realloc(bitset_t bits, mp_bitcnt_t size) except -1: if size <= 0: raise ValueError("bitset capacity must be greater than 0") - cdef mp_size_t limbs_new = (size - 1) / (8 * LIMB_SIZE) + 1 + cdef mp_size_t limbs_new = (size - 1) // (8 * LIMB_SIZE) + 1 bits.bits = check_reallocarray(bits.bits, limbs_new, LIMB_SIZE) bits.size = size bits.limbs = limbs_new From d4a657ec4e64d8ada87f48076e309d6b9033249b Mon Sep 17 00:00:00 2001 From: Daniel Bump <75940445+dwbmscz@users.noreply.github.com> Date: Mon, 20 Mar 2023 10:11:21 -0700 Subject: [PATCH 017/135] SmallPermutationGroup returns self._n as its order, to avoid recomputing it. --- src/sage/groups/perm_gps/permgroup_named.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index 223b3735329..e4aa4573353 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -3510,6 +3510,17 @@ def _repr_(self): """ return "Group of order %s and GAP Id %s as a permutation group"%(self._n, self._gap_id) + def order(self): + """ + Return the order of the group corresponding to ``self``. + + EXAMPLES:: + + sage: [SmallPermutationGroup(21,k).order() for k in [1,2]] + [21, 21] + """ + return self._n + def gap_small_group(self): r""" Return the GAP small group object corresponding to ``self``. From b12a3070dfd55041756c011ac1c6399819d422f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 20 Mar 2023 20:22:52 +0100 Subject: [PATCH 018/135] fixing some E502 outside of schemes and combinat --- .../affine_lie_conformal_algebra.py | 18 ++--- .../bosonic_ghosts_lie_conformal_algebra.py | 24 ++++--- .../fermionic_ghosts_lie_conformal_algebra.py | 32 +++++---- .../lie_conformal_algebra_element.py | 20 +++--- ..._conformal_algebra_with_structure_coefs.py | 40 +++++------ .../neveu_schwarz_lie_conformal_algebra.py | 18 ++--- .../weyl_lie_conformal_algebra.py | 34 +++++---- src/sage/categories/drinfeld_modules.py | 4 +- src/sage/coding/linear_code_no_metric.py | 11 ++- src/sage/crypto/mq/rijndael_gf.py | 38 +++++----- src/sage/databases/sql_db.py | 57 +++++++-------- src/sage/functions/wigner.py | 12 ++-- src/sage/groups/finitely_presented.py | 6 +- src/sage/interfaces/maxima_abstract.py | 6 +- src/sage/interfaces/rubik.py | 40 +++++------ src/sage/interfaces/singular.py | 8 +-- src/sage/libs/ntl/all.py | 25 +++---- .../differentiable/affine_connection.py | 15 ++-- .../manifolds/differentiable/mixed_form.py | 22 +++--- src/sage/misc/map_threaded.py | 5 +- .../quadratic_form__equivalence_testing.py | 60 ++++++++-------- .../quadratic_form__reduction_theory.py | 69 +++++++++---------- .../quadratic_forms/quadratic_form__theta.py | 22 +++--- .../drinfeld_modules/drinfeld_module.py | 4 +- src/sage/symbolic/assumptions.py | 8 +-- 25 files changed, 294 insertions(+), 304 deletions(-) diff --git a/src/sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py index 2cd0e9fe2c4..9fdf888fe39 100644 --- a/src/sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py @@ -107,24 +107,24 @@ def __init__(self, R, ct, names=None, prefix=None, bracket=None): if S.rank(k2) <= S.rank(k1): myb = B[k1].bracket(B[k2]).monomial_coefficients() myf = R(2).inverse_of_unit()*R(hv).inverse_of_unit()\ - *g.killing_form(B[k1],B[k2]) + * g.killing_form(B[k1], B[k2]) if myb or myf: - gdict[(k1,k2)] = {} + gdict[(k1, k2)] = {} if myb: - gdict[(k1,k2)][0] = {(nk,0):v for nk,v in \ - myb.items()} + gdict[(k1, k2)][0] = {(nk, 0): v + for nk, v in myb.items()} if myf: - gdict[(k1,k2)][1] = {('K',0):myf} + gdict[(k1, k2)][1] = {('K', 0): myf} - weights = (1,)*B.cardinality() + weights = (1,) * B.cardinality() self._ct = ct if prefix is None and names is None: prefix = 'B' GradedLieConformalAlgebra.__init__(self, - R, gdict, index_set=S, - central_elements=('K',), weights=weights, - names=names, prefix=prefix,bracket=bracket) + R, gdict, index_set=S, + central_elements=('K',), weights=weights, + names=names, prefix=prefix, bracket=bracket) def cartan_type(self): """ diff --git a/src/sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py index e5cddaed759..178493b13e8 100644 --- a/src/sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py @@ -87,29 +87,31 @@ def __init__(self, R, ngens=2, names=None, index_set=None): """ from sage.rings.integer_ring import ZZ try: - assert (ngens in ZZ and ngens > 0 and ngens % 2 == 0) + assert (ngens in ZZ and ngens > 0 and not ngens % 2) except AssertionError: raise ValueError("ngens should be an even positive integer, " + "got {}".format(ngens)) latex_names = None + half = ngens // 2 if (names is None) and (index_set is None): from sage.misc.defaults import variable_names as varnames from sage.misc.defaults import latex_variable_names as laxnames - names = varnames(ngens/2,'beta') + varnames(ngens/2,'gamma') - latex_names = tuple(laxnames(ngens/2,r'\beta') +\ - laxnames(ngens/2,r'\gamma')) + ('K',) + names = varnames(half, 'beta') + varnames(half, 'gamma') + latex_names = tuple(laxnames(half, r'\beta') + + laxnames(half, r'\gamma')) + ('K',) - names,index_set = standardize_names_index_set(names=names, + names, index_set = standardize_names_index_set(names=names, index_set=index_set, ngens=ngens) - A = identity_matrix(R, ngens // 2) + A = identity_matrix(R, half) from sage.matrix.special import block_matrix - gram_matrix = block_matrix([[R.zero(),A],[-A,R.zero()]]) - ghostsdict = { (i,j): {0: {('K',0): gram_matrix[index_set.rank(i), - index_set.rank(j)]}} for i in index_set for j in index_set} - weights = (1,)*(ngens//2) + (0,)*(ngens//2) + gram_matrix = block_matrix([[R.zero(), A], [-A, R.zero()]]) + ghostsdict = {(i, j): {0: {('K', 0): gram_matrix[index_set.rank(i), + index_set.rank(j)]}} + for i in index_set for j in index_set} + weights = (1,) * half + (0,) * half super().__init__(R, - ghostsdict,names=names, + ghostsdict, names=names, latex_names=latex_names, index_set=index_set, weights=weights, diff --git a/src/sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py index 4a74d9f9357..e6bca4de671 100644 --- a/src/sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py @@ -80,33 +80,35 @@ def __init__(self,R,ngens=2,names=None,index_set=None): sage: TestSuite(V).run() """ try: - assert (ngens > 0 and ngens % 2 == 0) + assert (ngens > 0 and not ngens % 2) except AssertionError: raise ValueError("ngens should be an even positive integer, " + "got {}".format(ngens)) latex_names = None + half = ngens // 2 if (names is None) and (index_set is None): from sage.misc.defaults import variable_names as varnames from sage.misc.defaults import latex_variable_names as laxnames - names = varnames(ngens/2,'b') + varnames(ngens/2,'c') - latex_names = tuple(laxnames(ngens/2,'b') +\ - laxnames(ngens/2,'c')) + ('K',) + names = varnames(half, 'b') + varnames(half, 'c') + latex_names = tuple(laxnames(half, 'b') + + laxnames(half, 'c')) + ('K',) from sage.structure.indexed_generators import \ - standardize_names_index_set - names,index_set = standardize_names_index_set(names=names, - index_set=index_set, - ngens=ngens) + standardize_names_index_set + names, index_set = standardize_names_index_set(names=names, + index_set=index_set, + ngens=ngens) from sage.matrix.special import identity_matrix - A = identity_matrix(R, ngens // 2) + A = identity_matrix(R, half) from sage.matrix.special import block_matrix - gram_matrix = block_matrix([[R.zero(),A],[A,R.zero()]]) - ghostsdict = { (i,j): {0: {('K',0): gram_matrix[index_set.rank(i), - index_set.rank(j)]}} for i in index_set for j in index_set} - weights = (1,)*(ngens//2) + (0,)*(ngens//2) - parity = (1,)*ngens + gram_matrix = block_matrix([[R.zero(), A], [A, R.zero()]]) + ghostsdict = {(i, j): {0: {('K', 0): gram_matrix[index_set.rank(i), + index_set.rank(j)]}} + for i in index_set for j in index_set} + weights = (1,) * half + (0,) * half + parity = (1,) * ngens super().__init__(R, - ghostsdict,names=names, + ghostsdict, names=names, latex_names=latex_names, index_set=index_set, weights=weights, diff --git a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py index d10426501f2..02c25a67297 100644 --- a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py +++ b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py @@ -121,23 +121,23 @@ def _bracket_(self, right): if self.is_zero() or right.is_zero(): return {} s_coeff = p._s_coeff - a,k = self.index() - coefa = self.monomial_coefficients()[(a,k)] - b,m = right.index() - coefb = right.monomial_coefficients()[(b,m)] + a, k = self.index() + coefa = self.monomial_coefficients()[(a, k)] + b, m = right.index() + coefb = right.monomial_coefficients()[(b, m)] try: - mbr = dict(s_coeff[(a,b)]) + mbr = dict(s_coeff[(a, b)]) except KeyError: return {} pole = max(mbr.keys()) - ret = {l: coefa*coefb*(-1)**k/factorial(k)*sum(factorial(l)\ - /factorial(m+k+j-l)/factorial(l-k-j)/factorial(j)*\ - mbr[j].T(m+k+j-l) for j in mbr if j >= l-m-k and\ + ret = {l: coefa*coefb*(-1)**k/factorial(k)*sum(factorial(l) + /factorial(m+k+j-l)/factorial(l-k-j)/factorial(j)* + mbr[j].T(m+k+j-l) for j in mbr if j >= l-m-k and j <= l-k) for l in range(m+k+pole+1)} return {k: v for k, v in ret.items() if v} - diclist = [i._bracket_(j) for i in self.terms() for - j in right.terms()] + diclist = [i._bracket_(j) for i in self.terms() + for j in right.terms()] ret = {} pz = p.zero() for d in diclist: diff --git a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py index 46119ad45f1..a4669506314 100644 --- a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py +++ b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py @@ -158,18 +158,18 @@ def _standardize_s_coeff(s_coeff, index_set, ce, parity=None): if lth_product: vals[l]=lth_product - myvals = tuple([(k,tuple(v.items())) for k,v in vals.items() if v]) + myvals = tuple((k, tuple(v.items())) for k, v in vals.items() if v) if key in sc.keys() and sorted(sc[key]) != sorted(myvals): - raise ValueError("two distinct values given for one "\ - "and the same bracket, skew-symmetry"\ + raise ValueError("two distinct values given for one " + "and the same bracket, skew-symmetry" "is not satisfied?") if myvals: sc[key] = myvals - #We now add the skew-symmetric part to optimize - #brackets computations later - key=(mypair[1],mypair[0]) + # We now add the skew-symmetric part to optimize + # brackets computations later + key = (mypair[1], mypair[0]) if index_to_parity[mypair[0]]*index_to_parity[mypair[1]]: parsgn = -1 else: @@ -191,11 +191,11 @@ def _standardize_s_coeff(s_coeff, index_set, ce, parity=None): if kth_product: vals[k]=kth_product - myvals = tuple([(k,tuple(v.items())) for k,v in vals.items() if v]) + myvals = tuple((k, tuple(v.items())) for k, v in vals.items() if v) if key in sc.keys() and sorted(sc[key]) != sorted(myvals): - raise ValueError("two distinct values given for one "\ - "and the same bracket. "\ + raise ValueError("two distinct values given for one " + "and the same bracket. " "Skew-symmetry is not satisfied?") if myvals: sc[key] = myvals @@ -233,31 +233,31 @@ def __init__(self, R, s_coeff, index_set=None, central_elements=None, # index_set pass - issuper=kwds.pop('super', False) + issuper = kwds.pop('super', False) if parity is None: - parity = (0,)*index_set.cardinality() + parity = (0,) * index_set.cardinality() else: issuper = True try: assert len(parity) == index_set.cardinality() except AssertionError: - raise ValueError("parity should have the same length as the "\ - "number of generators, got {}".format(parity)) + raise ValueError("parity should have the same length as the " + f"number of generators, got {parity}") s_coeff = LieConformalAlgebraWithStructureCoefficients\ - ._standardize_s_coeff(s_coeff, index_set, central_elements, - parity) + ._standardize_s_coeff(s_coeff, index_set, central_elements, + parity) if names is not None and central_elements is not None: names += tuple(central_elements) - self._index_to_pos = {k: i for i,k in enumerate(index_set)} - #Add central parameters to index_to_pos so that we can - #represent names + self._index_to_pos = {k: i for i, k in enumerate(index_set)} + # Add central parameters to index_to_pos so that we can + # represent names if central_elements is not None: - for i,ce in enumerate(central_elements): - self._index_to_pos[ce] = len(index_set)+i + for i, ce in enumerate(central_elements): + self._index_to_pos[ce] = len(index_set) + i default_category = LieConformalAlgebras(R).WithBasis().FinitelyGenerated() if issuper: diff --git a/src/sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py index d581558aafa..8f5756f993f 100644 --- a/src/sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py @@ -57,15 +57,17 @@ def __init__(self, R): sage: V = lie_conformal_algebras.NeveuSchwarz(QQ) sage: TestSuite(V).run() """ - nsdict = {('L','L'):{0:{('L',1):1}, 1:{('L',0): 2}, - 3:{('C', 0):R(2).inverse_of_unit()}}, - ('L','G'):{0:{('G',1):1}, 1:{('G',0):R(3)*R(2).\ - inverse_of_unit()}}, ('G','G'): {0:{('L',0):2}, - 2:{('C',0):R(2)*R(3).inverse_of_unit()}}} + nsdict = {('L', 'L'): {0: {('L', 1): 1}, + 1: {('L', 0): 2}, + 3: {('C', 0): R(2).inverse_of_unit()}}, + ('L', 'G'): {0: {('G', 1): 1}, + 1: {('G', 0): R(3) * R(2).inverse_of_unit()}}, + ('G', 'G'): {0: {('L', 0): 2}, + 2: {('C', 0): R(2) * R(3).inverse_of_unit()}}} from sage.rings.rational_field import QQ - weights = (2,QQ(3/2)) - parity = (0,1) - GradedLieConformalAlgebra.__init__(self, R, nsdict, names=('L','G'), + weights = (2, QQ((3, 2))) + parity = (0, 1) + GradedLieConformalAlgebra.__init__(self, R, nsdict, names=('L', 'G'), central_elements=('C',), weights=weights, parity=parity) def _repr_(self): diff --git a/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py index ee47970a31f..c51ed309ca5 100644 --- a/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py @@ -119,7 +119,7 @@ class WeylLieConformalAlgebra(LieConformalAlgebraWithStructureCoefficients): [0 1 0] [0 0 1] """ - def __init__(self,R,ngens=None, gram_matrix=None, names=None, + def __init__(self, R, ngens=None, gram_matrix=None, names=None, index_set=None): """ Initialize self. @@ -131,31 +131,29 @@ def __init__(self,R,ngens=None, gram_matrix=None, names=None, """ from sage.matrix.matrix_space import MatrixSpace if ngens: - try: - from sage.rings.integer_ring import ZZ - assert ngens in ZZ and ngens % 2 == 0 - except AssertionError: - raise ValueError("ngens needs to be an even positive "+ - "Integer, got {}".format(ngens)) - if (gram_matrix is not None): + from sage.rings.integer_ring import ZZ + if not(ngens in ZZ and not ngens % 2): + raise ValueError("ngens needs to be an even positive Integer, " + f"got {ngens}") + if gram_matrix is not None: if ngens is None: ngens = gram_matrix.dimensions()[0] try: - assert (gram_matrix in MatrixSpace(R,ngens,ngens)) + assert (gram_matrix in MatrixSpace(R, ngens, ngens)) except AssertionError: - raise ValueError("The gram_matrix should be a skew-symmetric "+ - "{0} x {0} matrix, got {1}".format(ngens,gram_matrix)) - if (not gram_matrix.is_skew_symmetric()) or \ - (gram_matrix.is_singular()): - raise ValueError("The gram_matrix should be a non degenerate " + - "skew-symmetric {0} x {0} matrix, got {1}"\ - .format(ngens,gram_matrix)) - elif (gram_matrix is None): + raise ValueError("The gram_matrix should be a skew-symmetric " + "{0} x {0} matrix, got {1}".format(ngens, gram_matrix)) + if (not gram_matrix.is_skew_symmetric() or + gram_matrix.is_singular()): + raise ValueError("The gram_matrix should be a non degenerate " + "skew-symmetric {0} x {0} matrix, got {1}" + .format(ngens, gram_matrix)) + elif gram_matrix is None: if ngens is None: ngens = 2 A = identity_matrix(R, ngens // 2) from sage.matrix.special import block_matrix - gram_matrix = block_matrix([[R.zero(),A],[-A,R.zero()]]) + gram_matrix = block_matrix([[R.zero(), A], [-A, R.zero()]]) latex_names = None if (names is None) and (index_set is None): diff --git a/src/sage/categories/drinfeld_modules.py b/src/sage/categories/drinfeld_modules.py index 08613d2d14a..5138586378e 100644 --- a/src/sage/categories/drinfeld_modules.py +++ b/src/sage/categories/drinfeld_modules.py @@ -423,7 +423,7 @@ def characteristic(self): 0 """ if self._characteristic is None: - raise NotImplementedError('function ring characteristic not ' \ + raise NotImplementedError('function ring characteristic not ' 'implemented in this case') return self._characteristic @@ -496,7 +496,7 @@ def object(self, gen): gen = self._ore_polring(gen) T = self._function_ring.gen() if gen[0] != self._base_morphism(T): - raise ValueError('constant coefficient must equal that of the ' \ + raise ValueError('constant coefficient must equal that of the ' 'category') return DrinfeldModule(self._function_ring, gen) diff --git a/src/sage/coding/linear_code_no_metric.py b/src/sage/coding/linear_code_no_metric.py index 932ad7ad937..d006ce17e3e 100644 --- a/src/sage/coding/linear_code_no_metric.py +++ b/src/sage/coding/linear_code_no_metric.py @@ -265,9 +265,9 @@ def __eq__(self, other): False """ # Fail without computing the generator matrix if possible: - if not (isinstance(other, AbstractLinearCodeNoMetric)\ - and self.length() == other.length()\ - and self.dimension() == other.dimension()\ + if not (isinstance(other, AbstractLinearCodeNoMetric) + and self.length() == other.length() + and self.dimension() == other.dimension() and self.base_ring() == other.base_ring()): return False # Check that basis elements of `other` are all in `self.` @@ -276,10 +276,7 @@ def __eq__(self, other): # This implementation may avoid linear algebra altogether, if `self` # implements an efficient way to obtain a parity check matrix, and in # the worst case does only one system solving. - for c in other.gens(): - if not (c in self): - return False - return True + return all(c in self for c in other.gens()) def __ne__(self, other): r""" diff --git a/src/sage/crypto/mq/rijndael_gf.py b/src/sage/crypto/mq/rijndael_gf.py index ec8f433d705..8665c4700c8 100644 --- a/src/sage/crypto/mq/rijndael_gf.py +++ b/src/sage/crypto/mq/rijndael_gf.py @@ -1140,16 +1140,16 @@ def _check_valid_PRmatrix(self, PRm, keyword): msg = ("keyword '{0}' must be a {1} x {2} matrix with entries from a " "multivariate PolynomialRing over {3}") msg = msg.format(keyword, 4, self._Nb, self._F) - if (not isinstance(PRm, Matrix) or \ - not (PRm.base_ring().is_field() and \ - PRm.base_ring().is_finite() and \ - PRm.base_ring().order() == 256 and \ + if (not isinstance(PRm, Matrix) or + not (PRm.base_ring().is_field() and + PRm.base_ring().is_finite() and + PRm.base_ring().order() == 256 and PRm.dimensions() == (4, self._Nb))) and \ - (not isinstance(PRm, Matrix) or \ - not isinstance(PRm.base_ring(), MPolynomialRing_base) or \ - not (PRm.base_ring().base_ring().is_field() and \ - PRm.base_ring().base_ring().is_finite() and \ - PRm.base_ring().base_ring().order() == 256) or \ + (not isinstance(PRm, Matrix) or + not isinstance(PRm.base_ring(), MPolynomialRing_base) or + not (PRm.base_ring().base_ring().is_field() and + PRm.base_ring().base_ring().is_finite() and + PRm.base_ring().base_ring().order() == 256) or not PRm.dimensions() == (4, self._Nb)): raise TypeError(msg) @@ -1183,8 +1183,8 @@ def expand_key(self, key): msg = "keyword '{0}' must be a {1} x {2} matrix over GF({3})" msg = msg.format(key, 4, self._Nk, self._F.order()) if not isinstance(key, Matrix) or \ - not (key.base_ring().is_field() and \ - key.base_ring().is_finite() and \ + not (key.base_ring().is_field() and + key.base_ring().is_finite() and key.base_ring().order() == self._F.order()) or \ not key.dimensions() == (4, self._Nk): raise TypeError(msg) @@ -1396,12 +1396,12 @@ def apply_poly(self, state, poly_constr, algorithm='encrypt', keys=None, if not isinstance(poly_constr, RijndaelGF.Round_Component_Poly_Constr): msg = "keyword 'poly_constr' must be a Round_Component_Poly_Constr" raise TypeError(msg) - if keys is not None and (not isinstance(keys, list) or \ - len(keys) != self._Nr + 1 or \ - not all(isinstance(k, Matrix) for k in keys) or \ - not all(k.dimensions() == (4, self._Nb) for k in keys) or \ + if keys is not None and (not isinstance(keys, list) or + len(keys) != self._Nr + 1 or + not all(isinstance(k, Matrix) for k in keys) or + not all(k.dimensions() == (4, self._Nb) for k in keys) or not all(k.base_ring().is_finite() and k.base_ring().is_field() - and k.base_ring().order() == 256 for k in keys) ): + and k.base_ring().order() == 256 for k in keys)): msg = ("keys must be a length {0} array of 4 by {1} matrices" " over {2}") raise TypeError(msg.format(self._Nr, self._Nb, self._F)) @@ -1864,8 +1864,8 @@ def _sub_bytes_pc(self, row, col, algorithm='encrypt', no_inversion=False): elif algorithm == 'decrypt': var = self.state_vrs[row, col] coeffs = self._sb_D_coeffs - result = (sum([coeffs[i] * var**(2**i) for i in range(8)]) + \ - self._F("x^2 + 1")) + result = (sum([coeffs[i] * var**(2**i) for i in range(8)]) + + self._F("x^2 + 1")) if no_inversion: return result else: @@ -2318,7 +2318,7 @@ def __call__(self, row, col, algorithm='encrypt', **kwargs): raise ValueError("keyword 'row' must be in range 0 - 3") if col not in range(self._Nb): msg = "keyword 'col' must be in range 0 - {0}" - raise ValueError(msg.format(self._Nb-1)) + raise ValueError(msg.format(self._Nb - 1)) if algorithm not in ['encrypt', 'decrypt']: msg = ("keyword 'algorithm' must be either 'encrypt' or " "'decrypt'") diff --git a/src/sage/databases/sql_db.py b/src/sage/databases/sql_db.py index 087c494ef39..4a456ba0f32 100644 --- a/src/sage/databases/sql_db.py +++ b/src/sage/databases/sql_db.py @@ -259,7 +259,7 @@ def construct_skeleton(database): typ = u'NOTYPE' else: typ = col[2] - skeleton[table[0]][col[1]] = {'sql':typ, \ + skeleton[table[0]][col[1]] = {'sql':typ, 'primary_key':(col[5]!=0), 'index':(col[5]!=0), 'unique': False} exe2 = cur.execute("PRAGMA index_list(%s)"%table[0]) for col in exe2.fetchall(): @@ -682,7 +682,7 @@ def show(self, **kwds): except Exception: raise RuntimeError('Failure to fetch query.') - print(_create_print_table(cur, [des[0] for des in cur.description], \ + print(_create_print_table(cur, [des[0] for des in cur.description], **kwds)) def __copy__(self): @@ -704,7 +704,7 @@ def __copy__(self): d.__param_tuple__ = self.__param_tuple__ return d - def intersect(self, other, join_table=None, join_dict=None, \ + def intersect(self, other, join_table=None, join_dict=None, in_place=False): """ Return a new ``SQLQuery`` that is the intersection of ``self`` and @@ -773,7 +773,7 @@ def intersect(self, other, join_table=None, join_dict=None, \ return copy(other) if not other.__query_string__: return copy(self) - return self._merge_queries(other, copy(self), join_table, \ + return self._merge_queries(other, copy(self), join_table, join_dict, 'AND') def _merge_queries(self, other, ret, join_table, join_dict, operator): @@ -830,8 +830,8 @@ def _merge_queries(self, other, ret, join_table, join_dict, operator): # concatenate where clause new_query = re.sub(' WHERE ',' WHERE ( ', new_query) - new_query += re.sub('^.* WHERE ',' ) %s ( '%operator, \ - other.__query_string__) + new_query += re.sub('^.* WHERE ',' ) %s ( '%operator, + other.__query_string__) ret.__query_string__ = new_query + ' )' ret.__param_tuple__ = self.__param_tuple__ + other.__param_tuple__ @@ -891,9 +891,10 @@ def union(self, other, join_table=None, join_dict=None, in_place=False): return copy(self) if not other.__query_string__: return copy(other) - return self._merge_queries(other, copy(self), join_table, \ + return self._merge_queries(other, copy(self), join_table, join_dict, 'OR') + class SQLDatabase(SageObject): def __init__(self, filename=None, read_only=None, skeleton=None): r""" @@ -1067,14 +1068,14 @@ def __init__(self, filename=None, read_only=None, skeleton=None): filename = tmp_filename() + '.db' elif (filename[-3:] != '.db'): raise ValueError('Please enter a valid database path (file name ' \ - + '%s does not end in .db).'%filename) + + '%s does not end in .db).' % filename) if read_only is None: read_only = True self.__read_only__ = read_only self.ignore_warnings = False self.__dblocation__ = filename - self.__connection__ = sqlite.connect(self.__dblocation__, \ + self.__connection__ = sqlite.connect(self.__dblocation__, check_same_thread=False) # this is to avoid the multiple thread problem with dsage: # pysqlite does not trust multiple threads for the same connection @@ -1092,8 +1093,8 @@ def __init__(self, filename=None, read_only=None, skeleton=None): else: for column in skeleton[table]: if column not in self.__skeleton__[table]: - self.add_column(table, column, \ - skeleton[table][column]) + self.add_column(table, column, + skeleton[table][column]) else: print('Column attributes were ignored for ' \ 'table {}, column {} -- column is ' \ @@ -1304,8 +1305,8 @@ def show(self, table_name, **kwds): cur.execute('SELECT * FROM ' + table_name) except Exception: raise RuntimeError('Failure to fetch data.') - print(_create_print_table(cur, [des[0] for des in cur.description], \ - **kwds)) + print(_create_print_table(cur, [des[0] for des in cur.description], + **kwds)) def get_cursor(self, ignore_warning=None): """ @@ -1376,9 +1377,9 @@ def get_connection(self, ignore_warning=None): ignore_warning = self.ignore_warnings if not ignore_warning: import warnings - warnings.warn('Database is read only, using the connection ' \ - + 'can alter the stored data. Set self.ignore_warnings ' \ - + 'to True in order to mute future warnings.', \ + warnings.warn('Database is read only, using the connection ' + 'can alter the stored data. Set self.ignore_warnings ' + 'to True in order to mute future warnings.', RuntimeWarning) return self.__connection__ @@ -1638,12 +1639,12 @@ def _rebuild_table(self, table_name, col_name=None, default=''): INSERT INTO spam SELECT %s FROM %s; DROP TABLE %s; CREATE TABLE %s (%s); - """%(cols_attr, original, table_name, table_name, table_name, cols_attr)) + """ % (cols_attr, original, table_name, table_name, table_name, cols_attr)) # Update indices in new table - index_statement = ''.join(['CREATE INDEX i_%s_%s ON '%(table_name, \ - col) + '%s(%s);\n'%(table_name, col) for col in \ - self.__skeleton__[table_name] if \ - self.__skeleton__[table_name][col]['index'] and not \ + index_statement = ''.join(['CREATE INDEX i_%s_%s ON ' % (table_name, + col) + '%s(%s);\n' % (table_name, col) for col in + self.__skeleton__[table_name] if + self.__skeleton__[table_name][col]['index'] and not self.__skeleton__[table_name][col]['primary_key']]) if index_statement: self.__connection__.executescript(index_statement) @@ -1652,7 +1653,7 @@ def _rebuild_table(self, table_name, col_name=None, default=''): self.__connection__.executescript(""" INSERT INTO %s SELECT %s FROM spam; DROP TABLE spam; - """%(table_name, cols)) + """ % (table_name, cols)) self.vacuum() @@ -2115,15 +2116,15 @@ def delete_rows(self, query): raise RuntimeError('Cannot delete rows from a read only database.') # Check query is associated with this database if not isinstance(query, SQLQuery): - raise TypeError('%s is not a valid SQLQuery'%query) + raise TypeError('%s is not a valid SQLQuery' % query) if query.__database__ is not self: - raise ValueError('%s is not associated to this database.'%query) + raise ValueError('%s is not associated to this database.' % query) if (query.__query_string__).find(' JOIN ') != -1: - raise ValueError('%s is not a valid query. Can only '%query \ - + 'delete from one table at a time.') + raise ValueError(f'{query} is not a valid query. Can only ' + 'delete from one table at a time.') - delete_statement = re.sub('SELECT .* FROM', 'DELETE FROM', \ - query.__query_string__) + delete_statement = re.sub('SELECT .* FROM', 'DELETE FROM', + query.__query_string__) try: cur = self.get_cursor() diff --git a/src/sage/functions/wigner.py b/src/sage/functions/wigner.py index cb5a5c0e107..53d0b744f6a 100644 --- a/src/sage/functions/wigner.py +++ b/src/sage/functions/wigner.py @@ -294,10 +294,10 @@ def _big_delta_coeff(aa, bb, cc, prec=None): maxfact = max(aa + bb - cc, aa + cc - bb, bb + cc - aa, aa + bb + cc + 1) _calc_factlist(maxfact) - argsqrt = Integer(_Factlist[int(aa + bb - cc)] * \ - _Factlist[int(aa + cc - bb)] * \ - _Factlist[int(bb + cc - aa)]) / \ - Integer(_Factlist[int(aa + bb + cc + 1)]) + argsqrt = Integer(_Factlist[int(aa + bb - cc)] * + _Factlist[int(aa + cc - bb)] * + _Factlist[int(bb + cc - aa)]) /\ + Integer(_Factlist[int(aa + bb + cc + 1)]) ressqrt = argsqrt.sqrt(prec) if isinstance(ressqrt, ComplexNumber): @@ -704,8 +704,8 @@ def gaunt(l_1, l_2, l_3, m_1, m_2, m_3, prec=None): (4*pi) ressqrt = argsqrt.sqrt() - prefac = Integer(_Factlist[bigL] * _Factlist[l_2 - l_1 + l_3] * \ - _Factlist[l_1 - l_2 + l_3] * _Factlist[l_1 + l_2 - l_3])/ \ + prefac = Integer(_Factlist[bigL] * _Factlist[l_2 - l_1 + l_3] * + _Factlist[l_1 - l_2 + l_3] * _Factlist[l_1 + l_2 - l_3]) / \ _Factlist[2 * bigL + 1] / \ (_Factlist[bigL - l_1] * _Factlist[bigL - l_2] * _Factlist[bigL - l_3]) diff --git a/src/sage/groups/finitely_presented.py b/src/sage/groups/finitely_presented.py index 1beb01af87f..6a6efb98ad8 100644 --- a/src/sage/groups/finitely_presented.py +++ b/src/sage/groups/finitely_presented.py @@ -177,11 +177,9 @@ def _repr_defn(self): sage: f = GroupMorphismWithGensImages(HS, lambda a: H.one()) sage: f._repr_defn() 'x0 |--> ()\nx1 |--> ()\nx2 |--> ()' - """ - D = self.domain() - return '\n'.join(['%s |--> %s'%(i, self(i)) for\ - i in D.gens()]) + return '\n'.join(f'{i} |--> {self(i)}' for i in self.domain().gens()) + class FinitelyPresentedGroupElement(FreeGroupElement): """ diff --git a/src/sage/interfaces/maxima_abstract.py b/src/sage/interfaces/maxima_abstract.py index 544e3b678a3..62bd5c9821e 100644 --- a/src/sage/interfaces/maxima_abstract.py +++ b/src/sage/interfaces/maxima_abstract.py @@ -746,12 +746,12 @@ def plot2d_parametric(self, r, var, trange, nticks=50, options=None): """ tmin = trange[0] tmax = trange[1] - cmd = "plot2d([parametric, %s, %s, [%s, %s, %s], [nticks, %s]]"%( \ - r[0], r[1], var, tmin, tmax, nticks) + cmd = "plot2d([parametric, %s, %s, [%s, %s, %s], [nticks, %s]]" % ( + r[0], r[1], var, tmin, tmax, nticks) if options is None: cmd += ")" else: - cmd += ", %s)"%options + cmd += ", %s)" % options self(cmd) def plot3d(self, *args): diff --git a/src/sage/interfaces/rubik.py b/src/sage/interfaces/rubik.py index 45857555caa..1a142200707 100644 --- a/src/sage/interfaces/rubik.py +++ b/src/sage/interfaces/rubik.py @@ -45,17 +45,17 @@ # Can't seem to find consistency in letter ordering # between us and them... These are copied from the source. -optimal_solver_tokens = ["UF", "UR", "UB", "UL", \ - "DF", "DR", "DB", "DL", \ - "FR", "FL", "BR", "BL", \ - "FU", "RU", "BU", "LU", \ - "FD", "RD", "BD", "LD", \ - "RF", "LF", "RB", "LB", \ - "UFR", "URB", "UBL", "ULF", \ - "DRF", "DFL", "DLB", "DBR", \ - "FRU", "RBU", "BLU", "LFU", \ - "RFD", "FLD", "LBD", "BRD", \ - "RUF", "BUR", "LUB", "FUL", \ +optimal_solver_tokens = ["UF", "UR", "UB", "UL", + "DF", "DR", "DB", "DL", + "FR", "FL", "BR", "BL", + "FU", "RU", "BU", "LU", + "FD", "RD", "BD", "LD", + "RF", "LF", "RB", "LB", + "UFR", "URB", "UBL", "ULF", + "DRF", "DFL", "DLB", "DBR", + "FRU", "RBU", "BLU", "LFU", + "RFD", "FLD", "LBD", "BRD", + "RUF", "BUR", "LUB", "FUL", "FDR", "LDF", "BDL", "RDB"] # The input format. @@ -309,15 +309,15 @@ def format_cube(self, facets): facet_colors[16+i*3] = i return "".join(str(c) for c in facet_colors) - facet_map = [ 1, 2, 3, \ - 4, 0, 5, \ - 6, 7, 8, \ - 9, 10, 11, 17, 18, 19, 25, 26, 27, 33, 34, 35, \ - 12, 0, 13, 20, 0, 21, 28, 0, 29, 36, 0, 37, \ - 14, 15, 16, 22, 23, 24, 30, 31, 32, 38, 39, 40, \ - 41, 42, 43, \ - 44, 0, 45, \ - 46, 47, 48, \ + facet_map = [ 1, 2, 3, + 4, 0, 5, + 6, 7, 8, + 9, 10, 11, 17, 18, 19, 25, 26, 27, 33, 34, 35, + 12, 0, 13, 20, 0, 21, 28, 0, 29, 36, 0, 37, + 14, 15, 16, 22, 23, 24, 30, 31, 32, 38, 39, 40, + 41, 42, 43, + 44, 0, 45, + 46, 47, 48, ] diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py index 2a127cfe482..b79e08c44f9 100644 --- a/src/sage/interfaces/singular.py +++ b/src/sage/interfaces/singular.py @@ -1845,14 +1845,14 @@ def sage_poly(self, R=None, kcache=None): out = R(self) self.parent().eval('short=%s'%is_short) return out - singular_poly_list = self.parent().eval("string(coef(%s,%s))" % (\ - self.name(),variable_str)).split(",") + singular_poly_list = self.parent().eval("string(coef(%s,%s))" % ( + self.name(),variable_str)).split(",") self.parent().eval('short=%s'%is_short) else: if isinstance(R, MPolynomialRing_libsingular): return R(self) - singular_poly_list = self.parent().eval("string(coef(%s,%s))" % (\ - self.name(),variable_str)).split(",") + singular_poly_list = self.parent().eval("string(coef(%s,%s))" % ( + self.name(),variable_str)).split(",") # Directly treat constants if singular_poly_list[0] in ['1', '(1.000e+00)']: diff --git a/src/sage/libs/ntl/all.py b/src/sage/libs/ntl/all.py index 20993d2cac8..e9d4271879a 100644 --- a/src/sage/libs/ntl/all.py +++ b/src/sage/libs/ntl/all.py @@ -5,8 +5,7 @@ Features of this library include *incredibly fast* arithmetic with polynomials and asymptotically fast factorization of polynomials. """ - -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2005 William Stein # # Distributed under the terms of the GNU General Public License (GPL) @@ -18,14 +17,14 @@ # # The full text of the GPL is available at: # -# http://www.gnu.org/licenses/ -#***************************************************************************** +# https://www.gnu.org/licenses/ +# **************************************************************************** from sage.libs.ntl.ntl_ZZ import ( - ntl_setSeed, \ - ntl_ZZ as ZZ, - randomBnd as ZZ_random, - randomBits as ZZ_random_bits ) + ntl_setSeed, + ntl_ZZ as ZZ, + randomBnd as ZZ_random, + randomBits as ZZ_random_bits) from sage.libs.ntl.ntl_ZZ_pContext import ntl_ZZ_pContext as ZZ_pContext @@ -56,16 +55,14 @@ from sage.libs.ntl.ntl_GF2 import ntl_GF2 as GF2 from sage.libs.ntl.ntl_GF2X import ( - ntl_GF2X as GF2X, - GF2XHexOutput, - ) + ntl_GF2X as GF2X, + GF2XHexOutput) from sage.libs.ntl.ntl_GF2EContext import ntl_GF2EContext as GF2EContext from sage.libs.ntl.ntl_GF2E import ( - ntl_GF2E as GF2E, \ - ntl_GF2E_random as GF2E_random, \ - ) + ntl_GF2E as GF2E, + ntl_GF2E_random as GF2E_random) from sage.libs.ntl.ntl_GF2EX import ntl_GF2EX as GF2EX diff --git a/src/sage/manifolds/differentiable/affine_connection.py b/src/sage/manifolds/differentiable/affine_connection.py index 008f13be22e..eb87805a49c 100644 --- a/src/sage/manifolds/differentiable/affine_connection.py +++ b/src/sage/manifolds/differentiable/affine_connection.py @@ -1996,15 +1996,16 @@ def riemann(self): @parallel(p_iter='multiprocessing', ncpus=nproc) def make_Riem(frame, gam, gam_gam, gam_sc, local_list_ijkl): partial = [] - for i,j,k,l in local_list_ijkl: - partial.append([i,j,k,l, frame[k](gam[[i,j,l]]) - \ - frame[l](gam[[i,j,k]]) + \ - gam_gam[[i,k,j,l]] - \ - gam_gam[[i,l,j,k]] - \ - gam_sc[[i,j,k,l]]]) + for i, j, k, l in local_list_ijkl: + partial.append([i, j, k, l, + frame[k](gam[[i, j, l]]) - + frame[l](gam[[i, j, k]]) + + gam_gam[[i, k, j, l]] - + gam_gam[[i, l, j, k]] - + gam_sc[[i, j, k, l]]]) return partial # Computation and assignation of values - for ii,val in make_Riem(listParalInput): + for ii, val in make_Riem(listParalInput): for jj in val: res[jj[0], jj[1], jj[2], jj[3]] = jj[4] diff --git a/src/sage/manifolds/differentiable/mixed_form.py b/src/sage/manifolds/differentiable/mixed_form.py index 2a30ececa45..90d2954547e 100644 --- a/src/sage/manifolds/differentiable/mixed_form.py +++ b/src/sage/manifolds/differentiable/mixed_form.py @@ -12,22 +12,21 @@ AUTHORS: - Michael Jung (2019) : initial version - """ - -#****************************************************************************** +# ***************************************************************************** # Copyright (C) 2019 Michael Jung # # Distributed under the terms of the GNU General Public License (GPL) # as published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # https://www.gnu.org/licenses/ -#****************************************************************************** +# ***************************************************************************** from sage.misc.cachefunc import cached_method from sage.structure.element import AlgebraElement, ModuleElementWithMutability from sage.rings.integer import Integer + class MixedForm(AlgebraElement, ModuleElementWithMutability): r""" An instance of this class is a mixed form along some differentiable map @@ -253,9 +252,9 @@ def __init__(self, parent, name=None, latex_name=None): self._domain = vmodule._domain self._ambient_domain = vmodule._ambient_domain self._max_deg = vmodule._ambient_domain.dim() - self._is_zero = False # a priori, may be changed below or via - # method __bool__() - self._comp = None # initialized on demand; see _init_comp + self._is_zero = False # a priori, may be changed below or via + # method __bool__() + self._comp = None # initialized on demand; see _init_comp # Set names: self._name = name if latex_name is None: @@ -289,7 +288,7 @@ def _init_comp(self): comp_latex_name = '{' + self._latex_name + '}_{' + str(i) + '}' diff_form = self._domain.diff_form self._comp.append(diff_form(i, name=comp_name, - latex_name=comp_latex_name)) + latex_name=comp_latex_name)) def _repr_(self): r""" @@ -487,7 +486,7 @@ def display_expansion(self, frame=None, chart=None, from_chart=None): if is_atomic(coef_latex): terms_latex.append(coef_latex + basis_term_latex) else: - terms_latex.append(r"\left(" + coef_latex + \ + terms_latex.append(r"\left(" + coef_latex + r"\right)" + basis_term_latex) if not terms_txt: resu_txt += "0" @@ -614,11 +613,10 @@ def set_name(self, name=None, latex_name=None, apply_to_comp=True): sage: F[0].set_name(name='g'); F.display() eta = g + F_1 + F_2 + F_3 + F_4 - """ if self.is_immutable(): raise ValueError("the name of an immutable element " - "cannot be changed") + "cannot be changed") if name is not None: self._name = name if latex_name is None: @@ -991,7 +989,7 @@ def wedge(self, other): return self # Generic case: resu = self._new_instance() - resu._comp = [sum(self[k].wedge(other[j-k]) for k in range(j+1)) + resu._comp = [sum(self[k].wedge(other[j - k]) for k in range(j + 1)) for j in self.irange()] # Compose name: from sage.typeset.unicode_characters import unicode_wedge diff --git a/src/sage/misc/map_threaded.py b/src/sage/misc/map_threaded.py index cc8f8f0a3dd..c5eba670052 100644 --- a/src/sage/misc/map_threaded.py +++ b/src/sage/misc/map_threaded.py @@ -2,6 +2,7 @@ Threaded map function """ + def map_threaded(function, sequence): """ Apply the function to the elements in the sequence by threading @@ -31,5 +32,5 @@ def map_threaded(function, sequence): """ if hasattr(sequence, 'apply_map'): return sequence.apply_map(function) - return [map_threaded(function, x) if isinstance(x, (list, tuple)) \ - else function(x) for x in sequence] + return [map_threaded(function, x) if isinstance(x, (list, tuple)) + else function(x) for x in sequence] diff --git a/src/sage/quadratic_forms/quadratic_form__equivalence_testing.py b/src/sage/quadratic_forms/quadratic_form__equivalence_testing.py index 3175126556d..cac17f3e952 100644 --- a/src/sage/quadratic_forms/quadratic_form__equivalence_testing.py +++ b/src/sage/quadratic_forms/quadratic_form__equivalence_testing.py @@ -5,7 +5,6 @@ - Anna Haensch (2014-12-01): added test for rational isometry """ - from sage.arith.misc import (hilbert_symbol, GCD, is_prime, @@ -209,21 +208,20 @@ def has_equivalent_Jordan_decomposition_at_prime(self, other, p): """ # Sanity Checks - #if not isinstance(other, QuadraticForm): + # if not isinstance(other, QuadraticForm): if not isinstance(other, type(self)): raise TypeError("the first argument must be of type QuadraticForm") if not is_prime(p): raise TypeError("the second argument must be a prime number") # Get the relevant local normal forms quickly - self_jordan = self.jordan_blocks_by_scale_and_unimodular(p, safe_flag= False) + self_jordan = self.jordan_blocks_by_scale_and_unimodular(p, safe_flag=False) other_jordan = other.jordan_blocks_by_scale_and_unimodular(p, safe_flag=False) # Check for the same number of Jordan components if len(self_jordan) != len(other_jordan): return False - # Deal with odd primes: Check that the Jordan component scales, dimensions, and discriminants are the same if p != 2: for i in range(len(self_jordan)): @@ -235,14 +233,12 @@ def has_equivalent_Jordan_decomposition_at_prime(self, other, p): # All tests passed for an odd prime. return True - # For p = 2: Check that all Jordan Invariants are the same. elif p == 2: # Useful definition t = len(self_jordan) # Define t = Number of Jordan components - # Check that all Jordan Invariants are the same (scale, dim, and norm) for i in range(t): if (self_jordan[i][0] != other_jordan[i][0]) \ @@ -254,27 +250,27 @@ def has_equivalent_Jordan_decomposition_at_prime(self, other, p): # ------------------------------------------ # List of norms, scales, and dimensions for each i - scale_list = [ZZ(2)**self_jordan[i][0] for i in range(t)] - norm_list = [ZZ(2)**(self_jordan[i][0] + valuation(GCD(self_jordan[i][1].coefficients()), 2)) for i in range(t)] - dim_list = [(self_jordan[i][1].dim()) for i in range(t)] + scale_list = [ZZ(2)**self_jordan[i][0] for i in range(t)] + norm_list = [ZZ(2)**(self_jordan[i][0] + valuation(GCD(self_jordan[i][1].coefficients()), 2)) for i in range(t)] + dim_list = [(self_jordan[i][1].dim()) for i in range(t)] # List of Hessian determinants and Hasse invariants for each Jordan (sub)chain # (Note: This is not the same as O'Meara's Gram determinants, but ratios are the same!) -- NOT SO GOOD... # But it matters in condition (ii), so we multiply all by 2 (instead of dividing by 2 since only square-factors matter, and it's easier.) j = 0 - self_chain_det_list = [ self_jordan[j][1].Gram_det() * (scale_list[j]**dim_list[j])] - other_chain_det_list = [ other_jordan[j][1].Gram_det() * (scale_list[j]**dim_list[j])] - self_hasse_chain_list = [ self_jordan[j][1].scale_by_factor(ZZ(2)**self_jordan[j][0]).hasse_invariant__OMeara(2) ] - other_hasse_chain_list = [ other_jordan[j][1].scale_by_factor(ZZ(2)**other_jordan[j][0]).hasse_invariant__OMeara(2) ] + self_chain_det_list = [self_jordan[j][1].Gram_det() * (scale_list[j]**dim_list[j])] + other_chain_det_list = [other_jordan[j][1].Gram_det() * (scale_list[j]**dim_list[j])] + self_hasse_chain_list = [self_jordan[j][1].scale_by_factor(ZZ(2)**self_jordan[j][0]).hasse_invariant__OMeara(2)] + other_hasse_chain_list = [other_jordan[j][1].scale_by_factor(ZZ(2)**other_jordan[j][0]).hasse_invariant__OMeara(2)] for j in range(1, t): self_chain_det_list.append(self_chain_det_list[j-1] * self_jordan[j][1].Gram_det() * (scale_list[j]**dim_list[j])) other_chain_det_list.append(other_chain_det_list[j-1] * other_jordan[j][1].Gram_det() * (scale_list[j]**dim_list[j])) - self_hasse_chain_list.append(self_hasse_chain_list[j-1] \ - * hilbert_symbol(self_chain_det_list[j-1], self_jordan[j][1].Gram_det(), 2) \ + self_hasse_chain_list.append(self_hasse_chain_list[j-1] + * hilbert_symbol(self_chain_det_list[j-1], self_jordan[j][1].Gram_det(), 2) * self_jordan[j][1].hasse_invariant__OMeara(2)) - other_hasse_chain_list.append(other_hasse_chain_list[j-1] \ - * hilbert_symbol(other_chain_det_list[j-1], other_jordan[j][1].Gram_det(), 2) \ + other_hasse_chain_list.append(other_hasse_chain_list[j-1] + * hilbert_symbol(other_chain_det_list[j-1], other_jordan[j][1].Gram_det(), 2) * other_jordan[j][1].hasse_invariant__OMeara(2)) # SANITY CHECK -- check that the scale powers are strictly increasing @@ -293,7 +289,7 @@ def has_equivalent_Jordan_decomposition_at_prime(self, other, p): return False # Check O'Meara's condition (ii) when appropriate - if norm_list[i+1] % (4 * norm_list[i]) == 0: + if norm_list[i + 1] % (4 * norm_list[i]) == 0: if self_hasse_chain_list[i] * hilbert_symbol(norm_list[i] * other_chain_det_list[i], -self_chain_det_list[i], 2) \ != other_hasse_chain_list[i] * hilbert_symbol(norm_list[i], -other_chain_det_list[i], 2): # Nipp conditions return False @@ -492,13 +488,13 @@ def is_rationally_isometric(self, other, return_matrix=False): if self.dim() != other.dim(): return False - if not (self.Gram_det()*other.Gram_det()).is_square(): + if not (self.Gram_det() * other.Gram_det()).is_square(): return False - L1=self.Gram_det().support() - L2=other.Gram_det().support() + L1 = self.Gram_det().support() + L2 = other.Gram_det().support() - for p in set().union(L1,L2): + for p in set().union(L1, L2): if self.hasse_invariant(p) != other.hasse_invariant(p): return False @@ -516,13 +512,13 @@ def is_rationally_isometric(self, other, return_matrix=False): for emb in K.real_embeddings(): - Mpos=0 + Mpos = 0 for x in Mentries: - Mpos+= emb(x) >= 0 + Mpos += emb(x) >= 0 - Npos=0 + Npos = 0 for x in Nentries: - Npos+= emb(x) >= 0 + Npos += emb(x) >= 0 if Npos != Mpos: return False @@ -606,7 +602,7 @@ def _diagonal_isometry(V, W): if Q.Gram_matrix()[0][0] != F.Gram_matrix()[0][0]: # Find a vector w in F such that F(w) equals the first term of Q. w = F.solve(Q.Gram_matrix()[0][0]) - w = vector(QQ, i*[0] + w.list()) + w = vector(QQ, i * [0] + w.list()) # We want to extend the basis of W to include the vector w. # Find a non-fixed vector in the current basis to replace by w. @@ -614,10 +610,10 @@ def _diagonal_isometry(V, W): # The new set of vectors must still be linearly independent (i.e. the matrix is non-singular). while True: temp_matrix = Matrix(change_of_basis_matrix) - temp_matrix.set_column(j, change_of_basis_matrix*w) + temp_matrix.set_column(j, change_of_basis_matrix * w) if not temp_matrix.is_singular(): break - j = j + 1 + j += 1 change_of_basis_matrix = temp_matrix @@ -690,12 +686,10 @@ def _gram_schmidt(m, fixed_vector_index, inner_product): from sage.matrix.constructor import column_matrix n = m.dimensions()[0] - vectors = [0] * n + vectors = [m.column(i) for i in range(n)] - for i in range(n): - vectors[i] = m.column(i) for i in range(fixed_vector_index, n): - for j in range(i+1, n): + for j in range(i + 1, n): vectors[j] = vectors[j] - (inner_product(vectors[j], vectors[i]) / inner_product(vectors[i], vectors[i])) * vectors[i] return column_matrix(vectors) diff --git a/src/sage/quadratic_forms/quadratic_form__reduction_theory.py b/src/sage/quadratic_forms/quadratic_form__reduction_theory.py index 16c89f6edf2..18968494f6b 100644 --- a/src/sage/quadratic_forms/quadratic_form__reduction_theory.py +++ b/src/sage/quadratic_forms/quadratic_form__reduction_theory.py @@ -388,80 +388,79 @@ def minkowski_reduction_for_4vars__SP(self): if (r == i) or (r == j): M_new[r,r] = 0 else: - M_new[r,r] = 1 + M_new[r, r] = 1 M = M * M_new - elif (i_sum == j_sum): - for k in [2,1,0]: # TO DO: These steps are a little redundant... + elif i_sum == j_sum: + for k in [2, 1, 0]: # TO DO: These steps are a little redundant... Q1 = Q.matrix() - c_flag = True - for l in range(k+1,4): - c_flag = c_flag and (abs(Q1[i,l]) == abs(Q1[j,l])) + c_flag = all(abs(Q1[i, l]) == abs(Q1[j, l]) + for l in range(k + 1, 4)) # Condition (c) - if c_flag and (abs(Q1[i,k]) > abs(Q1[j,k])): - Q.swap_variables(i,j,in_place=True) - M_new = matrix(R,n,n) - M_new[i,j] = -1 - M_new[j,i] = 1 + if c_flag and abs(Q1[i, k]) > abs(Q1[j, k]): + Q.swap_variables(i, j, in_place=True) + M_new = matrix(R, n, n) + M_new[i, j] = -1 + M_new[j, i] = 1 for r in range(4): if (r == i) or (r == j): - M_new[r,r] = 0 + M_new[r, r] = 0 else: - M_new[r,r] = 1 + M_new[r, r] = 1 M = M * M_new # Step 3: Order the signs for i in range(4): - if Q[i,3] < 0: + if Q[i, 3] < 0: Q.multiply_variable(-1, i, in_place=True) - M_new = matrix(R,n,n) + M_new = matrix(R, n, n) for r in range(4): if r == i: - M_new[r,r] = -1 + M_new[r, r] = -1 else: - M_new[r,r] = 1 + M_new[r, r] = 1 M = M * M_new for i in range(4): j = 3 - while (Q[i,j] == 0): + while (Q[i, j] == 0): j += -1 - if (Q[i,j] < 0): + if (Q[i, j] < 0): Q.multiply_variable(-1, i, in_place=True) - M_new = matrix(R,n,n) + M_new = matrix(R, n, n) for r in range(4): if r == i: - M_new[r,r] = -1 + M_new[r, r] = -1 else: - M_new[r,r] = 1 + M_new[r, r] = 1 M = M * M_new - if Q[1,2] < 0: + if Q[1, 2] < 0: # Test a row 1 sign change - if (Q[1,3] <= 0 and \ - ((Q[1,3] < 0) or (Q[1,3] == 0 and Q[1,2] < 0) \ - or (Q[1,3] == 0 and Q[1,2] == 0 and Q[1,1] < 0))): + if (Q[1, 3] <= 0 and + ((Q[1, 3] < 0) or (Q[1, 3] == 0 and Q[1, 2] < 0) + or (Q[1, 3] == 0 and Q[1, 2] == 0 and Q[1, 1] < 0))): Q.multiply_variable(-1, i, in_place=True) - M_new = matrix(R,n,n) + M_new = matrix(R, n, n) for r in range(4): if r == i: - M_new[r,r] = -1 + M_new[r, r] = -1 else: - M_new[r,r] = 1 + M_new[r, r] = 1 M = M * M_new - elif (Q[2,3] <= 0 and \ - ((Q[2,3] < 0) or (Q[2,3] == 0 and Q[2,2] < 0) \ - or (Q[2,3] == 0 and Q[2,2] == 0 and Q[2,1] < 0))): + elif (Q[2, 3] <= 0 and + ((Q[2, 3] < 0) or (Q[2, 3] == 0 and Q[2, 2] < 0) + or (Q[2, 3] == 0 and Q[2, 2] == 0 and Q[2, 1] < 0))): Q.multiply_variable(-1, i, in_place=True) - M_new = matrix(R,n,n) + M_new = matrix(R, n, n) for r in range(4): if r == i: - M_new[r,r] = -1 + M_new[r, r] = -1 else: - M_new[r,r] = 1 + M_new[r, r] = 1 M = M * M_new # Return the results diff --git a/src/sage/quadratic_forms/quadratic_form__theta.py b/src/sage/quadratic_forms/quadratic_form__theta.py index 7763c61a194..1c8813e04f9 100644 --- a/src/sage/quadratic_forms/quadratic_form__theta.py +++ b/src/sage/quadratic_forms/quadratic_form__theta.py @@ -235,32 +235,32 @@ def theta_by_cholesky(self, q_prec): # 3b. Main loop if (i > 0): from_step3_flag = True - T[i-1] = T[i] - Q[i,i] * (x[i] + U[i]) * (x[i] + U[i]) - i += - 1 + T[i - 1] = T[i] - Q[i, i] * (x[i] + U[i]) * (x[i] + U[i]) + i += -1 U[i] = 0 - for j in range(i+1, n): - U[i] += Q[i,j] * x[j] + for j in range(i + 1, n): + U[i] += Q[i, j] * x[j] # 4. Solution found (This happens when i=0) from_step4_flag = True - Q_val_double = q_prec - T[0] + Q[0,0] * (x[0] + U[0]) * (x[0] + U[0]) + Q_val_double = q_prec - T[0] + Q[0, 0] * (x[0] + U[0]) * (x[0] + U[0]) Q_val = floor(Q_val_double + half) # Note: This rounds the value up, since the "round" function returns a float, but floor returns integer. # OPTIONAL SAFETY CHECK: eps = 0.000000001 - if (abs(Q_val_double - Q_val) > eps): - raise RuntimeError("Oh No! We have a problem with the floating point precision... \n" \ - + " Q_val_double = " + str(Q_val_double) + "\n" \ - + " Q_val = " + str(Q_val) + "\n" \ + if abs(Q_val_double - Q_val) > eps: + raise RuntimeError("Oh No! We have a problem with the floating point precision... \n" + + " Q_val_double = " + str(Q_val_double) + "\n" + + " Q_val = " + str(Q_val) + "\n" + " x = " + str(x) + "\n") - if (Q_val <= q_prec): + if Q_val <= q_prec: theta[Q_val] += 2 # 5. Check if x = 0, for exit condition. =) done_flag = True for j in range(n): - if (x[j] != 0): + if x[j] != 0: done_flag = False # Set the value: theta[0] = 1 diff --git a/src/sage/rings/function_field/drinfeld_modules/drinfeld_module.py b/src/sage/rings/function_field/drinfeld_modules/drinfeld_module.py index 1a24f09d66d..b50193c1862 100644 --- a/src/sage/rings/function_field/drinfeld_modules/drinfeld_module.py +++ b/src/sage/rings/function_field/drinfeld_modules/drinfeld_module.py @@ -1030,7 +1030,7 @@ def height(self): """ try: if self.characteristic().is_zero(): - raise ValueError('height is defined for prime ' \ + raise ValueError('height is defined for prime ' 'function field characteristic') else: p = self.characteristic() @@ -1038,7 +1038,7 @@ def height(self): except NotImplementedError: raise NotImplementedError('height not implemented in this case') - def is_finite(self): + def is_finite(self) -> bool: r""" Return ``True`` if this Drinfeld module is finite, ``False`` otherwise. diff --git a/src/sage/symbolic/assumptions.py b/src/sage/symbolic/assumptions.py index 4616fd2880b..35c7dcfaeab 100644 --- a/src/sage/symbolic/assumptions.py +++ b/src/sage/symbolic/assumptions.py @@ -725,7 +725,7 @@ def forget(*args): try: x.forget() except KeyError: - raise TypeError("forget not defined for objects of type '%s'"%type(x)) + raise TypeError("forget not defined for objects of type '%s'" % type(x)) def assumptions(*args): @@ -782,11 +782,11 @@ def assumptions(*args): result = [] if len(args) == 1: result.extend([statement for statement in _assumptions - if statement.has(args[0])]) + if statement.has(args[0])]) else: for v in args: - result += [ statement for statement in list(_assumptions) \ - if str(v) in str(statement) ] + result += [statement for statement in list(_assumptions) + if str(v) in str(statement)] return result From 3fe393c8815fcb389ecfc095e108f529716aa7e3 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 20 Mar 2023 20:23:58 -0700 Subject: [PATCH 019/135] Remove many empty __init__.py files when all.py files are present --- src/sage/algebras/{__init__.py => letterplace/all.py} | 0 src/sage/algebras/lie_algebras/__init__.py | 0 src/sage/algebras/lie_conformal_algebras/__init__.py | 0 src/sage/algebras/quantum_groups/__init__.py | 0 src/sage/algebras/quatalg/__init__.py | 0 src/sage/algebras/steenrod/__init__.py | 0 src/sage/calculus/__init__.py | 0 src/sage/calculus/transforms/__init__.py | 0 src/sage/coding/__init__.py | 0 src/sage/coding/source_coding/__init__.py | 0 src/sage/combinat/__init__.py | 0 src/sage/combinat/chas/__init__.py | 0 src/sage/combinat/cluster_algebra_quiver/__init__.py | 0 src/sage/combinat/crystals/__init__.py | 0 src/sage/combinat/designs/__init__.py | 0 src/sage/combinat/matrices/__init__.py | 0 src/sage/combinat/ncsf_qsym/__init__.py | 0 src/sage/combinat/ncsym/__init__.py | 0 src/sage/combinat/path_tableaux/__init__.py | 0 src/sage/combinat/posets/__init__.py | 0 src/sage/combinat/rigged_configurations/__init__.py | 0 src/sage/combinat/root_system/__init__.py | 0 src/sage/combinat/sf/__init__.py | 0 src/sage/combinat/species/__init__.py | 0 src/sage/crypto/block_cipher/__init__.py | 0 src/sage/crypto/public_key/__init__.py | 0 src/sage/data_structures/__init__.py | 0 src/sage/databases/__init__.py | 0 src/sage/dynamics/__init__.py | 0 src/sage/dynamics/arithmetic_dynamics/__init__.py | 0 src/sage/dynamics/complex_dynamics/__init__.py | 0 src/sage/game_theory/__init__.py | 0 src/sage/games/__init__.py | 0 src/sage/geometry/__init__.py | 0 src/sage/geometry/hyperbolic_space/__init__.py | 0 src/sage/geometry/polyhedron/__init__.py | 0 src/sage/geometry/riemannian_manifolds/__init__.py | 0 src/sage/geometry/triangulation/__init__.py | 0 src/sage/groups/__init__.py | 0 src/sage/groups/abelian_gps/__init__.py | 0 src/sage/groups/additive_abelian/__init__.py | 0 src/sage/groups/matrix_gps/__init__.py | 0 src/sage/groups/perm_gps/__init__.py | 0 src/sage/homology/__init__.py | 0 src/sage/interacts/__init__.py | 0 src/sage/knots/__init__.py | 0 src/sage/lfunctions/__init__.py | 0 src/sage/logic/__init__.py | 0 src/sage/manifolds/__init__.py | 0 src/sage/modular/__init__.py | 0 src/sage/modular/abvar/__init__.py | 0 src/sage/modular/arithgroup/__init__.py | 0 src/sage/modular/btquotients/__init__.py | 0 src/sage/modular/hecke/__init__.py | 0 src/sage/modular/local_comp/__init__.py | 0 src/sage/modular/modform/__init__.py | 0 src/sage/modular/modform_hecketriangle/__init__.py | 0 src/sage/modular/modsym/__init__.py | 0 src/sage/modular/overconvergent/__init__.py | 0 src/sage/modular/pollack_stevens/__init__.py | 0 src/sage/modular/quatalg/__init__.py | 0 src/sage/modular/ssmod/__init__.py | 0 src/sage/modules/__init__.py | 0 src/sage/monoids/__init__.py | 0 src/sage/parallel/__init__.py | 0 src/sage/probability/__init__.py | 0 src/sage/quadratic_forms/__init__.py | 0 src/sage/quadratic_forms/genera/__init__.py | 0 src/sage/rings/asymptotic/__init__.py | 0 src/sage/rings/function_field/__init__.py | 0 src/sage/rings/invariants/__init__.py | 0 src/sage/rings/padics/__init__.py | 0 src/sage/rings/polynomial/padics/__init__.py | 0 .../__init__.py => rings/polynomial/padics/all.py} | 0 src/sage/rings/polynomial/weil/__init__.py | 0 src/sage/rings/semirings/__init__.py | 0 src/sage/sandpiles/__init__.py | 0 src/sage/sat/__init__.py | 0 src/sage/schemes/__init__.py | 0 src/sage/schemes/affine/__init__.py | 0 src/sage/schemes/berkovich/__init__.py | 0 src/sage/schemes/curves/__init__.py | 0 src/sage/schemes/cyclic_covers/__init__.py | 0 src/sage/schemes/elliptic_curves/__init__.py | 0 src/sage/schemes/generic/__init__.py | 0 src/sage/schemes/hyperelliptic_curves/__init__.py | 0 src/sage/schemes/jacobians/__init__.py | 0 src/sage/schemes/plane_conics/__init__.py | 0 src/sage/schemes/plane_quartics/__init__.py | 0 src/sage/schemes/product_projective/__init__.py | 0 src/sage/schemes/projective/__init__.py | 0 src/sage/schemes/riemann_surfaces/__init__.py | 0 .../fusion_rings/__init__.py => schemes/riemann_surfaces/all.py} | 0 src/sage/schemes/toric/__init__.py | 0 src/sage/schemes/toric/sheaf/__init__.py | 0 .../hecke_algebras/__init__.py => schemes/toric/sheaf/all.py} | 0 src/sage/server/__init__.py | 0 src/sage/stats/__init__.py | 0 src/sage/stats/distributions/__init__.py | 0 .../letterplace/__init__.py => stats/distributions/all.py} | 0 src/sage/stats/hmm/__init__.py | 0 src/sage/tensor/__init__.py | 0 src/sage/tensor/modules/__init__.py | 0 src/sage/topology/__init__.py | 0 src/sage/typeset/__init__.py | 0 105 files changed, 0 insertions(+), 0 deletions(-) rename src/sage/algebras/{__init__.py => letterplace/all.py} (100%) delete mode 100644 src/sage/algebras/lie_algebras/__init__.py delete mode 100644 src/sage/algebras/lie_conformal_algebras/__init__.py delete mode 100644 src/sage/algebras/quantum_groups/__init__.py delete mode 100644 src/sage/algebras/quatalg/__init__.py delete mode 100644 src/sage/algebras/steenrod/__init__.py delete mode 100644 src/sage/calculus/__init__.py delete mode 100644 src/sage/calculus/transforms/__init__.py delete mode 100644 src/sage/coding/__init__.py delete mode 100644 src/sage/coding/source_coding/__init__.py delete mode 100644 src/sage/combinat/__init__.py delete mode 100644 src/sage/combinat/chas/__init__.py delete mode 100644 src/sage/combinat/cluster_algebra_quiver/__init__.py delete mode 100644 src/sage/combinat/crystals/__init__.py delete mode 100644 src/sage/combinat/designs/__init__.py delete mode 100644 src/sage/combinat/matrices/__init__.py delete mode 100644 src/sage/combinat/ncsf_qsym/__init__.py delete mode 100644 src/sage/combinat/ncsym/__init__.py delete mode 100644 src/sage/combinat/path_tableaux/__init__.py delete mode 100644 src/sage/combinat/posets/__init__.py delete mode 100644 src/sage/combinat/rigged_configurations/__init__.py delete mode 100644 src/sage/combinat/root_system/__init__.py delete mode 100644 src/sage/combinat/sf/__init__.py delete mode 100644 src/sage/combinat/species/__init__.py delete mode 100644 src/sage/crypto/block_cipher/__init__.py delete mode 100644 src/sage/crypto/public_key/__init__.py delete mode 100644 src/sage/data_structures/__init__.py delete mode 100644 src/sage/databases/__init__.py delete mode 100644 src/sage/dynamics/__init__.py delete mode 100644 src/sage/dynamics/arithmetic_dynamics/__init__.py delete mode 100644 src/sage/dynamics/complex_dynamics/__init__.py delete mode 100644 src/sage/game_theory/__init__.py delete mode 100644 src/sage/games/__init__.py delete mode 100644 src/sage/geometry/__init__.py delete mode 100644 src/sage/geometry/hyperbolic_space/__init__.py delete mode 100644 src/sage/geometry/polyhedron/__init__.py delete mode 100644 src/sage/geometry/riemannian_manifolds/__init__.py delete mode 100644 src/sage/geometry/triangulation/__init__.py delete mode 100644 src/sage/groups/__init__.py delete mode 100644 src/sage/groups/abelian_gps/__init__.py delete mode 100644 src/sage/groups/additive_abelian/__init__.py delete mode 100644 src/sage/groups/matrix_gps/__init__.py delete mode 100644 src/sage/groups/perm_gps/__init__.py delete mode 100644 src/sage/homology/__init__.py delete mode 100644 src/sage/interacts/__init__.py delete mode 100644 src/sage/knots/__init__.py delete mode 100644 src/sage/lfunctions/__init__.py delete mode 100644 src/sage/logic/__init__.py delete mode 100644 src/sage/manifolds/__init__.py delete mode 100644 src/sage/modular/__init__.py delete mode 100644 src/sage/modular/abvar/__init__.py delete mode 100644 src/sage/modular/arithgroup/__init__.py delete mode 100644 src/sage/modular/btquotients/__init__.py delete mode 100644 src/sage/modular/hecke/__init__.py delete mode 100644 src/sage/modular/local_comp/__init__.py delete mode 100644 src/sage/modular/modform/__init__.py delete mode 100644 src/sage/modular/modform_hecketriangle/__init__.py delete mode 100644 src/sage/modular/modsym/__init__.py delete mode 100644 src/sage/modular/overconvergent/__init__.py delete mode 100644 src/sage/modular/pollack_stevens/__init__.py delete mode 100644 src/sage/modular/quatalg/__init__.py delete mode 100644 src/sage/modular/ssmod/__init__.py delete mode 100644 src/sage/modules/__init__.py delete mode 100644 src/sage/monoids/__init__.py delete mode 100644 src/sage/parallel/__init__.py delete mode 100644 src/sage/probability/__init__.py delete mode 100644 src/sage/quadratic_forms/__init__.py delete mode 100644 src/sage/quadratic_forms/genera/__init__.py delete mode 100644 src/sage/rings/asymptotic/__init__.py delete mode 100644 src/sage/rings/function_field/__init__.py delete mode 100644 src/sage/rings/invariants/__init__.py delete mode 100644 src/sage/rings/padics/__init__.py delete mode 100644 src/sage/rings/polynomial/padics/__init__.py rename src/sage/{algebras/finite_dimensional_algebras/__init__.py => rings/polynomial/padics/all.py} (100%) delete mode 100644 src/sage/rings/polynomial/weil/__init__.py delete mode 100644 src/sage/rings/semirings/__init__.py delete mode 100644 src/sage/sandpiles/__init__.py delete mode 100644 src/sage/sat/__init__.py delete mode 100644 src/sage/schemes/__init__.py delete mode 100644 src/sage/schemes/affine/__init__.py delete mode 100644 src/sage/schemes/berkovich/__init__.py delete mode 100644 src/sage/schemes/curves/__init__.py delete mode 100644 src/sage/schemes/cyclic_covers/__init__.py delete mode 100644 src/sage/schemes/elliptic_curves/__init__.py delete mode 100644 src/sage/schemes/generic/__init__.py delete mode 100644 src/sage/schemes/hyperelliptic_curves/__init__.py delete mode 100644 src/sage/schemes/jacobians/__init__.py delete mode 100644 src/sage/schemes/plane_conics/__init__.py delete mode 100644 src/sage/schemes/plane_quartics/__init__.py delete mode 100644 src/sage/schemes/product_projective/__init__.py delete mode 100644 src/sage/schemes/projective/__init__.py delete mode 100644 src/sage/schemes/riemann_surfaces/__init__.py rename src/sage/{algebras/fusion_rings/__init__.py => schemes/riemann_surfaces/all.py} (100%) delete mode 100644 src/sage/schemes/toric/__init__.py delete mode 100644 src/sage/schemes/toric/sheaf/__init__.py rename src/sage/{algebras/hecke_algebras/__init__.py => schemes/toric/sheaf/all.py} (100%) delete mode 100644 src/sage/server/__init__.py delete mode 100644 src/sage/stats/__init__.py delete mode 100644 src/sage/stats/distributions/__init__.py rename src/sage/{algebras/letterplace/__init__.py => stats/distributions/all.py} (100%) delete mode 100644 src/sage/stats/hmm/__init__.py delete mode 100644 src/sage/tensor/__init__.py delete mode 100644 src/sage/tensor/modules/__init__.py delete mode 100644 src/sage/topology/__init__.py delete mode 100644 src/sage/typeset/__init__.py diff --git a/src/sage/algebras/__init__.py b/src/sage/algebras/letterplace/all.py similarity index 100% rename from src/sage/algebras/__init__.py rename to src/sage/algebras/letterplace/all.py diff --git a/src/sage/algebras/lie_algebras/__init__.py b/src/sage/algebras/lie_algebras/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/algebras/lie_conformal_algebras/__init__.py b/src/sage/algebras/lie_conformal_algebras/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/algebras/quantum_groups/__init__.py b/src/sage/algebras/quantum_groups/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/algebras/quatalg/__init__.py b/src/sage/algebras/quatalg/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/algebras/steenrod/__init__.py b/src/sage/algebras/steenrod/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/calculus/__init__.py b/src/sage/calculus/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/calculus/transforms/__init__.py b/src/sage/calculus/transforms/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/coding/__init__.py b/src/sage/coding/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/coding/source_coding/__init__.py b/src/sage/coding/source_coding/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/combinat/__init__.py b/src/sage/combinat/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/combinat/chas/__init__.py b/src/sage/combinat/chas/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/combinat/cluster_algebra_quiver/__init__.py b/src/sage/combinat/cluster_algebra_quiver/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/combinat/crystals/__init__.py b/src/sage/combinat/crystals/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/combinat/designs/__init__.py b/src/sage/combinat/designs/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/combinat/matrices/__init__.py b/src/sage/combinat/matrices/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/combinat/ncsf_qsym/__init__.py b/src/sage/combinat/ncsf_qsym/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/combinat/ncsym/__init__.py b/src/sage/combinat/ncsym/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/combinat/path_tableaux/__init__.py b/src/sage/combinat/path_tableaux/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/combinat/posets/__init__.py b/src/sage/combinat/posets/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/combinat/rigged_configurations/__init__.py b/src/sage/combinat/rigged_configurations/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/combinat/root_system/__init__.py b/src/sage/combinat/root_system/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/combinat/sf/__init__.py b/src/sage/combinat/sf/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/combinat/species/__init__.py b/src/sage/combinat/species/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/crypto/block_cipher/__init__.py b/src/sage/crypto/block_cipher/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/crypto/public_key/__init__.py b/src/sage/crypto/public_key/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/data_structures/__init__.py b/src/sage/data_structures/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/databases/__init__.py b/src/sage/databases/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/dynamics/__init__.py b/src/sage/dynamics/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/dynamics/arithmetic_dynamics/__init__.py b/src/sage/dynamics/arithmetic_dynamics/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/dynamics/complex_dynamics/__init__.py b/src/sage/dynamics/complex_dynamics/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/game_theory/__init__.py b/src/sage/game_theory/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/games/__init__.py b/src/sage/games/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/geometry/__init__.py b/src/sage/geometry/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/geometry/hyperbolic_space/__init__.py b/src/sage/geometry/hyperbolic_space/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/geometry/polyhedron/__init__.py b/src/sage/geometry/polyhedron/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/geometry/riemannian_manifolds/__init__.py b/src/sage/geometry/riemannian_manifolds/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/geometry/triangulation/__init__.py b/src/sage/geometry/triangulation/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/groups/__init__.py b/src/sage/groups/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/groups/abelian_gps/__init__.py b/src/sage/groups/abelian_gps/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/groups/additive_abelian/__init__.py b/src/sage/groups/additive_abelian/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/groups/matrix_gps/__init__.py b/src/sage/groups/matrix_gps/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/groups/perm_gps/__init__.py b/src/sage/groups/perm_gps/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/homology/__init__.py b/src/sage/homology/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/interacts/__init__.py b/src/sage/interacts/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/knots/__init__.py b/src/sage/knots/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/lfunctions/__init__.py b/src/sage/lfunctions/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/logic/__init__.py b/src/sage/logic/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/manifolds/__init__.py b/src/sage/manifolds/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/modular/__init__.py b/src/sage/modular/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/modular/abvar/__init__.py b/src/sage/modular/abvar/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/modular/arithgroup/__init__.py b/src/sage/modular/arithgroup/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/modular/btquotients/__init__.py b/src/sage/modular/btquotients/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/modular/hecke/__init__.py b/src/sage/modular/hecke/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/modular/local_comp/__init__.py b/src/sage/modular/local_comp/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/modular/modform/__init__.py b/src/sage/modular/modform/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/modular/modform_hecketriangle/__init__.py b/src/sage/modular/modform_hecketriangle/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/modular/modsym/__init__.py b/src/sage/modular/modsym/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/modular/overconvergent/__init__.py b/src/sage/modular/overconvergent/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/modular/pollack_stevens/__init__.py b/src/sage/modular/pollack_stevens/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/modular/quatalg/__init__.py b/src/sage/modular/quatalg/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/modular/ssmod/__init__.py b/src/sage/modular/ssmod/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/modules/__init__.py b/src/sage/modules/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/monoids/__init__.py b/src/sage/monoids/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/parallel/__init__.py b/src/sage/parallel/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/probability/__init__.py b/src/sage/probability/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/quadratic_forms/__init__.py b/src/sage/quadratic_forms/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/quadratic_forms/genera/__init__.py b/src/sage/quadratic_forms/genera/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/rings/asymptotic/__init__.py b/src/sage/rings/asymptotic/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/rings/function_field/__init__.py b/src/sage/rings/function_field/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/rings/invariants/__init__.py b/src/sage/rings/invariants/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/rings/padics/__init__.py b/src/sage/rings/padics/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/rings/polynomial/padics/__init__.py b/src/sage/rings/polynomial/padics/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/algebras/finite_dimensional_algebras/__init__.py b/src/sage/rings/polynomial/padics/all.py similarity index 100% rename from src/sage/algebras/finite_dimensional_algebras/__init__.py rename to src/sage/rings/polynomial/padics/all.py diff --git a/src/sage/rings/polynomial/weil/__init__.py b/src/sage/rings/polynomial/weil/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/rings/semirings/__init__.py b/src/sage/rings/semirings/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/sandpiles/__init__.py b/src/sage/sandpiles/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/sat/__init__.py b/src/sage/sat/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/schemes/__init__.py b/src/sage/schemes/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/schemes/affine/__init__.py b/src/sage/schemes/affine/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/schemes/berkovich/__init__.py b/src/sage/schemes/berkovich/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/schemes/curves/__init__.py b/src/sage/schemes/curves/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/schemes/cyclic_covers/__init__.py b/src/sage/schemes/cyclic_covers/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/schemes/elliptic_curves/__init__.py b/src/sage/schemes/elliptic_curves/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/schemes/generic/__init__.py b/src/sage/schemes/generic/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/schemes/hyperelliptic_curves/__init__.py b/src/sage/schemes/hyperelliptic_curves/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/schemes/jacobians/__init__.py b/src/sage/schemes/jacobians/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/schemes/plane_conics/__init__.py b/src/sage/schemes/plane_conics/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/schemes/plane_quartics/__init__.py b/src/sage/schemes/plane_quartics/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/schemes/product_projective/__init__.py b/src/sage/schemes/product_projective/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/schemes/projective/__init__.py b/src/sage/schemes/projective/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/schemes/riemann_surfaces/__init__.py b/src/sage/schemes/riemann_surfaces/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/algebras/fusion_rings/__init__.py b/src/sage/schemes/riemann_surfaces/all.py similarity index 100% rename from src/sage/algebras/fusion_rings/__init__.py rename to src/sage/schemes/riemann_surfaces/all.py diff --git a/src/sage/schemes/toric/__init__.py b/src/sage/schemes/toric/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/schemes/toric/sheaf/__init__.py b/src/sage/schemes/toric/sheaf/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/algebras/hecke_algebras/__init__.py b/src/sage/schemes/toric/sheaf/all.py similarity index 100% rename from src/sage/algebras/hecke_algebras/__init__.py rename to src/sage/schemes/toric/sheaf/all.py diff --git a/src/sage/server/__init__.py b/src/sage/server/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/stats/__init__.py b/src/sage/stats/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/stats/distributions/__init__.py b/src/sage/stats/distributions/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/algebras/letterplace/__init__.py b/src/sage/stats/distributions/all.py similarity index 100% rename from src/sage/algebras/letterplace/__init__.py rename to src/sage/stats/distributions/all.py diff --git a/src/sage/stats/hmm/__init__.py b/src/sage/stats/hmm/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/tensor/__init__.py b/src/sage/tensor/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/tensor/modules/__init__.py b/src/sage/tensor/modules/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/topology/__init__.py b/src/sage/topology/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/typeset/__init__.py b/src/sage/typeset/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 From 915dc241f17de64ca07ac9eb02a37cbdba2c07fc Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 20 Mar 2023 20:47:39 -0700 Subject: [PATCH 020/135] Remove some more empty / almost empty __init__.py files when all.py files are present --- src/sage/dynamics/cellular_automata/__init__.py | 3 --- src/sage/libs/gap/__init__.py | 1 - src/sage/rings/valuation/__init__.py | 0 3 files changed, 4 deletions(-) delete mode 100644 src/sage/dynamics/cellular_automata/__init__.py delete mode 100644 src/sage/libs/gap/__init__.py delete mode 100644 src/sage/rings/valuation/__init__.py diff --git a/src/sage/dynamics/cellular_automata/__init__.py b/src/sage/dynamics/cellular_automata/__init__.py deleted file mode 100644 index bd469e79134..00000000000 --- a/src/sage/dynamics/cellular_automata/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -r""" -Cellular Automata -""" diff --git a/src/sage/libs/gap/__init__.py b/src/sage/libs/gap/__init__.py deleted file mode 100644 index faee3554865..00000000000 --- a/src/sage/libs/gap/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# libgap diff --git a/src/sage/rings/valuation/__init__.py b/src/sage/rings/valuation/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 From 3dd56c5409ddfa0c51cdaa947d17d4e6b1ab70b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Tue, 21 Mar 2023 13:28:30 +0100 Subject: [PATCH 021/135] fix reviewer suggestions --- .../lie_conformal_algebra_element.py | 22 ++++++++++--------- src/sage/crypto/mq/rijndael_gf.py | 6 ++--- src/sage/databases/sql_db.py | 16 ++++++++------ src/sage/interfaces/rubik.py | 22 +++++++++---------- .../quadratic_form__reduction_theory.py | 16 +++++++------- 5 files changed, 43 insertions(+), 39 deletions(-) diff --git a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py index 02c25a67297..b41cdf32811 100644 --- a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py +++ b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py @@ -60,14 +60,14 @@ def T(self, n=1): raise ValueError("n must be a nonnegative Integer") if n == 0 or self.is_zero(): return self - #it's faster to sum than to use recursion + # it's faster to sum than to use recursion if self.is_monomial(): p = self.parent() - a,m = self.index() - coef = self._monomial_coefficients[(a,m)] - if (a,m+n) in p._indices: - return coef*prod(j for j in range(m+1,m+n+1))\ - *p.monomial((a,m+n)) + a, m = self.index() + coef = self._monomial_coefficients[(a, m)] + if (a, m + n) in p._indices: + return coef * prod(j for j in range(m + 1, m + n + 1))\ + * p.monomial((a, m + n)) else: return p.zero() return sum(mon.T(n) for mon in self.terms()) @@ -130,10 +130,12 @@ def _bracket_(self, right): except KeyError: return {} pole = max(mbr.keys()) - ret = {l: coefa*coefb*(-1)**k/factorial(k)*sum(factorial(l) - /factorial(m+k+j-l)/factorial(l-k-j)/factorial(j)* - mbr[j].T(m+k+j-l) for j in mbr if j >= l-m-k and - j <= l-k) for l in range(m+k+pole+1)} + ret = {l: coefa * coefb * (-1)**k / factorial(k) * + sum(factorial(l) / factorial(m + k + j - l) + / factorial(l - k - j) / factorial(j) + * mbr[j].T(m + k + j - l) + for j in mbr if l - m - k <= j <= l - k) + for l in range(m + k + pole + 1)} return {k: v for k, v in ret.items() if v} diclist = [i._bracket_(j) for i in self.terms() diff --git a/src/sage/crypto/mq/rijndael_gf.py b/src/sage/crypto/mq/rijndael_gf.py index 8665c4700c8..6d3ddf988ea 100644 --- a/src/sage/crypto/mq/rijndael_gf.py +++ b/src/sage/crypto/mq/rijndael_gf.py @@ -1142,9 +1142,9 @@ def _check_valid_PRmatrix(self, PRm, keyword): msg = msg.format(keyword, 4, self._Nb, self._F) if (not isinstance(PRm, Matrix) or not (PRm.base_ring().is_field() and - PRm.base_ring().is_finite() and - PRm.base_ring().order() == 256 and - PRm.dimensions() == (4, self._Nb))) and \ + PRm.base_ring().is_finite() and + PRm.base_ring().order() == 256 and + PRm.dimensions() == (4, self._Nb))) and \ (not isinstance(PRm, Matrix) or not isinstance(PRm.base_ring(), MPolynomialRing_base) or not (PRm.base_ring().base_ring().is_field() and diff --git a/src/sage/databases/sql_db.py b/src/sage/databases/sql_db.py index 4a456ba0f32..cd611228dee 100644 --- a/src/sage/databases/sql_db.py +++ b/src/sage/databases/sql_db.py @@ -829,8 +829,9 @@ def _merge_queries(self, other, ret, join_table, join_dict, operator): new_query = ''.join(disp1) # concatenate where clause - new_query = re.sub(' WHERE ',' WHERE ( ', new_query) - new_query += re.sub('^.* WHERE ',' ) %s ( '%operator, + new_query = re.sub(' WHERE ', ' WHERE ( ', + new_query) + new_query += re.sub('^.* WHERE ', f' ) {operator} ( ', other.__query_string__) ret.__query_string__ = new_query + ' )' @@ -1641,11 +1642,12 @@ def _rebuild_table(self, table_name, col_name=None, default=''): CREATE TABLE %s (%s); """ % (cols_attr, original, table_name, table_name, table_name, cols_attr)) # Update indices in new table - index_statement = ''.join(['CREATE INDEX i_%s_%s ON ' % (table_name, - col) + '%s(%s);\n' % (table_name, col) for col in - self.__skeleton__[table_name] if - self.__skeleton__[table_name][col]['index'] and not - self.__skeleton__[table_name][col]['primary_key']]) + skeleton = self.__skeleton__[table_name] + index_statement = ''.join(f'CREATE INDEX i_{table_name}_{col} ON ' + + f'{table_name}({col});\n' + for col in skeleton + if skeleton[col]['index'] + and not skeleton[col]['primary_key']) if index_statement: self.__connection__.executescript(index_statement) diff --git a/src/sage/interfaces/rubik.py b/src/sage/interfaces/rubik.py index 1a142200707..546e7e962c6 100644 --- a/src/sage/interfaces/rubik.py +++ b/src/sage/interfaces/rubik.py @@ -46,17 +46,17 @@ # Can't seem to find consistency in letter ordering # between us and them... These are copied from the source. optimal_solver_tokens = ["UF", "UR", "UB", "UL", - "DF", "DR", "DB", "DL", - "FR", "FL", "BR", "BL", - "FU", "RU", "BU", "LU", - "FD", "RD", "BD", "LD", - "RF", "LF", "RB", "LB", - "UFR", "URB", "UBL", "ULF", - "DRF", "DFL", "DLB", "DBR", - "FRU", "RBU", "BLU", "LFU", - "RFD", "FLD", "LBD", "BRD", - "RUF", "BUR", "LUB", "FUL", - "FDR", "LDF", "BDL", "RDB"] + "DF", "DR", "DB", "DL", + "FR", "FL", "BR", "BL", + "FU", "RU", "BU", "LU", + "FD", "RD", "BD", "LD", + "RF", "LF", "RB", "LB", + "UFR", "URB", "UBL", "ULF", + "DRF", "DFL", "DLB", "DBR", + "FRU", "RBU", "BLU", "LFU", + "RFD", "FLD", "LBD", "BRD", + "RUF", "BUR", "LUB", "FUL", + "FDR", "LDF", "BDL", "RDB"] # The input format. optimal_solver_format = "UF UR UB UL DF DR DB DL FR FL BR BL UFR URB UBL ULF DRF DFL DLB DBR" diff --git a/src/sage/quadratic_forms/quadratic_form__reduction_theory.py b/src/sage/quadratic_forms/quadratic_form__reduction_theory.py index 18968494f6b..0035bbdf84f 100644 --- a/src/sage/quadratic_forms/quadratic_form__reduction_theory.py +++ b/src/sage/quadratic_forms/quadratic_form__reduction_theory.py @@ -425,9 +425,9 @@ def minkowski_reduction_for_4vars__SP(self): for i in range(4): j = 3 - while (Q[i, j] == 0): + while Q[i, j] == 0: j += -1 - if (Q[i, j] < 0): + if Q[i, j] < 0: Q.multiply_variable(-1, i, in_place=True) M_new = matrix(R, n, n) for r in range(4): @@ -439,9 +439,9 @@ def minkowski_reduction_for_4vars__SP(self): if Q[1, 2] < 0: # Test a row 1 sign change - if (Q[1, 3] <= 0 and - ((Q[1, 3] < 0) or (Q[1, 3] == 0 and Q[1, 2] < 0) - or (Q[1, 3] == 0 and Q[1, 2] == 0 and Q[1, 1] < 0))): + if (Q[1, 3] <= 0 and (Q[1, 3] < 0 + or Q[1, 2] < 0 + or (Q[1, 2] == 0 and Q[1, 1] < 0))): Q.multiply_variable(-1, i, in_place=True) M_new = matrix(R, n, n) for r in range(4): @@ -451,9 +451,9 @@ def minkowski_reduction_for_4vars__SP(self): M_new[r, r] = 1 M = M * M_new - elif (Q[2, 3] <= 0 and - ((Q[2, 3] < 0) or (Q[2, 3] == 0 and Q[2, 2] < 0) - or (Q[2, 3] == 0 and Q[2, 2] == 0 and Q[2, 1] < 0))): + elif (Q[2, 3] <= 0 and ((Q[2, 3] < 0) + or Q[2, 2] < 0 + or (Q[2, 2] == 0 and Q[2, 1] < 0))): Q.multiply_variable(-1, i, in_place=True) M_new = matrix(R, n, n) for r in range(4): From 9957360eb5539a42207ff733d3e821c3f27c6ce0 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 21 Mar 2023 13:52:15 -0700 Subject: [PATCH 022/135] sage.misc.package_dir.walk_packages: New, use in sage.misc.dev_tools --- src/sage/misc/dev_tools.py | 4 +- src/sage/misc/package_dir.py | 122 +++++++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+), 2 deletions(-) diff --git a/src/sage/misc/dev_tools.py b/src/sage/misc/dev_tools.py index 9b2f8a504c9..c18253358ba 100644 --- a/src/sage/misc/dev_tools.py +++ b/src/sage/misc/dev_tools.py @@ -169,7 +169,7 @@ def load_submodules(module=None, exclude_pattern=None): load sage.geometry.polyhedron.palp_database... succeeded load sage.geometry.polyhedron.ppl_lattice_polygon... succeeded """ - import pkgutil + from .package_dir import walk_packages if module is None: import sage @@ -181,7 +181,7 @@ def load_submodules(module=None, exclude_pattern=None): else: exclude = None - for importer, module_name, ispkg in pkgutil.walk_packages(module.__path__, module.__name__ + '.'): + for importer, module_name, ispkg in walk_packages(module.__path__, module.__name__ + '.'): if ispkg or module_name in sys.modules: continue diff --git a/src/sage/misc/package_dir.py b/src/sage/misc/package_dir.py index 17e0ce7b72c..bb4e34d5c26 100644 --- a/src/sage/misc/package_dir.py +++ b/src/sage/misc/package_dir.py @@ -14,6 +14,7 @@ import os import glob +import sys from contextlib import contextmanager @@ -211,3 +212,124 @@ def cython_namespace_package_support(): yield finally: Cython.Utils.is_package_dir = Cython.Build.Cythonize.is_package_dir = Cython.Build.Dependencies.is_package_dir = orig_is_package_dir + + +def walk_packages(path=None, prefix='', onerror=None): + r""" + Yield :class:`pkgutil.ModuleInfo` for all modules recursively on ``path``. + + This version of the standard library function :func:`pkgutil.walk_packages` + addresses /~https://github.com/python/cpython/issues/73444 by handling + the implicit namespace packages in the package layout used by Sage; + see :func:`is_package_or_sage_namespace_package_dir`. + + INPUT: + + - ``path`` -- a list of paths to look for modules in or + ``None`` (all accessible modules). + + - ``prefix`` -- a string to output on the front of every module name + on output. + + - ``onerror`` -- a function which gets called with one argument (the + name of the package which was being imported) if any exception + occurs while trying to import a package. If ``None``, ignore + :class:`ImportError` but propagate all other exceptions. + + EXAMPLES:: + + sage: sorted(sage.misc.package_dir.walk_packages(sage.misc.__path__)) # a namespace package + [..., ModuleInfo(module_finder=FileFinder('.../sage/misc'), name='package_dir', ispkg=False), ...] + """ + # Adapted from /~https://github.com/python/cpython/blob/3.11/Lib/pkgutil.py + + def iter_modules(path=None, prefix=''): + """ + Yield :class:`ModuleInfo` for all submodules on ``path``. + """ + from pkgutil import get_importer, iter_importers, ModuleInfo + + if path is None: + importers = iter_importers() + elif isinstance(path, str): + raise ValueError("path must be None or list of paths to look for modules in") + else: + importers = map(get_importer, path) + + yielded = {} + for i in importers: + for name, ispkg in iter_importer_modules(i, prefix): + if name not in yielded: + yielded[name] = 1 + yield ModuleInfo(i, name, ispkg) + + def iter_importer_modules(importer, prefix=''): + r""" + Yield :class:`ModuleInfo` for all modules of ``importer``. + """ + from importlib.machinery import FileFinder + + if isinstance(importer, FileFinder): + if importer.path is None or not os.path.isdir(importer.path): + return + + yielded = {} + import inspect + try: + filenames = os.listdir(importer.path) + except OSError: + # ignore unreadable directories like import does + filenames = [] + filenames.sort() # handle packages before same-named modules + + for fn in filenames: + modname = inspect.getmodulename(fn) + if modname and (modname in ['__init__', 'all'] + or modname.startswith('all__') + or modname in yielded): + continue + + path = os.path.join(importer.path, fn) + ispkg = False + + if not modname and os.path.isdir(path) and '.' not in fn: + modname = fn + if not (ispkg := is_package_or_sage_namespace_package_dir(path)): + continue + + if modname and '.' not in modname: + yielded[modname] = 1 + yield prefix + modname, ispkg + + elif not hasattr(importer, 'iter_modules'): + yield from [] + + else: + yield from importer.iter_modules(prefix) + + def seen(p, m={}): + if p in m: + return True + m[p] = True + + for info in iter_modules(path, prefix): + yield info + + if info.ispkg: + try: + __import__(info.name) + except ImportError: + if onerror is not None: + onerror(info.name) + except Exception: + if onerror is not None: + onerror(info.name) + else: + raise + else: + path = getattr(sys.modules[info.name], '__path__', None) or [] + + # don't traverse path items we've seen before + path = [p for p in path if not seen(p)] + + yield from walk_packages(path, info.name + '.', onerror) From 8a9ff3f6c972d9197c6c74450252c26fc7c2e25f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 21 Mar 2023 17:36:52 -0700 Subject: [PATCH 023/135] Remove most remaining empty / almost empty __init__.py files when all.py files are present --- src/sage/categories/examples/{__init__.py => all.py} | 0 src/sage/coding/codecan/{__init__.py => all.py} | 0 src/sage/coding/guruswami_sudan/{__init__.py => all.py} | 0 .../__init__.py => geometry/hyperplane_arrangement/all.py} | 0 .../__init__.py => polyhedron/combinatorial_polyhedron/all.py} | 0 .../{combinatorial_polyhedron/__init__.py => modules/all.py} | 0 .../polyhedron/modules/__init__.py => graphs/base/all.py} | 0 src/sage/graphs/{base/__init__.py => generators/all.py} | 0 .../{graphs/generators/__init__.py => groups/affine_gps/all.py} | 0 src/sage/groups/{affine_gps/__init__.py => lie_gps/all.py} | 0 src/sage/groups/{lie_gps/__init__.py => misc_gps/all.py} | 0 .../__init__.py => semimonomial_transformations/all.py} | 0 .../__init__.py => manifolds/differentiable/all.py} | 0 .../manifolds/differentiable/{__init__.py => examples/all.py} | 0 .../{differentiable/examples/__init__.py => subsets/all.py} | 0 src/sage/matroids/__init__.py | 2 -- src/sage/modular/quasimodform/__init__.py | 1 - .../{manifolds/subsets/__init__.py => modules/fg_pid/all.py} | 0 src/sage/modules/{fg_pid/__init__.py => fp_graded/all.py} | 0 src/sage/modules/fp_graded/{__init__.py => steenrod/all.py} | 0 src/sage/quivers/__init__.py | 0 .../{modules/fp_graded/steenrod/__init__.py => quivers/all.py} | 0 src/sage/rings/convert/__init__.py | 0 src/sage/{plot/__init__.py => rings/convert/all.py} | 0 src/sage/rings/function_field/drinfeld_modules/__init__.py | 0 .../function_field/drinfeld_modules/all.py} | 0 src/sage/symbolic/__init__.py | 0 src/sage/symbolic/integration/__init__.py | 0 28 files changed, 3 deletions(-) rename src/sage/categories/examples/{__init__.py => all.py} (100%) rename src/sage/coding/codecan/{__init__.py => all.py} (100%) rename src/sage/coding/guruswami_sudan/{__init__.py => all.py} (100%) rename src/sage/{functions/__init__.py => geometry/hyperplane_arrangement/all.py} (100%) rename src/sage/geometry/{hyperplane_arrangement/__init__.py => polyhedron/combinatorial_polyhedron/all.py} (100%) rename src/sage/geometry/polyhedron/{combinatorial_polyhedron/__init__.py => modules/all.py} (100%) rename src/sage/{geometry/polyhedron/modules/__init__.py => graphs/base/all.py} (100%) rename src/sage/graphs/{base/__init__.py => generators/all.py} (100%) rename src/sage/{graphs/generators/__init__.py => groups/affine_gps/all.py} (100%) rename src/sage/groups/{affine_gps/__init__.py => lie_gps/all.py} (100%) rename src/sage/groups/{lie_gps/__init__.py => misc_gps/all.py} (100%) rename src/sage/groups/{misc_gps/__init__.py => semimonomial_transformations/all.py} (100%) rename src/sage/{groups/semimonomial_transformations/__init__.py => manifolds/differentiable/all.py} (100%) rename src/sage/manifolds/differentiable/{__init__.py => examples/all.py} (100%) rename src/sage/manifolds/{differentiable/examples/__init__.py => subsets/all.py} (100%) delete mode 100644 src/sage/matroids/__init__.py delete mode 100644 src/sage/modular/quasimodform/__init__.py rename src/sage/{manifolds/subsets/__init__.py => modules/fg_pid/all.py} (100%) rename src/sage/modules/{fg_pid/__init__.py => fp_graded/all.py} (100%) mode change 100644 => 100755 rename src/sage/modules/fp_graded/{__init__.py => steenrod/all.py} (100%) delete mode 100644 src/sage/quivers/__init__.py rename src/sage/{modules/fp_graded/steenrod/__init__.py => quivers/all.py} (100%) mode change 100755 => 100644 delete mode 100644 src/sage/rings/convert/__init__.py rename src/sage/{plot/__init__.py => rings/convert/all.py} (100%) delete mode 100644 src/sage/rings/function_field/drinfeld_modules/__init__.py rename src/sage/{plot/plot3d/__init__.py => rings/function_field/drinfeld_modules/all.py} (100%) delete mode 100644 src/sage/symbolic/__init__.py delete mode 100644 src/sage/symbolic/integration/__init__.py diff --git a/src/sage/categories/examples/__init__.py b/src/sage/categories/examples/all.py similarity index 100% rename from src/sage/categories/examples/__init__.py rename to src/sage/categories/examples/all.py diff --git a/src/sage/coding/codecan/__init__.py b/src/sage/coding/codecan/all.py similarity index 100% rename from src/sage/coding/codecan/__init__.py rename to src/sage/coding/codecan/all.py diff --git a/src/sage/coding/guruswami_sudan/__init__.py b/src/sage/coding/guruswami_sudan/all.py similarity index 100% rename from src/sage/coding/guruswami_sudan/__init__.py rename to src/sage/coding/guruswami_sudan/all.py diff --git a/src/sage/functions/__init__.py b/src/sage/geometry/hyperplane_arrangement/all.py similarity index 100% rename from src/sage/functions/__init__.py rename to src/sage/geometry/hyperplane_arrangement/all.py diff --git a/src/sage/geometry/hyperplane_arrangement/__init__.py b/src/sage/geometry/polyhedron/combinatorial_polyhedron/all.py similarity index 100% rename from src/sage/geometry/hyperplane_arrangement/__init__.py rename to src/sage/geometry/polyhedron/combinatorial_polyhedron/all.py diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/__init__.py b/src/sage/geometry/polyhedron/modules/all.py similarity index 100% rename from src/sage/geometry/polyhedron/combinatorial_polyhedron/__init__.py rename to src/sage/geometry/polyhedron/modules/all.py diff --git a/src/sage/geometry/polyhedron/modules/__init__.py b/src/sage/graphs/base/all.py similarity index 100% rename from src/sage/geometry/polyhedron/modules/__init__.py rename to src/sage/graphs/base/all.py diff --git a/src/sage/graphs/base/__init__.py b/src/sage/graphs/generators/all.py similarity index 100% rename from src/sage/graphs/base/__init__.py rename to src/sage/graphs/generators/all.py diff --git a/src/sage/graphs/generators/__init__.py b/src/sage/groups/affine_gps/all.py similarity index 100% rename from src/sage/graphs/generators/__init__.py rename to src/sage/groups/affine_gps/all.py diff --git a/src/sage/groups/affine_gps/__init__.py b/src/sage/groups/lie_gps/all.py similarity index 100% rename from src/sage/groups/affine_gps/__init__.py rename to src/sage/groups/lie_gps/all.py diff --git a/src/sage/groups/lie_gps/__init__.py b/src/sage/groups/misc_gps/all.py similarity index 100% rename from src/sage/groups/lie_gps/__init__.py rename to src/sage/groups/misc_gps/all.py diff --git a/src/sage/groups/misc_gps/__init__.py b/src/sage/groups/semimonomial_transformations/all.py similarity index 100% rename from src/sage/groups/misc_gps/__init__.py rename to src/sage/groups/semimonomial_transformations/all.py diff --git a/src/sage/groups/semimonomial_transformations/__init__.py b/src/sage/manifolds/differentiable/all.py similarity index 100% rename from src/sage/groups/semimonomial_transformations/__init__.py rename to src/sage/manifolds/differentiable/all.py diff --git a/src/sage/manifolds/differentiable/__init__.py b/src/sage/manifolds/differentiable/examples/all.py similarity index 100% rename from src/sage/manifolds/differentiable/__init__.py rename to src/sage/manifolds/differentiable/examples/all.py diff --git a/src/sage/manifolds/differentiable/examples/__init__.py b/src/sage/manifolds/subsets/all.py similarity index 100% rename from src/sage/manifolds/differentiable/examples/__init__.py rename to src/sage/manifolds/subsets/all.py diff --git a/src/sage/matroids/__init__.py b/src/sage/matroids/__init__.py deleted file mode 100644 index 39cf60e3a53..00000000000 --- a/src/sage/matroids/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ - -__all__ = ["all"] diff --git a/src/sage/modular/quasimodform/__init__.py b/src/sage/modular/quasimodform/__init__.py deleted file mode 100644 index 6e633f48916..00000000000 --- a/src/sage/modular/quasimodform/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import all diff --git a/src/sage/manifolds/subsets/__init__.py b/src/sage/modules/fg_pid/all.py similarity index 100% rename from src/sage/manifolds/subsets/__init__.py rename to src/sage/modules/fg_pid/all.py diff --git a/src/sage/modules/fg_pid/__init__.py b/src/sage/modules/fp_graded/all.py old mode 100644 new mode 100755 similarity index 100% rename from src/sage/modules/fg_pid/__init__.py rename to src/sage/modules/fp_graded/all.py diff --git a/src/sage/modules/fp_graded/__init__.py b/src/sage/modules/fp_graded/steenrod/all.py similarity index 100% rename from src/sage/modules/fp_graded/__init__.py rename to src/sage/modules/fp_graded/steenrod/all.py diff --git a/src/sage/quivers/__init__.py b/src/sage/quivers/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/modules/fp_graded/steenrod/__init__.py b/src/sage/quivers/all.py old mode 100755 new mode 100644 similarity index 100% rename from src/sage/modules/fp_graded/steenrod/__init__.py rename to src/sage/quivers/all.py diff --git a/src/sage/rings/convert/__init__.py b/src/sage/rings/convert/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/plot/__init__.py b/src/sage/rings/convert/all.py similarity index 100% rename from src/sage/plot/__init__.py rename to src/sage/rings/convert/all.py diff --git a/src/sage/rings/function_field/drinfeld_modules/__init__.py b/src/sage/rings/function_field/drinfeld_modules/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/plot/plot3d/__init__.py b/src/sage/rings/function_field/drinfeld_modules/all.py similarity index 100% rename from src/sage/plot/plot3d/__init__.py rename to src/sage/rings/function_field/drinfeld_modules/all.py diff --git a/src/sage/symbolic/__init__.py b/src/sage/symbolic/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/sage/symbolic/integration/__init__.py b/src/sage/symbolic/integration/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 From 8dcea985c28452f7bd7f25aeaa6f0a1282bcdf25 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 21 Mar 2023 20:07:26 -0700 Subject: [PATCH 024/135] src/sage/symbolic/integration/all.py: New --- src/sage/symbolic/integration/all.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/sage/symbolic/integration/all.py diff --git a/src/sage/symbolic/integration/all.py b/src/sage/symbolic/integration/all.py new file mode 100644 index 00000000000..e69de29bb2d From 7f8eb6a3a19ce6205e6abb95a1d289cd1529926b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 21 Mar 2023 20:13:44 -0700 Subject: [PATCH 025/135] is_package_or_sage_namespace_package_dir: Update doctest after namespacification --- src/sage/misc/package_dir.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/misc/package_dir.py b/src/sage/misc/package_dir.py index bb4e34d5c26..5e3bc440b4b 100644 --- a/src/sage/misc/package_dir.py +++ b/src/sage/misc/package_dir.py @@ -177,7 +177,7 @@ def is_package_or_sage_namespace_package_dir(path, *, distribution_filter=None): Not a package:: - sage: directory = os.path.join(os.path.dirname(sage.symbolic.__file__), 'ginac'); directory + sage: directory = os.path.join(sage.symbolic.__path__[0], 'ginac'); directory '.../sage/symbolic/ginac' sage: is_package_or_sage_namespace_package_dir(directory) False From 284c5cb6823bb5416711d3fb58b04dc17f1bb42a Mon Sep 17 00:00:00 2001 From: Moritz Firsching Date: Wed, 22 Mar 2023 15:10:01 +0100 Subject: [PATCH 026/135] Add monotile to polgyon examples This adds an aperiodic monotile to the many examples in the documentation of the `polygon2d` function. https://arxiv.org/abs/2303.10798 --- src/sage/plot/polygon.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/sage/plot/polygon.py b/src/sage/plot/polygon.py index 916957643d7..d54487ab95d 100644 --- a/src/sage/plot/polygon.py +++ b/src/sage/plot/polygon.py @@ -386,6 +386,20 @@ def polygon2d(points, **options): P = polygon2d(v, legend_label='some form') sphinx_plot(P) + An aperiodic monotile:: + + sage: s = sqrt(3) + sage: polygon2d([[0, 0], [0, s], [1, s], [3/2, 3/2*s], [3, s], [3, 0], [4, 0], [9/2, -1/2*s], [3, -s], + [3/2, -1/2*s], [1, -s], [-1, -s], [-3/2, -1/2*s]], axes=False) + Graphics object consisting of 1 graphics primitive + + .. PLOT:: + + s = sqrt(3) + P = polygon2d([[0, 0], [0, s], [1, s], [3/2, 3/2*s], [3, s], [3, 0], [4, 0], [9/2, -1/2*s], [3, -s], + [3/2, -1/2*s], [1, -s], [-1, -s], [-3/2, -1/2*s]], axes=False) + sphinx_plot(P) + A purple hexagon:: sage: L = [[cos(pi*i/3),sin(pi*i/3)] for i in range(6)] From b7ac7dce77eec2c9864aaa72938d1f06e57ab884 Mon Sep 17 00:00:00 2001 From: Moritz Firsching Date: Wed, 22 Mar 2023 15:15:44 +0100 Subject: [PATCH 027/135] remove trailing whitespace --- src/sage/plot/polygon.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sage/plot/polygon.py b/src/sage/plot/polygon.py index d54487ab95d..edd51575f68 100644 --- a/src/sage/plot/polygon.py +++ b/src/sage/plot/polygon.py @@ -387,19 +387,19 @@ def polygon2d(points, **options): sphinx_plot(P) An aperiodic monotile:: - + sage: s = sqrt(3) - sage: polygon2d([[0, 0], [0, s], [1, s], [3/2, 3/2*s], [3, s], [3, 0], [4, 0], [9/2, -1/2*s], [3, -s], + sage: polygon2d([[0, 0], [0, s], [1, s], [3/2, 3/2*s], [3, s], [3, 0], [4, 0], [9/2, -1/2*s], [3, -s], [3/2, -1/2*s], [1, -s], [-1, -s], [-3/2, -1/2*s]], axes=False) Graphics object consisting of 1 graphics primitive - + .. PLOT:: - + s = sqrt(3) - P = polygon2d([[0, 0], [0, s], [1, s], [3/2, 3/2*s], [3, s], [3, 0], [4, 0], [9/2, -1/2*s], [3, -s], + P = polygon2d([[0, 0], [0, s], [1, s], [3/2, 3/2*s], [3, s], [3, 0], [4, 0], [9/2, -1/2*s], [3, -s], [3/2, -1/2*s], [1, -s], [-1, -s], [-3/2, -1/2*s]], axes=False) sphinx_plot(P) - + A purple hexagon:: sage: L = [[cos(pi*i/3),sin(pi*i/3)] for i in range(6)] From fdc51c273e83040c6c76b3e6251892628e3f98ad Mon Sep 17 00:00:00 2001 From: Travis Scrimshaw Date: Wed, 22 Mar 2023 23:45:26 +0900 Subject: [PATCH 028/135] Optimize the finite field squarefree_decomposition(). --- .../rings/finite_rings/finite_field_base.pyx | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/src/sage/rings/finite_rings/finite_field_base.pyx b/src/sage/rings/finite_rings/finite_field_base.pyx index 39cec205ab5..876c3bb621c 100644 --- a/src/sage/rings/finite_rings/finite_field_base.pyx +++ b/src/sage/rings/finite_rings/finite_field_base.pyx @@ -537,8 +537,9 @@ cdef class FiniteField(Field): def _squarefree_decomposition_univariate_polynomial(self, f): """ - Return the square-free decomposition of this polynomial. This is a - partial factorization into square-free, coprime polynomials. + Return the square-free decomposition of this polynomial. + + This is a partial factorization into square-free, coprime polynomials. This is a helper method for :meth:`sage.rings.polynomial.squarefree_decomposition`. @@ -547,8 +548,8 @@ cdef class FiniteField(Field): - ``f`` -- a univariate non-zero polynomial over this field - ALGORITHM; [Coh1993]_, algorithm 3.4.2 which is basically the algorithm in - [Yun1976]_ with special treatment for powers divisible by `p`. + ALGORITHM: [Coh1993]_, Algorithm 3.4.2 which is basically the algorithm + in [Yun1976]_ with special treatment for powers divisible by `p`. EXAMPLES:: @@ -591,49 +592,55 @@ cdef class FiniteField(Field): if f.degree() == 0: return Factorization([], unit=f[0]) - factors = [] - p = self.characteristic() + cdef Py_ssize_t i, k + cdef list factors = [] + cdef Integer p = Integer(self.characteristic()) unit = f.leading_coefficient() T0 = f.monic() - e = 1 - if T0.degree() > 0: + cdef Integer e = Integer(1) + cdef Integer T0_deg = T0.degree() + if T0_deg > 0: + P = T0.parent() der = T0.derivative() pth_root = self.frobenius_endomorphism(-1) while der.is_zero(): - T0 = T0.parent()([pth_root(T0[p*i]) for i in range(T0.degree()//p + 1)]) + T0 = P([pth_root(T0[p*i]) for i in range(T0_deg//p + 1)]) + T0_deg //= p if T0 == 1: raise RuntimeError der = T0.derivative() - e = e*p + e *= p T = T0.gcd(der) V = T0 // T k = 0 - while T0.degree() > 0: + while T0_deg > 0: k += 1 if p.divides(k): T = T // V k += 1 W = V.gcd(T) if W.degree() < V.degree(): - factors.append((V // W, e*k)) + factors.append((V // W, e * k)) V = W T = T // V if V.degree() == 0: if T.degree() == 0: break # T is of the form sum_{i=0}^n t_i X^{pi} - T0 = T0.parent()([pth_root(T[p*i]) for i in range(T.degree()//p + 1)]) + T0 = P([pth_root(T[p*i]) for i in range(T.degree()//p + 1)]) + T0_deg //= p der = T0.derivative() - e = p*e + e *= p while der.is_zero(): - T0 = T0.parent()([pth_root(T0[p*i]) for i in range(T0.degree()//p + 1)]) + T0 = P([pth_root(T0[p*i]) for i in range(T0_deg//p + 1)]) + T0_deg //= p der = T0.derivative() - e = p*e + e *= p T = T0.gcd(der) V = T0 // T k = 0 else: - T = T//V + T = T // V return Factorization(factors, unit=unit, sort=False) From b1312f8d5710dbbf68a7b8ba49e47eeb15f6a8bc Mon Sep 17 00:00:00 2001 From: Moritz Firsching Date: Wed, 22 Mar 2023 20:20:28 +0100 Subject: [PATCH 029/135] reference and newlines --- src/doc/en/reference/references/index.rst | 4 ++++ src/sage/plot/polygon.py | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/doc/en/reference/references/index.rst b/src/doc/en/reference/references/index.rst index bc96846353c..113bab67b99 100644 --- a/src/doc/en/reference/references/index.rst +++ b/src/doc/en/reference/references/index.rst @@ -5565,6 +5565,10 @@ REFERENCES: Journal of Cryptology. 12. 193-196. 1999. :doi:`10.1007/s001459900052`. +.. [Smi2023] \D. Smith, J. S. Myers, C. S. Kaplan and Chaim Goodman-Strauss, + *An aperiodic monotile*, + :arxiv:`2303.10798` + .. [SP2010] Fernando Solano and Michal Pioro, *Lightpath Reconfiguration in WDM networks*, IEEE/OSA Journal of Optical Communication and Networking 2(12):1010-1021, 2010. :doi:`10.1364/JOCN.2.001010`. diff --git a/src/sage/plot/polygon.py b/src/sage/plot/polygon.py index edd51575f68..a3a7e656df1 100644 --- a/src/sage/plot/polygon.py +++ b/src/sage/plot/polygon.py @@ -386,17 +386,17 @@ def polygon2d(points, **options): P = polygon2d(v, legend_label='some form') sphinx_plot(P) - An aperiodic monotile:: + An aperiodic monotile, [Smi2023]_:: sage: s = sqrt(3) - sage: polygon2d([[0, 0], [0, s], [1, s], [3/2, 3/2*s], [3, s], [3, 0], [4, 0], [9/2, -1/2*s], [3, -s], + sage: polygon2d([[0, 0], [0, s], [1, s], [3/2, 3/2*s], [3, s], [3, 0], [4, 0], [9/2, -1/2*s], [3, -s], \ [3/2, -1/2*s], [1, -s], [-1, -s], [-3/2, -1/2*s]], axes=False) Graphics object consisting of 1 graphics primitive .. PLOT:: s = sqrt(3) - P = polygon2d([[0, 0], [0, s], [1, s], [3/2, 3/2*s], [3, s], [3, 0], [4, 0], [9/2, -1/2*s], [3, -s], + P = polygon2d([[0, 0], [0, s], [1, s], [3/2, 3/2*s], [3, s], [3, 0], [4, 0], [9/2, -1/2*s], [3, -s], \ [3/2, -1/2*s], [1, -s], [-1, -s], [-3/2, -1/2*s]], axes=False) sphinx_plot(P) From 6d6c3d00b925abccdf6b084d6af1457320d86660 Mon Sep 17 00:00:00 2001 From: Moritz Firsching Date: Wed, 22 Mar 2023 20:21:09 +0100 Subject: [PATCH 030/135] more uniform names --- src/doc/en/reference/references/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/en/reference/references/index.rst b/src/doc/en/reference/references/index.rst index 113bab67b99..277d3b6d210 100644 --- a/src/doc/en/reference/references/index.rst +++ b/src/doc/en/reference/references/index.rst @@ -5565,7 +5565,7 @@ REFERENCES: Journal of Cryptology. 12. 193-196. 1999. :doi:`10.1007/s001459900052`. -.. [Smi2023] \D. Smith, J. S. Myers, C. S. Kaplan and Chaim Goodman-Strauss, +.. [Smi2023] \D. Smith, J. S. Myers, C. S. Kaplan and C. Goodman-Strauss, *An aperiodic monotile*, :arxiv:`2303.10798` From 7ce1b16b870bed6d2ae958537393f6beb0cbc6e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20K=C3=B6ppe?= Date: Wed, 22 Mar 2023 19:04:12 -0700 Subject: [PATCH 031/135] Reformat monotile doctest for better syntax highlighting --- src/sage/plot/polygon.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sage/plot/polygon.py b/src/sage/plot/polygon.py index a3a7e656df1..84043fb5ed0 100644 --- a/src/sage/plot/polygon.py +++ b/src/sage/plot/polygon.py @@ -389,8 +389,9 @@ def polygon2d(points, **options): An aperiodic monotile, [Smi2023]_:: sage: s = sqrt(3) - sage: polygon2d([[0, 0], [0, s], [1, s], [3/2, 3/2*s], [3, s], [3, 0], [4, 0], [9/2, -1/2*s], [3, -s], \ - [3/2, -1/2*s], [1, -s], [-1, -s], [-3/2, -1/2*s]], axes=False) + sage: polygon2d([[0, 0], [0, s], [1, s], [3/2, 3/2*s], [3, s], [3, 0], [4, 0], + ....: [9/2, -1/2*s], [3, -s], [3/2, -1/2*s], [1, -s], [-1, -s], + ....: [-3/2, -1/2*s]], axes=False) Graphics object consisting of 1 graphics primitive .. PLOT:: From e9e52ea26e62f4f66aff3fe0578d94e03aa67fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20K=C3=B6ppe?= Date: Wed, 22 Mar 2023 19:11:14 -0700 Subject: [PATCH 032/135] delete trailing whitespace --- src/sage/plot/polygon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/plot/polygon.py b/src/sage/plot/polygon.py index 84043fb5ed0..48518a36da0 100644 --- a/src/sage/plot/polygon.py +++ b/src/sage/plot/polygon.py @@ -390,7 +390,7 @@ def polygon2d(points, **options): sage: s = sqrt(3) sage: polygon2d([[0, 0], [0, s], [1, s], [3/2, 3/2*s], [3, s], [3, 0], [4, 0], - ....: [9/2, -1/2*s], [3, -s], [3/2, -1/2*s], [1, -s], [-1, -s], + ....: [9/2, -1/2*s], [3, -s], [3/2, -1/2*s], [1, -s], [-1, -s], ....: [-3/2, -1/2*s]], axes=False) Graphics object consisting of 1 graphics primitive From ef1fa37a7ed3a19aff24a3611f6dba346d6b2be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Oudompheng?= Date: Tue, 21 Mar 2023 07:49:44 +0100 Subject: [PATCH 033/135] Fix squarefree_decomposition failure over GF(2) --- .../rings/finite_rings/finite_field_base.pyx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/sage/rings/finite_rings/finite_field_base.pyx b/src/sage/rings/finite_rings/finite_field_base.pyx index 06e57a04952..39cec205ab5 100644 --- a/src/sage/rings/finite_rings/finite_field_base.pyx +++ b/src/sage/rings/finite_rings/finite_field_base.pyx @@ -576,6 +576,16 @@ cdef class FiniteField(Field): ....: for j in range(len(F)): ....: if i == j: continue ....: assert gcd(F[i][0], F[j][0]) == 1 + + Check that :trac:`35323` is fixed:: + + sage: R. = GF(2)[] + sage: (x^2 + 1).squarefree_decomposition() + (x + 1)^2 + sage: R. = PolynomialRing(GF(65537), sparse=True) + sage: (x^65537 + 2).squarefree_decomposition() + (x + 2)^65537 + """ from sage.structure.factorization import Factorization if f.degree() == 0: @@ -588,8 +598,9 @@ cdef class FiniteField(Field): e = 1 if T0.degree() > 0: der = T0.derivative() + pth_root = self.frobenius_endomorphism(-1) while der.is_zero(): - T0 = T0.parent()([T0[p*i].pth_root() for i in range(T0.degree()//p + 1)]) + T0 = T0.parent()([pth_root(T0[p*i]) for i in range(T0.degree()//p + 1)]) if T0 == 1: raise RuntimeError der = T0.derivative() @@ -611,11 +622,11 @@ cdef class FiniteField(Field): if T.degree() == 0: break # T is of the form sum_{i=0}^n t_i X^{pi} - T0 = T0.parent()([T[p*i].pth_root() for i in range(T.degree()//p + 1)]) + T0 = T0.parent()([pth_root(T[p*i]) for i in range(T.degree()//p + 1)]) der = T0.derivative() e = p*e while der.is_zero(): - T0 = T0.parent()([T0[p*i].pth_root() for i in range(T0.degree()//p + 1)]) + T0 = T0.parent()([pth_root(T0[p*i]) for i in range(T0.degree()//p + 1)]) der = T0.derivative() e = p*e T = T0.gcd(der) From 21d1151eeec735464f9c25a53c6cff70849e7970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Oudompheng?= Date: Wed, 22 Mar 2023 13:46:27 +0100 Subject: [PATCH 034/135] Make FLINT polynomial factor() interruptible This is useful for large degree polynomials. --- src/sage/libs/flint/nmod_poly_linkage.pxi | 2 ++ src/sage/rings/polynomial/polynomial_zmod_flint.pyx | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/sage/libs/flint/nmod_poly_linkage.pxi b/src/sage/libs/flint/nmod_poly_linkage.pxi index 51c5fa196cb..3c04b610087 100644 --- a/src/sage/libs/flint/nmod_poly_linkage.pxi +++ b/src/sage/libs/flint/nmod_poly_linkage.pxi @@ -644,10 +644,12 @@ cdef factor_helper(Polynomial_zmod_flint poly, bint squarefree=False): cdef nmod_poly_factor_t factors_c nmod_poly_factor_init(factors_c) + sig_on() if squarefree: nmod_poly_factor_squarefree(factors_c, &poly.x) else: nmod_poly_factor(factors_c, &poly.x) + sig_off() factor_list = [] cdef Polynomial_zmod_flint t diff --git a/src/sage/rings/polynomial/polynomial_zmod_flint.pyx b/src/sage/rings/polynomial/polynomial_zmod_flint.pyx index 04c523d9788..3cec134e239 100644 --- a/src/sage/rings/polynomial/polynomial_zmod_flint.pyx +++ b/src/sage/rings/polynomial/polynomial_zmod_flint.pyx @@ -689,6 +689,16 @@ cdef class Polynomial_zmod_flint(Polynomial_template): Traceback (most recent call last): ... NotImplementedError: factorization of polynomials over rings with composite characteristic is not implemented + + Test that factorization can be interrupted:: + + sage: R. = PolynomialRing(GF(65537), implementation="FLINT") + sage: f = R.random_element(9973) * R.random_element(10007) + sage: alarm(0.5); f.factor() + Traceback (most recent call last): + ... + AlarmInterrupt + """ R = self.base_ring() From 453f3ba847fc313f1aec1dbb4177b48da8361beb Mon Sep 17 00:00:00 2001 From: Antonio Rojas Date: Thu, 23 Mar 2023 18:39:14 +0100 Subject: [PATCH 035/135] Fix test output to pass with ipywidgets 8.0.5 --- src/sage/interacts/library.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/interacts/library.py b/src/sage/interacts/library.py index b340ddc930a..5e069633824 100644 --- a/src/sage/interacts/library.py +++ b/src/sage/interacts/library.py @@ -1436,7 +1436,7 @@ def riemann_sum( sage: interacts.calculus.riemann_sum() Manual interactive function with 9 widgets title: HTMLText(value='

Riemann integral with random sampling

') - f: EvalText(value='x^2+1', description='$f(x)=$', layout=Layout(max_width='41em')) + f: EvalText(value='x^2+1',... description='$f(x)=$', layout=Layout(max_width='41em')) n: IntSlider(value=5, description='# divisions', max=30, min=1) hr1: HTMLText(value='
') interval_input: ToggleButtons(description='Integration interval', options=('from slider', 'from keyboard'), value='from slider') From bd225fd1aee36f9aba6970a9a5d98e4569322927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Oudompheng?= Date: Mon, 20 Mar 2023 11:57:21 +0100 Subject: [PATCH 036/135] Use PARI implementation of Frobenius morphism for PARI finite field elements PARI implements Frobenius morphisms as field morphisms defined by the image of the generator. Caching these morphisms requires O(degree) field elements in memory and computation requires O(sqrt(degree)) field multiplications instead of O(degree * log p) for the exponentiation method. For very small powers or very large extension degrees, the power method will be used for the p-th power Frobenius. --- .../rings/finite_rings/element_pari_ffelt.pyx | 55 +++++++++++++++++++ .../finite_rings/finite_field_pari_ffelt.py | 28 ++++++++++ .../rings/finite_rings/hom_finite_field.pyx | 5 +- 3 files changed, 87 insertions(+), 1 deletion(-) diff --git a/src/sage/rings/finite_rings/element_pari_ffelt.pyx b/src/sage/rings/finite_rings/element_pari_ffelt.pyx index be70aa56d39..bf40604c542 100644 --- a/src/sage/rings/finite_rings/element_pari_ffelt.pyx +++ b/src/sage/rings/finite_rings/element_pari_ffelt.pyx @@ -850,6 +850,61 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): x.construct(FF_pow(self.val, (exp).g)) return x + def pth_power(FiniteFieldElement_pari_ffelt self, int k=1): + r""" + Return the `(p^k)^{th}` power of ``self``, where `p` is the + characteristic of the field. + + INPUT: + + - ``k`` -- integer (default: 1); must fit in a C ``int`` + + Note that if `k` is negative, then this computes the appropriate root. + + TESTS:: + + sage: F. = GF(13^64, impl='pari_ffelt'); F + Finite Field in a of size 13^64 + sage: x = F.random_element() + sage: x.pth_power(0) == x + True + sage: x.pth_power(1) == x**13 + True + sage: x.pth_power(2) == x**(13**2) + True + sage: x.pth_power(-1)**13 == x + True + + sage: F. = GF(127^16, impl='pari_ffelt'); F + Finite Field in a of size 127^16 + sage: x = F.random_element() + sage: x.pth_power(0) == x + True + sage: x.pth_power(1) == x**127 + True + sage: x.pth_power(2) == x**(127**2) + True + sage: x.pth_power(-1)**127 == x + True + """ + cdef int n = int(self._parent.degree()) + if k % n == 0: + return self + cdef Integer p = self._parent.characteristic() + if k == 1 and (p < 100 or p.bit_length()**2 < n): + # For extremely small primes or very large extension degrees, + # exponentiation is faster. + return self**p + # Otherwise use PARI field morphism (evaluation of a Fp polynomial + # at the image of the generator). + f = self._parent._pari_frobenius(k) + cdef FiniteFieldElement_pari_ffelt x = self._new() + sig_on() + x.construct(ffmap((f).g, self.val)) + return x + + frobenius = pth_power + def polynomial(self, name=None): """ Return the unique representative of ``self`` as a polynomial diff --git a/src/sage/rings/finite_rings/finite_field_pari_ffelt.py b/src/sage/rings/finite_rings/finite_field_pari_ffelt.py index 906c91d6ba8..bbb1040ee57 100644 --- a/src/sage/rings/finite_rings/finite_field_pari_ffelt.py +++ b/src/sage/rings/finite_rings/finite_field_pari_ffelt.py @@ -124,6 +124,9 @@ def __init__(self, p, modulus, name=None): self._one_element = self.element_class(self, 1) self._gen = self.element_class(self, self._gen_pari) + # Cache for Frobenius endomorphisms (O(n) field elements) + self.__pari_frobenius_powers = [] + Element = FiniteFieldElement_pari_ffelt def __reduce__(self): @@ -201,3 +204,28 @@ def degree(self): 20 """ return self._degree + + def _pari_frobenius(self, k=1): + """ + Return a cached PARI Frobenius endomorphism (internally defined + by the image of the generator). + + TESTS:: + + sage: F = FiniteField(37^10, 'a', impl='pari_ffelt') + sage: x = F.random_element() + sage: all(x**(37**k) == F(F._pari_frobenius(k).ffmap(x)) for k in range(1, 30) if k % 10 != 0) + True + sage: F(F._pari_frobenius(-1).ffmap(x))**37 == x + True + + """ + k = k % self.degree() + if k == 0: + raise ValueError("_pari_frobenius requires a non-zero exponent") + g = self.gen() + i = len(self.__pari_frobenius_powers) + while i < k: + i += 1 + self.__pari_frobenius_powers.append(g.__pari__().fffrobenius(i)) + return self.__pari_frobenius_powers[k-1] diff --git a/src/sage/rings/finite_rings/hom_finite_field.pyx b/src/sage/rings/finite_rings/hom_finite_field.pyx index 44dc3450be8..a69eb42b8be 100644 --- a/src/sage/rings/finite_rings/hom_finite_field.pyx +++ b/src/sage/rings/finite_rings/hom_finite_field.pyx @@ -619,7 +619,10 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic): sage: Frob(t) == t^5 True """ - return x ** self._q + if self.is_identity(): + return x + else: + return x.pth_power(self._power) def order(self): From e9c3333d4145bf631f0eae91514219479e1000ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Mon, 6 Mar 2023 14:38:34 -0300 Subject: [PATCH 037/135] Fix warning with ipython 8.11 --- src/sage/repl/inputhook.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/sage/repl/inputhook.py b/src/sage/repl/inputhook.py index da5df0268c0..165068da8bc 100644 --- a/src/sage/repl/inputhook.py +++ b/src/sage/repl/inputhook.py @@ -47,15 +47,25 @@ def install(): """ Install the Sage input hook - EXAMPLES:: + EXAMPLES: + + Make sure ipython is running so we really test this function:: + + sage: from sage.repl.interpreter import get_test_shell + sage: get_test_shell() + + + Run the function twice, to check it is idempotent (see :trac:`35235`):: sage: from sage.repl.inputhook import install sage: install() + sage: install() """ ip = get_ipython() if not ip: return # Not running in ipython, e.g. doctests - ip.enable_gui('sage') + if ip._inputhook != sage_inputhook: + ip.enable_gui('sage') def uninstall(): From f13d6e93ead771b0acf7769f442ad662ef3ffa71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Fri, 24 Mar 2023 17:40:38 -0700 Subject: [PATCH 038/135] src/sage/symbolic/pynac.pxi: Work around /~https://github.com/cython/cython/issues/5335 --- src/sage/symbolic/pynac.pxi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/symbolic/pynac.pxi b/src/sage/symbolic/pynac.pxi index 4015657b951..03da305ca97 100644 --- a/src/sage/symbolic/pynac.pxi +++ b/src/sage/symbolic/pynac.pxi @@ -3,9 +3,9 @@ Declarations for pynac, a Python frontend for ginac Check that we can externally cimport this (:trac:`18825`):: - sage: cython( # long time; random compiler warnings # optional - sage.misc.cython + sage: cython( # optional - sage.misc.cython ....: ''' - ....: from sage.symbolic cimport expression + ....: cimport sage.symbolic.expression ....: ''') """ From 5ee730dbb56fa85d3657f7968b0ab0bdefa59a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Fri, 24 Mar 2023 17:41:37 -0700 Subject: [PATCH 039/135] src/sage/misc/cython.py: Add doctests for PEP 420 support, /~https://github.com/cython/cython/issues/5335 --- src/sage/misc/cython.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/sage/misc/cython.py b/src/sage/misc/cython.py index 109e555abe4..fea06f8a333 100644 --- a/src/sage/misc/cython.py +++ b/src/sage/misc/cython.py @@ -211,6 +211,28 @@ def cython(filename, verbose=0, compile_message=False, sage: cython(''' ....: cdef size_t foo = 3/2 ....: ''') + + Check that Cython supports PEP 420 packages:: + + sage: cython(''' + ....: cimport sage.misc.cachefunc + ....: ''') + + sage: cython(''' + ....: from sage.misc.cachefunc cimport cache_key + ....: ''') + + In Cython 0.29.33 using `from PACKAGE cimport MODULE` is broken + when `PACKAGE` is a namespace package, see :trac:`35322`:: + + sage: cython(''' + ....: from sage.misc cimport cachefunc + ....: ''') + Traceback (most recent call last): + ... + RuntimeError: Error compiling Cython file: + ... + ...: 'sage/misc.pxd' not found """ if not filename.endswith('pyx'): print("Warning: file (={}) should have extension .pyx".format(filename), file=sys.stderr) From dc8b3c50d849746ec69e11b45ebc33ceb9e3d0e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Fri, 24 Mar 2023 18:07:18 -0700 Subject: [PATCH 040/135] is_package_or_sage_namespace_package_dir: Update more doctests after namespacification --- src/sage/misc/package_dir.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/misc/package_dir.py b/src/sage/misc/package_dir.py index 5e3bc440b4b..d4e5cb3bc7a 100644 --- a/src/sage/misc/package_dir.py +++ b/src/sage/misc/package_dir.py @@ -155,7 +155,7 @@ def is_package_or_sage_namespace_package_dir(path, *, distribution_filter=None): :mod:`sage.cpython` is an ordinary package:: sage: from sage.misc.package_dir import is_package_or_sage_namespace_package_dir - sage: directory = os.path.dirname(sage.cpython.__file__); directory + sage: directory = sage.cpython.__path__[0]; directory '.../sage/cpython' sage: is_package_or_sage_namespace_package_dir(directory) True @@ -163,14 +163,14 @@ def is_package_or_sage_namespace_package_dir(path, *, distribution_filter=None): :mod:`sage.libs.mpfr` only has an ``__init__.pxd`` file, but we consider it a package directory for consistency with Cython:: - sage: directory = os.path.join(os.path.dirname(sage.libs.all.__file__), 'mpfr'); directory + sage: directory = os.path.join(sage.libs.__path__[0], 'mpfr'); directory '.../sage/libs/mpfr' sage: is_package_or_sage_namespace_package_dir(directory) True :mod:`sage` is designated to become an implicit namespace package:: - sage: directory = os.path.dirname(sage.env.__file__); directory + sage: directory = sage.__path__[0]; directory '.../sage' sage: is_package_or_sage_namespace_package_dir(directory) True From e2bd466208bb12d8986e87f6c9545a5225d94d45 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 26 Mar 2023 14:50:23 +0800 Subject: [PATCH 041/135] Correctly list develop packages in conda dev environment --- bootstrap-conda | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bootstrap-conda b/bootstrap-conda index 9ba4b50ab6f..579c3a72f8b 100755 --- a/bootstrap-conda +++ b/bootstrap-conda @@ -11,7 +11,6 @@ STRIP_COMMENTS="sed s/#.*//;" shopt -s extglob DEVELOP_SPKG_PATTERN="@(_develop$(for a in $(head -n 1 build/pkgs/_develop/dependencies); do echo -n "|"$a; done))" - BOOTSTRAP_PACKAGES=$(echo $(${STRIP_COMMENTS} build/pkgs/_bootstrap/distros/conda.txt)) SYSTEM_PACKAGES= OPTIONAL_SYSTEM_PACKAGES= @@ -37,10 +36,13 @@ for PKG_BASE in $(sage-package list --has-file distros/conda.txt); do ;; esac else - case "$PKG_TYPE" in - standard) + case "$PKG_BASE:$PKG_TYPE" in + *:standard) SAGELIB_SYSTEM_PACKAGES+=" $PKG_SYSTEM_PACKAGES" ;; + $DEVELOP_SPKG_PATTERN:*) + DEVELOP_SYSTEM_PACKAGES+=" $PKG_SYSTEM_PACKAGES" + ;; *) SAGELIB_OPTIONAL_SYSTEM_PACKAGES+=" $PKG_SYSTEM_PACKAGES" ;; From 3e6389a4a81849a1d13ea3512d95edbab8cdf48f Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 26 Mar 2023 14:54:32 +0800 Subject: [PATCH 042/135] Fix version specifiers of python packages for conda --- .github/workflows/ci-conda.yml | 18 ++++++++++++++++-- build/pkgs/ipywidgets/distros/conda.txt | 2 +- build/pkgs/lrcalc_python/distros/conda.txt | 2 +- build/pkgs/networkx/distros/conda.txt | 2 +- build/pkgs/ptyprocess/distros/conda.txt | 4 +++- build/pkgs/scipy/distros/conda.txt | 2 +- build/pkgs/sphinx/distros/conda.txt | 2 +- 7 files changed, 24 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-conda.yml b/.github/workflows/ci-conda.yml index bc1f1c5a634..36c0f3eece9 100644 --- a/.github/workflows/ci-conda.yml +++ b/.github/workflows/ci-conda.yml @@ -6,6 +6,9 @@ on: - '*' branches: - 'public/build/**-runci' + pull_request: + types: + - labeled workflow_dispatch: # Allow to run manually @@ -19,6 +22,8 @@ jobs: name: Conda runs-on: ${{ matrix.os }} + if: github.event.label.name == 'c: packages: optional' || github.event.label.name == 'c: packages: standard' || github.event.label.name == 's: run conda ci' + strategy: fail-fast: false matrix: @@ -77,13 +82,22 @@ jobs: echo "::remove-matcher owner=configure-system-package-warning::" echo "::remove-matcher owner=configure-system-package-error::" + # Manually install ptyprocess for now, until /~https://github.com/sagemath/sage/issues/32147 is fixed + pip install --no-build-isolation -v -v ptyprocess==0.5.1 + - name: Build shell: bash -l {0} run: | - pip install --no-build-isolation -v -v -e ./pkgs/sage-conf ./pkgs/sage-setup - pip install --no-build-isolation -v -v -e ./src + # Use --no-deps and pip check below to verify that all necessary dependencies are installed via conda. + pip install --no-build-isolation --no-deps -v -v -e ./pkgs/sage-conf ./pkgs/sage-setup + pip install --no-build-isolation --no-deps -v -v -e ./src env: SAGE_NUM_THREADS: 2 + + - name: Verify dependencies + if: always() + shell: bash -l {0} + run: pip check - name: Test shell: bash -l {0} diff --git a/build/pkgs/ipywidgets/distros/conda.txt b/build/pkgs/ipywidgets/distros/conda.txt index f582a4a3283..f943f9d4979 100644 --- a/build/pkgs/ipywidgets/distros/conda.txt +++ b/build/pkgs/ipywidgets/distros/conda.txt @@ -1 +1 @@ -ipywidgets +ipywidgets<8.0.0 diff --git a/build/pkgs/lrcalc_python/distros/conda.txt b/build/pkgs/lrcalc_python/distros/conda.txt index 3a3af9e524f..4dca5b61e5d 100644 --- a/build/pkgs/lrcalc_python/distros/conda.txt +++ b/build/pkgs/lrcalc_python/distros/conda.txt @@ -1 +1 @@ -python-lrcalc +python-lrcalc~=2.1 diff --git a/build/pkgs/networkx/distros/conda.txt b/build/pkgs/networkx/distros/conda.txt index 4d07dfe2f85..67cbec89b21 100644 --- a/build/pkgs/networkx/distros/conda.txt +++ b/build/pkgs/networkx/distros/conda.txt @@ -1 +1 @@ -networkx +networkx<3.0,>=2.4 diff --git a/build/pkgs/ptyprocess/distros/conda.txt b/build/pkgs/ptyprocess/distros/conda.txt index 57ebb2d6bdd..4a518435c60 100644 --- a/build/pkgs/ptyprocess/distros/conda.txt +++ b/build/pkgs/ptyprocess/distros/conda.txt @@ -1 +1,3 @@ -ptyprocess +# The version should be fixed to 0.5.1 (see /~https://github.com/sagemath/sage/issues/32147), but this is not available on conda-forge +# thus don't install ptyprocess with conda, but let pip handle it +# ptyprocess diff --git a/build/pkgs/scipy/distros/conda.txt b/build/pkgs/scipy/distros/conda.txt index 9a635b910d9..21b2670008a 100644 --- a/build/pkgs/scipy/distros/conda.txt +++ b/build/pkgs/scipy/distros/conda.txt @@ -1 +1 @@ -scipy +scipy<1.11,>=1.5 diff --git a/build/pkgs/sphinx/distros/conda.txt b/build/pkgs/sphinx/distros/conda.txt index 6966869c705..244ffb45e50 100644 --- a/build/pkgs/sphinx/distros/conda.txt +++ b/build/pkgs/sphinx/distros/conda.txt @@ -1 +1 @@ -sphinx +sphinx<6,>=5.2 From 91a067e63be5cf4791320e48e6d875d0abb4fd75 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 26 Mar 2023 15:08:20 +0800 Subject: [PATCH 043/135] fix workflow --- .github/workflows/ci-conda.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-conda.yml b/.github/workflows/ci-conda.yml index 36c0f3eece9..35ab423ce22 100644 --- a/.github/workflows/ci-conda.yml +++ b/.github/workflows/ci-conda.yml @@ -22,7 +22,10 @@ jobs: name: Conda runs-on: ${{ matrix.os }} - if: github.event.label.name == 'c: packages: optional' || github.event.label.name == 'c: packages: standard' || github.event.label.name == 's: run conda ci' + if: | + github.event.label.name == 'c: packages: optional' || + github.event.label.name == 'c: packages: standard' || + github.event.label.name == 's: run conda ci' strategy: fail-fast: false From 2af30b1a88a22bebf8bf4d096fbc709a2381e47d Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 26 Mar 2023 15:38:56 +0800 Subject: [PATCH 044/135] also run workflow in non-pr cases --- .github/workflows/ci-conda.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-conda.yml b/.github/workflows/ci-conda.yml index 35ab423ce22..2961850477c 100644 --- a/.github/workflows/ci-conda.yml +++ b/.github/workflows/ci-conda.yml @@ -23,9 +23,11 @@ jobs: runs-on: ${{ matrix.os }} if: | - github.event.label.name == 'c: packages: optional' || - github.event.label.name == 'c: packages: standard' || - github.event.label.name == 's: run conda ci' + (github.event.action == 'labeled' && ( + github.event.label.name == 'c: packages: optional' || + github.event.label.name == 'c: packages: standard' || + github.event.label.name == 's: run conda ci')) || + github.event.action != 'labeled' strategy: fail-fast: false From 8dd6f2ef34e36988861374f188616bf1526c2609 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 26 Mar 2023 15:42:28 +0800 Subject: [PATCH 045/135] simplify if condition --- .github/workflows/ci-conda.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-conda.yml b/.github/workflows/ci-conda.yml index 2961850477c..46c88ad1306 100644 --- a/.github/workflows/ci-conda.yml +++ b/.github/workflows/ci-conda.yml @@ -23,11 +23,10 @@ jobs: runs-on: ${{ matrix.os }} if: | - (github.event.action == 'labeled' && ( - github.event.label.name == 'c: packages: optional' || - github.event.label.name == 'c: packages: standard' || - github.event.label.name == 's: run conda ci')) || - github.event.action != 'labeled' + github.event.action != 'labeled' || + github.event.label.name == 'c: packages: optional' || + github.event.label.name == 'c: packages: standard' || + github.event.label.name == 's: run conda ci' strategy: fail-fast: false From 7d8c93e9a22f0fe462112ac8f9dd6ce6daa92263 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 26 Mar 2023 15:47:25 +0800 Subject: [PATCH 046/135] Add minimum version of conda gap package --- build/pkgs/gap/distros/conda.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/gap/distros/conda.txt b/build/pkgs/gap/distros/conda.txt index 401c67cba31..e1d9958012d 100644 --- a/build/pkgs/gap/distros/conda.txt +++ b/build/pkgs/gap/distros/conda.txt @@ -1 +1 @@ -gap-defaults +gap-defaults>=4.12.2 From 23da0c64dd70cd7cfbc0029d9c176e05a635ccc0 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 26 Mar 2023 15:55:26 +0800 Subject: [PATCH 047/135] Add instructions on how to update existing conda environment --- src/doc/en/installation/conda.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/doc/en/installation/conda.rst b/src/doc/en/installation/conda.rst index df396777262..0025566d49d 100644 --- a/src/doc/en/installation/conda.rst +++ b/src/doc/en/installation/conda.rst @@ -173,3 +173,7 @@ suffices to restart Sage. After editing any Cython files, rebuild the Sage library using:: $ pip install --no-build-isolation -v -v --editable src + +In order to update the conda environment later, you can run:: + + $ mamba env update --file src/environment-dev.yml --name sage-dev From aca70fc8741061bf374c214e833e06f6bddef942 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 26 Mar 2023 16:18:46 +0800 Subject: [PATCH 048/135] Replace \mbox by \text in manifolds --- src/sage/manifolds/chart.py | 2 +- src/sage/manifolds/continuous_map.py | 8 ++++---- src/sage/manifolds/differentiable/curve.py | 2 +- .../differentiable/diff_form_module.py | 2 +- src/sage/manifolds/differentiable/metric.py | 4 ++-- src/sage/manifolds/differentiable/mixed_form.py | 6 +++--- .../differentiable/multivector_module.py | 2 +- .../manifolds/differentiable/symplectic_form.py | 2 +- .../manifolds/differentiable/tensorfield.py | 6 +++--- .../differentiable/tensorfield_module.py | 2 +- .../differentiable/tensorfield_paral.py | 4 ++-- .../manifolds/differentiable/vector_bundle.py | 10 +++++----- src/sage/manifolds/manifold_homset.py | 2 +- src/sage/manifolds/point.py | 4 ++-- src/sage/manifolds/scalarfield.py | 17 +++++++++++------ src/sage/manifolds/section.py | 2 +- 16 files changed, 40 insertions(+), 35 deletions(-) diff --git a/src/sage/manifolds/chart.py b/src/sage/manifolds/chart.py index d0ff3cea922..54d4ea5c71f 100644 --- a/src/sage/manifolds/chart.py +++ b/src/sage/manifolds/chart.py @@ -2165,7 +2165,7 @@ def _display_coord_range(self, xx, rtxt, rlatex): rlatex += r"\right]" if bounds[1][1] == 'periodic': rtxt += " (periodic)" - rlatex += r"\mbox{(periodic)}" + rlatex += r"\text{(periodic)}" else: rtxt += ")" rlatex += r"\right)" diff --git a/src/sage/manifolds/continuous_map.py b/src/sage/manifolds/continuous_map.py index 20cc672a644..b6404a9bd94 100644 --- a/src/sage/manifolds/continuous_map.py +++ b/src/sage/manifolds/continuous_map.py @@ -505,7 +505,7 @@ def _latex_(self): """ if self._latex_name is None: - return r'\mbox{' + str(self) + r'}' + return r'\text{' + str(self) + r'}' else: return self._latex_name @@ -1119,7 +1119,7 @@ def display(self, chart1=None, chart2=None): sage: latex(Phi.display(c_xy, c_cart)) \begin{array}{llcl} \Phi:& S^2 & \longrightarrow & \RR^3 - \\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto + \\ \text{on}\ U : & \left(x, y\right) & \longmapsto & \left(X, Y, Z\right) = \left(\frac{2 \, x}{x^{2} + y^{2} + 1}, \frac{2 \, y}{x^{2} + y^{2} + 1}, \frac{x^{2} + y^{2} - 1}{x^{2} + y^{2} + 1}\right) @@ -1176,7 +1176,7 @@ def display(self, chart1=None, chart2=None): 2*y/(x**2 + y**2 + 1), (x**2 + y**2 - 1)/(x**2 + y**2 + 1)) sage: latex(Phi.display(c_xy, c_cart)) \begin{array}{llcl} \Phi:& S^2 & \longrightarrow & \RR^3 - \\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto + \\ \text{on}\ U : & \left(x, y\right) & \longmapsto & \left(X, Y, Z\right) = \left(\frac{2 x}{x^{2} + y^{2} + 1}, \frac{2 y}{x^{2} + y^{2} + 1}, \frac{x^{2} + y^{2} - 1}{x^{2} + y^{2} + 1}\right) @@ -1212,7 +1212,7 @@ def _display_expression(self, chart1, chart2, result): result._latex += ' & ' else: result._txt += 'on ' + chart1._domain._name + ': ' - result._latex += r'\mbox{on}\ ' + latex(chart1._domain) + \ + result._latex += r'\text{on}\ ' + latex(chart1._domain) + \ r': & ' result._txt += repr(coords1) + ' ' + unicode_mapsto + ' ' result._latex += latex(coords1) + r'& \longmapsto & ' diff --git a/src/sage/manifolds/differentiable/curve.py b/src/sage/manifolds/differentiable/curve.py index ca7cef3f626..7ee1517c43d 100644 --- a/src/sage/manifolds/differentiable/curve.py +++ b/src/sage/manifolds/differentiable/curve.py @@ -186,7 +186,7 @@ class DifferentiableCurve(DiffMap): sage: c = M.curve([sin(t), sin(2*t)/2], (t, 0, 2*pi)) sage: latex(c) - \mbox{Curve in the 2-dimensional differentiable manifold M} + \text{Curve in the 2-dimensional differentiable manifold M} sage: c = M.curve([sin(t), sin(2*t)/2], (t, 0, 2*pi), name='c') sage: latex(c) c diff --git a/src/sage/manifolds/differentiable/diff_form_module.py b/src/sage/manifolds/differentiable/diff_form_module.py index 04d85a0817d..e11a32d2131 100644 --- a/src/sage/manifolds/differentiable/diff_form_module.py +++ b/src/sage/manifolds/differentiable/diff_form_module.py @@ -498,7 +498,7 @@ def _latex_(self): """ if self._latex_name is None: - return r'\mbox{' + str(self) + r'}' + return r'\text{' + str(self) + r'}' else: return self._latex_name diff --git a/src/sage/manifolds/differentiable/metric.py b/src/sage/manifolds/differentiable/metric.py index 6dece42f0fe..5b6e16be39c 100644 --- a/src/sage/manifolds/differentiable/metric.py +++ b/src/sage/manifolds/differentiable/metric.py @@ -447,7 +447,7 @@ def _new_instance(self): """ return type(self)(self._vmodule, 'unnamed metric', signature=self._signature, - latex_name=r'\mbox{unnamed metric}') + latex_name=r'\text{unnamed metric}') def _init_derived(self): r""" @@ -2706,7 +2706,7 @@ def _new_instance(self): """ return type(self)(self._vmodule, 'unnamed metric', signature=self._signature, - latex_name=r'\mbox{unnamed metric}') + latex_name=r'\text{unnamed metric}') def signature(self): r""" diff --git a/src/sage/manifolds/differentiable/mixed_form.py b/src/sage/manifolds/differentiable/mixed_form.py index 2a30ececa45..5f357bd5614 100644 --- a/src/sage/manifolds/differentiable/mixed_form.py +++ b/src/sage/manifolds/differentiable/mixed_form.py @@ -347,7 +347,7 @@ def _latex_(self): """ if self._name is None: - return r'\mbox{' + repr(self) + r'}' + return r'\text{' + repr(self) + r'}' else: return self._latex_name @@ -549,7 +549,7 @@ def display(self): else: resu_txt += self[0]._name if self[0]._latex_name is None: - resu_latex += r"\mbox{(unnamed scalar field)}" + resu_latex += r"\text{(unnamed scalar field)}" else: resu_latex += latex(self[0]) # Differential forms: @@ -559,7 +559,7 @@ def display(self): else: resu_txt += " + " + self[j]._name if self[j]._latex_name is None: - resu_latex += r"+\mbox{(unnamed " + str(j) + r"-form)}" + resu_latex += r"+\text{(unnamed " + str(j) + r"-form)}" else: resu_latex += r"+" + latex(self[j]) return FormattedExpansion(resu_txt, resu_latex) diff --git a/src/sage/manifolds/differentiable/multivector_module.py b/src/sage/manifolds/differentiable/multivector_module.py index 6fda4d48567..83c741fa8af 100644 --- a/src/sage/manifolds/differentiable/multivector_module.py +++ b/src/sage/manifolds/differentiable/multivector_module.py @@ -444,7 +444,7 @@ def _latex_(self): """ if self._latex_name is None: - return r'\mbox{' + str(self) + r'}' + return r'\text{' + str(self) + r'}' else: return self._latex_name diff --git a/src/sage/manifolds/differentiable/symplectic_form.py b/src/sage/manifolds/differentiable/symplectic_form.py index c72f50b70fa..b11b02557fa 100644 --- a/src/sage/manifolds/differentiable/symplectic_form.py +++ b/src/sage/manifolds/differentiable/symplectic_form.py @@ -185,7 +185,7 @@ def _new_instance(self): return type(self)( self._vmodule, "unnamed symplectic form", - latex_name=r"\mbox{unnamed symplectic form}", + latex_name=r"\text{unnamed symplectic form}", ) def _init_derived(self): diff --git a/src/sage/manifolds/differentiable/tensorfield.py b/src/sage/manifolds/differentiable/tensorfield.py index db4a2a05aa1..3b1235f80fe 100644 --- a/src/sage/manifolds/differentiable/tensorfield.py +++ b/src/sage/manifolds/differentiable/tensorfield.py @@ -108,8 +108,8 @@ class TensorField(ModuleElementWithMutability): .. MATH:: - t(p):\ \underbrace{T_q^*M\times\cdots\times T_q^*M}_{k\ \; \mbox{times}} - \times \underbrace{T_q M\times\cdots\times T_q M}_{l\ \; \mbox{times}} + t(p):\ \underbrace{T_q^*M\times\cdots\times T_q^*M}_{k\ \; \text{times}} + \times \underbrace{T_q M\times\cdots\times T_q M}_{l\ \; \text{times}} \longrightarrow K, where `T_q^* M` is the dual vector space to `T_q M` and `K` is the @@ -589,7 +589,7 @@ def _latex_(self): """ if self._latex_name is None: - return r'\mbox{' + str(self) + r'}' + return r'\text{' + str(self) + r'}' else: return self._latex_name diff --git a/src/sage/manifolds/differentiable/tensorfield_module.py b/src/sage/manifolds/differentiable/tensorfield_module.py index 6347189848f..8d31d670137 100644 --- a/src/sage/manifolds/differentiable/tensorfield_module.py +++ b/src/sage/manifolds/differentiable/tensorfield_module.py @@ -520,7 +520,7 @@ def _latex_(self): """ if self._latex_name is None: - return r'\mbox{' + str(self) + r'}' + return r'\text{' + str(self) + r'}' else: return self._latex_name diff --git a/src/sage/manifolds/differentiable/tensorfield_paral.py b/src/sage/manifolds/differentiable/tensorfield_paral.py index eb517832382..1f5b7cf3512 100644 --- a/src/sage/manifolds/differentiable/tensorfield_paral.py +++ b/src/sage/manifolds/differentiable/tensorfield_paral.py @@ -355,8 +355,8 @@ class TensorFieldParal(FreeModuleTensor, TensorField): .. MATH:: - t(p):\ \underbrace{T_q^*M\times\cdots\times T_q^*M}_{k\ \; \mbox{times}} - \times \underbrace{T_q M\times\cdots\times T_q M}_{l\ \; \mbox{times}} + t(p):\ \underbrace{T_q^*M\times\cdots\times T_q^*M}_{k\ \; \text{times}} + \times \underbrace{T_q M\times\cdots\times T_q M}_{l\ \; \text{times}} \longrightarrow K, where `T_q^* M` is the dual vector space to `T_q M` and `K` is the diff --git a/src/sage/manifolds/differentiable/vector_bundle.py b/src/sage/manifolds/differentiable/vector_bundle.py index 4177a406cac..18d1169064d 100644 --- a/src/sage/manifolds/differentiable/vector_bundle.py +++ b/src/sage/manifolds/differentiable/vector_bundle.py @@ -362,8 +362,8 @@ class TensorBundle(DifferentiableVectorBundle): .. MATH:: - t:\ \underbrace{T_q^*N\times\cdots\times T_q^*N}_{k\ \; \mbox{times}} - \times \underbrace{T_q N\times\cdots\times T_q N}_{l\ \; \mbox{times}} + t:\ \underbrace{T_q^*N\times\cdots\times T_q^*N}_{k\ \; \text{times}} + \times \underbrace{T_q N\times\cdots\times T_q N}_{l\ \; \text{times}} \longrightarrow K (`k` is called the *contravariant* and `l` the *covariant* rank of the @@ -464,7 +464,7 @@ def __init__(self, base_space, k, l, dest_map=None): else: name = self._dest_map._name + "^*" if self._dest_map._latex_name is None: - latex_name = r'\mbox{(unnamed map)}^* ' + latex_name = r'\text{(unnamed map)}^* ' else: latex_name = self._dest_map._latex_name + r'^* ' else: @@ -1356,8 +1356,8 @@ def local_frame(self, *args, **kwargs): .. MATH:: - p \mapsto \Big(\underbrace{e^*(p), \dots, e^*(p)}_{k\ \; \mbox{times}}, - \underbrace{e(p), \dots, e(p)}_{l\ \; \mbox{times}}\Big) \in + p \mapsto \Big(\underbrace{e^*(p), \dots, e^*(p)}_{k\ \; \text{times}}, + \underbrace{e(p), \dots, e(p)}_{l\ \; \text{times}}\Big) \in T^{(k,l)}_q N , with `q=\Phi(p)`, defines a basis at each point `p \in U` and diff --git a/src/sage/manifolds/manifold_homset.py b/src/sage/manifolds/manifold_homset.py index e33dea15ee9..492e460ab47 100644 --- a/src/sage/manifolds/manifold_homset.py +++ b/src/sage/manifolds/manifold_homset.py @@ -207,7 +207,7 @@ def _latex_(self): \mathrm{Hom}\left(M,N\right) """ if self._latex_name is None: - return r'\mbox{' + str(self) + r'}' + return r'\text{' + str(self) + r'}' else: return self._latex_name diff --git a/src/sage/manifolds/point.py b/src/sage/manifolds/point.py index 794c48e06d0..728269ed5ea 100644 --- a/src/sage/manifolds/point.py +++ b/src/sage/manifolds/point.py @@ -250,7 +250,7 @@ def _latex_(self): sage: X. = M.chart() sage: p = M((2,-3)) sage: p._latex_() - '\\mbox{Point on the 2-dimensional topological manifold M}' + '\\text{Point on the 2-dimensional topological manifold M}' sage: p = M((2,-3), name='p') sage: p._latex_() 'p' @@ -262,7 +262,7 @@ def _latex_(self): """ if self._latex_name is None: - return r'\mbox{' + str(self) + r'}' + return r'\text{' + str(self) + r'}' return self._latex_name def coordinates(self, chart=None, old_chart=None): diff --git a/src/sage/manifolds/scalarfield.py b/src/sage/manifolds/scalarfield.py index 4b43a9dca14..c1bb10c7eb4 100644 --- a/src/sage/manifolds/scalarfield.py +++ b/src/sage/manifolds/scalarfield.py @@ -40,13 +40,18 @@ # https://www.gnu.org/licenses/ # ***************************************************************************** -from typing import Optional +from __future__ import annotations +from typing import Optional, TYPE_CHECKING from sage.structure.element import (CommutativeAlgebraElement, ModuleElementWithMutability) from sage.symbolic.expression import Expression from sage.manifolds.chart_func import ChartFunction from sage.misc.cachefunc import cached_method +if TYPE_CHECKING: + from sage.tensor.modules.format_utilities import FormattedExpansion + from sage.manifolds.chart import Chart + class ScalarField(CommutativeAlgebraElement, ModuleElementWithMutability): r""" Scalar field on a topological manifold. @@ -1499,7 +1504,7 @@ def _latex_(self): sage: X. = M.chart() sage: f = M.scalar_field({X: x+y}) sage: f._latex_() - '\\mbox{Scalar field on the 2-dimensional topological manifold M}' + '\\text{Scalar field on the 2-dimensional topological manifold M}' sage: f = M.scalar_field({X: x+y}, name='f') sage: f._latex_() 'f' @@ -1511,7 +1516,7 @@ def _latex_(self): """ if self._latex_name is None: - return r'\mbox{' + str(self) + r'}' + return r'\text{' + str(self) + r'}' else: return self._latex_name @@ -2096,7 +2101,7 @@ def set_restriction(self, rst): self._express[chart.restrict(intersection)] = expr self._is_zero = False # a priori - def display(self, chart=None): + def display(self, chart: Optional[Chart]=None) -> FormattedExpansion: r""" Display the expression of the scalar field in a given chart. @@ -2149,7 +2154,7 @@ def display(self, chart=None): f: M → ℝ on U: (x, y) ↦ y^2 sage: latex(f.display()) - \begin{array}{llcl} f:& M & \longrightarrow & \mathbb{R} \\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto & y^{2} \end{array} + \begin{array}{llcl} f:& M & \longrightarrow & \mathbb{R} \\ \text{on}\ U : & \left(x, y\right) & \longmapsto & y^{2} \end{array} """ from sage.misc.latex import latex @@ -2176,7 +2181,7 @@ def _display_expression(self, chart, result): result._latex += " & " else: result._txt += "on " + chart.domain()._name + ": " - result._latex += r"\mbox{on}\ " + latex(chart.domain()) \ + result._latex += r"\text{on}\ " + latex(chart.domain()) \ + r": & " result._txt += repr(coords) + " " + unicode_mapsto + " " \ + repr(expression) + "\n" diff --git a/src/sage/manifolds/section.py b/src/sage/manifolds/section.py index 7a2ce1c7a50..e48b2b5ee29 100644 --- a/src/sage/manifolds/section.py +++ b/src/sage/manifolds/section.py @@ -345,7 +345,7 @@ def _latex_(self): """ if self._latex_name is None: - return r'\mbox{' + str(self) + r'}' + return r'\text{' + str(self) + r'}' else: return self._latex_name From 86bfee4e43aec10a4f5ba6a5d2a2bfc6899e654a Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 26 Mar 2023 20:12:39 +0800 Subject: [PATCH 049/135] add one more instance --- src/sage/manifolds/differentiable/vectorfield_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/manifolds/differentiable/vectorfield_module.py b/src/sage/manifolds/differentiable/vectorfield_module.py index 12060175278..f806ecf5dd3 100644 --- a/src/sage/manifolds/differentiable/vectorfield_module.py +++ b/src/sage/manifolds/differentiable/vectorfield_module.py @@ -396,7 +396,7 @@ def _latex_(self): """ if self._latex_name is None: - return r'\mbox{' + str(self) + r'}' + return r"\text{" + str(self) + r"}" else: return self._latex_name From c43a9f2a0702102be3f1c9ac59f61cb45753ee8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 26 Mar 2023 17:45:21 +0200 Subject: [PATCH 050/135] partial fix for E221 (to be continued) --- .../algebras/rational_cherednik_algebra.py | 2 +- src/sage/algebras/splitting_algebra.py | 12 ++-- src/sage/categories/algebra_functor.py | 2 +- src/sage/categories/cartesian_product.py | 2 +- src/sage/categories/category_with_axiom.py | 10 ++-- .../covariant_functorial_construction.py | 2 +- ...distributive_magmas_and_additive_magmas.py | 2 +- src/sage/categories/enumerated_sets.py | 6 +- .../categories/infinite_enumerated_sets.py | 2 +- src/sage/categories/quotient_fields.py | 10 ++-- src/sage/categories/semigroups.py | 2 +- src/sage/coding/channel.py | 2 +- src/sage/coding/code_bounds.py | 2 +- src/sage/coding/grs_code.py | 12 ++-- .../cluster_algebra_quiver/mutation_type.py | 2 +- .../crystals/generalized_young_walls.py | 4 +- src/sage/combinat/designs/bibd.py | 10 ++-- src/sage/combinat/designs/block_design.py | 6 +- src/sage/combinat/designs/database.py | 40 ++++++------- .../combinat/designs/difference_family.py | 4 +- .../combinat/designs/difference_matrices.py | 4 +- src/sage/combinat/designs/ext_rep.py | 4 +- .../designs/group_divisible_designs.py | 14 ++--- src/sage/combinat/designs/latin_squares.py | 4 +- .../combinat/designs/orthogonal_arrays.py | 12 ++-- .../orthogonal_arrays_build_recursive.py | 10 ++-- src/sage/combinat/designs/resolvable_bibd.py | 8 +-- .../designs/steiner_quadruple_systems.py | 4 +- src/sage/combinat/ncsf_qsym/qsym.py | 4 +- src/sage/combinat/root_system/cartan_type.py | 2 +- .../root_system/extended_affine_weyl_group.py | 2 +- .../combinat/root_system/pieri_factors.py | 2 +- src/sage/combinat/root_system/plot.py | 4 +- .../root_system/reflection_group_real.py | 2 +- .../root_system/root_lattice_realizations.py | 2 +- src/sage/combinat/root_system/type_A.py | 2 +- .../combinat/root_system/type_A_affine.py | 2 +- .../combinat/root_system/type_B_affine.py | 2 +- src/sage/combinat/root_system/type_D.py | 4 +- src/sage/combinat/root_system/type_affine.py | 2 +- src/sage/combinat/root_system/type_super_A.py | 2 +- src/sage/combinat/sf/sfa.py | 10 ++-- src/sage/combinat/species/empty_species.py | 2 +- src/sage/finance/easter.py | 4 +- src/sage/finance/markov_multifractal.py | 6 +- src/sage/functions/transcendental.py | 2 +- src/sage/games/sudoku.py | 10 ++-- src/sage/geometry/cone.py | 14 ++--- .../hyperplane_arrangement/arrangement.py | 2 +- .../geometry/polyhedron/backend_cdd_rdf.py | 4 +- .../geometry/polyhedron/cdd_file_format.py | 6 +- .../geometry/polyhedron/double_description.py | 2 +- src/sage/geometry/toric_lattice.py | 2 +- src/sage/geometry/toric_plotter.py | 2 +- .../triangulation/point_configuration.py | 4 +- src/sage/graphs/generic_graph.py | 6 +- src/sage/modular/abvar/cuspidal_subgroup.py | 4 +- .../modular/arithgroup/arithgroup_generic.py | 2 +- src/sage/modular/modform/half_integral.py | 16 ++--- src/sage/modular/modform/numerical.py | 2 +- .../modform_hecketriangle/abstract_ring.py | 26 ++++----- .../modform_hecketriangle/abstract_space.py | 58 +++++++++---------- .../modform_hecketriangle/constructor.py | 38 ++++++------ .../graded_ring_element.py | 40 ++++++------- .../hecke_triangle_group_element.py | 54 ++++++++--------- .../hecke_triangle_groups.py | 10 ++-- .../series_constructor.py | 28 ++++----- src/sage/modular/modsym/boundary.py | 6 +- .../schemes/elliptic_curves/constructor.py | 2 +- .../elliptic_curves/ell_curve_isogeny.py | 2 +- .../elliptic_curves/ell_modular_symbols.py | 2 +- .../elliptic_curves/ell_rational_field.py | 16 ++--- src/sage/schemes/elliptic_curves/gal_reps.py | 8 +-- src/sage/schemes/elliptic_curves/heegner.py | 44 +++++++------- .../schemes/elliptic_curves/padic_lseries.py | 4 +- src/sage/schemes/elliptic_curves/padics.py | 4 +- .../schemes/elliptic_curves/saturation.py | 4 +- .../hyperelliptic_generic.py | 2 +- .../schemes/product_projective/morphism.py | 2 +- .../projective/projective_rational_point.py | 2 +- src/sage/schemes/toric/morphism.py | 4 +- 81 files changed, 341 insertions(+), 341 deletions(-) diff --git a/src/sage/algebras/rational_cherednik_algebra.py b/src/sage/algebras/rational_cherednik_algebra.py index 597954c7249..3b85c1e13a3 100644 --- a/src/sage/algebras/rational_cherednik_algebra.py +++ b/src/sage/algebras/rational_cherednik_algebra.py @@ -237,7 +237,7 @@ def algebra_generators(self): sage: list(R.algebra_generators()) [a1, a2, s1, s2, ac1, ac2] """ - keys = ['a'+str(i) for i in self._cartan_type.index_set()] + keys = ['a'+str(i) for i in self._cartan_type.index_set()] keys += ['s'+str(i) for i in self._cartan_type.index_set()] keys += ['ac'+str(i) for i in self._cartan_type.index_set()] diff --git a/src/sage/algebras/splitting_algebra.py b/src/sage/algebras/splitting_algebra.py index 2ca3881bbcf..94b3fbc5c24 100644 --- a/src/sage/algebras/splitting_algebra.py +++ b/src/sage/algebras/splitting_algebra.py @@ -217,7 +217,7 @@ def __init__(self, monic_polynomial, names='X', iterate=True, warning=True): deg = monic_polynomial.degree() from sage.structure.category_object import normalize_names - self._root_names = normalize_names(deg-1, names) + self._root_names = normalize_names(deg-1, names) root_names = list(self._root_names) verbose("Create splitting algebra to base ring %s and polynomial %s (%s %s)" % (base_ring, monic_polynomial, iterate, warning)) @@ -238,8 +238,8 @@ def __init__(self, monic_polynomial, names='X', iterate=True, warning=True): if deg < 1: raise ValueError("the degree of the polynomial must positive") - self._splitting_roots = [] - self._coefficients_list = [] + self._splitting_roots = [] + self._coefficients_list = [] self._invertible_elements = {} if isinstance(base_ring, SplittingAlgebra): @@ -289,12 +289,12 @@ def __init__(self, monic_polynomial, names='X', iterate=True, warning=True): SplittingAlgebra.__init__(self, q, root_names_reduces, warning=False) - splitting_roots = base_ring_step._splitting_roots + self._splitting_roots + splitting_roots = base_ring_step._splitting_roots + self._splitting_roots coefficients_list = base_ring_step._coefficients_list + self._coefficients_list verbose("Adding roots: %s" % (splitting_roots)) - self._splitting_roots = splitting_roots + self._splitting_roots = splitting_roots self._coefficients_list = coefficients_list else: PolynomialQuotientRing_domain.__init__(self, P, p, root_name) @@ -343,7 +343,7 @@ def __init__(self, monic_polynomial, names='X', iterate=True, warning=True): # ------------------------------------------------------------------ if cf0_inv is not None: deg_cf = len(cf)-1 - pf = P(cf) + pf = P(cf) for root in self._splitting_roots: check = self(pf) if not check.is_zero(): diff --git a/src/sage/categories/algebra_functor.py b/src/sage/categories/algebra_functor.py index d9b4872b129..d2c64474d8e 100644 --- a/src/sage/categories/algebra_functor.py +++ b/src/sage/categories/algebra_functor.py @@ -631,7 +631,7 @@ def _apply_functor_to_morphism(self, f): 2*() + 2*(2,3) + (1,2,3) + 4*(1,3,2) """ from sage.categories.rings import Rings - domain = self(f.domain()) + domain = self(f.domain()) codomain = self(f.codomain()) # we would want to use something like: # domain.module_morphism(on_coefficients=h, codomain=codomain, category=Rings()) diff --git a/src/sage/categories/cartesian_product.py b/src/sage/categories/cartesian_product.py index f61cca89629..39e9a316b9a 100644 --- a/src/sage/categories/cartesian_product.py +++ b/src/sage/categories/cartesian_product.py @@ -16,7 +16,7 @@ from sage.categories.covariant_functorial_construction import CovariantFunctorialConstruction, CovariantConstructionCategory from sage.categories.pushout import MultivariateConstructionFunctor -native_python_containers = set([tuple, list, set, frozenset, range]) +native_python_containers = set([tuple, list, set, frozenset, range]) class CartesianProductFunctor(CovariantFunctorialConstruction, MultivariateConstructionFunctor): """ diff --git a/src/sage/categories/category_with_axiom.py b/src/sage/categories/category_with_axiom.py index 9850f4d4c85..1c92e587456 100644 --- a/src/sage/categories/category_with_axiom.py +++ b/src/sage/categories/category_with_axiom.py @@ -2609,11 +2609,11 @@ def super_categories(self): class SubcategoryMethods: FiniteDimensional = axiom("FiniteDimensional") - Commutative = axiom("Commutative") - Unital = axiom("Unital") - Connected = axiom("Connected") - Flying = axiom("Flying") - Blue = axiom("Blue") + Commutative = axiom("Commutative") + Unital = axiom("Unital") + Connected = axiom("Connected") + Flying = axiom("Flying") + Blue = axiom("Blue") class FiniteDimensional(CategoryWithAxiom): pass diff --git a/src/sage/categories/covariant_functorial_construction.py b/src/sage/categories/covariant_functorial_construction.py index 40d661945e8..ad402bfe09d 100644 --- a/src/sage/categories/covariant_functorial_construction.py +++ b/src/sage/categories/covariant_functorial_construction.py @@ -286,7 +286,7 @@ def _base_category_class(cls): """ module_name = cls.__module__.replace(cls._functor_category.lower() + "_","") import sys - name = cls.__name__.replace(cls._functor_category, "") + name = cls.__name__.replace(cls._functor_category, "") __import__(module_name) module = sys.modules[module_name] return (module.__dict__[name],) diff --git a/src/sage/categories/distributive_magmas_and_additive_magmas.py b/src/sage/categories/distributive_magmas_and_additive_magmas.py index 233f0ce12ac..3518893c907 100644 --- a/src/sage/categories/distributive_magmas_and_additive_magmas.py +++ b/src/sage/categories/distributive_magmas_and_additive_magmas.py @@ -43,7 +43,7 @@ class AdditiveCommutative(CategoryWithAxiom): class AdditiveUnital(CategoryWithAxiom): class Associative(CategoryWithAxiom): AdditiveInverse = LazyImport('sage.categories.rngs', 'Rngs', at_startup=True) - Unital = LazyImport('sage.categories.semirings', 'Semirings', at_startup=True) + Unital = LazyImport('sage.categories.semirings', 'Semirings', at_startup=True) class ParentMethods: diff --git a/src/sage/categories/enumerated_sets.py b/src/sage/categories/enumerated_sets.py index 695f4982bd8..1097a04412a 100644 --- a/src/sage/categories/enumerated_sets.py +++ b/src/sage/categories/enumerated_sets.py @@ -230,7 +230,7 @@ def __iter__(self): """ # Check if .first() and .next(x) are overridden in the subclass if ( self.first != self._first_from_iterator and - self.next != self._next_from_iterator ): + self.next != self._next_from_iterator ): return self._iterator_from_next() #Check to see if .unrank() is overridden in the subclass elif self.unrank != self._unrank_from_iterator: @@ -592,7 +592,7 @@ def list(self): [1, 2, 3] """ return list(self.tuple()) - _list_default = list # needed by the check system. + _list_default = list # needed by the check system. def _list_from_iterator(self): r""" @@ -1108,7 +1108,7 @@ def rank(self): """ return self.parent().rank(self) - Finite = LazyImport('sage.categories.finite_enumerated_sets', 'FiniteEnumeratedSets', at_startup=True) + Finite = LazyImport('sage.categories.finite_enumerated_sets', 'FiniteEnumeratedSets', at_startup=True) Infinite = LazyImport('sage.categories.infinite_enumerated_sets', 'InfiniteEnumeratedSets', at_startup=True) class CartesianProducts(CartesianProductsCategory): diff --git a/src/sage/categories/infinite_enumerated_sets.py b/src/sage/categories/infinite_enumerated_sets.py index 581faab5ff4..3c7a861a4b6 100644 --- a/src/sage/categories/infinite_enumerated_sets.py +++ b/src/sage/categories/infinite_enumerated_sets.py @@ -88,7 +88,7 @@ def list(self): NotImplementedError: cannot list an infinite set """ raise NotImplementedError("cannot list an infinite set") - _list_default = list # needed by the check system. + _list_default = list # needed by the check system. def _test_enumerated_set_iter_cardinality(self, **options): """ diff --git a/src/sage/categories/quotient_fields.py b/src/sage/categories/quotient_fields.py index 5e4cf0c7edc..02780268c8f 100644 --- a/src/sage/categories/quotient_fields.py +++ b/src/sage/categories/quotient_fields.py @@ -315,7 +315,7 @@ def xgcd(self, other): return (P(g)/P(lcmD), P(s*selfD)/P(lcmD),P(t*otherD)/P(lcmD)) except (AttributeError, NotImplementedError, TypeError, ValueError): zero = self.parent().zero() - one = self.parent().one() + one = self.parent().one() if self != zero: return (one, ~self, zero) elif other != zero: @@ -681,11 +681,11 @@ def _derivative(self, var=None): try: numder = num._derivative(var) dender = den._derivative(var) - d = den.gcd(dender) - den = den // d + d = den.gcd(dender) + den = den // d dender = dender // d - tnum = numder * den - num * dender - tden = self.denominator() * den + tnum = numder * den - num * dender + tden = self.denominator() * den if not tden.is_one() and tden.is_unit(): try: tnum = tnum * tden.inverse_of_unit() diff --git a/src/sage/categories/semigroups.py b/src/sage/categories/semigroups.py index 8e60690e631..10e2617e1ab 100644 --- a/src/sage/categories/semigroups.py +++ b/src/sage/categories/semigroups.py @@ -327,7 +327,7 @@ def cayley_graph(self, side="right", simple=False, elements=None, generators = self.semigroup_generators() if isinstance(generators, (list, tuple)): generators = dict((self(g), self(g)) for g in generators) - left = (side == "left" or side == "twosided") + left = (side == "left" or side == "twosided") right = (side == "right" or side == "twosided") def add_edge(source, target, label, side_label): diff --git a/src/sage/coding/channel.py b/src/sage/coding/channel.py index 915982850c9..ba59d756d1a 100644 --- a/src/sage/coding/channel.py +++ b/src/sage/coding/channel.py @@ -603,7 +603,7 @@ def transmit_unsafe(self, message): zero = V.base_ring().zero() errors = sample(range(n), number_errors + number_erasures) - error_positions = errors[:number_errors] + error_positions = errors[:number_errors] erasure_positions = errors[number_errors:] error_vector = random_error_vector(n, V.base_ring(), error_positions) diff --git a/src/sage/coding/code_bounds.py b/src/sage/coding/code_bounds.py index 766a8f266cf..8e1ce61cedb 100644 --- a/src/sage/coding/code_bounds.py +++ b/src/sage/coding/code_bounds.py @@ -656,7 +656,7 @@ def entropy_inverse(x, q=2): if q < 2: # Here we check that q is actually at least 2 raise ValueError("The value q must be an integer greater than 1") - eps = 4.5e-16 # find_root has about this as the default xtol + eps = 4.5e-16 # find_root has about this as the default xtol ymax = 1 - 1/q if x <= eps: return 0 diff --git a/src/sage/coding/grs_code.py b/src/sage/coding/grs_code.py index efbc1d32c5b..d86c61c254e 100644 --- a/src/sage/coding/grs_code.py +++ b/src/sage/coding/grs_code.py @@ -1009,7 +1009,7 @@ def encode(self, p): C = self.code() if p.degree() >= C.dimension(): raise ValueError("The polynomial to encode must have degree at most %s" % (C.dimension() - 1)) - alphas = C.evaluation_points() + alphas = C.evaluation_points() col_mults = C.column_multipliers() c = vector(C.base_ring(), [col_mults[i]*p(alphas[i]) for i in range(C.length())]) return c @@ -1057,7 +1057,7 @@ def unencode_nocheck(self, c): """ C = self.code() - alphas = C.evaluation_points() + alphas = C.evaluation_points() col_mults = C.column_multipliers() c = [c[i]/col_mults[i] for i in range(C.length())] @@ -1229,14 +1229,14 @@ def _decode_to_code_and_message(self, r): r_list = copy(r) r_list = [r[i]/col_mults[i] for i in range(0, C.length())] - t = (C.minimum_distance()-1) // 2 + t = (C.minimum_distance()-1) // 2 l0 = n-1-t l1 = n-1-t-(k-1) - S = matrix(C.base_field(), n, l0+l1+2, + S = matrix(C.base_field(), n, l0+l1+2, lambda i, j: (C.evaluation_points()[i])**j if j<(l0+1) else r_list[i]*(C.evaluation_points()[i])**(j-(l0+1))) - S = S.right_kernel() - S = S.basis_matrix().row(0) + S = S.right_kernel() + S = S.basis_matrix().row(0) R = C.base_field()['x'] Q0 = R(S.list_from_positions(range(l0 + 1))) diff --git a/src/sage/combinat/cluster_algebra_quiver/mutation_type.py b/src/sage/combinat/cluster_algebra_quiver/mutation_type.py index b5eddce4393..da766a9c108 100644 --- a/src/sage/combinat/cluster_algebra_quiver/mutation_type.py +++ b/src/sage/combinat/cluster_algebra_quiver/mutation_type.py @@ -763,7 +763,7 @@ def _connected_mutation_type(dg): elif len( exc_labels ) == 1: label = exc_labels[0] v_out = label[0] - v_in = label[1] + v_in = label[1] label = label[2] if label == (1,-2): if dict_in_out[ v_in ][0] == 1 and dict_in_out[ v_in ][1] == 0: diff --git a/src/sage/combinat/crystals/generalized_young_walls.py b/src/sage/combinat/crystals/generalized_young_walls.py index 9503199c28c..2d8114eeda2 100644 --- a/src/sage/combinat/crystals/generalized_young_walls.py +++ b/src/sage/combinat/crystals/generalized_young_walls.py @@ -452,7 +452,7 @@ def e(self, i): """ signature = self.generate_signature(i) raw_signature = signature[0] - lastminus = signature[1].rfind('-') + lastminus = signature[1].rfind('-') newdata = [] if lastminus > -1: deletionrow = raw_signature[lastminus][1] @@ -725,7 +725,7 @@ def in_highest_weight_crystal(self,La): else: p_not_found = True for p in index_set: - if (j+k) % (n+1) == (p+1) % (n+1) and self.a(j,k) - self.a( (j-1) % (n+1) ,k) <= La.scalar(ac[p]): + if (j+k) % (n+1) == (p+1) % (n+1) and self.a(j,k) - self.a( (j-1) % (n+1) ,k) <= La.scalar(ac[p]): p_not_found = False continue else: diff --git a/src/sage/combinat/designs/bibd.py b/src/sage/combinat/designs/bibd.py index d850d6eeb8d..8e0a2df99de 100644 --- a/src/sage/combinat/designs/bibd.py +++ b/src/sage/combinat/designs/bibd.py @@ -1372,15 +1372,15 @@ def BIBD_from_arc_in_desarguesian_projective_plane(n,k,existence=False): from sage.libs.gap.libgap import libgap from sage.matrix.constructor import Matrix - K = GF(q,'a') + K = GF(q,'a') one = K.one() # An irreducible quadratic form over K[X,Y] GO = libgap.GeneralOrthogonalGroup(-1,2,q) - M = libgap.InvariantQuadraticForm(GO)['matrix'] - M = Matrix(M) - M = M.change_ring(K) - Q = lambda xx,yy : M[0,0]*xx**2+(M[0,1]+M[1,0])*xx*yy+M[1,1]*yy**2 + M = libgap.InvariantQuadraticForm(GO)['matrix'] + M = Matrix(M) + M = M.change_ring(K) + Q = lambda xx,yy : M[0,0]*xx**2+(M[0,1]+M[1,0])*xx*yy+M[1,1]*yy**2 # Here, the additive subgroup H (of order n) of K mentioned in # [Denniston69] is the set of all elements of K of degree < log_n diff --git a/src/sage/combinat/designs/block_design.py b/src/sage/combinat/designs/block_design.py index 6e1c58f0224..608a06581e1 100644 --- a/src/sage/combinat/designs/block_design.py +++ b/src/sage/combinat/designs/block_design.py @@ -343,11 +343,11 @@ def DesarguesianProjectivePlaneDesign(n, point_coordinates=True, check=True): # we relabel the points with the integers from 0 to n^2 + n as follows: # - the affine plane is the set of points [x:y:1] (i.e. the third coordinate # is non-zero) and gets relabeled from 0 to n^2-1 - affine_plane = lambda x,y: relabel[x] + n * relabel[y] + affine_plane = lambda x,y: relabel[x] + n * relabel[y] # - the affine line is the set of points [x:1:0] (i.e. the third coordinate is # zero but not the second one) and gets relabeled from n^2 to n^2 + n - 1 - line_infinity = lambda x: n2 + relabel[x] + line_infinity = lambda x: n2 + relabel[x] # - the point is [1:0:0] and gets relabeled n^2 + n point_infinity = n2 + n @@ -380,7 +380,7 @@ def DesarguesianProjectivePlaneDesign(n, point_coordinates=True, check=True): if point_coordinates: zero = K.zero() - one = K.one() + one = K.one() d = {affine_plane(x,y): (x,y,one) for x in Kiter for y in Kiter} diff --git a/src/sage/combinat/designs/database.py b/src/sage/combinat/designs/database.py index d13823082ec..54528b14b9b 100644 --- a/src/sage/combinat/designs/database.py +++ b/src/sage/combinat/designs/database.py @@ -514,7 +514,7 @@ def OA_8_69(): PBD = [[x for x in B if x not in oval] for B in BIBD] sets_of_size_seven = [R for R in PBD if len(R) == 7] - others = [R for R in PBD if len(R) != 7] + others = [R for R in PBD if len(R) != 7] # 68, 27, and 52 are the only elements appearing twice in the rows of # sets_of_size_seven, and each row contains exactly one of them. @@ -628,7 +628,7 @@ def OA_8_76(): PBD.remove([]) sets_of_size_seven = [R for R in PBD if len(R) == 7] - others = [R for R in PBD if len(R) != 7] + others = [R for R in PBD if len(R) != 7] # critical_points are the 10 elements appearing twice in the rows of the 10 # sets_of_size_seven, and each row contains exactly two of them @@ -1477,11 +1477,11 @@ def OA_17_560(): """ from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF alpha = 5 - beta = 4 - p = 2 - k = 17 - m = 16 - n = p**alpha + beta = 4 + p = 2 + k = 17 + m = 16 + n = p**alpha G = GF((p, alpha), prefix='x') G_set = sorted(G) # sorted by lexicographic order, G[1] = 1 @@ -3694,7 +3694,7 @@ def DM_52_6_1(): sage: _ = designs.difference_matrix(52,6) """ from sage.rings.finite_rings.finite_field_constructor import FiniteField - F4 = FiniteField(4,'z') + F4 = FiniteField(4,'z') G13 = FiniteField(13) G = F4.cartesian_product(G13) z = F4('z') @@ -3805,9 +3805,9 @@ def DM_56_8_1(): sage: _ = designs.difference_matrix(56,8) """ from sage.rings.finite_rings.finite_field_constructor import FiniteField - F8 = FiniteField(8,'z') - F7 = FiniteField(7) - G = F8.cartesian_product(F7) + F8 = FiniteField(8,'z') + F7 = FiniteField(7) + G = F8.cartesian_product(F7) w = F8.primitive_element() assert w**3 == w+1 @@ -3936,7 +3936,7 @@ def DM_75_8_1(): F3 = FiniteField(3) F5 = FiniteField(5) - G = cartesian_product((F3,F5,F5)) + G = cartesian_product((F3,F5,F5)) M = [ [(2,0,0), (0,0,0), (0,0,0), (1,0,0), (0,0,0), (1,0,0), (1,0,0), (0,0,0)], @@ -4121,7 +4121,7 @@ def RBIBD_120_8_1(): BIBD = new_BIBD r = {v:i for i,v in enumerate(x for x in range(n) if x not in hyperoval)} - BIBD = [[r[x] for x in B] for B in BIBD ] + BIBD = [[r[x] for x in B] for B in BIBD ] equiv = [[r[x] for x in B] for B in equiv] BIBD = IncidenceStructure(range(255),BIBD) @@ -5008,13 +5008,13 @@ def BIBD_56_11_2(): for k in sorted(EDS)) __doc__ = __doc__.format( - LIST_OF_OA_CONSTRUCTIONS = LIST_OF_OA_CONSTRUCTIONS, + LIST_OF_OA_CONSTRUCTIONS = LIST_OF_OA_CONSTRUCTIONS, LIST_OF_MOLS_CONSTRUCTIONS = LIST_OF_MOLS_CONSTRUCTIONS, - LIST_OF_VMT_VECTORS = LIST_OF_VMT_VECTORS, - LIST_OF_BIBD = LIST_OF_BIBD, - LIST_OF_DF = LIST_OF_DF, - LIST_OF_DM = LIST_OF_DM, - LIST_OF_QDM = LIST_OF_QDM, - LIST_OF_EDS = LIST_OF_EDS) + LIST_OF_VMT_VECTORS = LIST_OF_VMT_VECTORS, + LIST_OF_BIBD = LIST_OF_BIBD, + LIST_OF_DF = LIST_OF_DF, + LIST_OF_DM = LIST_OF_DM, + LIST_OF_QDM = LIST_OF_QDM, + LIST_OF_EDS = LIST_OF_EDS) del LIST_OF_OA_CONSTRUCTIONS, LIST_OF_MOLS_CONSTRUCTIONS, LIST_OF_VMT_VECTORS,LIST_OF_DF, LIST_OF_DM, LIST_OF_QDM, LIST_OF_EDS, LIST_OF_BIBD del PolynomialRing, ZZ, a, diff --git a/src/sage/combinat/designs/difference_family.py b/src/sage/combinat/designs/difference_family.py index b486183cf6c..18dfcbf9fd4 100644 --- a/src/sage/combinat/designs/difference_family.py +++ b/src/sage/combinat/designs/difference_family.py @@ -270,7 +270,7 @@ def is_difference_family(G, D, v=None, k=None, l=None, verbose=False): # Check that every x \in G-{0},occurs exactly l times as a difference counter = {g: 0 for g in Glist} - where = {g: set() for g in Glist} + where = {g: set() for g in Glist} del counter[identity] for i,d in enumerate(D): @@ -296,7 +296,7 @@ def is_difference_family(G, D, v=None, k=None, l=None, verbose=False): counter[gg] += tmp_counter[gg]//stabi # Check the counter and report any error - too_few = [] + too_few = [] too_much = [] for g in Glist: if g == identity: diff --git a/src/sage/combinat/designs/difference_matrices.py b/src/sage/combinat/designs/difference_matrices.py index 9e27b4688c4..6d609fc94f4 100644 --- a/src/sage/combinat/designs/difference_matrices.py +++ b/src/sage/combinat/designs/difference_matrices.py @@ -232,8 +232,8 @@ def difference_matrix(g,k,lmbda=1,existence=False,check=True): k = g elif existence: return True - F = FiniteField(g,'x') - F_set = list(F) + F = FiniteField(g,'x') + F_set = list(F) F_k_set = F_set[:k] G = F diff --git a/src/sage/combinat/designs/ext_rep.py b/src/sage/combinat/designs/ext_rep.py index 6b02f95f2ac..cc2f13687a0 100644 --- a/src/sage/combinat/designs/ext_rep.py +++ b/src/sage/combinat/designs/ext_rep.py @@ -45,8 +45,8 @@ from sage.misc.temporary_file import tmp_filename -XML_NAMESPACE = 'http://designtheory.org/xml-namespace' -DTRS_PROTOCOL = '2.0' +XML_NAMESPACE = 'http://designtheory.org/xml-namespace' +DTRS_PROTOCOL = '2.0' # The following string is the file # http://designtheory.org/database/v-b-k/v2-b2-k2.icgsa.txt.bz2 diff --git a/src/sage/combinat/designs/group_divisible_designs.py b/src/sage/combinat/designs/group_divisible_designs.py index b6898358c45..74425c5516f 100644 --- a/src/sage/combinat/designs/group_divisible_designs.py +++ b/src/sage/combinat/designs/group_divisible_designs.py @@ -114,8 +114,8 @@ def group_divisible_design(v,K,G,existence=False,check=False): return GDD_4_2(v//2,check=check) # From a TD(k,g) - elif (len(G) == 1 and - len(K) == 1 and + elif (len(G) == 1 and + len(K) == 1 and K[0]*G[0] == v): from .orthogonal_arrays import transversal_design return transversal_design(k=K[0],n=G[0],existence=existence) @@ -127,7 +127,7 @@ def group_divisible_design(v,K,G,existence=False,check=False): G = G, K = K, check = check, - copy = True) + copy = True) if existence: return Unknown @@ -195,10 +195,10 @@ def GDD_4_2(q,existence=False,check=True): return GroupDivisibleDesign(2*q, groups = [[i,i+1] for i in range(0,2*q,2)], blocks = sum(classes,[]), - K = [4], - G = [2], - check = check, - copy = False) + K = [4], + G = [2], + check = check, + copy = False) class GroupDivisibleDesign(IncidenceStructure): r""" diff --git a/src/sage/combinat/designs/latin_squares.py b/src/sage/combinat/designs/latin_squares.py index 9daa508e07d..4dea7cd63d7 100644 --- a/src/sage/combinat/designs/latin_squares.py +++ b/src/sage/combinat/designs/latin_squares.py @@ -513,8 +513,8 @@ def MOLS_table(start,stop=None,compare=False,width=None): start,stop = 0,start # make start and stop be congruent to 0 mod 20 start = start - (start%20) - stop = stop-1 - stop = stop + (20-(stop%20)) + stop = stop-1 + stop = stop + (20-(stop%20)) assert start%20 == 0 and stop%20 == 0 if stop <= start: return diff --git a/src/sage/combinat/designs/orthogonal_arrays.py b/src/sage/combinat/designs/orthogonal_arrays.py index 388a3a777cc..f561491df7e 100644 --- a/src/sage/combinat/designs/orthogonal_arrays.py +++ b/src/sage/combinat/designs/orthogonal_arrays.py @@ -1227,10 +1227,10 @@ def incomplete_orthogonal_array(k,n,holes,resolvable=False, existence=False): if not holes: return orthogonal_array(k,n,existence=existence,resolvable=resolvable) - sum_of_holes = sum(holes) + sum_of_holes = sum(holes) number_of_holes = len(holes) - max_hole = max(holes) - min_hole = min(holes) + max_hole = max(holes) + min_hole = min(holes) if sum_of_holes > n: if existence: @@ -1362,7 +1362,7 @@ def incomplete_orthogonal_array(k,n,holes,resolvable=False, existence=False): if uu == sum_of_holes and mu <= 1 and lmbda == 1 and k <= kk + 1: break G,M = f() - OA = OA_from_quasi_difference_matrix(M,G,fill_hole=False) + OA = OA_from_quasi_difference_matrix(M,G,fill_hole=False) return [B[:k] for B in OA] # Equal holes [h,h,...] with h>1 through OA product construction @@ -1375,7 +1375,7 @@ def incomplete_orthogonal_array(k,n,holes,resolvable=False, existence=False): incomplete_orthogonal_array(k,n//min_hole,[1]*number_of_holes,existence=True)): # OA(k,n/h)-x.OA(k,1) if existence: return True - h = min_hole + h = min_hole iOA1 = incomplete_orthogonal_array(k,n//holes[0],[1]*number_of_holes) iOA2 = orthogonal_array(k,h) @@ -2088,7 +2088,7 @@ def __init__(self,*args,**kwds): """ raise RuntimeError("This is not a function but a class. You want to call the designs.orthogonal_arrays.* functions") - largest_available_k = staticmethod(largest_available_k) + largest_available_k = staticmethod(largest_available_k) @staticmethod def explain_construction(k,n,t=2): diff --git a/src/sage/combinat/designs/orthogonal_arrays_build_recursive.py b/src/sage/combinat/designs/orthogonal_arrays_build_recursive.py index fad25aff6da..c2f2bca5209 100644 --- a/src/sage/combinat/designs/orthogonal_arrays_build_recursive.py +++ b/src/sage/combinat/designs/orthogonal_arrays_build_recursive.py @@ -724,11 +724,11 @@ def thwart_lemma_3_5(k,n,m,a,b,c,d=0,complement=False,explain_construction=False assert n - len(third_complement) >= c # The keepers - first_set = list(range(a)) + first_set = list(range(a)) second_set = list(range(b)) - third_set = [x for x in range(n) if x not in third_complement][:c] + third_set = [x for x in range(n) if x not in third_complement][:c] - last_sets = [first_set, second_set, third_set] + last_sets = [first_set, second_set, third_set] if complement: last_sets = [set(range(n)).difference(s) for s in last_sets] @@ -1109,7 +1109,7 @@ def product_with_parallel_classes(OA1,k,g1,g2,g1_parall,parall,check=True): # Leftover blocks become parallel classes. We must split them into slices of # length n3 - OA3_parall = [OA3[i:i+n3] for i in range(len(OA3_n1_parall)*n1*n3, len(OA3), n3)] + OA3_parall = [OA3[i:i+n3] for i in range(len(OA3_n1_parall)*n1*n3, len(OA3), n3)] # First product: OA1 and OA3 n1_parall, parall = product_with_parallel_classes(OA1,k,n1,n3,OA3_n1_parall,OA3_parall,check=check) @@ -1470,7 +1470,7 @@ def brouwer_separable_design(k,t,q,x,check=False,verbose=False,explain_construct e2 = int(x != 1) e3 = int(x != q**2) e4 = int(x != t+q+1) - N = t*N1+x + N = t*N1+x # i) if x == 0: diff --git a/src/sage/combinat/designs/resolvable_bibd.py b/src/sage/combinat/designs/resolvable_bibd.py index 944a1b6d4a7..e9de2d9a7cf 100644 --- a/src/sage/combinat/designs/resolvable_bibd.py +++ b/src/sage/combinat/designs/resolvable_bibd.py @@ -257,9 +257,9 @@ def kirkman_triple_system(v,existence=False): a = K.primitive_element() t = (q - 1) // 6 A0 = [(0,0),(0,1),(0,2)] - B = [[(a**i,j),(a**(i+2*t),j),(a**(i+4*t),j)] for j in range(3) + B = [[(a**i,j),(a**(i+2*t),j),(a**(i+4*t),j)] for j in range(3) for i in range(t)] - A = [[(a**i,0),(a**(i+2*t),1),(a**(i+4*t),2)] for i in range(6*t)] + A = [[(a**i,0),(a**(i+2*t),1),(a**(i+4*t),2)] for i in range(6*t)] # Action of K on the points action = lambda v,x: (v+x[0],x[1]) @@ -269,7 +269,7 @@ def kirkman_triple_system(v,existence=False): for i,p in enumerate(K) for j in range(3)} - B0 = [A0] + B + A[t:2*t] + A[3*t:4*t] + A[5*t:6*t] + B0 = [A0] + B + A[t:2*t] + A[3*t:4*t] + A[5*t:6*t] # Classes classes = [[[relabel[action(p,x)] for x in tr] for tr in B0] @@ -559,7 +559,7 @@ def PBD_4_7(v,check=True, existence=False): from .group_divisible_designs import group_divisible_design from .orthogonal_arrays import transversal_design GDD = group_divisible_design(3*5,K=[4],G=[3],check=False) - TD = transversal_design(5,5) + TD = transversal_design(5,5) # A (75,{4},{15})-GDD GDD2 = [[3*B[x//3]+x%3 for x in BB] for B in TD for BB in GDD] diff --git a/src/sage/combinat/designs/steiner_quadruple_systems.py b/src/sage/combinat/designs/steiner_quadruple_systems.py index ee8d8102f28..a4be443cc04 100644 --- a/src/sage/combinat/designs/steiner_quadruple_systems.py +++ b/src/sage/combinat/designs/steiner_quadruple_systems.py @@ -511,7 +511,7 @@ def P(alpha, m): return [(2*a, (2*a - 2*b - 1)%(2*m)) for a in range(m)] else: y = alpha - m - pairs = [(b,(2*y-b)%(2*m)) for b in range(y)] + pairs = [(b,(2*y-b)%(2*m)) for b in range(y)] pairs += [(c,(2*m+2*y-c-2)%(2*m)) for c in range(2*y+1,m+y-1)] pairs += [(2*m+int(-1.5-.5*(-1)**y),y),(2*m+int(-1.5+.5*(-1)**y),m+y-1)] return pairs @@ -525,7 +525,7 @@ def P(alpha, m): return [(2*a,(2*a-2*b-1)%(2*m)) for a in range(m)] else: y = alpha-m+1 - pairs = [(b,2*y-b) for b in range(y)] + pairs = [(b,2*y-b) for b in range(y)] pairs += [(c,2*m+2*y-c) for c in range(2*y+1,m+y)] pairs += [(y,m+y)] return pairs diff --git a/src/sage/combinat/ncsf_qsym/qsym.py b/src/sage/combinat/ncsf_qsym/qsym.py index 8bdef2fa7dd..9169e38e1d1 100644 --- a/src/sage/combinat/ncsf_qsym/qsym.py +++ b/src/sage/combinat/ncsf_qsym/qsym.py @@ -564,10 +564,10 @@ def __init__(self, R): Parent.__init__(self, category = category.WithRealizations()) # Bases - Monomial = self.Monomial() + Monomial = self.Monomial() Fundamental = self.Fundamental() dualImmaculate = self.dualImmaculate() - QS = self.Quasisymmetric_Schur() + QS = self.Quasisymmetric_Schur() # Change of bases Fundamental.module_morphism(Monomial.sum_of_finer_compositions, diff --git a/src/sage/combinat/root_system/cartan_type.py b/src/sage/combinat/root_system/cartan_type.py index 825fc95ee16..6c89e131c9d 100644 --- a/src/sage/combinat/root_system/cartan_type.py +++ b/src/sage/combinat/root_system/cartan_type.py @@ -1736,7 +1736,7 @@ def symmetrizer(self): n = m.nrows() M = matrix(ZZ, n, n*n, sparse = True) for (i,j) in m.nonzero_positions(): - M[i, n * i + j] = m[i,j] + M[i, n * i + j] = m[i,j] M[j, n * i + j] -= m[j,i] kern = M.integer_kernel() c = len(self.dynkin_diagram().connected_components()) diff --git a/src/sage/combinat/root_system/extended_affine_weyl_group.py b/src/sage/combinat/root_system/extended_affine_weyl_group.py index f4a2e54a88e..87fe3399169 100644 --- a/src/sage/combinat/root_system/extended_affine_weyl_group.py +++ b/src/sage/combinat/root_system/extended_affine_weyl_group.py @@ -485,7 +485,7 @@ def __init__(self, cartan_type, general_linear, **print_options): self._prefixcl = "s" self._ct0 = cartan_type.classical() - self._R0 = self._ct0.root_system() + self._R0 = self._ct0.root_system() self._I0 = self._ct0.index_set() self._ct0v = self._ct0.dual() self._R0v = self._ct0v.root_system() diff --git a/src/sage/combinat/root_system/pieri_factors.py b/src/sage/combinat/root_system/pieri_factors.py index 106b5e0efd8..14d78e3b3f4 100644 --- a/src/sage/combinat/root_system/pieri_factors.py +++ b/src/sage/combinat/root_system/pieri_factors.py @@ -731,7 +731,7 @@ def __getitem__(self, support): """ index_set = sorted(self.W.index_set()) - support = sorted(support) + support = sorted(support) if not set(support).issubset(set(index_set)) or support == index_set: raise ValueError("the support must be a proper subset of the index set") if not support: diff --git a/src/sage/combinat/root_system/plot.py b/src/sage/combinat/root_system/plot.py index ce3cce65ef4..ee23f9fe836 100644 --- a/src/sage/combinat/root_system/plot.py +++ b/src/sage/combinat/root_system/plot.py @@ -1393,8 +1393,8 @@ def cone(self, rays=[], lines=[], color="black", thickness=1, alpha=1, wireframe if self.level: old_rays = rays vertices = [self.intersection_at_level_1(ray) for ray in old_rays if ray.level() > 0] - rays = [ray for ray in old_rays if ray.level() == 0] - rays += [vertex - self.intersection_at_level_1(ray) for ray in old_rays if ray.level() < 0 for vertex in vertices] + rays = [ray for ray in old_rays if ray.level() == 0] + rays += [vertex - self.intersection_at_level_1(ray) for ray in old_rays if ray.level() < 0 for vertex in vertices] else: vertices = [] diff --git a/src/sage/combinat/root_system/reflection_group_real.py b/src/sage/combinat/root_system/reflection_group_real.py index 9d7c9a92bbf..7591f283adf 100644 --- a/src/sage/combinat/root_system/reflection_group_real.py +++ b/src/sage/combinat/root_system/reflection_group_real.py @@ -271,7 +271,7 @@ def __init__(self, W_types, index_set=None, hyperplane_index_set=None, reflectio cls = IrreducibleComplexReflectionGroup else: cls = ComplexReflectionGroup - cls.__init__(self, W_types, index_set = index_set, + cls.__init__(self, W_types, index_set = index_set, hyperplane_index_set = hyperplane_index_set, reflection_index_set = reflection_index_set) diff --git a/src/sage/combinat/root_system/root_lattice_realizations.py b/src/sage/combinat/root_system/root_lattice_realizations.py index fb63471ffb0..d1f24de2d90 100644 --- a/src/sage/combinat/root_system/root_lattice_realizations.py +++ b/src/sage/combinat/root_system/root_lattice_realizations.py @@ -1900,7 +1900,7 @@ def _classical_alpha_0(self): sage: L.classical().highest_root() 2*alpha[1] + 2*alpha[2] + alpha[3] """ - cartan_type = self.cartan_type() + cartan_type = self.cartan_type() special_node = cartan_type.special_node() a = self.cartan_type().col_annihilator() classical = self.classical() diff --git a/src/sage/combinat/root_system/type_A.py b/src/sage/combinat/root_system/type_A.py index e48524ffbcc..c1134668507 100644 --- a/src/sage/combinat/root_system/type_A.py +++ b/src/sage/combinat/root_system/type_A.py @@ -335,7 +335,7 @@ def ascii_art(self, label=lambda i: i, node=None): return "" if node is None: node = self._ascii_art_node - ret = "---".join(node(label(i)) for i in range(1,n+1)) + "\n" + ret = "---".join(node(label(i)) for i in range(1,n+1)) + "\n" ret += "".join("{!s:4}".format(label(i)) for i in range(1,n+1)) return ret diff --git a/src/sage/combinat/root_system/type_A_affine.py b/src/sage/combinat/root_system/type_A_affine.py index e5fc4d00935..c287ae98f7e 100644 --- a/src/sage/combinat/root_system/type_A_affine.py +++ b/src/sage/combinat/root_system/type_A_affine.py @@ -187,7 +187,7 @@ def ascii_art(self, label=lambda i: i, node=None): l0 = label(0) l1 = label(1) return "{}<=>{}\n{!s:4}{}".format(node(l0), node(l1), l0, l1) - ret = "{}\n{}".format(label(0), node(label(0))) + ret = "{}\n{}".format(label(0), node(label(0))) ret += "----"*(n-2) + "---+\n|" + " "*(n-2) + " |\n|" + " "*(n-2) + " |\n" ret += "---".join(node(label(i)) for i in range(1,n+1)) + "\n" ret += "".join("{!s:4}".format(label(i)) for i in range(1,n+1)) diff --git a/src/sage/combinat/root_system/type_B_affine.py b/src/sage/combinat/root_system/type_B_affine.py index fd709894a6e..ecf30bc226d 100644 --- a/src/sage/combinat/root_system/type_B_affine.py +++ b/src/sage/combinat/root_system/type_B_affine.py @@ -192,7 +192,7 @@ def ascii_art(self, label=lambda i: i, node=None): return CartanType(["A",1,1]).ascii_art(label, node) if n == 2: return CartanType(["C",2,1]).relabel({0:0, 1:2, 2:1}).ascii_art(label, node) - ret = " {} {}\n |\n |\n".format(node(label(0)), label(0)) + ret = " {} {}\n |\n |\n".format(node(label(0)), label(0)) ret += "---".join(node(label(i)) for i in range(1,n)) + "=>={}\n".format(node(label(n))) ret += "".join("{!s:4}".format(label(i)) for i in range(1,n+1)) return ret diff --git a/src/sage/combinat/root_system/type_D.py b/src/sage/combinat/root_system/type_D.py index d250a3643b6..94880f6e2c8 100644 --- a/src/sage/combinat/root_system/type_D.py +++ b/src/sage/combinat/root_system/type_D.py @@ -341,8 +341,8 @@ def ascii_art(self, label=lambda i: i, node=None): if n == 2: ret = "{} {}\n".format(node(label(1)), node(label(2))) return ret + "{!s:4}{!s:4}".format(label(1), label(2)) - ret = (4*(n-3))*" "+"{} {}\n".format(node(label(n)), label(n)) - ret += ((4*(n-3))*" " +"|\n")*2 + ret = (4*(n-3))*" "+"{} {}\n".format(node(label(n)), label(n)) + ret += ((4*(n-3))*" " +"|\n")*2 ret += "---".join(node(label(i)) for i in range(1, n)) +"\n" ret += "".join("{!s:4}".format(label(i)) for i in range(1,n)) return ret diff --git a/src/sage/combinat/root_system/type_affine.py b/src/sage/combinat/root_system/type_affine.py index 5ce62dfb7be..b24f2d2afa5 100644 --- a/src/sage/combinat/root_system/type_affine.py +++ b/src/sage/combinat/root_system/type_affine.py @@ -347,7 +347,7 @@ def simple_root(self, i): - :meth:`CartanType.col_annihilator` - :meth:`null_root` """ - cartan_type = self.cartan_type() + cartan_type = self.cartan_type() special_node = cartan_type.special_node() if i == special_node: return self(self._classical_alpha_0()) + self.monomial("delta") diff --git a/src/sage/combinat/root_system/type_super_A.py b/src/sage/combinat/root_system/type_super_A.py index c014dfa7ee5..9eda2eeeee5 100644 --- a/src/sage/combinat/root_system/type_super_A.py +++ b/src/sage/combinat/root_system/type_super_A.py @@ -815,7 +815,7 @@ def ascii_art(self, label=lambda i: i, node=None): """ if node is None: node = lambda i: 'O' - ret = "---".join(node(label(i)) for i in range(1,self.m+1)) + ret = "---".join(node(label(i)) for i in range(1,self.m+1)) if self.m == 0: if self.n == 0: ret = "X" diff --git a/src/sage/combinat/sf/sfa.py b/src/sage/combinat/sf/sfa.py index a833b1f5d81..9082586c453 100644 --- a/src/sage/combinat/sf/sfa.py +++ b/src/sage/combinat/sf/sfa.py @@ -2245,12 +2245,12 @@ def _invert_morphism(self, n, base_ring, self_to_other_cache, other_to_self_cach #Decide whether we know how to go from self to other or #from other to self if to_other_function is not None: - known_cache = self_to_other_cache #the known direction - unknown_cache = other_to_self_cache #the unknown direction + known_cache = self_to_other_cache #the known direction + unknown_cache = other_to_self_cache #the unknown direction known_function = to_other_function else: - unknown_cache = self_to_other_cache #the known direction - known_cache = other_to_self_cache #the unknown direction + unknown_cache = self_to_other_cache #the known direction + known_cache = other_to_self_cache #the unknown direction known_function = to_self_function #Do nothing if we've already computed the inverse @@ -2264,7 +2264,7 @@ def _invert_morphism(self, n, base_ring, self_to_other_cache, other_to_self_cach #should use that. #Zt = ZZ['t'] #t = Zt.gen() - one = base_ring.one() + one = base_ring.one() zero = base_ring.zero() #Get and store the list of partitions we'll need diff --git a/src/sage/combinat/species/empty_species.py b/src/sage/combinat/species/empty_species.py index a6eb69597bc..e66019360ac 100644 --- a/src/sage/combinat/species/empty_species.py +++ b/src/sage/combinat/species/empty_species.py @@ -113,7 +113,7 @@ def _gs(self, series_ring, base_ring): return series_ring.zero() _itgs = _gs - _cis = _gs + _cis = _gs def _structures(self, structure_class, labels): """ diff --git a/src/sage/finance/easter.py b/src/sage/finance/easter.py index 6c69f1d34ec..3e73b60bf09 100644 --- a/src/sage/finance/easter.py +++ b/src/sage/finance/easter.py @@ -11,9 +11,9 @@ __all__ = ["easter", "EASTER_JULIAN", "EASTER_ORTHODOX", "EASTER_WESTERN"] -EASTER_JULIAN = 1 +EASTER_JULIAN = 1 EASTER_ORTHODOX = 2 -EASTER_WESTERN = 3 +EASTER_WESTERN = 3 def easter(year, algorithm=EASTER_WESTERN): diff --git a/src/sage/finance/markov_multifractal.py b/src/sage/finance/markov_multifractal.py index 6206f56b304..36d386b8d86 100644 --- a/src/sage/finance/markov_multifractal.py +++ b/src/sage/finance/markov_multifractal.py @@ -200,15 +200,15 @@ def gamma(self): except AttributeError: pass - b = self.__b + b = self.__b gamma_kbar = self.__gamma_kbar - kbar = self.__kbar + kbar = self.__kbar # We compute gamma1 from gamma_kbar by inverting the relation # that defines the gamma_k given on page 54 of Calvet-Fisher: gamma1 = 1 - math.exp(math.log(1-gamma_kbar)/(b**(kbar-1))) - gamma = tuple([1 - (1 - gamma1)**(b**k) for k in range(kbar)]) + gamma = tuple([1 - (1 - gamma1)**(b**k) for k in range(kbar)]) self.__gamma = gamma return gamma diff --git a/src/sage/functions/transcendental.py b/src/sage/functions/transcendental.py index b76e3a1bbbe..2511d47f13e 100644 --- a/src/sage/functions/transcendental.py +++ b/src/sage/functions/transcendental.py @@ -444,7 +444,7 @@ def zeta_symmetric(s): if s == 1: # deal with poles, hopefully return R(0.5) - return (s/2 + 1).gamma() * (s-1) * (R.pi()**(-s/2)) * s.zeta() + return (s/2 + 1).gamma() * (s-1) * (R.pi()**(-s/2)) * s.zeta() import math from sage.rings.polynomial.polynomial_real_mpfr_dense import PolynomialRealDense diff --git a/src/sage/games/sudoku.py b/src/sage/games/sudoku.py index 4731b9bc517..e732fc66026 100644 --- a/src/sage/games/sudoku.py +++ b/src/sage/games/sudoku.py @@ -829,16 +829,16 @@ def dlx(self, count_only=False): # Boxes of the grid are numbered in row-major order # ``rcbox`` simply maps a row-column index pair to the box number it lives in - rcbox = [ [i//n + n*(j//n) for i in range(nsquare)] for j in range(nsquare)] + rcbox = [ [i//n + n*(j//n) for i in range(nsquare)] for j in range(nsquare)] # Every entry in a Sudoku puzzle satisfies four constraints # Every location has a single entry, and each row, column and box has each symbol once # These arrays can be thought of as assigning ID numbers to these constraints, # and correspond to column numbers of the `0-1` matrix describing the exact cover - rows = [[i+j for i in range(nsquare)] for j in range(0, nfour, nsquare)] - cols = [[i+j for i in range(nsquare)] for j in range(nfour, 2*nfour, nsquare)] - boxes = [[i+j for i in range(nsquare)] for j in range(2*nfour, 3*nfour, nsquare)] - rowcol = [[i+j for i in range(nsquare)] for j in range(3*nfour, 4*nfour, nsquare)] + rows = [[i+j for i in range(nsquare)] for j in range(0, nfour, nsquare)] + cols = [[i+j for i in range(nsquare)] for j in range(nfour, 2*nfour, nsquare)] + boxes = [[i+j for i in range(nsquare)] for j in range(2*nfour, 3*nfour, nsquare)] + rowcol = [[i+j for i in range(nsquare)] for j in range(3*nfour, 4*nfour, nsquare)] def make_row(row, col, entry): r""" diff --git a/src/sage/geometry/cone.py b/src/sage/geometry/cone.py index 1b0a74d9111..7e1e2355f22 100644 --- a/src/sage/geometry/cone.py +++ b/src/sage/geometry/cone.py @@ -6566,19 +6566,19 @@ def random_cone(lattice=None, min_ambient_dim=0, max_ambient_dim=None, # The next three checks prevent an infinite loop (a futile # search for more rays) in zero, one, or two dimensions. if min_rays > 4 and max_ambient_dim < 3: - msg = 'all cones in zero/one/two dimensions have four or fewer ' + msg = 'all cones in zero/one/two dimensions have four or fewer ' msg += 'generators. Please increase max_ambient_dim to at least ' msg += '3, or decrease min_rays.' raise ValueError(msg) if min_rays > 2 and max_ambient_dim < 2: - msg = 'all cones in zero/one dimensions have two or fewer ' + msg = 'all cones in zero/one dimensions have two or fewer ' msg += 'generators. Please increase max_ambient_dim to at least ' msg += '2, or decrease min_rays.' raise ValueError(msg) if min_rays > 0 and max_ambient_dim == 0: - msg = 'all cones in zero dimensions have no generators. ' + msg = 'all cones in zero dimensions have no generators. ' msg += 'Please increase max_ambient_dim to at least 1, or ' msg += 'decrease min_rays.' raise ValueError(msg) @@ -6593,17 +6593,17 @@ def random_cone(lattice=None, min_ambient_dim=0, max_ambient_dim=None, # using its dimension rather than max_ambient_dim as the indicator. if lattice is not None: if min_rays > 4 and lattice.dimension() < 3: - msg = 'all cones in the given lattice have four or fewer ' + msg = 'all cones in the given lattice have four or fewer ' msg += 'generators. Please decrease min_rays.' raise ValueError(msg) if min_rays > 2 and lattice.dimension() < 2: - msg = 'all cones in the given lattice have two or fewer ' + msg = 'all cones in the given lattice have two or fewer ' msg += 'generators. Please decrease min_rays.' raise ValueError(msg) if min_rays > 0 and lattice.dimension() == 0: - msg = 'all cones in the given lattice have no generators. ' + msg = 'all cones in the given lattice have no generators. ' msg += 'Please decrease min_rays.' raise ValueError(msg) @@ -6613,7 +6613,7 @@ def random_cone(lattice=None, min_ambient_dim=0, max_ambient_dim=None, msg = 'all cones in this lattice are strictly convex (trivial).' raise ValueError(msg) if max_rays is not None and max_rays < 2: - msg = 'all cones are strictly convex when ``max_rays`` is ' + msg = 'all cones are strictly convex when ``max_rays`` is ' msg += 'less than two.' raise ValueError(msg) diff --git a/src/sage/geometry/hyperplane_arrangement/arrangement.py b/src/sage/geometry/hyperplane_arrangement/arrangement.py index 2874eb57409..bed0fa2a7c4 100644 --- a/src/sage/geometry/hyperplane_arrangement/arrangement.py +++ b/src/sage/geometry/hyperplane_arrangement/arrangement.py @@ -1934,7 +1934,7 @@ def regions(self): # In this case, at least one of the vertices is not on the hyperplane. # So we check if any ray or line pokes the hyperplane. if ( any(ieq[1:]*r[:]*direction < 0 for r in region.rays()) or - any(ieq[1:]*l[:] != 0 for l in region_lines)): + any(ieq[1:]*l[:] != 0 for l in region_lines)): splits = True if splits: diff --git a/src/sage/geometry/polyhedron/backend_cdd_rdf.py b/src/sage/geometry/polyhedron/backend_cdd_rdf.py index 2f3795a4b0f..2d9e5359425 100644 --- a/src/sage/geometry/polyhedron/backend_cdd_rdf.py +++ b/src/sage/geometry/polyhedron/backend_cdd_rdf.py @@ -204,7 +204,7 @@ def try_init(rep): from warnings import catch_warnings, simplefilter vertices, rays, lines = (tuple(x) for x in Vrep) - ieqs, eqns = (tuple(x) for x in Hrep) + ieqs, eqns = (tuple(x) for x in Hrep) if not (vertices or rays or lines): # cdd refuses to handle empty polyhedra. @@ -214,7 +214,7 @@ def try_init(rep): # We prefer the shorter representation. # Note that for the empty polyhedron we prefer Hrepresentation. prim = "Hrep" if len(ieqs) <= len(vertices) + len(rays) else "Vrep" - sec = "Vrep" if len(ieqs) <= len(vertices) + len(rays) else "Hrep" + sec = "Vrep" if len(ieqs) <= len(vertices) + len(rays) else "Hrep" with catch_warnings(): # Raise an error and try the other representation in case of diff --git a/src/sage/geometry/polyhedron/cdd_file_format.py b/src/sage/geometry/polyhedron/cdd_file_format.py index 78fd01787b7..4388f2ecb0b 100644 --- a/src/sage/geometry/polyhedron/cdd_file_format.py +++ b/src/sage/geometry/polyhedron/cdd_file_format.py @@ -50,8 +50,8 @@ def cdd_Vrepresentation(cdd_type, vertices, rays, lines, file_output=None): sage: cdd_Vrepresentation('rational', [[0,0]], [[1,0]], [[0,1]], file_output=filename) """ vertices = _set_to_None_if_empty(vertices) - rays = _set_to_None_if_empty(rays) - lines = _set_to_None_if_empty(lines) + rays = _set_to_None_if_empty(rays) + lines = _set_to_None_if_empty(lines) num, ambient_dim = _common_length_of(vertices, rays, lines) @@ -115,7 +115,7 @@ def cdd_Hrepresentation(cdd_type, ieqs, eqns, file_output=None): sage: cdd_Hrepresentation('rational', None, [[0,1]], file_output=filename) """ ieqs = _set_to_None_if_empty(ieqs) - eqns = _set_to_None_if_empty(eqns) + eqns = _set_to_None_if_empty(eqns) num, ambient_dim = _common_length_of(ieqs, eqns) ambient_dim -= 1 diff --git a/src/sage/geometry/polyhedron/double_description.py b/src/sage/geometry/polyhedron/double_description.py index c1c94a9b8f9..e8aad9bcd29 100644 --- a/src/sage/geometry/polyhedron/double_description.py +++ b/src/sage/geometry/polyhedron/double_description.py @@ -147,7 +147,7 @@ def __init__(self, problem, A_rows, R_cols): self.problem = problem self.A = list(A_rows) self.R = list(R_cols) - self.one = problem._field.one() + self.one = problem._field.one() self.zero = problem._field.zero() # a cache for scalar products (see the method zero_set) diff --git a/src/sage/geometry/toric_lattice.py b/src/sage/geometry/toric_lattice.py index 7f1665ee79a..ce5817c991a 100644 --- a/src/sage/geometry/toric_lattice.py +++ b/src/sage/geometry/toric_lattice.py @@ -1169,7 +1169,7 @@ def _latex_(self): '\\left\\langle\\left(1,\\,2,\\,3\\right)_{L}, \\left(0,\\,4,\\,8\\right)_{L}\\right\\rangle' """ - s = '\\left\\langle' + s = '\\left\\langle' s += ', '.join([ b._latex_() for b in self.basis() ]) s += '\\right\\rangle' return s diff --git a/src/sage/geometry/toric_plotter.py b/src/sage/geometry/toric_plotter.py index 988c180431a..07aed17663a 100644 --- a/src/sage/geometry/toric_plotter.py +++ b/src/sage/geometry/toric_plotter.py @@ -731,7 +731,7 @@ def set_rays(self, generators): rays = generators elif self.mode == "round": r = self.radius - rays = [r * gen / gen.norm() for gen in generators] + rays = [r * gen / gen.norm() for gen in generators] self.rays = rays diff --git a/src/sage/geometry/triangulation/point_configuration.py b/src/sage/geometry/triangulation/point_configuration.py index 3ad39184f37..a4cea3829cd 100644 --- a/src/sage/geometry/triangulation/point_configuration.py +++ b/src/sage/geometry/triangulation/point_configuration.py @@ -1493,9 +1493,9 @@ def circuits(self): m = matrix([ U[i] for i in support ]).transpose() ker = m.right_kernel().basis()[0] assert len(ker)==len(support) - Cplus = [ support[i] for i in range(len(support)) if ker[i]>0 ] + Cplus = [ support[i] for i in range(len(support)) if ker[i]>0 ] Cminus = [ support[i] for i in range(len(support)) if ker[i]<0 ] - Czero = set( range(n) ).difference(support) + Czero = set( range(n) ).difference(support) Circuits += ( (tuple(Cplus), tuple(Czero), tuple(Cminus)), ) self._circuits = Circuits return Circuits diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 8a95e53d8f8..ce0283aa4b1 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -18762,8 +18762,8 @@ def union(self, other, immutable=None): raise TypeError('both arguments must be of the same class') multiedges = self.allows_multiple_edges() or other.allows_multiple_edges() - loops = self.allows_loops() or other.allows_loops() - weighted = self.weighted() and other.weighted() + loops = self.allows_loops() or other.allows_loops() + weighted = self.weighted() and other.weighted() if self._directed: from sage.graphs.digraph import DiGraph @@ -21015,7 +21015,7 @@ def plot3d(self, bgcolor=(1, 1, 1), """ from . import graph_plot layout_options = {key: kwds[key] for key in kwds.keys() if key in graph_plot.layout_options} - kwds = {key: kwds[key] for key in kwds.keys() if key not in graph_plot.layout_options} + kwds = {key: kwds[key] for key in kwds.keys() if key not in graph_plot.layout_options} if pos3d is None: pos3d = self.layout(dim=3, **layout_options) diff --git a/src/sage/modular/abvar/cuspidal_subgroup.py b/src/sage/modular/abvar/cuspidal_subgroup.py index 2113272d2c4..fe174e6631a 100644 --- a/src/sage/modular/abvar/cuspidal_subgroup.py +++ b/src/sage/modular/abvar/cuspidal_subgroup.py @@ -158,8 +158,8 @@ def _compute_lattice(self, rational_only=False, rational_subgroup=False): """ A = self.abelian_variety() Cusp = A.modular_symbols() - Amb = Cusp.ambient_module() - Eis = Amb.eisenstein_submodule() + Amb = Cusp.ambient_module() + Eis = Amb.eisenstein_submodule() C = Amb.cusps() N = Amb.level() diff --git a/src/sage/modular/arithgroup/arithgroup_generic.py b/src/sage/modular/arithgroup/arithgroup_generic.py index cbad28e64c6..892c8de62d2 100644 --- a/src/sage/modular/arithgroup/arithgroup_generic.py +++ b/src/sage/modular/arithgroup/arithgroup_generic.py @@ -971,7 +971,7 @@ def genus(self): sage: [n for n in [1..200] if Gamma0(n).genus() == 1] [11, 14, 15, 17, 19, 20, 21, 24, 27, 32, 36, 49] """ - return ZZ(1 + (self.projective_index()) / ZZ(12) - (self.nu2())/ZZ(4) - (self.nu3())/ZZ(3) - self.ncusps()/ZZ(2)) + return ZZ(1 + (self.projective_index()) / ZZ(12) - (self.nu2())/ZZ(4) - (self.nu3())/ZZ(3) - self.ncusps()/ZZ(2)) def farey_symbol(self): r""" diff --git a/src/sage/modular/modform/half_integral.py b/src/sage/modular/modform/half_integral.py index 432b4318046..eda22b15916 100644 --- a/src/sage/modular/modform/half_integral.py +++ b/src/sage/modular/modform/half_integral.py @@ -123,18 +123,18 @@ def half_integral_weight_modform_basis(chi, k, prec): psi = chi.parent()(DirichletGroup(4, chi.base_ring()).gen()) eps = chi*psi**((k+1) // 2) eps = eps.minimize_base_ring() - M = constructor.ModularForms(eps, (k+1)//2) - C = M.cuspidal_subspace() - B = C.basis() + M = constructor.ModularForms(eps, (k+1)//2) + C = M.cuspidal_subspace() + B = C.basis() # This computation of S below -- of course --dominates the whole function. S = [f.q_expansion(prec) for f in B] - T2 = theta2_qexp(prec) - T3 = theta_qexp(prec) - n = len(S) - MS = MatrixSpace(M.base_ring(), 2*n, prec) - A = copy(MS.zero_matrix()) + T2 = theta2_qexp(prec) + T3 = theta_qexp(prec) + n = len(S) + MS = MatrixSpace(M.base_ring(), 2*n, prec) + A = copy(MS.zero_matrix()) for i in range(n): T2f = T2*S[i] diff --git a/src/sage/modular/modform/numerical.py b/src/sage/modular/modform/numerical.py index ad52403f471..f096ad53f22 100644 --- a/src/sage/modular/modform/numerical.py +++ b/src/sage/modular/modform/numerical.py @@ -104,7 +104,7 @@ def __init__(self, group, weight=2, eps=1e-20, """ if isinstance(group, (int, Integer)): group = Gamma0(Integer(group)) - self._group = group + self._group = group self._weight = Integer(weight) self._tp = tp if self._weight < 2: diff --git a/src/sage/modular/modform_hecketriangle/abstract_ring.py b/src/sage/modular/modform_hecketriangle/abstract_ring.py index 0ff086c0a60..aa70599f0cc 100644 --- a/src/sage/modular/modform_hecketriangle/abstract_ring.py +++ b/src/sage/modular/modform_hecketriangle/abstract_ring.py @@ -89,17 +89,17 @@ def __init__(self, group, base_ring, red_hom, n): if (base_ring.characteristic() > 0): raise NotImplementedError("only characteristic 0 is supported") - self._group = group - self._red_hom = red_hom - self._base_ring = base_ring - self._coeff_ring = FractionField(PolynomialRing(base_ring,'d')) - self._pol_ring = PolynomialRing(base_ring,'x,y,z,d') - self._rat_field = FractionField(self._pol_ring) + self._group = group + self._red_hom = red_hom + self._base_ring = base_ring + self._coeff_ring = FractionField(PolynomialRing(base_ring,'d')) + self._pol_ring = PolynomialRing(base_ring,'x,y,z,d') + self._rat_field = FractionField(self._pol_ring) # default values - self._weight = None - self._ep = None - self._analytic_type = self.AT(["quasi", "mero"]) + self._weight = None + self._ep = None + self._analytic_type = self.AT(["quasi", "mero"]) self.default_prec(10) self.disp_prec(5) @@ -1947,12 +1947,12 @@ def EisensteinSeries(self, k=None): reduced_self = extended_self.reduce_type(["holo"], degree = (QQ(k), ep)) if (n == infinity): - l2 = ZZ(0) - l1 = ZZ((k-(1-ep)) / ZZ(4)) + l2 = ZZ(0) + l1 = ZZ((k-(1-ep)) / ZZ(4)) else: num = ZZ((k-(1-ep)*n/(n-2)) * (n-2) / ZZ(4)) - l2 = num % n - l1 = ((num-l2)/n).numerator() + l2 = num % n + l1 = ((num-l2)/n).numerator() # If the space is one dimensional we return the normalized generator if l1 == 0: diff --git a/src/sage/modular/modform_hecketriangle/abstract_space.py b/src/sage/modular/modform_hecketriangle/abstract_space.py index 3d30e8495b2..a6141f4067a 100644 --- a/src/sage/modular/modform_hecketriangle/abstract_space.py +++ b/src/sage/modular/modform_hecketriangle/abstract_space.py @@ -959,22 +959,22 @@ def Faber_pol(self, m, order_1=ZZ(0), fix_d = False, d_num_prec = None): if (m > order_inf): raise ValueError("Invalid basis index: m = {} > {} = order_inf!".format(m, order_inf)) - prec = 2*order_inf - m + 1 - d = self.get_d(fix_d=fix_d, d_num_prec=d_num_prec) - q = self.get_q(prec=prec, fix_d=fix_d, d_num_prec=d_num_prec) + prec = 2*order_inf - m + 1 + d = self.get_d(fix_d=fix_d, d_num_prec=d_num_prec) + q = self.get_q(prec=prec, fix_d=fix_d, d_num_prec=d_num_prec) - simple_qexp = self.F_simple(order_1=order_1).q_expansion(prec=prec, fix_d=fix_d, d_num_prec=d_num_prec) - J_qexp = self.J_inv().q_expansion(prec=order_inf - m, fix_d=fix_d, d_num_prec=d_num_prec) + simple_qexp = self.F_simple(order_1=order_1).q_expansion(prec=prec, fix_d=fix_d, d_num_prec=d_num_prec) + J_qexp = self.J_inv().q_expansion(prec=order_inf - m, fix_d=fix_d, d_num_prec=d_num_prec) # The precision could be infinity, otherwise we could do this: #assert(temp_reminder.prec() == 1) temp_reminder = (1 / simple_qexp / q**(-m)).add_bigoh(1) - fab_pol = q.parent()([]) + fab_pol = q.parent()([]) while (len(temp_reminder.coefficients()) > 0): - temp_coeff = temp_reminder.coefficients()[0] - temp_exp = -temp_reminder.exponents()[0] - fab_pol += temp_coeff * (q/d)**temp_exp + temp_coeff = temp_reminder.coefficients()[0] + temp_exp = -temp_reminder.exponents()[0] + fab_pol += temp_coeff * (q/d)**temp_exp temp_reminder -= temp_coeff * (J_qexp/d)**temp_exp # The first term is zero only up to numerical errors, @@ -1101,22 +1101,22 @@ def faber_pol(self, m, order_1=ZZ(0), fix_d = False, d_num_prec = None): if (m > order_inf): raise ValueError("Invalid basis index: m = {} > {} = order_inf!".format(m, order_inf)) - prec = 2*order_inf - m + 1 - d = self.get_d(fix_d=fix_d, d_num_prec=d_num_prec) - q = self.get_q(prec=prec, fix_d=fix_d, d_num_prec=d_num_prec) + prec = 2*order_inf - m + 1 + d = self.get_d(fix_d=fix_d, d_num_prec=d_num_prec) + q = self.get_q(prec=prec, fix_d=fix_d, d_num_prec=d_num_prec) - simple_qexp = self.F_simple(order_1=order_1).q_expansion(prec=prec, fix_d=fix_d, d_num_prec=d_num_prec) - j_qexp = self.j_inv().q_expansion(prec=order_inf - m, fix_d=fix_d, d_num_prec=d_num_prec) + simple_qexp = self.F_simple(order_1=order_1).q_expansion(prec=prec, fix_d=fix_d, d_num_prec=d_num_prec) + j_qexp = self.j_inv().q_expansion(prec=order_inf - m, fix_d=fix_d, d_num_prec=d_num_prec) # The precision could be infinity, otherwise we could do this: #assert(temp_reminder.prec() == 1) temp_reminder = (1 / simple_qexp / q**(-m)).add_bigoh(1) - fab_pol = q.parent()([]) + fab_pol = q.parent()([]) while (len(temp_reminder.coefficients()) > 0): - temp_coeff = temp_reminder.coefficients()[0] - temp_exp = -temp_reminder.exponents()[0] - fab_pol += temp_coeff*q**temp_exp + temp_coeff = temp_reminder.coefficients()[0] + temp_exp = -temp_reminder.exponents()[0] + fab_pol += temp_coeff*q**temp_exp temp_reminder -= temp_coeff*j_qexp**temp_exp # The first term is zero only up to numerical errors, @@ -1214,17 +1214,17 @@ def F_basis_pol(self, m, order_1=ZZ(0)): n = self._group.n() if (n ==infinity): - order_1 = ZZ(order_1) + order_1 = ZZ(order_1) order_inf = self._l1 - order_1 - finf_pol = d*(x-y**2) - jinv_pol = x/(x-y**2) - rat = finf_pol**order_inf * x**order_1 * y**(ZZ(1-self._ep)/ZZ(2)) * self.Faber_pol(m, order_1)(jinv_pol) + finf_pol = d*(x-y**2) + jinv_pol = x/(x-y**2) + rat = finf_pol**order_inf * x**order_1 * y**(ZZ(1-self._ep)/ZZ(2)) * self.Faber_pol(m, order_1)(jinv_pol) else: order_inf = self._l1 - order_1 = order_inf - finf_pol = d*(x**n-y**2) - jinv_pol = x**n/(x**n-y**2) - rat = finf_pol**order_inf * x**self._l2 * y**(ZZ(1-self._ep)/ZZ(2)) * self.Faber_pol(m)(jinv_pol) + order_1 = order_inf + finf_pol = d*(x**n-y**2) + jinv_pol = x**n/(x**n-y**2) + rat = finf_pol**order_inf * x**self._l2 * y**(ZZ(1-self._ep)/ZZ(2)) * self.Faber_pol(m)(jinv_pol) return rat @@ -1734,9 +1734,9 @@ def construct_form(self, laurent_series, order_1=ZZ(0), check=True, rationalize= if (laurent_series.prec() < order_inf + 1): raise ValueError("Insufficient precision: {} < {} = order_inf!".format(laurent_series.prec(), order_inf + 1)) - new_series = laurent_series.add_bigoh(order_inf + 1) - coefficients = new_series.coefficients() - exponents = new_series.exponents() + new_series = laurent_series.add_bigoh(order_inf + 1) + coefficients = new_series.coefficients() + exponents = new_series.exponents() if (len(coefficients) == 0): return self(0) diff --git a/src/sage/modular/modform_hecketriangle/constructor.py b/src/sage/modular/modform_hecketriangle/constructor.py index 15ddd6e4c9d..c7079c8779b 100644 --- a/src/sage/modular/modform_hecketriangle/constructor.py +++ b/src/sage/modular/modform_hecketriangle/constructor.py @@ -131,26 +131,26 @@ def rational_type(f, n=ZZ(3), base_ring=ZZ): analytic_type = AT(["quasi", "mero"]) - R = PolynomialRing(base_ring,'x,y,z,d') - F = FractionField(R) - (x,y,z,d) = R.gens() - R2 = PolynomialRing(PolynomialRing(base_ring, 'd'), 'x,y,z') - dhom = R.hom( R2.gens() + (R2.base().gen(),), R2) + R = PolynomialRing(base_ring,'x,y,z,d') + F = FractionField(R) + (x,y,z,d) = R.gens() + R2 = PolynomialRing(PolynomialRing(base_ring, 'd'), 'x,y,z') + dhom = R.hom( R2.gens() + (R2.base().gen(),), R2) - f = F(f) + f = F(f) - num = R(f.numerator()) - denom = R(f.denominator()) - ep_num = set([ZZ(1) - 2*(( sum([g.exponents()[0][m] for m in [1,2]]) )%2) for g in dhom(num).monomials()]) - ep_denom = set([ZZ(1) - 2*(( sum([g.exponents()[0][m] for m in [1,2]]) )%2) for g in dhom(denom).monomials()]) + num = R(f.numerator()) + denom = R(f.denominator()) + ep_num = set([ZZ(1) - 2*(( sum([g.exponents()[0][m] for m in [1,2]]) )%2) for g in dhom(num).monomials()]) + ep_denom = set([ZZ(1) - 2*(( sum([g.exponents()[0][m] for m in [1,2]]) )%2) for g in dhom(denom).monomials()]) if (n == infinity): - hom_num = R( num.subs(x=x**4, y=y**2, z=z**2) ) - hom_denom = R( denom.subs(x=x**4, y=y**2, z=z**2) ) + hom_num = R( num.subs(x=x**4, y=y**2, z=z**2) ) + hom_denom = R( denom.subs(x=x**4, y=y**2, z=z**2) ) else: - n = ZZ(n) - hom_num = R( num.subs(x=x**4, y=y**(2*n), z=z**(2*(n-2))) ) - hom_denom = R( denom.subs(x=x**4, y=y**(2*n), z=z**(2*(n-2))) ) + n = ZZ(n) + hom_num = R( num.subs(x=x**4, y=y**(2*n), z=z**(2*(n-2))) ) + hom_denom = R( denom.subs(x=x**4, y=y**(2*n), z=z**(2*(n-2))) ) # Determine whether the denominator of f is homogeneous if (len(ep_denom) == 1 and dhom(hom_denom).is_homogeneous()): @@ -161,17 +161,17 @@ def rational_type(f, n=ZZ(3), base_ring=ZZ): # Determine whether f is homogeneous if (len(ep_num) == 1 and dhom(hom_num).is_homogeneous()): - homo = True + homo = True if (n == infinity): weight = (dhom(hom_num).degree() - dhom(hom_denom).degree()) else: weight = (dhom(hom_num).degree() - dhom(hom_denom).degree()) / (n-2) - ep = ep_num.pop() / ep_denom.pop() + ep = ep_num.pop() / ep_denom.pop() # TODO: decompose f (resp. its degrees) into homogeneous parts else: - homo = False + homo = False weight = None - ep = None + ep = None # Note that we intentionally leave out the d-factor! if (n == infinity): diff --git a/src/sage/modular/modform_hecketriangle/graded_ring_element.py b/src/sage/modular/modform_hecketriangle/graded_ring_element.py index c244bc34f48..837091a6982 100644 --- a/src/sage/modular/modform_hecketriangle/graded_ring_element.py +++ b/src/sage/modular/modform_hecketriangle/graded_ring_element.py @@ -1100,14 +1100,14 @@ def diff_op(self, op, new_parent=None): L = op.monomials() new_rat = 0 for mon in L: - mon_summand = self._rat - mon_summand = mon_summand.derivative(x,mon.degree(dX)) - mon_summand = mon_summand.derivative(y,mon.degree(dY)) - mon_summand = mon_summand.derivative(z,mon.degree(dZ)) + mon_summand = self._rat + mon_summand = mon_summand.derivative(x,mon.degree(dX)) + mon_summand = mon_summand.derivative(y,mon.degree(dY)) + mon_summand = mon_summand.derivative(z,mon.degree(dZ)) mon_summand *= x**(mon.degree(X)) mon_summand *= y**(mon.degree(Y)) mon_summand *= z**(mon.degree(Z)) - new_rat += op.monomial_coefficient(mon)*mon_summand + new_rat += op.monomial_coefficient(mon)*mon_summand res = self.parent().rat_field()(new_rat) if (new_parent is None): new_parent = self.parent().extend_type(["quasi", "mero"], ring=True) @@ -1346,12 +1346,12 @@ def order_at(self, tau=infinity): return infinity if (self.is_homogeneous() and self.is_modular()): - rat = self.parent().rat_field()(self._rat) - R = self.parent().pol_ring() + rat = self.parent().rat_field()(self._rat) + R = self.parent().pol_ring() numerator = R(rat.numerator()) - denom = R(rat.denominator()) + denom = R(rat.denominator()) (x,y,z,d) = R.gens() - n = self.hecke_n() + n = self.hecke_n() if (tau == i): f_pol = y @@ -1378,17 +1378,17 @@ def order_at(self, tau=infinity): # Also numerator /= f_pol doesn't seem to return an element of R for non-exact rings... try: while (f_pol.divides(numerator)): - numerator = numerator.quo_rem(f_pol)[0] + numerator = numerator.quo_rem(f_pol)[0] #numerator /= f_pol - numerator = R(numerator) + numerator = R(numerator) order_f += 1 except TypeError: pass try: while (f_pol.divides(denom)): - denom = denom.quo_rem(f_pol)[0] + denom = denom.quo_rem(f_pol)[0] #denom /= f_pol - denom = R(denom) + denom = R(denom) order_f -= 1 except TypeError: pass @@ -1398,12 +1398,12 @@ def order_at(self, tau=infinity): if (tau != infinity): raise NotImplementedError("Only the order at infinity is supported for non-homogeneous or quasi forms!") - num_val = prec_num_bound = 1 #(self.parent()._prec/ZZ(2)).ceil() + num_val = prec_num_bound = 1 #(self.parent()._prec/ZZ(2)).ceil() denom_val = prec_denom_bound = 1 #(self.parent()._prec/ZZ(2)).ceil() while (num_val >= prec_num_bound): - prec_num_bound *= 2 - num_val = self.numerator().q_expansion(prec=prec_num_bound, fix_prec=True).valuation() + prec_num_bound *= 2 + num_val = self.numerator().q_expansion(prec=prec_num_bound, fix_prec=True).valuation() while (denom_val >= prec_denom_bound): prec_denom_bound *= 2 denom_val = self.denominator().q_expansion(prec=prec_denom_bound, fix_prec=True).valuation() @@ -1563,7 +1563,7 @@ def _q_expansion_cached(self, prec, fix_d, subs_d, d_num_prec, fix_prec = False) X = SC.E4_ZZ().base_extend(formal_d.parent()) else: X = SC.f_rho_ZZ().base_extend(formal_d.parent()) - Y = SC.f_i_ZZ().base_extend(formal_d.parent()) + Y = SC.f_i_ZZ().base_extend(formal_d.parent()) if (self.parent().is_modular()): # z does not appear in self._rat but we need to specialize it for @@ -2193,9 +2193,9 @@ def evaluate(self, tau, prec = None, num_prec = None, check=False): E2_cor_term = 4 * self.group().lam() / (2*pi*i).n(num_prec) * self.hecke_n() / (self.hecke_n()-2) * A.c() * (A.c()*w + A.d()) return E2_wvalue*aut_factor + E2_cor_term else: - f_i = self.parent().graded_ring().f_i() - E2 = self.parent().graded_ring().E2() - dval = self.parent().group().dvalue().n(num_prec) + f_i = self.parent().graded_ring().f_i() + E2 = self.parent().graded_ring().E2() + dval = self.parent().group().dvalue().n(num_prec) if (self.hecke_n() == infinity): E4 = self.parent().graded_ring().E4() return self._rat.subs(x=E4(tau), y=f_i(tau), z=E2(tau), d=dval) diff --git a/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py b/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py index 090d1bfaf0f..8f4d3a25d47 100644 --- a/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py +++ b/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py @@ -202,10 +202,10 @@ def _word_S_T_data(self): (((1, 1), (0, 1)), 1) """ res = [] - ID = self.parent().I()._matrix - T = self.parent().T()._matrix - S = self.parent().S()._matrix - M = self._matrix + ID = self.parent().I()._matrix + T = self.parent().T()._matrix + S = self.parent().S()._matrix + M = self._matrix lam = self.parent().lam() zero = ZZ.zero() one = ZZ.one() @@ -602,18 +602,18 @@ def continued_fraction(self): # emb = self.root_extension_embedding(QQbar) raise NotImplementedError - emb = self.root_extension_embedding(AA) - G = self.parent() - S = G.S() - TI = G.T().inverse() - lam = G.lam() + emb = self.root_extension_embedding(AA) + G = self.parent() + S = G.S() + TI = G.T().inverse() + lam = G.lam() - p = self.fixed_points()[0] + p = self.fixed_points()[0] - cf_dict = {} - L = [] + cf_dict = {} + L = [] cf_index = ZZ.zero() - one = ZZ.one() + one = ZZ.one() while(p not in cf_dict): cf_dict[p] = cf_index @@ -765,22 +765,22 @@ def _primitive_block_decomposition_data(self): G = self.parent() zero = ZZ.zero() - one = ZZ.one() + one = ZZ.one() # The elliptic case (for this case we use a special notation): if self.is_elliptic(): if self.parent().n() == infinity: raise NotImplementedError - emb = self.root_extension_embedding(QQbar) - p = self.fixed_points()[0] - embp = emb(p) + emb = self.root_extension_embedding(QQbar) + p = self.fixed_points()[0] + embp = emb(p) embp.simplify() embp.exactify() (R, embw) = G.get_FD(embp) - w = R.inverse().acton(p) + w = R.inverse().acton(p) # we should have: embw == emb(w) - embw = emb(w) + embw = emb(w) embw.simplify() embw.exactify() @@ -807,7 +807,7 @@ def _primitive_block_decomposition_data(self): (preperiod, period) = self.continued_fraction() number_of_ones = [] - list_larger = [] + list_larger = [] ones = 0 for l in period: if l > 1: @@ -820,11 +820,11 @@ def _primitive_block_decomposition_data(self): initial_ones = number_of_ones.pop(0) if len(list_larger) == 0: - list_v1 = [-ZZ(1)] - list_vlarger = [ initial_ones + 2 ] + list_v1 = [-ZZ(1)] + list_vlarger = [ initial_ones + 2 ] else: - list_v1 = [ v-2 for v in list_larger ] - list_vlarger = [ v+2 for v in number_of_ones ] + list_v1 = [ v-2 for v in list_larger ] + list_vlarger = [ v+2 for v in number_of_ones ] list_vlarger[-1] += initial_ones L = [] @@ -1331,8 +1331,8 @@ def primitive_power(self, method="cf"): warn("The case n=infinity here is not verified at all and probably wrong!") zero = ZZ.zero() - one = ZZ.one() - two = ZZ(2) + one = ZZ.one() + two = ZZ(2) if self.is_identity(): return zero @@ -1352,7 +1352,7 @@ def primitive_power(self, method="cf"): Uj = G.I() for j in range(1, G.n()): Uj *= U - if U_power == Uj: + if U_power == Uj: #L = [one, ZZ(j)] break elif U_power == -Uj: diff --git a/src/sage/modular/modform_hecketriangle/hecke_triangle_groups.py b/src/sage/modular/modform_hecketriangle/hecke_triangle_groups.py index fdd7e38b552..d84bb365745 100644 --- a/src/sage/modular/modform_hecketriangle/hecke_triangle_groups.py +++ b/src/sage/modular/modform_hecketriangle/hecke_triangle_groups.py @@ -619,8 +619,8 @@ def get_FD(self, z): 134.1200000... + 0.2200000000...*I """ ID = self.I() - T = self.T() - S = self.S() + T = self.T() + S = self.S() TI = self.T(-1) A = ID @@ -960,9 +960,9 @@ def _conjugacy_representatives(self, max_block_length=ZZ(0), D=None): if not hasattr(self, "_max_block_length"): self._max_block_length = ZZ(0) - self._conj_block = {} - self._conj_nonprim = {} - self._conj_prim = {} + self._conj_block = {} + self._conj_nonprim = {} + self._conj_prim = {} # It is not clear how to define the class number for D=0: # Conjugacy classes are V(n-1)^(+-k) for arbitrary k diff --git a/src/sage/modular/modform_hecketriangle/series_constructor.py b/src/sage/modular/modform_hecketriangle/series_constructor.py index 881270c5bfa..7bd6e256c31 100644 --- a/src/sage/modular/modform_hecketriangle/series_constructor.py +++ b/src/sage/modular/modform_hecketriangle/series_constructor.py @@ -115,9 +115,9 @@ def __init__(self, group, prec): Power series constructor for Hecke modular forms for n=+Infinity with (basic series) precision 10 """ - self._group = group - self._prec = prec - self._series_ring = PowerSeriesRing(QQ,'q',default_prec=self._prec) + self._group = group + self._prec = prec + self._series_ring = PowerSeriesRing(QQ,'q',default_prec=self._prec) def _repr_(self): r""" @@ -210,7 +210,7 @@ def J_inv_ZZ(self): q^-1 + 3/8 + 69/1024*q + O(q^2) """ - F1 = lambda a,b: self._series_ring( + F1 = lambda a,b: self._series_ring( [ ZZ(0) ] + [ rising_factorial(a,k) * rising_factorial(b,k) / (ZZ(k).factorial())**2 @@ -222,23 +222,23 @@ def J_inv_ZZ(self): ZZ(self._prec+1) ) - F = lambda a,b,c: self._series_ring( + F = lambda a,b,c: self._series_ring( [ rising_factorial(a,k) * rising_factorial(b,k) / rising_factorial(c,k) / ZZ(k).factorial() for k in range(ZZ(0), ZZ(self._prec+1)) ], ZZ(self._prec+1) ) - a = self._group.alpha() - b = self._group.beta() - Phi = F1(a,b) / F(a,b,ZZ(1)) - q = self._series_ring.gen() + a = self._group.alpha() + b = self._group.beta() + Phi = F1(a,b) / F(a,b,ZZ(1)) + q = self._series_ring.gen() # the current implementation of power series reversion is slow # J_inv_ZZ = ZZ(1) / ((q*Phi.exp()).reverse()) - temp_f = (q*Phi.exp()).polynomial() - new_f = temp_f.revert_series(temp_f.degree()+1) + temp_f = (q*Phi.exp()).polynomial() + new_f = temp_f.revert_series(temp_f.degree()+1) J_inv_ZZ = ZZ(1) / (new_f + O(q**(temp_f.degree()+1))) return J_inv_ZZ @@ -341,7 +341,7 @@ def f_inf_ZZ(self): if (n == infinity): f_inf_ZZ = ((-q*self.J_inv_ZZ().derivative())**2/(self.J_inv_ZZ()**2*(self.J_inv_ZZ()-1))).power_series() else: - temp_expr = ((-q*self.J_inv_ZZ().derivative())**(2*n)/(self.J_inv_ZZ()**(2*n-2)*(self.J_inv_ZZ()-1)**n)/q**(n-2)).power_series() + temp_expr = ((-q*self.J_inv_ZZ().derivative())**(2*n)/(self.J_inv_ZZ()**(2*n-2)*(self.J_inv_ZZ()-1)**n)/q**(n-2)).power_series() f_inf_ZZ = (temp_expr.log()/(n-2)).exp()*q return f_inf_ZZ @@ -563,7 +563,7 @@ def EisensteinSeries_ZZ(self, k): if k == 0: return self._series_ring(1) - M = ZZ(self.group().lam()**2) + M = ZZ(self.group().lam()**2) lamk = M**(ZZ(k/2)) dval = self.group().dvalue() @@ -575,7 +575,7 @@ def coeff(m): return ZZ(1) factor = -2*k / QQ(bernoulli(k)) / lamk - sum1 = sigma(m, k-1) + sum1 = sigma(m, k-1) if M.divides(m): sum2 = (lamk-1) * sigma(ZZ(m/M), k-1) else: diff --git a/src/sage/modular/modsym/boundary.py b/src/sage/modular/modsym/boundary.py index ec41f8c36dd..f29c363cf8b 100644 --- a/src/sage/modular/modsym/boundary.py +++ b/src/sage/modular/modsym/boundary.py @@ -896,8 +896,8 @@ def _coerce_cusp(self, c): sage: [ B(Cusp(i,7)) for i in range(7) ] [0, [1/7], [2/7], [3/7], -[3/7], -[2/7], -[1/7]] """ - N = self.level() - k = self.weight() + N = self.level() + k = self.weight() sign = self.sign() i, eps = self._cusp_index(c) if i != -1: @@ -1146,7 +1146,7 @@ def _coerce_cusp(self, c): sage: S.dimension() 8 """ - k = self.weight() + k = self.weight() sign = self.sign() i, eps = self._cusp_index(c) if i != -1: diff --git a/src/sage/schemes/elliptic_curves/constructor.py b/src/sage/schemes/elliptic_curves/constructor.py index 8d1a7ddf363..f40b294324a 100644 --- a/src/sage/schemes/elliptic_curves/constructor.py +++ b/src/sage/schemes/elliptic_curves/constructor.py @@ -731,7 +731,7 @@ def coefficients_from_j(j, minimal_twist=True): for p in Set(n.prime_divisors()+m.prime_divisors()): e = min(a4.valuation(p)//2,a6.valuation(p)//3) if e>0: - p = p**e + p = p**e a4 /= p**2 a6 /= p**3 diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index 213ac83d73b..df96fdcd1f4 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -2219,7 +2219,7 @@ def __init_even_kernel_polynomial(self, E, psi_G): (x^7 + 5*x^6 + 2*x^5 + 6*x^4 + 3*x^3 + 5*x^2 + 6*x + 3, x^9*y - 3*x^8*y + 2*x^7*y - 3*x^3*y + 2*x^2*y + x*y - y, 1, 6, 3, 4) """ # check if the polynomial really divides the two_torsion_polynomial - if self.__check and E.division_polynomial(2, x=self.__poly_ring.gen()) % psi_G != 0 : + if self.__check and E.division_polynomial(2, x=self.__poly_ring.gen()) % psi_G != 0 : raise ValueError(f"the polynomial {psi_G} does not define a finite subgroup of {E}") n = psi_G.degree() # 1 or 3 diff --git a/src/sage/schemes/elliptic_curves/ell_modular_symbols.py b/src/sage/schemes/elliptic_curves/ell_modular_symbols.py index b31f7dfe46c..9789701f026 100644 --- a/src/sage/schemes/elliptic_curves/ell_modular_symbols.py +++ b/src/sage/schemes/elliptic_curves/ell_modular_symbols.py @@ -448,7 +448,7 @@ def __init__(self, E, sign, normalize="L_ratio"): if self._failed_to_scale: self._find_scaling_period() # will reset _e and _scaling else: - self._e *= self._scaling + self._e *= self._scaling elif normalize == "period" : self._find_scaling_period() # this will set _e and _scaling elif normalize == "none": diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py index f1b7d937748..ffc35984fff 100644 --- a/src/sage/schemes/elliptic_curves/ell_rational_field.py +++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py @@ -2333,7 +2333,7 @@ def _compute_gens(self, proof, for a in ai: if not a.is_integral(): for p, _ in a.denom().factor(): - e = min((ai[i].valuation(p)/[1,2,3,4,6][i]) + e = min((ai[i].valuation(p)/[1,2,3,4,6][i]) for i in range(5)).floor() ai = [ai[i]/p**(e*[1,2,3,4,6][i]) for i in range(5)] xterm *= p**(2*e) @@ -2747,9 +2747,9 @@ def silverman_height_bound(self, algorithm='default'): 0.16397076103046915 """ if algorithm == 'default': - Delta = self.discriminant() - j = self.j_invariant() - b2 = self.b2() + Delta = self.discriminant() + j = self.j_invariant() + b2 = self.b2() twostar = 2 if b2 else 1 from math import log @@ -2758,7 +2758,7 @@ def h(x): def h_oo(x): return log(max(abs(x), 1)) - mu = h(Delta)/12 + h_oo(j)/12 + h_oo(b2/12)/2 + log(twostar)/2 + mu = h(Delta)/12 + h_oo(j)/12 + h_oo(b2/12)/2 + log(twostar)/2 lower = 2*(-h(j)/24 - mu - 0.961) upper = 2*(mu + 1.07) return max(abs(lower), abs(upper)) @@ -3489,7 +3489,7 @@ def local_integral_model(self, p): """ assert p.is_prime(), "p must be prime in local_integral_model()" ai = self.a_invariants() - e = min([(ai[i].valuation(p)/[1,2,3,4,6][i]) for i in range(5)]).floor() + e = min([(ai[i].valuation(p)/[1,2,3,4,6][i]) for i in range(5)]).floor() return constructor.EllipticCurve([ai[i]/p**(e*[1,2,3,4,6][i]) for i in range(5)]) def is_global_integral_model(self): @@ -3523,7 +3523,7 @@ def global_integral_model(self): for a in ai: if not a.is_integral(): for p, _ in a.denom().factor(): - e = min((ai[i].valuation(p)/[1,2,3,4,6][i]) + e = min((ai[i].valuation(p)/[1,2,3,4,6][i]) for i in range(5)).floor() ai = [ai[i]/p**(e*[1,2,3,4,6][i]) for i in range(5)] for z in ai: @@ -3620,7 +3620,7 @@ def _generalized_congmod_numbers(self, M, invariant="both"): if invariant in ["moddeg", "both"]: V = A.integral_structure() W = B.integral_structure() - moddeg = (V + W).index_in(S.integral_structure()) + moddeg = (V + W).index_in(S.integral_structure()) L["moddeg"] = moddeg self.__generalized_modular_degree[M] = moddeg diff --git a/src/sage/schemes/elliptic_curves/gal_reps.py b/src/sage/schemes/elliptic_curves/gal_reps.py index 056268eb230..140e1560f66 100644 --- a/src/sage/schemes/elliptic_curves/gal_reps.py +++ b/src/sage/schemes/elliptic_curves/gal_reps.py @@ -989,7 +989,7 @@ def image_type(self, p): could_be_split = 1 could_be_non_split = 1 # loops over primes as long as we still have two options left - while ell < 10000 and (could_be_exc + could_be_split + could_be_non_split > 1): + while ell < 10000 and (could_be_exc + could_be_split + could_be_non_split > 1): ell = arith.next_prime(ell) if Np % ell != 0: a_ell = self._E.ap(ell) @@ -1007,7 +1007,7 @@ def image_type(self, p): verbose("the image cannot be split, found u=%s"%u, level=2) could_be_split = 0 - assert could_be_exc + could_be_split + could_be_non_split > 0, "bug in image_type." + assert could_be_exc + could_be_split + could_be_non_split > 0, "bug in image_type." if could_be_exc + could_be_split + could_be_non_split == 1: # it is only one of the three cases: @@ -1029,7 +1029,7 @@ def image_type(self, p): f = R([1,-3,1]) #(X**2 - 3*X+1) el5 = f.roots() # loops over primes as long as we still have two options left - while ell < 10000 and (could_be_s4 + could_be_a4 + could_be_a5 > 1): + while ell < 10000 and (could_be_s4 + could_be_a4 + could_be_a5 > 1): ell = arith.next_prime(ell) if Np % ell != 0: a_ell = self._E.ap(ell) @@ -1043,7 +1043,7 @@ def image_type(self, p): could_be_a4 = 0 could_be_s4 = 0 - assert (could_be_s4 + could_be_a4 + could_be_a5 > 0), "bug in image_type." + assert (could_be_s4 + could_be_a4 + could_be_a5 > 0), "bug in image_type." if could_be_s4 + could_be_a4 + could_be_a5 == 1: if could_be_s4 == 1: diff --git a/src/sage/schemes/elliptic_curves/heegner.py b/src/sage/schemes/elliptic_curves/heegner.py index ebbfcb00afa..05c03f3906b 100644 --- a/src/sage/schemes/elliptic_curves/heegner.py +++ b/src/sage/schemes/elliptic_curves/heegner.py @@ -516,7 +516,7 @@ def quadratic_field(self): sage: K.quadratic_field() Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 with sqrt_minus_7 = 2.645751311064591?*I """ - D = self.__D + D = self.__D var = 'sqrt_minus_%s'%(-D) return number_field.QuadraticField(D,var) @@ -2192,7 +2192,7 @@ def quadratic_field(self): sage: K.quadratic_field() Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 with sqrt_minus_7 = 2.645751311064591?*I """ - D = self.__D + D = self.__D var = 'sqrt_minus_%s'%(-D) return number_field.QuadraticField(D,var) @@ -3847,7 +3847,7 @@ def _qf_from_tau(self, tau): sage: P._qf_from_tau(tau) (57, 26, 3) """ - g = tau.minpoly() + g = tau.minpoly() g *= g.denominator() return (ZZ(g[2]), ZZ(g[1]), ZZ(g[0])) @@ -4799,7 +4799,7 @@ def optimal_embeddings(self, D, c, R): Embedding sending 2*sqrt(-7) to -2*i + 2*j + 2*k] """ Q, G = R.ternary_quadratic_form(include_basis=True) - n = -D*c*c + n = -D*c*c reps = Q.representation_vector_list(n+1)[-1] # The representatives give elements in terms of the @@ -6672,7 +6672,7 @@ def heegner_index(self, D, min_p=2, prec=5, descent_second_limit=12, else: F = self # Now rank(F) > 0 - h = ht.upper() + h = ht.upper() verbose("Heegner height bound = %s"%h) B = F.CPS_height_bound() verbose("CPS bound = %s"%B) @@ -6818,7 +6818,7 @@ def heegner_index_bound(self, D=0, prec=5, max_height=None): if 0 in ht: return 0, D, False F = self.quadratic_twist(D) - h = ht.upper() + h = ht.upper() verbose("Heegner height bound = %s"%h) B = F.CPS_height_bound() verbose("CPS bound = %s"%B) @@ -6949,25 +6949,25 @@ def _heegner_index_in_EK(self, D): # so we may assume t is of 2-power order. ##################################################################### - E = self # nice shortcut - F = E.quadratic_twist(D).minimal_model() - K = rings.QuadraticField(D, 'a') + E = self # nice shortcut + F = E.quadratic_twist(D).minimal_model() + K = rings.QuadraticField(D, 'a') # Define a map phi that we'll use to put the points of E^D(QQ) # into E(K): - G = E.change_ring(K) - G2 = F.change_ring(K) - phi = G2.isomorphism_to(G) + G = E.change_ring(K) + G2 = F.change_ring(K) + phi = G2.isomorphism_to(G) # Basis for E(Q)/tor oplus E^D(QQ)/tor in E(K): basis = [G(z) for z in E.gens()] + [G(phi(z)) for z in F.gens()] # Make a list of the 2-power order torsion points in E(K), including 0. - T = [G(z) for z in G.torsion_subgroup().list() if z.order() == 1 or + T = [G(z) for z in G.torsion_subgroup().list() if z.order() == 1 or ((z.order() % 2 == 0 and len(z.order().factor()) == 1))] - r = len(basis) # rank - V = rings.QQ**r - B = [] + r = len(basis) # rank + V = rings.QQ**r + B = [] # Iterate through reps for A/(2*A) creating vectors in (1/2)*ZZ^r for v in rings.GF(2)**r: @@ -6980,7 +6980,7 @@ def _heegner_index_in_EK(self, D): A = rings.ZZ**r # Take span of our vectors in (1/2)*ZZ^r, along with ZZ^r. This is E(K)/tor. - W = V.span(B, rings.ZZ) + A + W = V.span(B, rings.ZZ) + A # Compute the index in E(K)/tor of A = E(Q)/tor + E^D(Q)/tor, cache, and return. index = A.index_in(W) @@ -7077,13 +7077,13 @@ def heegner_sha_an(self, D, prec=53): # Use the BSD conjecture over the quadratic imaginary K -- # see page 311 of [GZ1986]_ for the formula. - E = self # notational convenience - F = E.quadratic_twist(D).minimal_model() - K = rings.QuadraticField(D, 'a') + E = self # notational convenience + F = E.quadratic_twist(D).minimal_model() + K = rings.QuadraticField(D, 'a') # Compute each of the quantities in BSD # - The torsion subgroup over K. - T = E.change_ring(K).torsion_order() + T = E.change_ring(K).torsion_order() # - The product of the Tamagawa numbers, which because D is # coprime to N is just the square of the product of the @@ -7093,7 +7093,7 @@ def heegner_sha_an(self, D, prec=53): # - The leading term of the L-series, as a product of two # other L-series. - rE = E.rank() + rE = E.rank() rF = F.rank() L_E = E.lseries().dokchitser(prec).derivative(1, rE) L_F = F.lseries().dokchitser(prec).derivative(1, rF) diff --git a/src/sage/schemes/elliptic_curves/padic_lseries.py b/src/sage/schemes/elliptic_curves/padic_lseries.py index 875a4113464..7b72c68b232 100644 --- a/src/sage/schemes/elliptic_curves/padic_lseries.py +++ b/src/sage/schemes/elliptic_curves/padic_lseries.py @@ -1450,7 +1450,7 @@ def Dp_valued_series(self, n=3, quadratic_twist=+1, prec=5): # now compute phi phi = matrix.matrix([[0,-1/p],[1,E.ap(p)/p]]) - lpv = vector([G + (E.ap(p))*H , - R(p) * H ]) # this is L_p + lpv = vector([G + (E.ap(p))*H , - R(p) * H ]) # this is L_p eps = (1-phi)**(-2) resu = lpv*eps.transpose() return resu @@ -1506,7 +1506,7 @@ def isom(e1,e2): raise ValueError("Curves must be isomorphic.") usq = (e1.discriminant()/e2.discriminant()).nth_root(6) u = usq.sqrt() - s = (u * e2.a1() - e1.a1() )/ZZ(2) + s = (u * e2.a1() - e1.a1() )/ZZ(2) r = (usq * e2.a2() - e1.a2() + s**2 + e1.a1()*s)/ZZ(3) t = (u**3 * e2.a3() - e1.a3() - e1.a1()*r)/ZZ(2) return [u,r,s,t] diff --git a/src/sage/schemes/elliptic_curves/padics.py b/src/sage/schemes/elliptic_curves/padics.py index e4d88113716..7ee1499c7a2 100644 --- a/src/sage/schemes/elliptic_curves/padics.py +++ b/src/sage/schemes/elliptic_curves/padics.py @@ -1096,7 +1096,7 @@ def padic_sigma(self, p, N=20, E2=None, check=False, check_hypotheses=True): Rt = x.parent() - A = (x + c) * f + A = (x + c) * f # do integral over QQ, to avoid divisions by p A = Rt(QQt(A).integral()) A = (-X.a1()/2 - A) * f @@ -1284,7 +1284,7 @@ def padic_sigma_truncated(self, p, N=20, lamb=0, E2=None, check_hypotheses=True) Rt = x.parent() - A = (x + c) * f + A = (x + c) * f # do integral over QQ, to avoid divisions by p A = Rt(QQt(A).integral()) A = (-X.a1()/2 - A) * f diff --git a/src/sage/schemes/elliptic_curves/saturation.py b/src/sage/schemes/elliptic_curves/saturation.py index 57367c515d4..fcd02287b27 100644 --- a/src/sage/schemes/elliptic_curves/saturation.py +++ b/src/sage/schemes/elliptic_curves/saturation.py @@ -268,7 +268,7 @@ def full_p_saturation(self, Plist, p): verbose = self._verbose if verbose: - print(" --starting full %s-saturation" % p) + print(" --starting full %s-saturation" % p) n = len(Plist) # number of points supplied & to be returned Plist = Plist + [T for T in self._torsion_gens if p.divides(T.order())] @@ -656,7 +656,7 @@ def p_projections(Eq, Plist, p, debug=False): # project onto p-primary part - pts = [m*pt for pt in Plist] + pts = [m*pt for pt in Plist] gens = [m*g.element() for g in G.gens()] gens = [g for g in gens if g] if debug: diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py index ad3b7d59a53..828b6514cb2 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py @@ -507,7 +507,7 @@ def local_coordinates_at_weierstrass(self, P, prec=20, name='t'): pol = self.hyperelliptic_polynomials()[0] pol_prime = pol.derivative() b = P[0] - t2 = t**2 + t2 = t**2 c = b + t2/pol_prime(b) c = c.add_bigoh(prec) for _ in range(int(1 + log(prec, 2))): diff --git a/src/sage/schemes/product_projective/morphism.py b/src/sage/schemes/product_projective/morphism.py index b558d88b304..86fe1bce757 100644 --- a/src/sage/schemes/product_projective/morphism.py +++ b/src/sage/schemes/product_projective/morphism.py @@ -160,7 +160,7 @@ def _repr_defn(self): sage: f._repr_defn() 'Defined by sending (x : y , z : w) to \n(x^2 : y^2 , z : w).' """ - s = 'Defined by sending ' + s = 'Defined by sending ' s += self.domain().ambient_space()._repr_generic_point() s += ' to \n' s += self.codomain().ambient_space()._repr_generic_point(self._polys) diff --git a/src/sage/schemes/projective/projective_rational_point.py b/src/sage/schemes/projective/projective_rational_point.py index 738f28cb993..1b4c7da1543 100644 --- a/src/sage/schemes/projective/projective_rational_point.py +++ b/src/sage/schemes/projective/projective_rational_point.py @@ -445,7 +445,7 @@ def good_primes(B): best_size = 2 best_time = (N**2)*M[2][-1]**(N) + (N**5 * RR(prod(M[2])**dim_scheme / M[2][-1]) ) for i in range(2, max_length + 1): - current_time = (N**2)*M[i][-1]**(N) + (N**5 * RR(prod(M[i])**dim_scheme / M[i][-1]) ) + current_time = (N**2)*M[i][-1]**(N) + (N**5 * RR(prod(M[i])**dim_scheme / M[i][-1]) ) if current_time < best_time: best_size = i best_time = current_time diff --git a/src/sage/schemes/toric/morphism.py b/src/sage/schemes/toric/morphism.py index d41c35c5a7b..82b7c4d46b4 100644 --- a/src/sage/schemes/toric/morphism.py +++ b/src/sage/schemes/toric/morphism.py @@ -678,7 +678,7 @@ def _repr_defn(self): 'Defined by embedding the torus closure associated to the 1-d cone of Rational polyhedral fan in 2-d lattice N.' """ - s = 'Defined by embedding the torus closure associated to the ' + s = 'Defined by embedding the torus closure associated to the ' s += str(self._defining_cone) s += '.' return s @@ -964,7 +964,7 @@ def _repr_defn(self): sage: f._repr_defn() 'Defined by sending Rational polyhedral fan in 2-d lattice N to Rational polyhedral fan in 1-d lattice N.' """ - s = 'Defined by sending ' + s = 'Defined by sending ' s += str(self.domain().fan()) s += ' to ' s += str(self.codomain().fan()) From 897cff7b1e54b272461e61d93c5e330b078b2078 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Mon, 27 Mar 2023 00:36:49 +0800 Subject: [PATCH 051/135] Fix documentation deployment --- .github/workflows/doc-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/doc-publish.yml b/.github/workflows/doc-publish.yml index ec79a52de79..716daa07d81 100644 --- a/.github/workflows/doc-publish.yml +++ b/.github/workflows/doc-publish.yml @@ -31,7 +31,7 @@ jobs: uses: actions/github-script@v6.4.0 with: script: | - var artifacts = await github.actions.listWorkflowRunArtifacts({ + var artifacts = await github.rest.actions.listWorkflowRunArtifacts({ owner: context.repo.owner, repo: context.repo.repo, run_id: ${{github.event.workflow_run.id }}, @@ -39,7 +39,7 @@ jobs: var matchArtifact = artifacts.data.artifacts.filter((artifact) => { return artifact.name == "docs" })[0]; - var download = await github.actions.downloadArtifact({ + var download = await github.rest.actions.downloadArtifact({ owner: context.repo.owner, repo: context.repo.repo, artifact_id: matchArtifact.id, From 63c3ab6b736535cb9b7f633cd6c5a09db52fd9f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Oudompheng?= Date: Sun, 19 Mar 2023 10:09:22 +0100 Subject: [PATCH 052/135] Lighter construction of finite field elements from lists When doing intensive polynomial arithmetic with the NTL implementation the constructor with lists is called a large number of times and may spend a lot of time constructing the vector_space and FreeModuleElement objects. The very common call to vector_space(map=False) is optimized to be as cheap as possible using the already cached object. The common case of lists of length 0 and 1 is replaced by cheaper shortcuts. --- src/sage/rings/finite_rings/element_pari_ffelt.pyx | 14 +++++++++++++- src/sage/rings/finite_rings/finite_field_base.pyx | 9 +++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/sage/rings/finite_rings/element_pari_ffelt.pyx b/src/sage/rings/finite_rings/element_pari_ffelt.pyx index be70aa56d39..4c0b02011a8 100644 --- a/src/sage/rings/finite_rings/element_pari_ffelt.pyx +++ b/src/sage/rings/finite_rings/element_pari_ffelt.pyx @@ -270,13 +270,19 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): sage: k = FiniteField(3^11, 't', impl='pari_ffelt') sage: k([ 0, 1/2 ]) 2*t + sage: k([ 0, 1/2, 0, 0, 0, 0, 0, 0, 0, -1, 0 ]) + 2*t^9 + 2*t sage: k([ k(0), k(1) ]) t sage: k([ GF(3)(2), GF(3^5,'u')(1) ]) t + 2 sage: R. = PolynomialRing(k) + sage: k([ x/x ]) + 1 sage: k([ R(-1), x/x ]) t + 2 + sage: k([ R(-1), R(0), 0 ]) + 2 Check that zeros are created correctly (:trac:`11685`):: @@ -496,7 +502,13 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): self.construct_from(x.constant_coefficient()) elif isinstance(x, list): - if len(x) == self._parent.degree(): + n = len(x) + if n == 0: + self.construct_from(None) + elif n == 1: + Fp = self._parent.base_ring() + self.construct_from(Fp(x[0])) + elif n == self._parent.degree(): self.construct_from(self._parent.vector_space(map=False)(x)) else: Fp = self._parent.base_ring() diff --git a/src/sage/rings/finite_rings/finite_field_base.pyx b/src/sage/rings/finite_rings/finite_field_base.pyx index 06e57a04952..fa9c8862ddb 100644 --- a/src/sage/rings/finite_rings/finite_field_base.pyx +++ b/src/sage/rings/finite_rings/finite_field_base.pyx @@ -1230,8 +1230,6 @@ cdef class FiniteField(Field): sage: all(to_V(h(c) * e) == c * to_V(e) for e in E for c in F) True """ - from sage.modules.all import VectorSpace - from sage.categories.morphism import is_Morphism if subfield is not None: if base is not None: raise ValueError @@ -1241,6 +1239,13 @@ cdef class FiniteField(Field): deprecation(28481, "The default value for map will be changing to True. To keep the current behavior, explicitly pass map=False.") map = False + if base is None and self.__vector_space is not None and not map: + # A very common case: return as early as possible. + return self.__vector_space + + from sage.modules.all import VectorSpace + from sage.categories.morphism import is_Morphism + if base is None: base = self.prime_subfield() s = self.degree() From 884b18f0693b9a50659a80222a76c0be9969aa5e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Mar 2023 11:56:48 -0700 Subject: [PATCH 053/135] src/sage/combinat/words: Move documentation from __init__.py to all.py --- src/sage/combinat/words/__init__.py | 41 -------------------------- src/sage/combinat/words/all.py | 45 +++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 41 deletions(-) delete mode 100644 src/sage/combinat/words/__init__.py diff --git a/src/sage/combinat/words/__init__.py b/src/sage/combinat/words/__init__.py deleted file mode 100644 index 4dc6dd45dba..00000000000 --- a/src/sage/combinat/words/__init__.py +++ /dev/null @@ -1,41 +0,0 @@ -r""" -Combinatorics on words - -**Main modules and their methods:** - -- :ref:`sage.combinat.words.abstract_word` -- :ref:`sage.combinat.words.finite_word` -- :ref:`sage.combinat.words.infinite_word` -- :ref:`sage.combinat.words.alphabet` -- :ref:`sage.combinat.words.words` -- :ref:`sage.combinat.words.paths` -- :ref:`sage.combinat.words.morphism` -- :ref:`sage.combinat.words.shuffle_product` -- :ref:`sage.combinat.words.suffix_trees` - -Main classes and functions meant to be used by the user: - - :func:`~sage.combinat.words.word.Word`, - :class:`~sage.combinat.words.words.FiniteWords`, - :class:`~sage.combinat.words.words.InfiniteWords`, - :func:`~sage.combinat.words.words.Words`, - :func:`~sage.combinat.words.alphabet.Alphabet`, - :class:`~sage.combinat.words.morphism.WordMorphism`, - :class:`~sage.combinat.words.paths.WordPaths`. - -A list of common words can be accessed through ``words.`` and are listed in -the :ref:`words catalog `. - -**Internal representation of words:** - -- :ref:`sage.combinat.words.word` -- :ref:`sage.combinat.words.word_char` -- :ref:`sage.combinat.words.word_datatypes` -- :ref:`sage.combinat.words.word_infinite_datatypes` - -**Options:** - -- :ref:`sage.combinat.words.word_options` - -See :func:`~sage.combinat.words.word_options.WordOptions`. -""" diff --git a/src/sage/combinat/words/all.py b/src/sage/combinat/words/all.py index 078ca4e48ab..687b572c8e5 100644 --- a/src/sage/combinat/words/all.py +++ b/src/sage/combinat/words/all.py @@ -1,3 +1,48 @@ +r""" +Combinatorics on words + +**Main modules and their methods:** + +- :ref:`sage.combinat.words.abstract_word` +- :ref:`sage.combinat.words.finite_word` +- :ref:`sage.combinat.words.infinite_word` +- :ref:`sage.combinat.words.alphabet` +- :ref:`sage.combinat.words.words` +- :ref:`sage.combinat.words.paths` +- :ref:`sage.combinat.words.morphism` +- :ref:`sage.combinat.words.shuffle_product` +- :ref:`sage.combinat.words.suffix_trees` + +Main classes and functions meant to be used by the user: + + :func:`~sage.combinat.words.word.Word`, + :class:`~sage.combinat.words.words.FiniteWords`, + :class:`~sage.combinat.words.words.InfiniteWords`, + :func:`~sage.combinat.words.words.Words`, + :func:`~sage.combinat.words.alphabet.Alphabet`, + :class:`~sage.combinat.words.morphism.WordMorphism`, + :class:`~sage.combinat.words.paths.WordPaths`. + +A list of common words can be accessed through ``words.`` and are listed in +the :ref:`words catalog `. + +**Internal representation of words:** + +- :ref:`sage.combinat.words.word` +- :ref:`sage.combinat.words.word_char` +- :ref:`sage.combinat.words.word_datatypes` +- :ref:`sage.combinat.words.word_infinite_datatypes` + +**Options:** + +- :ref:`sage.combinat.words.word_options` + +See :func:`~sage.combinat.words.word_options.WordOptions`. +""" +# install the docstring of this module to the containing package +from sage.misc.namespace_package import install_doc +install_doc(__package__, __doc__) + from .alphabet import Alphabet, build_alphabet from .morphism import WordMorphism from .paths import WordPaths From 8c4ea799e9567f2f1cfb9e973c318b9907f7af2c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Mar 2023 11:58:35 -0700 Subject: [PATCH 054/135] src/sage/modules/with_basis: Move documentation from __init__.py to all.py --- src/sage/modules/with_basis/{__init__.py => all.py} | 3 +++ 1 file changed, 3 insertions(+) rename src/sage/modules/with_basis/{__init__.py => all.py} (67%) diff --git a/src/sage/modules/with_basis/__init__.py b/src/sage/modules/with_basis/all.py similarity index 67% rename from src/sage/modules/with_basis/__init__.py rename to src/sage/modules/with_basis/all.py index 8cafbaa9b89..1f352bcc768 100644 --- a/src/sage/modules/with_basis/__init__.py +++ b/src/sage/modules/with_basis/all.py @@ -8,3 +8,6 @@ .. SEEALSO:: The category :class:`ModulesWithBasis` """ +# install the docstring of this module to the containing package +from sage.misc.namespace_package import install_doc +install_doc(__package__, __doc__) From 4837e0bd35a39394995c3749ec5a037af4b6287a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Mar 2023 12:00:11 -0700 Subject: [PATCH 055/135] src/sage/groups/perm_gps/partn_ref*: Change to namespace packages --- src/sage/groups/perm_gps/partn_ref/{__init__.py => all.py} | 0 src/sage/groups/perm_gps/partn_ref2/{__init__.py => all.py} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src/sage/groups/perm_gps/partn_ref/{__init__.py => all.py} (100%) rename src/sage/groups/perm_gps/partn_ref2/{__init__.py => all.py} (100%) diff --git a/src/sage/groups/perm_gps/partn_ref/__init__.py b/src/sage/groups/perm_gps/partn_ref/all.py similarity index 100% rename from src/sage/groups/perm_gps/partn_ref/__init__.py rename to src/sage/groups/perm_gps/partn_ref/all.py diff --git a/src/sage/groups/perm_gps/partn_ref2/__init__.py b/src/sage/groups/perm_gps/partn_ref2/all.py similarity index 100% rename from src/sage/groups/perm_gps/partn_ref2/__init__.py rename to src/sage/groups/perm_gps/partn_ref2/all.py From 9e8afdd7544a4656b72067f7586688a10b182cd8 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Mar 2023 12:07:50 -0700 Subject: [PATCH 056/135] src/sage_setup/autogen/interpreters/__init__.py: Generate sage.ext.interpreters as a namespace package --- src/sage_setup/autogen/interpreters/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/sage_setup/autogen/interpreters/__init__.py b/src/sage_setup/autogen/interpreters/__init__.py index 13d3eed1735..c3534aeccf9 100644 --- a/src/sage_setup/autogen/interpreters/__init__.py +++ b/src/sage_setup/autogen/interpreters/__init__.py @@ -199,6 +199,11 @@ def rebuild(dirname, force=False): except OSError: if not os.path.isdir(dirname): raise + # Remove leftover file from before move to namespace packages + try: + os.remove(os.path.join(dirname, '__init__.py')) + except FileNotFoundError: + pass # Although multiple files are generated by this function, since # they are all generated at once it suffices to make sure if just @@ -208,7 +213,7 @@ class NeedToRebuild(Exception): try: if force: raise NeedToRebuild("-> Force rebuilding interpreters") - gen_file = os.path.join(dirname, '__init__.py') + gen_file = os.path.join(dirname, 'all.py') if not os.path.isfile(gen_file): raise NeedToRebuild("-> First build of interpreters") @@ -230,5 +235,5 @@ class NeedToRebuild(Exception): for interp in _INTERPRETERS: build_interp(interp(), dirname) - with open(os.path.join(dirname, '__init__.py'), 'w') as f: + with open(os.path.join(dirname, 'all.py'), 'w') as f: f.write("# " + AUTOGEN_WARN) From 82d39e3635e76c292cbf8d30df83fb12d2c47043 Mon Sep 17 00:00:00 2001 From: David Lowry-Duda Date: Mon, 27 Mar 2023 16:58:51 -0400 Subject: [PATCH 057/135] Add output documentation on monte_carlo_integral This small commit adds an OUTPUT description to the documentation of monte_carlo_integral. The wording of the output is essentially taken from numerical_integral. --- src/sage/calculus/integration.pyx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sage/calculus/integration.pyx b/src/sage/calculus/integration.pyx index f2125bbc2d7..04ef352a906 100644 --- a/src/sage/calculus/integration.pyx +++ b/src/sage/calculus/integration.pyx @@ -457,6 +457,11 @@ def monte_carlo_integral(func, xl, xu, size_t calls, algorithm='plain', * 'vegas' -- The VEGAS algorithm of Lepage is based on importance sampling. + OUTPUT: + + A tuple whose first component is the approximated integral and whose second + component is an error estimate. + EXAMPLES:: sage: x, y = SR.var('x,y') From cb5577a74f4744fd74a0f127d2d7d44fcd2eeedb Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Mar 2023 18:55:15 -0700 Subject: [PATCH 058/135] src/doc/en/reference: Update module lists --- src/doc/en/reference/combinat/module_list.rst | 2 +- src/doc/en/reference/modules/index.rst | 2 +- src/sage/modules/all.py | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/doc/en/reference/combinat/module_list.rst b/src/doc/en/reference/combinat/module_list.rst index fc7ec70194c..6a523f32e43 100644 --- a/src/doc/en/reference/combinat/module_list.rst +++ b/src/doc/en/reference/combinat/module_list.rst @@ -367,7 +367,7 @@ Comprehensive Module List sage/combinat/tutorial sage/combinat/vector_partition sage/combinat/words/abstract_word - sage/combinat/words + sage/combinat/words/all sage/combinat/words/alphabet sage/combinat/words/finite_word sage/combinat/words/infinite_word diff --git a/src/doc/en/reference/modules/index.rst b/src/doc/en/reference/modules/index.rst index c6109643c35..24851df37a7 100644 --- a/src/doc/en/reference/modules/index.rst +++ b/src/doc/en/reference/modules/index.rst @@ -29,7 +29,7 @@ Modules with basis .. toctree:: :maxdepth: 1 - sage/modules/with_basis/__init__ + sage/modules/with_basis/all sage/modules/with_basis/cell_module sage/modules/with_basis/indexed_element sage/modules/with_basis/invariant diff --git a/src/sage/modules/all.py b/src/sage/modules/all.py index a90258d7ec8..87621e61b29 100644 --- a/src/sage/modules/all.py +++ b/src/sage/modules/all.py @@ -23,6 +23,8 @@ from .vector_space_morphism import linear_transformation +from .with_basis.all import * + from sage.misc.lazy_import import lazy_import lazy_import('sage.modules.filtered_vector_space', 'FilteredVectorSpace') From 4b397a7c27c5be5754334f724b45b1fee313e05c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Mar 2023 22:42:13 -0700 Subject: [PATCH 059/135] src/sage/combinat/all.py: Update reference --- src/sage/combinat/all.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/combinat/all.py b/src/sage/combinat/all.py index a378e86b5d3..2206ea2873a 100644 --- a/src/sage/combinat/all.py +++ b/src/sage/combinat/all.py @@ -26,7 +26,7 @@ - :ref:`sage.combinat.species.all` - :ref:`sage.combinat.designs.all` - :ref:`sage.combinat.posets.all` -- :ref:`sage.combinat.words` +- :ref:`sage.combinat.words.all` - :ref:`sage.combinat.bijectionist` Utilities From 83ba577f60985998f2107e63febd81e15d707b85 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Tue, 28 Mar 2023 13:56:22 +0800 Subject: [PATCH 060/135] Explain if condition --- .github/workflows/ci-conda.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-conda.yml b/.github/workflows/ci-conda.yml index 46c88ad1306..9a1b0af811f 100644 --- a/.github/workflows/ci-conda.yml +++ b/.github/workflows/ci-conda.yml @@ -22,6 +22,7 @@ jobs: name: Conda runs-on: ${{ matrix.os }} + # Run on push, workflow dispatch and when certain labels are added if: | github.event.action != 'labeled' || github.event.label.name == 'c: packages: optional' || From 200c62637b309b90fff1e7c913d826e6d1c87488 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 28 Mar 2023 16:16:08 -0700 Subject: [PATCH 061/135] build/pkgs/openblas/spkg-configure.m4: Reject version 0.3.22 --- build/pkgs/openblas/spkg-configure.m4 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/build/pkgs/openblas/spkg-configure.m4 b/build/pkgs/openblas/spkg-configure.m4 index c81533ba71a..3743839a51a 100644 --- a/build/pkgs/openblas/spkg-configure.m4 +++ b/build/pkgs/openblas/spkg-configure.m4 @@ -7,7 +7,12 @@ SAGE_SPKG_CONFIGURE([openblas], [ m4_pushdef([SAGE_OPENBLAS_MIN_VERSION_MINOR], [2]) m4_pushdef([SAGE_OPENBLAS_MIN_VERSION_MICRO], [20]) m4_pushdef([SAGE_OPENBLAS_MIN_VERSION], [SAGE_OPENBLAS_MIN_VERSION_MAJOR.SAGE_OPENBLAS_MIN_VERSION_MINOR.SAGE_OPENBLAS_MIN_VERSION_MICRO]) - PKG_CHECK_MODULES([OPENBLAS], [openblas >= ]SAGE_OPENBLAS_MIN_VERSION, [ + dnl Reject openblas 0.3.22 - /~https://github.com/sagemath/sage/pull/35371 + m4_pushdef([SAGE_OPENBLAS_LT_VERSION_MAJOR], [0]) + m4_pushdef([SAGE_OPENBLAS_LT_VERSION_MINOR], [3]) + m4_pushdef([SAGE_OPENBLAS_LT_VERSION_MICRO], [22]) + m4_pushdef([SAGE_OPENBLAS_LT_VERSION], [SAGE_OPENBLAS_LT_VERSION_MAJOR.SAGE_OPENBLAS_LT_VERSION_MINOR.SAGE_OPENBLAS_LT_VERSION_MICRO]) + PKG_CHECK_MODULES([OPENBLAS], [openblas >= ]SAGE_OPENBLAS_MIN_VERSION [openblas < ]SAGE_OPENBLAS_LT_VERSION, [ LIBS="$OPENBLAS_LIBS $LIBS" CFLAGS="$OPENBLAS_CFLAGS $CFLAGS" PKG_CHECK_VAR([OPENBLASPCDIR], [openblas], [pcfiledir], [ @@ -74,6 +79,13 @@ SAGE_SPKG_CONFIGURE([openblas], [ < 10000 * ]]SAGE_OPENBLAS_MIN_VERSION_MAJOR[[ + 100 * ]]SAGE_OPENBLAS_MIN_VERSION_MINOR[[ + ]]SAGE_OPENBLAS_MIN_VERSION_MICRO[[) + return 1; + if ( 10000 * version[0] + + 100 * version[1] + + version[2] + >=10000 * ]]SAGE_OPENBLAS_LT_VERSION_MAJOR[[ + + 100 * ]]SAGE_OPENBLAS_LT_VERSION_MINOR[[ + + ]]SAGE_OPENBLAS_LT_VERSION_MICRO[[) return 1;]]) ], [AS_VAR_SET([HAVE_OPENBLAS], [yes])], [AS_VAR_SET([HAVE_OPENBLAS], [no])], [AS_VAR_SET([HAVE_OPENBLAS], [yes])]) From b31a12d373a572000999d705fb723dcb6d398c52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Oudompheng?= Date: Wed, 29 Mar 2023 08:03:38 +0200 Subject: [PATCH 062/135] Use Singular maMapPoly to avoid quadratic complexity in polynomial evaluation The function fast_map_common_subexp tries to sort monomials using a quadratic algorithm, making it unusable for large polynomials. Function maMapPoly does not have this issue. --- src/sage/libs/singular/decl.pxd | 14 +++++++++++-- src/sage/libs/singular/polynomial.pyx | 29 ++++++++++++++++++--------- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/sage/libs/singular/decl.pxd b/src/sage/libs/singular/decl.pxd index 747a6b1e2fb..aa6c5515432 100644 --- a/src/sage/libs/singular/decl.pxd +++ b/src/sage/libs/singular/decl.pxd @@ -978,11 +978,23 @@ cdef extern from "singular/Singular/libsingular.h": void setFlag(leftv *A, int F) void resetFlag(leftv *A, int F) + ctypedef number* (*nMapFunc)(number *c,const n_Procs_s* src,const n_Procs_s* dst) + +cdef extern from "singular/coeffs/coeffs.h": + + number *ndCopyMap(number *, const n_Procs_s* src,const n_Procs_s* dst) + cdef extern from "singular/coeffs/rmodulo2m.h": #init 2^m from a long number *nr2mMapZp(number *,const n_Procs_s* src,const n_Procs_s* dst) +cdef extern from "singular/kernel/maps/gen_maps.h": + + # mapping from p in r1 by i2 to r2 + + poly *maMapPoly(poly *p, ring *r1, ideal *i2, ring *r2, const nMapFunc nMap) + cdef extern from "singular/kernel/maps/fast_maps.h": # mapping from ideal i1 in r1 by i2 to r2 @@ -993,8 +1005,6 @@ cdef extern from "singular/polys/ext_fields/algext.h": naInitChar(n_Procs_s* cf, void * infoStruct) - ctypedef number* (*nMapFunc)(number *c,const n_Procs_s* src,const n_Procs_s* dst) - nMapFunc naSetMap(const n_Procs_s* src, const n_Procs_s* dst) cdef extern from "singular/coeffs/rmodulon.h": diff --git a/src/sage/libs/singular/polynomial.pyx b/src/sage/libs/singular/polynomial.pyx index b2efc7dfbcb..59fcf2d0ad3 100644 --- a/src/sage/libs/singular/polynomial.pyx +++ b/src/sage/libs/singular/polynomial.pyx @@ -35,6 +35,7 @@ from sage.libs.singular.decl cimport omAlloc0, omStrDup, omFree from sage.libs.singular.decl cimport p_GetComp, p_SetComp from sage.libs.singular.decl cimport pSubst from sage.libs.singular.decl cimport p_Normalize +from sage.libs.singular.decl cimport ndCopyMap, maMapPoly from sage.libs.singular.singular cimport sa2si, si2sa, overflow_check @@ -200,25 +201,33 @@ cdef int singular_polynomial_call(poly **ret, poly *p, ring *r, list args, poly """ cdef long l = len(args) cdef ideal *to_id = idInit(l,1) + cdef bint constant_args = 1 for i from 0 <= i < l: to_id.m[i]= p_Copy( get_element(args[i]), r) + if not p_IsConstant(to_id.m[i], r): + constant_args = 0 - cdef ideal *from_id=idInit(1,1) - from_id.m[0] = p - + cdef ideal *from_id rChangeCurrRing(r) - cdef ideal *res_id = fast_map_common_subexp(from_id, r, to_id, r) - ret[0] = res_id.m[0] + cdef ideal *res_id + if not constant_args: + from_id = idInit(1,1) + from_id.m[0] = p + + res_id = fast_map_common_subexp(from_id, r, to_id, r) + ret[0] = res_id.m[0] + + from_id.m[0] = NULL + res_id.m[0] = NULL + id_Delete(&from_id, r) + id_Delete(&res_id, r) + else: + ret[0] = maMapPoly(p, r, to_id, r, ndCopyMap) # Unsure why we have to normalize here. See #16958 p_Normalize(ret[0], r) - from_id.m[0] = NULL - res_id.m[0] = NULL - id_Delete(&to_id, r) - id_Delete(&from_id, r) - id_Delete(&res_id, r) return 0 From dbbd8514884b9090a742ff1d12914fd385fd20e7 Mon Sep 17 00:00:00 2001 From: Karan Handa Date: Wed, 29 Mar 2023 14:46:02 +0530 Subject: [PATCH 063/135] Added missing backticks to correct formatting --- src/sage/matrix/matrix_modn_dense_float.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/matrix/matrix_modn_dense_float.pyx b/src/sage/matrix/matrix_modn_dense_float.pyx index 646570ad65e..3f4da74fbfa 100644 --- a/src/sage/matrix/matrix_modn_dense_float.pyx +++ b/src/sage/matrix/matrix_modn_dense_float.pyx @@ -52,7 +52,7 @@ cdef class Matrix_modn_dense_float(Matrix_modn_dense_template): ``Matrix_modn_dense_double`` class is used for larger moduli. Routines here are for the most basic access, see the - `matrix_modn_dense_template.pxi` file for higher-level routines. + ``matrix_modn_dense_template.pxi`` file for higher-level routines. """ def __cinit__(self): """ From 8653067f43dccc6ae55ce6a493bc27127c332869 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 29 Mar 2023 13:59:26 -0700 Subject: [PATCH 064/135] build/bin/sage-clone-source, src/bin/sage-env: Replace Trac by github --- build/bin/sage-clone-source | 8 +++++--- src/bin/sage-env | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/build/bin/sage-clone-source b/build/bin/sage-clone-source index 1b71e81999a..35f93bf15e2 100755 --- a/build/bin/sage-clone-source +++ b/build/bin/sage-clone-source @@ -31,11 +31,13 @@ CONFBALL="$SRC/upstream/configure-$CONFVERSION.tar.gz" rm -rf "$DST" mkdir -p "$DST" -git clone --origin trac "$SRC" "$DST" +git clone --origin upstream "$SRC" "$DST" cd "$DST" -git remote set-url trac "$SAGE_REPO_ANONYMOUS" -git remote set-url --push trac "$SAGE_REPO_AUTHENTICATED" +git remote set-url upstream "$SAGE_REPO_ANONYMOUS" +git remote set-url --push upstream "do not push to upstream" +git remote add trac trac /~https://github.com/sagemath/sagetrac-mirror.git +git remote set-url --push trac "do not push to trac" # Save space git gc --aggressive --prune=now diff --git a/src/bin/sage-env b/src/bin/sage-env index 28f86bc52ef..a7da60df28f 100644 --- a/src/bin/sage-env +++ b/src/bin/sage-env @@ -305,11 +305,11 @@ if [ -n "$SAGE_LOCAL" ]; then fi if [ -z "$SAGE_REPO_ANONYMOUS" ]; then - SAGE_REPO_ANONYMOUS="/~https://github.com/sagemath/sagetrac-mirror.git" + SAGE_REPO_ANONYMOUS="/~https://github.com/sagemath/sage.git" export SAGE_REPO_ANONYMOUS fi if [ -z "$SAGE_REPO_AUTHENTICATED" ]; then - SAGE_REPO_AUTHENTICATED="ssh://git@trac.sagemath.org:2222/sage.git" + SAGE_REPO_AUTHENTICATED="/~https://github.com/sagemath/sage.git" export SAGE_REPO_AUTHENTICATED fi From 3f6ff407a469d8993719701e846bbe12a30fc7ed Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 29 Mar 2023 13:59:55 -0700 Subject: [PATCH 065/135] src: Replace some remaining Trac references --- src/sage/cpython/__init__.py | 2 +- src/sage/dynamics/arithmetic_dynamics/projective_ds.py | 2 +- src/sage/repl/interpreter.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/cpython/__init__.py b/src/sage/cpython/__init__.py index 51974f1e438..5deff221609 100644 --- a/src/sage/cpython/__init__.py +++ b/src/sage/cpython/__init__.py @@ -40,7 +40,7 @@ def connect(*args, **kwargs): if fix_for_ticket_30157(): raise RuntimeError( 'patch for Github issue #30157 failed; please report this ' - 'bug to https://trac.sagemath.org') + 'bug to /~https://github.com/sagemath/sage/issues') # Undo the monkey-patch try: diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index 4dd109036d4..895415d58ec 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -2336,7 +2336,7 @@ def canonical_height(self, P, **kwds): # is always nonnegative, so if this value is within -err of 0, return 0. if h < 0: assert h > -err, "A negative height less than -error_bound was computed. " + \ - "This should be impossible, please report bug on trac.sagemath.org." + "This should be impossible, please report bug on /~https://github.com/sagemath/sage/issues" # This should be impossible. The error bound for Wells' is rigorous # and the actual height is always >= 0. If we see something less than -err, # something has g one very wrong. diff --git a/src/sage/repl/interpreter.py b/src/sage/repl/interpreter.py index fe4cff3add5..fd451a2bab5 100644 --- a/src/sage/repl/interpreter.py +++ b/src/sage/repl/interpreter.py @@ -696,14 +696,14 @@ def __init__(self, app): sage: sorted(sch.info.items()) [('app_name', 'Sage'), - ('bug_tracker', 'http://trac.sagemath.org'), + ('bug_tracker', '/~https://github.com/sagemath/sage/issues'), ('contact_email', 'sage-support@googlegroups.com'), ('contact_name', 'sage-support'), ('crash_report_fname', 'Crash_report_Sage.txt')] """ contact_name = 'sage-support' contact_email = 'sage-support@googlegroups.com' - bug_tracker = 'http://trac.sagemath.org' + bug_tracker = '/~https://github.com/sagemath/sage/issues' CrashHandler.__init__(self, app, contact_name, contact_email, bug_tracker, show_crash_traceback=True) self.crash_report_fname = 'Sage_crash_report.txt' From 6b1ce2a1ff24b7bbd810f8231c11b67058599cc3 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 29 Mar 2023 14:32:02 -0700 Subject: [PATCH 066/135] src/tox.ini: Add cython-lint --- src/doc/en/developer/tools.rst | 10 ++++++++++ src/tox.ini | 8 +++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/doc/en/developer/tools.rst b/src/doc/en/developer/tools.rst index e2ac3ef82dd..f365086e45b 100644 --- a/src/doc/en/developer/tools.rst +++ b/src/doc/en/developer/tools.rst @@ -59,7 +59,10 @@ available:: pycodestyle-minimal -- check against Sage's minimal style conventions relint -- check whether some forbidden patterns appear (includes all patchbot pattern-exclusion plugins) + rst -- validate Python docstrings markup as reStructuredText codespell -- check for misspelled words in source code + cython-lint -- Check Cython files for code style + pyright -- run the static typing checker pyright pycodestyle -- check against the Python style conventions of PEP8 -p auto -- run test environments in parallel --help -- show tox help @@ -208,6 +211,13 @@ or a few related issues:: *Documentation:* https://pycodestyle.pycqa.org/en/latest/index.html +.. _section-tools-cython-lint: +Cython-lint +=========== + +`Cython-lint `_ checks Cython source files +for coding style. + .. _section-tools-relint: Relint diff --git a/src/tox.ini b/src/tox.ini index bff0b3bc441..11300919591 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -21,7 +21,7 @@ ## in a virtual environment. ## [tox] -envlist = doctest, coverage, startuptime, pycodestyle-minimal, relint, codespell, rst +envlist = doctest, coverage, startuptime, pycodestyle-minimal, relint, codespell, rst, cython-lint # When adding environments above, also update the delegations in SAGE_ROOT/tox.ini skipsdist = true @@ -196,6 +196,12 @@ description = deps = flake8-rst-docstrings commands = flake8 --select=RST {posargs:{toxinidir}/sage/} +[testenv:cython-lint]: +description = + Check Cython files for code style +deps = cython-lint +commands = cython-lint --no-pycodestyle {posargs:{toxinidir}/sage/} + [flake8] rst-roles = # Sphinx From 217a60d52f3bb46059ed911906dbd4be763b56bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20K=C3=B6ppe?= Date: Wed, 29 Mar 2023 16:08:26 -0700 Subject: [PATCH 067/135] build/bin/sage-clone-source: Fix up Co-authored-by: John H. Palmieri --- build/bin/sage-clone-source | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/bin/sage-clone-source b/build/bin/sage-clone-source index 35f93bf15e2..65dc1ffa93f 100755 --- a/build/bin/sage-clone-source +++ b/build/bin/sage-clone-source @@ -36,7 +36,7 @@ git clone --origin upstream "$SRC" "$DST" cd "$DST" git remote set-url upstream "$SAGE_REPO_ANONYMOUS" git remote set-url --push upstream "do not push to upstream" -git remote add trac trac /~https://github.com/sagemath/sagetrac-mirror.git +git remote add trac /~https://github.com/sagemath/sagetrac-mirror.git git remote set-url --push trac "do not push to trac" # Save space From e05af10b9bcaecfaa2ef4c6ed2bd62aaba559d3b Mon Sep 17 00:00:00 2001 From: yukibl <110329609+yukibl@users.noreply.github.com> Date: Thu, 30 Mar 2023 13:33:43 +0900 Subject: [PATCH 068/135] Typo: 'minumum' for 'minimum' In sage/src/sage/libs/eclib/mwrank.pyx Line 843 should read 'minumum' instead of 'minimum'. --- src/sage/libs/eclib/mwrank.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/libs/eclib/mwrank.pyx b/src/sage/libs/eclib/mwrank.pyx index 4fa12cc10dd..e3b0b6b0000 100644 --- a/src/sage/libs/eclib/mwrank.pyx +++ b/src/sage/libs/eclib/mwrank.pyx @@ -840,7 +840,7 @@ cdef class _mw: - ``sat_bnd`` (int, default -1) -- upper bound on primes at which to saturate. If -1 (default), compute a bound for the primes which may not be saturated, and use that. Otherwise, - the bound used is the minumum of the value of ``sat_bnd`` + the bound used is the minimum of the value of ``sat_bnd`` and the computed bound. - ``sat_low_bd`` (int, default 2) -- only do saturation at From 42db4c94214b51aacb7cc8a844461494f4516f97 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 30 Mar 2023 04:24:04 -0700 Subject: [PATCH 069/135] src/tox.ini: Fix syntax so that pytest does not get confused --- src/tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tox.ini b/src/tox.ini index 11300919591..0db6b745dc0 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -196,7 +196,7 @@ description = deps = flake8-rst-docstrings commands = flake8 --select=RST {posargs:{toxinidir}/sage/} -[testenv:cython-lint]: +[testenv:cython-lint] description = Check Cython files for code style deps = cython-lint From 719a2804e0059e0d56338894f7c0b83fac90e10b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 30 Mar 2023 07:27:18 -0700 Subject: [PATCH 070/135] src/doc/en/developer/tools.rst: Fix markup --- src/doc/en/developer/tools.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/src/doc/en/developer/tools.rst b/src/doc/en/developer/tools.rst index f365086e45b..df87e537679 100644 --- a/src/doc/en/developer/tools.rst +++ b/src/doc/en/developer/tools.rst @@ -212,6 +212,7 @@ or a few related issues:: .. _section-tools-cython-lint: + Cython-lint =========== From 44506fcc332e14c0114902c53e34233452036e7d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 30 Mar 2023 07:28:08 -0700 Subject: [PATCH 071/135] src/tox.ini: Remove cython-lint from default envlist --- src/tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tox.ini b/src/tox.ini index 0db6b745dc0..a4ab5c3c40b 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -21,7 +21,7 @@ ## in a virtual environment. ## [tox] -envlist = doctest, coverage, startuptime, pycodestyle-minimal, relint, codespell, rst, cython-lint +envlist = doctest, coverage, startuptime, pycodestyle-minimal, relint, codespell, rst # When adding environments above, also update the delegations in SAGE_ROOT/tox.ini skipsdist = true From 385b11a03b467d95c5fd66e4a0bdd8ceb2d86705 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 30 Mar 2023 07:29:21 -0700 Subject: [PATCH 072/135] tox.ini: Add delegation for cython-lint --- tox.ini | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tox.ini b/tox.ini index 076be2f064b..80b9c18cff5 100644 --- a/tox.ini +++ b/tox.ini @@ -780,3 +780,11 @@ passenv = {[sage_src]passenv} envdir = {[sage_src]envdir} commands = {[sage_src]commands} allowlist_externals = {[sage_src]allowlist_externals} + +[testenv:cython-lint] +description = + Check Cython files for code style +passenv = {[sage_src]passenv} +envdir = {[sage_src]envdir} +commands = {[sage_src]commands} +allowlist_externals = {[sage_src]allowlist_externals} From bc9cb827518e1fe1c43c0ea0d7988cb561788ae2 Mon Sep 17 00:00:00 2001 From: Marc Mezzarobba Date: Fri, 31 Mar 2023 17:13:13 +0200 Subject: [PATCH 073/135] accept plain Python types in block_matrix() --- src/sage/matrix/special.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/sage/matrix/special.py b/src/sage/matrix/special.py index 5d3bb13445b..41a48c0e99f 100644 --- a/src/sage/matrix/special.py +++ b/src/sage/matrix/special.py @@ -66,7 +66,7 @@ from sage.rings.ring import is_Ring import sage.matrix.matrix_space as matrix_space from sage.modules.free_module_element import vector -from sage.structure.element import is_Matrix +from sage.structure.element import is_Matrix, parent from sage.structure.sequence import Sequence from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ @@ -1905,6 +1905,12 @@ def block_matrix(*args, **kwds): sage: block_matrix(A) [ 3 5] [ 8 13] + sage: block_matrix([[A, 0r], [1r, A]]) + [ 3 5| 0 0] + [ 8 13| 0 0] + [-----+-----] + [ 1 0| 3 5] + [ 0 1| 8 13] """ args = list(args) sparse = kwds.get('sparse', None) @@ -2020,7 +2026,7 @@ def block_matrix(*args, **kwds): ring = ZZ for row in sub_matrices: for M in row: - R = M.base_ring() if is_Matrix(M) else M.parent() + R = M.base_ring() if is_Matrix(M) else parent(M) if R is not ZZ: ring = sage.categories.pushout.pushout(ring, R) From 16547260d9aa78a0005d6a6a9447dad6abaef237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sat, 1 Apr 2023 09:45:04 +0200 Subject: [PATCH 074/135] fix pep8 E303 in folders starting with m --- src/sage/manifolds/chart.py | 1 - .../differentiable/automorphismfield_group.py | 2 -- src/sage/manifolds/differentiable/chart.py | 2 -- src/sage/manifolds/differentiable/degenerate.py | 1 - .../differentiable/degenerate_submanifold.py | 1 - src/sage/manifolds/differentiable/diff_form.py | 1 - src/sage/manifolds/differentiable/diff_map.py | 1 - src/sage/manifolds/differentiable/integrated_curve.py | 9 --------- .../differentiable/levi_civita_connection.py | 1 - src/sage/manifolds/differentiable/manifold.py | 1 - src/sage/manifolds/differentiable/manifold_homset.py | 2 -- src/sage/manifolds/differentiable/metric.py | 4 ---- src/sage/manifolds/differentiable/scalarfield.py | 1 - .../manifolds/differentiable/tensorfield_paral.py | 3 --- src/sage/manifolds/differentiable/vectorfield.py | 1 - .../manifolds/differentiable/vectorfield_module.py | 1 - src/sage/manifolds/differentiable/vectorframe.py | 2 -- src/sage/manifolds/scalarfield.py | 1 - src/sage/manifolds/trivialization.py | 1 - src/sage/matrix/benchmark.py | 2 -- src/sage/matrix/compute_J_ideal.py | 11 ----------- src/sage/media/wav.py | 1 - src/sage/misc/gperftools.py | 1 - src/sage/misc/sage_eval.py | 1 - src/sage/modular/quasimodform/element.py | 1 - src/sage/modules/fg_pid/fgp_element.py | 5 ----- src/sage/modules/free_module.py | 1 - src/sage/modules/vector_space_morphism.py | 1 - src/sage/modules/with_basis/morphism.py | 1 - src/sage/modules/with_basis/representation.py | 1 - src/sage/monoids/free_abelian_monoid.py | 1 - 31 files changed, 63 deletions(-) diff --git a/src/sage/manifolds/chart.py b/src/sage/manifolds/chart.py index d0ff3cea922..e48fe7c44fb 100644 --- a/src/sage/manifolds/chart.py +++ b/src/sage/manifolds/chart.py @@ -2317,7 +2317,6 @@ def _tighten_bounds(self): self._restrictions = new_restrictions self._fast_valid_coordinates = None - def restrict(self, subset, restrictions=None): r""" Return the restriction of the chart to some open subset of its domain. diff --git a/src/sage/manifolds/differentiable/automorphismfield_group.py b/src/sage/manifolds/differentiable/automorphismfield_group.py index 0791f0b9f24..72955d48b3c 100644 --- a/src/sage/manifolds/differentiable/automorphismfield_group.py +++ b/src/sage/manifolds/differentiable/automorphismfield_group.py @@ -175,7 +175,6 @@ def __init__(self, vector_field_module): Parent.__init__(self, category=Groups()) self._vmodule = vector_field_module - #### Parent methods #### def _element_constructor_(self, comp=[], frame=None, name=None, @@ -266,7 +265,6 @@ def _an_element_(self): #### End of parent methods #### - #### Monoid methods #### @cached_method diff --git a/src/sage/manifolds/differentiable/chart.py b/src/sage/manifolds/differentiable/chart.py index 098f85516bf..6ea06b662ed 100644 --- a/src/sage/manifolds/differentiable/chart.py +++ b/src/sage/manifolds/differentiable/chart.py @@ -679,7 +679,6 @@ def symbolic_velocities(self, left='D', right=None): return list(var(list_strings_velocities)) - #***************************************************************************** class RealDiffChart(DiffChart, RealChart): @@ -1001,7 +1000,6 @@ def __init__(self, domain, coordinates, calc_method=None, self._frame = CoordFrame(self) self._coframe = self._frame._coframe - def restrict(self, subset, restrictions=None): r""" Return the restriction of the chart to some subset. diff --git a/src/sage/manifolds/differentiable/degenerate.py b/src/sage/manifolds/differentiable/degenerate.py index 0fddd642e17..30846aa6891 100644 --- a/src/sage/manifolds/differentiable/degenerate.py +++ b/src/sage/manifolds/differentiable/degenerate.py @@ -368,7 +368,6 @@ def open_subset(self, name, latex_name=None, coord_def={}): return resu - #******************************************************************************************* from sage.manifolds.differentiable.tensorfield_paral import TensorFieldParal diff --git a/src/sage/manifolds/differentiable/degenerate_submanifold.py b/src/sage/manifolds/differentiable/degenerate_submanifold.py index 5d5ebb3de0f..67d5228f2d9 100644 --- a/src/sage/manifolds/differentiable/degenerate_submanifold.py +++ b/src/sage/manifolds/differentiable/degenerate_submanifold.py @@ -1323,7 +1323,6 @@ def principal_directions(self, screen=None): self._principal_directions[screen._name] = res return res - def mean_curvature(self, screen=None): r""" diff --git a/src/sage/manifolds/differentiable/diff_form.py b/src/sage/manifolds/differentiable/diff_form.py index ec6a8d353f3..dc682328e55 100644 --- a/src/sage/manifolds/differentiable/diff_form.py +++ b/src/sage/manifolds/differentiable/diff_form.py @@ -1556,7 +1556,6 @@ def wedge(self, other): other_r = other.restrict(dom_resu) return FreeModuleAltForm.wedge(self_r, other_r) - def interior_product(self, qvect): r""" Interior product with a multivector field. diff --git a/src/sage/manifolds/differentiable/diff_map.py b/src/sage/manifolds/differentiable/diff_map.py index 4260f233e40..ded6843afb3 100644 --- a/src/sage/manifolds/differentiable/diff_map.py +++ b/src/sage/manifolds/differentiable/diff_map.py @@ -1144,7 +1144,6 @@ def paral_comp(tcomp, chart1, chart2, coord2_1, jacob, resu._components[frame] = comp return resu - def pushforward(self, tensor): r""" Pushforward operator associated with ``self``. diff --git a/src/sage/manifolds/differentiable/integrated_curve.py b/src/sage/manifolds/differentiable/integrated_curve.py index 8b62aab4f39..74f76ab3e33 100644 --- a/src/sage/manifolds/differentiable/integrated_curve.py +++ b/src/sage/manifolds/differentiable/integrated_curve.py @@ -579,7 +579,6 @@ def fast_CoF(pos, vel, M=M): for f in transf] self._fast_changes_of_chart[CoC] = fast_transf - self._velocities = list(velocities) # converts to list # since might not already be a list (which is later required) self._curve_parameter = curve_parameter @@ -1376,13 +1375,11 @@ def jacobian(t,y): # 'tangent_vector_eval_at', and in 'plot' when plotting the # tangent vectors.) - if isinstance(sol, list): coords_sol = [point[0:dim + 1] for point in sol] else: coords_sol = sol[:, 0:dim + 1].tolist() # far faster in numpy - if verbose: print("Numerical integration completed.\n\n" + "Checking all points are in the chart domain...") @@ -1779,7 +1776,6 @@ def solve_across_charts(self, charts=None, step=None, solution_key=None, new_vel = self._fast_changes_of_frame[(new_chart.frame().restrict(inter), chart.frame().restrict(inter))](last_pts, last_vel) - ics = new_pts + new_vel chart = new_chart @@ -2434,7 +2430,6 @@ def plot_integrated(self, chart=None, ambient_coords=None, thickness = kwds.pop('thickness') aspect_ratio = kwds.pop('aspect_ratio') - # # The mapping, if present, and the chart with respect to which the curve # is plotted @@ -3425,7 +3420,6 @@ def __init__(self, parent, affine_connection, curve_parameter, velocities = chart.symbolic_velocities() - dim = parent.codomain().dim() i0 = parent.codomain().start_index() @@ -3470,7 +3464,6 @@ def __init__(self, parent, affine_connection, curve_parameter, equations_rhs_chart += [rhs.simplify_full()] equations_rhs[chart] = equations_rhs_chart - IntegratedCurve.__init__(self, parent, equations_rhs, velocities, curve_parameter, initial_tangent_vector, chart=chart, @@ -3479,7 +3472,6 @@ def __init__(self, parent, affine_connection, curve_parameter, self._affine_connection = affine_connection - def _repr_(self): r""" Return a string representation of ``self``. @@ -3825,7 +3817,6 @@ class IntegratedGeodesic(IntegratedAutoparallelCurve): def __init__(self, parent, metric, curve_parameter, initial_tangent_vector, chart=None, name=None, latex_name=None, verbose=False, across_charts=False): - r""" Construct a geodesic curve with respect to the given metric with the given initial tangent vector. diff --git a/src/sage/manifolds/differentiable/levi_civita_connection.py b/src/sage/manifolds/differentiable/levi_civita_connection.py index 3b8095004e3..7ff2643e32b 100644 --- a/src/sage/manifolds/differentiable/levi_civita_connection.py +++ b/src/sage/manifolds/differentiable/levi_civita_connection.py @@ -387,7 +387,6 @@ def _new_coef(self, frame): start_index=self._domain._sindex, output_formatter=DiffScalarField.coord_function) - def coef(self, frame=None): r""" Return the connection coefficients relative to the given frame. diff --git a/src/sage/manifolds/differentiable/manifold.py b/src/sage/manifolds/differentiable/manifold.py index e674ad8db05..e216a42ada3 100644 --- a/src/sage/manifolds/differentiable/manifold.py +++ b/src/sage/manifolds/differentiable/manifold.py @@ -2977,7 +2977,6 @@ def change_of_frame(self, frame1, frame2): " has not been defined on the {}".format(self)) return self._frame_changes[(frame1, frame2)] - def set_change_of_frame(self, frame1, frame2, change_of_frame, compute_inverse=True): r""" diff --git a/src/sage/manifolds/differentiable/manifold_homset.py b/src/sage/manifolds/differentiable/manifold_homset.py index 7152774ec75..2d35505f63c 100644 --- a/src/sage/manifolds/differentiable/manifold_homset.py +++ b/src/sage/manifolds/differentiable/manifold_homset.py @@ -777,7 +777,6 @@ def _repr_(self): description += "which actually are integrated curves" return description - def _element_constructor_(self, equations_rhs, velocities, curve_parameter, initial_tangent_vector, chart=None, name=None, latex_name=None, verbose=False, across_charts=False): @@ -1221,7 +1220,6 @@ def _repr_(self): description += "curves with respect to a certain affine connection" return description - def _element_constructor_(self, affine_connection, curve_parameter, initial_tangent_vector, chart=None, name=None, latex_name=None, verbose=False, across_charts=False): diff --git a/src/sage/manifolds/differentiable/metric.py b/src/sage/manifolds/differentiable/metric.py index 6dece42f0fe..5da567945a3 100644 --- a/src/sage/manifolds/differentiable/metric.py +++ b/src/sage/manifolds/differentiable/metric.py @@ -662,7 +662,6 @@ def set(self, symbiform): rst = self.restrict(dom) rst.set(symbiform_rst) - def inverse(self, expansion_symbol=None, order=1): r""" Return the inverse metric. @@ -879,7 +878,6 @@ def christoffel_symbols(self, chart=None): frame = chart._frame return self.connection().coef(frame) - def christoffel_symbols_display(self, chart=None, symbol=None, latex_symbol=None, index_labels=None, index_latex_labels=None, coordinate_labels=True, only_nonzero=True, @@ -1069,7 +1067,6 @@ def riemann(self, name=None, latex_name=None): """ return self.connection().riemann(name, latex_name) - def ricci(self, name=None, latex_name=None): r""" Return the Ricci tensor associated with the metric. @@ -2271,7 +2268,6 @@ def restrict(self, subdomain, dest_map=None): self._restrictions[subdomain] = resu return self._restrictions[subdomain] - def set(self, symbiform): r""" Define the metric from a field of symmetric bilinear forms. diff --git a/src/sage/manifolds/differentiable/scalarfield.py b/src/sage/manifolds/differentiable/scalarfield.py index 1b9a3c2ae2d..ba5c5d70f2c 100644 --- a/src/sage/manifolds/differentiable/scalarfield.py +++ b/src/sage/manifolds/differentiable/scalarfield.py @@ -819,7 +819,6 @@ def differential(self) -> DiffForm: derivative = differential # allows one to use functional notation, # e.g. diff(f) for f.differential() - def lie_derivative(self, vector): r""" Compute the Lie derivative with respect to a vector field. diff --git a/src/sage/manifolds/differentiable/tensorfield_paral.py b/src/sage/manifolds/differentiable/tensorfield_paral.py index eb517832382..065a5e9e5ec 100644 --- a/src/sage/manifolds/differentiable/tensorfield_paral.py +++ b/src/sage/manifolds/differentiable/tensorfield_paral.py @@ -657,7 +657,6 @@ def __init__(self, vector_field_module, tensor_type, name=None, # Initialization of derived quantities: self._init_derived() - def _repr_(self): r""" String representation of ``self``. @@ -769,7 +768,6 @@ def _preparse_display(self, basis=None, format_spec=None): basis = basis.frame() return (basis, format_spec) - def _set_comp_unsafe(self, basis=None): r""" Return the components of the tensor field in a given vector frame @@ -1511,7 +1509,6 @@ def paral_lie_deriv(a, b , coord_frame, chart_cp, local_list_ind): vc[[i]].coord_function(chart).diff(ind[k]) resc[[ind]] = rsum.scalar_field() - # # 3/ Final result (the tensor) res = vf_module.tensor_from_comp(self._tensor_type, resc) diff --git a/src/sage/manifolds/differentiable/vectorfield.py b/src/sage/manifolds/differentiable/vectorfield.py index ecd41a9882f..01a9c52d93c 100644 --- a/src/sage/manifolds/differentiable/vectorfield.py +++ b/src/sage/manifolds/differentiable/vectorfield.py @@ -359,7 +359,6 @@ def __call__(self, scalar): resu.set_name(name=name, latex_name=latex_name) return resu - @options(max_range=8, scale=1, color='blue') def plot(self, chart=None, ambient_coords=None, mapping=None, chart_domain=None, fixed_coords=None, ranges=None, diff --git a/src/sage/manifolds/differentiable/vectorfield_module.py b/src/sage/manifolds/differentiable/vectorfield_module.py index 12060175278..5a3791409af 100644 --- a/src/sage/manifolds/differentiable/vectorfield_module.py +++ b/src/sage/manifolds/differentiable/vectorfield_module.py @@ -1206,7 +1206,6 @@ def metric(self, name: str, signature: Optional[int] = None, latex_name: Optiona return PseudoRiemannianMetric(self, name, signature=signature[0]-signature[1], latex_name=latex_name) - def symplectic_form( self, name: Optional[str] = None, latex_name: Optional[str] = None ): diff --git a/src/sage/manifolds/differentiable/vectorframe.py b/src/sage/manifolds/differentiable/vectorframe.py index 8f8c26c0c61..a02d69da5d0 100644 --- a/src/sage/manifolds/differentiable/vectorframe.py +++ b/src/sage/manifolds/differentiable/vectorframe.py @@ -764,7 +764,6 @@ def __init__(self, vector_field_module, symbol, latex_symbol=None, # NB: set(self._restrictions.values()) is identical to # self._subframes - ###### Methods that must be redefined by derived classes of ###### ###### FreeModuleBasis ###### @@ -1777,7 +1776,6 @@ def __init__(self, chart): # - force_free=True ensures that a free module is constructed in case # it is the first call to the vector field module on chart.domain() - ###### Methods that must be redefined by derived classes of ###### ###### FreeModuleBasis ###### diff --git a/src/sage/manifolds/scalarfield.py b/src/sage/manifolds/scalarfield.py index 4b43a9dca14..458312279b7 100644 --- a/src/sage/manifolds/scalarfield.py +++ b/src/sage/manifolds/scalarfield.py @@ -2652,7 +2652,6 @@ def __neg__(self): result._latex_name = '-' + self._latex_name return result - ######### CommutativeAlgebraElement arithmetic operators ######## def _add_(self, other): diff --git a/src/sage/manifolds/trivialization.py b/src/sage/manifolds/trivialization.py index dcdaad390d9..ed3a8b4ed9f 100644 --- a/src/sage/manifolds/trivialization.py +++ b/src/sage/manifolds/trivialization.py @@ -693,7 +693,6 @@ def matrix(self): """ return self._automorphism.matrix(self._frame1) - def __eq__(self, other): r""" Equality operator. diff --git a/src/sage/matrix/benchmark.py b/src/sage/matrix/benchmark.py index 811a1cbfc98..751b89c5cc3 100644 --- a/src/sage/matrix/benchmark.py +++ b/src/sage/matrix/benchmark.py @@ -562,7 +562,6 @@ def vecmat_ZZ(n=300, min=-9, max=9, system='sage', times=200): raise ValueError('unknown system "%s"'%system) - ####################################################################### # Dense Benchmarks over GF(p), for small p. ####################################################################### @@ -721,7 +720,6 @@ def matrix_add_GF(n=1000, p=16411, system='sage',times=100): raise ValueError('unknown system "%s"'%system) - # Matrix multiplication over GF(p) def matrix_multiply_GF(n=100, p=16411, system='sage', times=3): diff --git a/src/sage/matrix/compute_J_ideal.py b/src/sage/matrix/compute_J_ideal.py index 7c31c0160f1..55dcb5e7072 100644 --- a/src/sage/matrix/compute_J_ideal.py +++ b/src/sage/matrix/compute_J_ideal.py @@ -190,7 +190,6 @@ def lifting(p, t, A, G): """ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing - DX = A.parent().base() (X,) = DX.variable_names() D = DX.base_ring() @@ -203,7 +202,6 @@ def lifting(p, t, A, G): if not (A*G % p**(t-1)).is_zero(): raise ValueError("A*G not zero mod %s^%s" % (p, t-1)) - R = A*G/p**(t-1) R.change_ring(DX) @@ -351,7 +349,6 @@ def __init__(self, B): self._DX = X.parent() self._cache = {} - def find_monic_replacements(self, p, t, pt_generators, prev_nu): r""" Replace possibly non-monic generators of `N_{(p^t)}(B)` by monic @@ -432,7 +429,6 @@ def find_monic_replacements(self, p, t, pt_generators, prev_nu): return replacements - def current_nu(self, p, t, pt_generators, prev_nu): r""" Compute `(p^t)`-minimal polynomial of `B`. @@ -482,7 +478,6 @@ def current_nu(self, p, t, pt_generators, prev_nu): from sage.misc.verbose import verbose - if not all((g(self._B) % p**t).is_zero() for g in pt_generators): raise ValueError("%s not in N_{(%s^%s)}(B)" % @@ -519,7 +514,6 @@ def current_nu(self, p, t, pt_generators, prev_nu): return g - def mccoy_column(self, p, t, nu): r""" Compute matrix for McCoy's criterion. @@ -577,7 +571,6 @@ def mccoy_column(self, p, t, nu): return column - def p_minimal_polynomials(self, p, s_max=None): r""" Compute `(p^s)`-minimal polynomials `\nu_s` of `B`. @@ -768,7 +761,6 @@ def p_minimal_polynomials(self, p, s_max=None): d = self._A.ncols() G = matrix(self._DX, d, 0) - while t < s_max: deg_prev_nu = nu.degree() t += 1 @@ -812,7 +804,6 @@ def p_minimal_polynomials(self, p, s_max=None): return p_min_polys - def null_ideal(self, b=0): r""" Return the `(b)`-ideal `N_{(b)}(B)=\{f\in D[X] \mid f(B)\in M_n(bD)\}`. @@ -877,7 +868,6 @@ def null_ideal(self, b=0): return self._DX.ideal(generators) - def prime_candidates(self): r""" Determine those primes `p` where `\mu_B` might not be a @@ -910,7 +900,6 @@ def prime_candidates(self): return [p for (p, t) in factor(T.det())] - def integer_valued_polynomials_generators(self): r""" Determine the generators of the ring of integer valued polynomials on `B`. diff --git a/src/sage/media/wav.py b/src/sage/media/wav.py index c847754f2e5..9e9664595b3 100644 --- a/src/sage/media/wav.py +++ b/src/sage/media/wav.py @@ -102,7 +102,6 @@ def __init__(self, data=None, **kwds): else: raise ValueError("Must give a filename") - def save(self, filename='sage.wav'): r""" Save this wave file to disk, either as a Sage sobj or as a .wav file. diff --git a/src/sage/misc/gperftools.py b/src/sage/misc/gperftools.py index 55ee572b8c4..d6e8123e8b2 100644 --- a/src/sage/misc/gperftools.py +++ b/src/sage/misc/gperftools.py @@ -47,7 +47,6 @@ libprofiler = None - class Profiler(SageObject): def __init__(self, filename=None): diff --git a/src/sage/misc/sage_eval.py b/src/sage/misc/sage_eval.py index 4e2a9968f24..8d0416a4cfd 100644 --- a/src/sage/misc/sage_eval.py +++ b/src/sage/misc/sage_eval.py @@ -198,7 +198,6 @@ def sage_eval(source, locals=None, cmds='', preparse=True): return eval(source, sage.all.__dict__, locals) - def sageobj(x, vars=None): """ Return a native Sage object associated to ``x``, if possible and diff --git a/src/sage/modular/quasimodform/element.py b/src/sage/modular/quasimodform/element.py index 24a6b7ebfad..b92c31722ac 100644 --- a/src/sage/modular/quasimodform/element.py +++ b/src/sage/modular/quasimodform/element.py @@ -622,7 +622,6 @@ def __getitem__(self, weight): homogeneous_component = __getitem__ # alias - def serre_derivative(self): r""" Return the Serre derivative of the given quasimodular form. diff --git a/src/sage/modules/fg_pid/fgp_element.py b/src/sage/modules/fg_pid/fgp_element.py index dbaeaf8c3e0..0a0f435d779 100644 --- a/src/sage/modules/fg_pid/fgp_element.py +++ b/src/sage/modules/fg_pid/fgp_element.py @@ -120,7 +120,6 @@ def lift(self): """ return self._x - def __neg__(self): """ EXAMPLES:: @@ -135,7 +134,6 @@ def __neg__(self): P = self.parent() return P.element_class(P, -self._x) - def _add_(self, other): """ EXAMPLES:: @@ -170,7 +168,6 @@ def _add_(self, other): P = self.parent() return P.element_class(P, self._x + other._x) - def _sub_(self, other): """ EXAMPLES:: @@ -190,7 +187,6 @@ def _sub_(self, other): P = self.parent() return P.element_class(P, self._x - other._x) - def _rmul_(self, c): """ Multiplication by a scalar from the left (``self`` is on the right). @@ -293,7 +289,6 @@ def _repr_(self): """ return repr(self.vector()) - def __getitem__(self, *args): """ EXAMPLES:: diff --git a/src/sage/modules/free_module.py b/src/sage/modules/free_module.py index 41bd5633503..b7618475111 100644 --- a/src/sage/modules/free_module.py +++ b/src/sage/modules/free_module.py @@ -1830,7 +1830,6 @@ def free_resolution(self, *args, **kwds): raise NotImplementedError("the module must be a free module or " "have the base ring be a polynomial ring using Singular") - def graded_free_resolution(self, *args, **kwds): r""" Return a graded free resolution of ``self``. diff --git a/src/sage/modules/vector_space_morphism.py b/src/sage/modules/vector_space_morphism.py index b0e0846a163..8044ed8dd4c 100644 --- a/src/sage/modules/vector_space_morphism.py +++ b/src/sage/modules/vector_space_morphism.py @@ -866,7 +866,6 @@ def __init__(self, homspace, A, side="left"): if homspace.domain().dimension() != A.ncols(): raise TypeError('codomain dimension is incompatible with matrix size') - A = homspace._matrix_space(side)(A) free_module_morphism.FreeModuleMorphism.__init__(self, homspace, A, side) diff --git a/src/sage/modules/with_basis/morphism.py b/src/sage/modules/with_basis/morphism.py index 6a43cab1461..0a38d7903d0 100644 --- a/src/sage/modules/with_basis/morphism.py +++ b/src/sage/modules/with_basis/morphism.py @@ -690,7 +690,6 @@ def __init__(self, triangular="upper", unitriangular=False, self._inverse_on_support = inverse_on_support - if invertible is None and (domain.basis().keys() == codomain.basis().keys()) and \ (self._inverse_on_support==identity or domain in Modules.FiniteDimensional): invertible = True diff --git a/src/sage/modules/with_basis/representation.py b/src/sage/modules/with_basis/representation.py index 815871e038d..44b9f6115e2 100644 --- a/src/sage/modules/with_basis/representation.py +++ b/src/sage/modules/with_basis/representation.py @@ -494,7 +494,6 @@ def side(self): """ return "left" if self._left_repr else "right" - class Element(CombinatorialFreeModule.Element): def _acted_upon_(self, scalar, self_on_left=False): """ diff --git a/src/sage/monoids/free_abelian_monoid.py b/src/sage/monoids/free_abelian_monoid.py index 54771b247e4..aa0581c2c0e 100644 --- a/src/sage/monoids/free_abelian_monoid.py +++ b/src/sage/monoids/free_abelian_monoid.py @@ -220,7 +220,6 @@ def __call__(self, x): return x return self.element_class(self, x) - def __contains__(self, x): """ Return True if `x` is an element of this abelian monoid. From 526cb5d68f2812c8c5c383924249451d0710758d Mon Sep 17 00:00:00 2001 From: Daniel Bump <75940445+dwbmscz@users.noreply.github.com> Date: Sat, 1 Apr 2023 08:58:43 -0700 Subject: [PATCH 075/135] replace oeis(1) by call to libgap.NumberSmallGroups --- src/sage/groups/perm_gps/permgroup_named.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index 2a3e45e0633..1e1225898d5 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -3476,7 +3476,8 @@ class SmallPermutationGroup(PermutationGroup_generic): [ 1 1 -1 1 -1 -1] [ 2 0 -2 -1 0 1] [ 2 0 2 -1 0 -1] - sage: all(SmallPermutationGroup(n,k).id()==[n,k] for n in [1..64] for k in [1..oeis(1)[n]]) + sage: def numgps(n) : return ZZ(libgap.NumberSmallGroups(n)) + sage: all(SmallPermutationGroup(n,k).id()==[n,k] for n in [1..64] for k in [1..numgps(n)]) True sage: H = SmallPermutationGroup(6,1) sage: H.is_abelian() From a0515ede5c87bee47887df1be63b045a74bf4ee8 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 2 Apr 2023 00:13:52 +0800 Subject: [PATCH 076/135] Activate codecov reports even if other checks are failing --- .codecov.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.codecov.yml b/.codecov.yml index 466a0fb42b7..3662ded4cf4 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,5 +1,8 @@ # https://docs.codecov.com/docs/pull-request-comments#disable-comment comment: false +# https://docs.codecov.com/docs/codecovyml-reference#codecov +codecov: + require_ci_to_pass: true # https://docs.codecov.com/docs/commit-status coverage: status: From c09a90afc76a8c3b0dcde3a060bb4c41b31ea74b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 20 Mar 2023 00:29:46 -0700 Subject: [PATCH 077/135] sage.schemes: Add # optional - sage.rings.{number_field,finite_rings,padics}; doctest cosmetics --- src/sage/schemes/affine/affine_homset.py | 22 +- src/sage/schemes/affine/affine_morphism.py | 270 ++++---- src/sage/schemes/affine/affine_point.py | 62 +- .../schemes/affine/affine_rational_point.py | 46 +- src/sage/schemes/affine/affine_space.py | 102 +-- src/sage/schemes/affine/affine_subscheme.py | 57 +- src/sage/schemes/generic/algebraic_scheme.py | 332 +++++----- src/sage/schemes/generic/ambient_space.py | 20 +- src/sage/schemes/generic/divisor.py | 84 +-- src/sage/schemes/generic/divisor_group.py | 8 +- src/sage/schemes/generic/homset.py | 80 +-- src/sage/schemes/generic/hypersurface.py | 32 +- src/sage/schemes/generic/morphism.py | 371 +++++------ src/sage/schemes/generic/point.py | 12 +- src/sage/schemes/generic/scheme.py | 64 +- src/sage/schemes/generic/spec.py | 23 +- .../schemes/projective/proj_bdd_height.py | 14 +- .../schemes/projective/projective_homset.py | 50 +- .../schemes/projective/projective_morphism.py | 590 +++++++++--------- .../schemes/projective/projective_point.py | 324 +++++----- .../projective/projective_rational_point.py | 54 +- .../schemes/projective/projective_space.py | 339 +++++----- .../projective/projective_subscheme.py | 214 +++---- 23 files changed, 1600 insertions(+), 1570 deletions(-) diff --git a/src/sage/schemes/affine/affine_homset.py b/src/sage/schemes/affine/affine_homset.py index 914e54f7148..052c9f64fb3 100644 --- a/src/sage/schemes/affine/affine_homset.py +++ b/src/sage/schemes/affine/affine_homset.py @@ -210,14 +210,14 @@ def points(self, **kwds): EXAMPLES: The bug reported at #11526 is fixed:: sage: A2 = AffineSpace(ZZ, 2) - sage: F = GF(3) - sage: A2(F).points() + sage: F = GF(3) # optional - sage.rings.finite_rings + sage: A2(F).points() # optional - sage.rings.finite_rings [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)] :: sage: A. = ZZ[] - sage: I = A.ideal(x^2-y^2-1) + sage: I = A.ideal(x^2 - y^2-1) sage: V = AffineSpace(ZZ, 2) sage: X = V.subscheme(I) sage: M = X(ZZ) @@ -227,9 +227,9 @@ def points(self, **kwds): :: sage: u = QQ['u'].0 - sage: K. = NumberField(u^2 + 3) - sage: A. = AffineSpace(K, 2) - sage: len(A(K).points(bound=2)) + sage: K. = NumberField(u^2 + 3) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 2) # optional - sage.rings.number_field + sage: len(A(K).points(bound=2)) # optional - sage.rings.number_field 1849 :: @@ -388,14 +388,14 @@ def numerical_points(self, F=None, **kwds): EXAMPLES:: - sage: K. = QuadraticField(3) - sage: A. = AffineSpace(K, 2) - sage: X = A.subscheme([x^3 - v^2*y, y - v*x^2 + 3]) - sage: L = X(K).numerical_points(F=RR); L # abs tol 1e-14 + sage: K. = QuadraticField(3) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 2) # optional - sage.rings.number_field + sage: X = A.subscheme([x^3 - v^2*y, y - v*x^2 + 3]) # optional - sage.rings.number_field + sage: L = X(K).numerical_points(F=RR); L # abs tol 1e-14 # optional - sage.rings.number_field [(-1.18738247880014, -0.558021142104134), (1.57693558184861, 1.30713548084184), (4.80659931965815, 37.0162574656220)] - sage: L[0].codomain() + sage: L[0].codomain() # optional - sage.rings.number_field Affine Space of dimension 2 over Real Field with 53 bits of precision :: diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py index b61b011f979..f6cb2606bfa 100644 --- a/src/sage/schemes/affine/affine_morphism.py +++ b/src/sage/schemes/affine/affine_morphism.py @@ -140,7 +140,7 @@ def __init__(self, parent, polys, check=True): :: sage: A. = AffineSpace(QQ, 2) - sage: X = A.subscheme([x-y^2]) + sage: X = A.subscheme([x - y^2]) sage: H = Hom(X, X) sage: H([9/4*x^2, 3/2*y]) Scheme endomorphism of Closed subscheme of Affine Space of dimension 2 @@ -160,10 +160,10 @@ def __init__(self, parent, polys, check=True): If you pass in quotient ring elements, they are reduced:: sage: A. = AffineSpace(QQ, 3) - sage: X = A.subscheme([x-y]) - sage: H = Hom(X,X) + sage: X = A.subscheme([x - y]) + sage: H = Hom(X, X) sage: u,v,w = X.coordinate_ring().gens() - sage: H([u, v, u+v]) + sage: H([u, v, u + v]) Scheme endomorphism of Closed subscheme of Affine Space of dimension 3 over Rational Field defined by: x - y @@ -173,8 +173,8 @@ def __init__(self, parent, polys, check=True): You must use the ambient space variables to create rational functions:: sage: A. = AffineSpace(QQ, 3) - sage: X = A.subscheme([x^2-y^2]) - sage: H = Hom(X,X) + sage: X = A.subscheme([x^2 - y^2]) + sage: H = Hom(X, X) sage: u,v,w = X.coordinate_ring().gens() sage: H([u, v, (u+1)/v]) Traceback (most recent call last): @@ -191,7 +191,7 @@ def __init__(self, parent, polys, check=True): sage: R. = PolynomialRing(QQ) sage: A. = AffineSpace(R, 3) - sage: X = A.subscheme(x^2-y^2) + sage: X = A.subscheme(x^2 - y^2) sage: H = End(X) sage: H([x^2/(t*y), t*y^2, x*z]) Scheme endomorphism of Closed subscheme of Affine Space of dimension 3 @@ -239,7 +239,7 @@ def __call__(self, x, check=True): sage: P. = AffineSpace(QQ, 3) sage: H = Hom(P, P) - sage: f = H([x^2+y^2, y^2, z^2 + y*z]) + sage: f = H([x^2 + y^2, y^2, z^2 + y*z]) sage: f(P([1, 1, 1])) (2, 1, 2) @@ -256,13 +256,13 @@ def __call__(self, x, check=True): Defn: Defined on coordinates by sending (u, v) to (u + v, u*v) - sage: F. = GF(4) - sage: P = T(F)(1, a) - sage: h(P) + sage: F. = GF(4) # optional - sage.rings.finite_rings + sage: P = T(F)(1, a) # optional - sage.rings.finite_rings + sage: h(P) # optional - sage.rings.finite_rings (a + 1, a) - sage: h(P).domain() + sage: h(P).domain() # optional - sage.rings.finite_rings Spectrum of Finite Field in a of size 2^2 - sage: h.change_ring(F)(P) + sage: h.change_ring(F)(P) # optional - sage.rings.finite_rings (a + 1, a) """ from sage.schemes.affine.affine_point import SchemeMorphism_point_affine @@ -334,7 +334,7 @@ def __ne__(self, right): sage: A. = AffineSpace(RR, 2) sage: H = End(A) sage: f = H([x^2 - y, y^2]) - sage: g = H([x^3-x*y, x*y^2]) + sage: g = H([x^3 - x*y, x*y^2]) sage: f != g True sage: f != f @@ -355,7 +355,7 @@ def _fastpolys(self): sage: P. = AffineSpace(QQ, 2) sage: H = Hom(P, P) - sage: f = H([x^2+y^2, y^2/(1+x)]) + sage: f = H([x^2 + y^2, y^2/(1+x)]) sage: [t.op_list() for g in f._fastpolys for t in g] [[('load_const', 0), ('load_const', 1), ('load_arg', ...), ('ipow', 2), 'mul', 'add', ('load_const', 1), ('load_arg', ...), ('ipow', 2), 'mul', @@ -410,7 +410,7 @@ def _fast_eval(self, x): sage: P. = AffineSpace(QQ, 3) sage: H = Hom(P, P) - sage: f = H([x^2+y^2, y^2, z^2 + y*z]) + sage: f = H([x^2 + y^2, y^2, z^2 + y*z]) sage: f._fast_eval([1, 1, 1]) [2, 1, 2] @@ -464,7 +464,7 @@ def homogenize(self, n): sage: A. = AffineSpace(CC, 2) sage: H = Hom(A, A) - sage: f = H([(x^2-2)/(x*y), y^2-x]) + sage: f = H([(x^2-2)/(x*y), y^2 - x]) sage: f.homogenize((2, 0)) Scheme endomorphism of Projective Space of dimension 2 over Complex Field with 53 bits of precision @@ -474,7 +474,7 @@ def homogenize(self, n): :: sage: A. = AffineSpace(ZZ, 2) - sage: X = A.subscheme([x-y^2]) + sage: X = A.subscheme([x - y^2]) sage: H = Hom(X, X) sage: f = H([9*y^2, 3*y]) sage: f.homogenize(2) @@ -489,7 +489,7 @@ def homogenize(self, n): sage: R. = PolynomialRing(ZZ) sage: A. = AffineSpace(R, 2) sage: H = Hom(A, A) - sage: f = H([(x^2-2)/y, y^2-x]) + sage: f = H([(x^2-2)/y, y^2 - x]) sage: f.homogenize((2, 0)) Scheme endomorphism of Projective Space of dimension 2 over Univariate Polynomial Ring in t over Integer Ring @@ -500,7 +500,7 @@ def homogenize(self, n): sage: A. = AffineSpace(QQ, 1) sage: H = End(A) - sage: f = H([x^2-1]) + sage: f = H([x^2 - 1]) sage: f.homogenize((1, 0)) Scheme endomorphism of Projective Space of dimension 1 over Rational Field @@ -509,11 +509,11 @@ def homogenize(self, n): :: - sage: R. = PolynomialRing(QQbar) - sage: A. = AffineSpace(R, 2) - sage: H = End(A) - sage: f = H([QQbar(sqrt(2))*x*y, a*x^2]) - sage: f.homogenize(2) + sage: R. = PolynomialRing(QQbar) # optional - sage.rings.number_field + sage: A. = AffineSpace(R, 2) # optional - sage.rings.number_field + sage: H = End(A) # optional - sage.rings.number_field + sage: f = H([QQbar(sqrt(2))*x*y, a*x^2]) # optional - sage.rings.number_field sage.symbolic + sage: f.homogenize(2) # optional - sage.rings.number_field sage.symbolic Scheme endomorphism of Projective Space of dimension 2 over Univariate Polynomial Ring in a over Algebraic Field Defn: Defined on coordinates by sending (x0 : x1 : x2) to @@ -540,10 +540,10 @@ def homogenize(self, n): :: - sage: A. = AffineSpace(QQbar, 1) - sage: H = End(A) - sage: f = H([2*z / (z^2 + 2*z + 3)]) - sage: f.homogenize(1) + sage: A. = AffineSpace(QQbar, 1) # optional - sage.rings.number_field + sage: H = End(A) # optional - sage.rings.number_field + sage: f = H([2*z / (z^2 + 2*z + 3)]) # optional - sage.rings.number_field + sage: f.homogenize(1) # optional - sage.rings.number_field Scheme endomorphism of Projective Space of dimension 1 over Algebraic Field Defn: Defined on coordinates by sending (x0 : x1) to @@ -551,11 +551,11 @@ def homogenize(self, n): :: - sage: R. = QQbar[] - sage: A. = AffineSpace(R, 1) - sage: H = Hom(A, A) - sage: F = H([d*x^2 + c]) - sage: F.homogenize(1) + sage: R. = QQbar[] # optional - sage.rings.number_field + sage: A. = AffineSpace(R, 1) # optional - sage.rings.number_field + sage: H = Hom(A, A) # optional - sage.rings.number_field + sage: F = H([d*x^2 + c]) # optional - sage.rings.number_field + sage: F.homogenize(1) # optional - sage.rings.number_field Scheme endomorphism of Projective Space of dimension 1 over Multivariate Polynomial Ring in c, d over Algebraic Field Defn: Defined on coordinates by sending (x0 : x1) to (d*x0^2 + c*x1^2 : x1^2) @@ -564,7 +564,7 @@ def homogenize(self, n): sage: A2. = AffineSpace(QQ, 2) sage: P2. = ProjectiveSpace(QQ, 2) - sage: f = A2.hom([u,v,u*v], P2) + sage: f = A2.hom([u, v, u*v], P2) sage: g = f.homogenize(0) sage: i = A2.projective_embedding(0, g.domain()) sage: g*i == f @@ -658,10 +658,10 @@ def as_dynamical_system(self): :: - sage: A. = AffineSpace(GF(5), 1) - sage: H = End(A) - sage: f = H([x^2]) - sage: type(f.as_dynamical_system()) + sage: A. = AffineSpace(GF(5), 1) # optional - sage.rings.finite_rings + sage: H = End(A) # optional - sage.rings.finite_rings + sage: f = H([x^2]) # optional - sage.rings.finite_rings + sage: type(f.as_dynamical_system()) # optional - sage.rings.finite_rings :: @@ -703,25 +703,25 @@ def global_height(self, prec=None): sage: A. = AffineSpace(QQ, 1) sage: H = Hom(A, A) - sage: f = H([1/1331*x^2 + 4000]); + sage: f = H([1/1331*x^2 + 4000]) sage: f.global_height() 15.4877354584971 :: sage: R. = PolynomialRing(QQ) - sage: k. = NumberField(x^2 + 5) - sage: A. = AffineSpace(k, 2) - sage: H = Hom(A, A) - sage: f = H([13*w*x^2 + 4*y, 1/w*y^2]); - sage: f.global_height(prec=2) + sage: k. = NumberField(x^2 + 5) # optional - sage.rings.number_field + sage: A. = AffineSpace(k, 2) # optional - sage.rings.number_field + sage: H = Hom(A, A) # optional - sage.rings.number_field + sage: f = H([13*w*x^2 + 4*y, 1/w*y^2]) # optional - sage.rings.number_field + sage: f.global_height(prec=2) # optional - sage.rings.number_field 4.0 :: sage: A. = AffineSpace(ZZ, 1) sage: H = Hom(A, A) - sage: f = H([7*x^2 + 1513]); + sage: f = H([7*x^2 + 1513]) sage: f.global_height() 7.32184971378836 @@ -765,7 +765,7 @@ def local_height(self, v, prec=None): sage: P. = AffineSpace(QQ, 2) sage: H = Hom(P, P) - sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]); + sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]) sage: f.local_height(1331) 7.19368581839511 @@ -773,7 +773,7 @@ def local_height(self, v, prec=None): sage: P. = AffineSpace(QQ, 3) sage: H = Hom(P, P) - sage: f = H([4*x^2 + 3/100*y^2, 8/210*x*y, 1/10000*z^2]); + sage: f = H([4*x^2 + 3/100*y^2, 8/210*x*y, 1/10000*z^2]) sage: f.local_height(2) 2.77258872223978 @@ -781,18 +781,18 @@ def local_height(self, v, prec=None): sage: P. = AffineSpace(QQ, 3) sage: H = Hom(P, P) - sage: f = H([4*x^2 + 3/100*y^2, 8/210*x*y, 1/10000*z^2]); + sage: f = H([4*x^2 + 3/100*y^2, 8/210*x*y, 1/10000*z^2]) sage: f.local_height(2, prec=2) 3.0 :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(z^2 - 2) - sage: P. = AffineSpace(K, 2) - sage: H = Hom(P, P) - sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) - sage: f.local_height(K.ideal(3)) + sage: K. = NumberField(z^2 - 2) # optional - sage.rings.number_field + sage: P. = AffineSpace(K, 2) # optional - sage.rings.number_field + sage: H = Hom(P, P) # optional - sage.rings.number_field + sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) # optional - sage.rings.number_field + sage: f.local_height(K.ideal(3)) # optional - sage.rings.number_field 1.09861228866811 """ K = FractionField(self.domain().base_ring()) @@ -835,11 +835,11 @@ def local_height_arch(self, i, prec=None): :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(z^2 - 2) - sage: P. = AffineSpace(K, 2) - sage: H = Hom(P, P) - sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) - sage: f.local_height_arch(1) + sage: K. = NumberField(z^2 - 2) # optional - sage.rings.number_field + sage: P. = AffineSpace(K, 2) # optional - sage.rings.number_field + sage: H = Hom(P, P) # optional - sage.rings.number_field + sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) # optional - sage.rings.number_field + sage: f.local_height_arch(1) # optional - sage.rings.number_field 0.6931471805599453094172321214582 """ K = FractionField(self.domain().base_ring()) @@ -916,10 +916,10 @@ def _matrix_times_polymap_(self, mat, h): :: - sage: A1 = AffineSpace(ZZ,1) - sage: A2 = AffineSpace(ZZ,2) + sage: A1 = AffineSpace(ZZ, 1) + sage: A2 = AffineSpace(ZZ, 2) sage: H = Hom(A1, A2) - sage: f = H([x^2+1,x^2-1]) + sage: f = H([x^2 + 1, x^2 - 1]) sage: matrix([[1,2,3], [0,1,2], [0,0,1]]) * f Scheme morphism: From: Affine Space of dimension 1 over Integer Ring @@ -960,10 +960,10 @@ def _polymap_times_matrix_(self, mat, h): :: - sage: A1 = AffineSpace(ZZ,1) - sage: A2 = AffineSpace(ZZ,2) + sage: A1 = AffineSpace(ZZ, 1) + sage: A2 = AffineSpace(ZZ, 2) sage: H = Hom(A1, A2) - sage: f = H([x^2+1,x^2-1]) + sage: f = H([x^2 + 1, x^2 - 1]) sage: f * matrix([[1,2], [0,1]]) Scheme morphism: From: Affine Space of dimension 1 over Integer Ring @@ -974,10 +974,10 @@ def _polymap_times_matrix_(self, mat, h): :: sage: P. = AffineSpace(QQ, 2) - sage: P2. = AffineSpace(QQ,3) + sage: P2. = AffineSpace(QQ, 3) sage: H = Hom(P2, P) sage: f = H([u^2 + v^2, w^2]) - sage: m = matrix([[1,1,1], [1,0,1],[0,0,1]]) + sage: m = matrix([[1,1,1], [1,0,1], [0,0,1]]) sage: m*f Scheme morphism: From: Affine Space of dimension 3 over Rational Field @@ -1057,25 +1057,25 @@ def weil_restriction(self): EXAMPLES:: - sage: K. = QuadraticField(5) - sage: A. = AffineSpace(K, 2) - sage: H = End(A) - sage: f = H([x^2-y^2, y^2]) - sage: f.weil_restriction() + sage: K. = QuadraticField(5) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 2) # optional - sage.rings.number_field + sage: H = End(A) # optional - sage.rings.number_field + sage: f = H([x^2 - y^2, y^2]) # optional - sage.rings.number_field + sage: f.weil_restriction() # optional - sage.rings.number_field Scheme endomorphism of Affine Space of dimension 4 over Rational Field Defn: Defined on coordinates by sending (z0, z1, z2, z3) to (z0^2 + 5*z1^2 - z2^2 - 5*z3^2, 2*z0*z1 - 2*z2*z3, z2^2 + 5*z3^2, 2*z2*z3) :: - sage: K. = QuadraticField(5) - sage: PS. = AffineSpace(K, 2) - sage: H = Hom(PS, PS) - sage: f = H([x, y]) - sage: F = f.weil_restriction() - sage: P = PS(2, 1) - sage: Q = P.weil_restriction() - sage: f(P).weil_restriction() == F(Q) + sage: K. = QuadraticField(5) # optional - sage.rings.number_field + sage: PS. = AffineSpace(K, 2) # optional - sage.rings.number_field + sage: H = Hom(PS, PS) # optional - sage.rings.number_field + sage: f = H([x, y]) # optional - sage.rings.number_field + sage: F = f.weil_restriction() # optional - sage.rings.number_field + sage: P = PS(2, 1) # optional - sage.rings.number_field + sage: Q = P.weil_restriction() # optional - sage.rings.number_field + sage: f(P).weil_restriction() == F(Q) # optional - sage.rings.number_field True """ if any(isinstance(f, FractionFieldElement) for f in self): @@ -1103,26 +1103,26 @@ def reduce_base_field(self): EXAMPLES:: - sage: K. = GF(5^4) - sage: A. = AffineSpace(K, 1) - sage: A2. = AffineSpace(K, 2) - sage: H = End(A) - sage: H2 = Hom(A,A2) - sage: H3 = Hom(A2,A) - sage: f = H([x^2 + 2*(t^3 + t^2 + t + 3)]) - sage: f.reduce_base_field() + sage: K. = GF(5^4) # optional - sage.rings.finite_rings + sage: A. = AffineSpace(K, 1) # optional - sage.rings.finite_rings + sage: A2. = AffineSpace(K, 2) # optional - sage.rings.finite_rings + sage: H = End(A) # optional - sage.rings.finite_rings + sage: H2 = Hom(A, A2) # optional - sage.rings.finite_rings + sage: H3 = Hom(A2, A) # optional - sage.rings.finite_rings + sage: f = H([x^2 + 2*(t^3 + t^2 + t + 3)]) # optional - sage.rings.finite_rings + sage: f.reduce_base_field() # optional - sage.rings.finite_rings Scheme endomorphism of Affine Space of dimension 1 over Finite Field in t2 of size 5^2 Defn: Defined on coordinates by sending (x) to (x^2 + (2*t2)) - sage: f2 = H2([x^2 + 4, 2*x]) - sage: f2.reduce_base_field() + sage: f2 = H2([x^2 + 4, 2*x]) # optional - sage.rings.finite_rings + sage: f2.reduce_base_field() # optional - sage.rings.finite_rings Scheme morphism: From: Affine Space of dimension 1 over Finite Field of size 5 To: Affine Space of dimension 2 over Finite Field of size 5 Defn: Defined on coordinates by sending (x) to (x^2 - 1, 2*x) - sage: f3 = H3([a^2 + t*b]) - sage: f3.reduce_base_field() + sage: f3 = H3([a^2 + t*b]) # optional - sage.rings.finite_rings + sage: f3.reduce_base_field() # optional - sage.rings.finite_rings Scheme morphism: From: Affine Space of dimension 2 over Finite Field in t of size 5^4 To: Affine Space of dimension 1 over Finite Field in t of size 5^4 @@ -1131,34 +1131,36 @@ def reduce_base_field(self): :: - sage: K. = CyclotomicField(4) - sage: A. = AffineSpace(K, 1) - sage: H = End(A) - sage: f = H([x^2 + v]) - sage: g = f.reduce_base_field();g - Scheme endomorphism of Affine Space of dimension 1 over Cyclotomic Field of order 4 and degree 2 + sage: K. = CyclotomicField(4) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 1) # optional - sage.rings.number_field + sage: H = End(A) # optional - sage.rings.number_field + sage: f = H([x^2 + v]) # optional - sage.rings.number_field + sage: g = f.reduce_base_field(); g # optional - sage.rings.number_field + Scheme endomorphism of Affine Space of dimension 1 over + Cyclotomic Field of order 4 and degree 2 Defn: Defined on coordinates by sending (x) to (x^2 + v) - sage: g.base_ring() is K + sage: g.base_ring() is K # optional - sage.rings.number_field True :: - sage: A. = AffineSpace(QQbar, 1) - sage: H = End(A) - sage: f = H([(QQbar(sqrt(2))*x^2 + 1/QQbar(sqrt(3))) / (5*x)]) - sage: f.reduce_base_field() - Scheme endomorphism of Affine Space of dimension 1 over Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a = ...? + sage: A. = AffineSpace(QQbar, 1) # optional - sage.rings.number_field + sage: H = End(A) # optional - sage.rings.number_field + sage: f = H([(QQbar(sqrt(2))*x^2 + 1/QQbar(sqrt(3))) / (5*x)]) # optional - sage.rings.number_field + sage: f.reduce_base_field() # optional - sage.rings.number_field + Scheme endomorphism of Affine Space of dimension 1 over Number Field in a + with defining polynomial y^4 - 4*y^2 + 1 with a = ...? Defn: Defined on coordinates by sending (x) to (((a^3 - 3*a)*x^2 + (-1/3*a^2 + 2/3))/(5*x)) :: sage: R. = PolynomialRing(QQ) - sage: A. =AffineSpace(QQbar,1) - sage: H = End(A) - sage: f = H([QQbar(3^(1/3))*x^2 + QQbar(sqrt(-2))]) - sage: f.reduce_base_field() + sage: A. = AffineSpace(QQbar, 1) # optional - sage.rings.number_field + sage: H = End(A) # optional - sage.rings.number_field + sage: f = H([QQbar(3^(1/3))*x^2 + QQbar(sqrt(-2))]) # optional - sage.rings.number_field + sage: f.reduce_base_field() # optional - sage.rings.number_field Scheme endomorphism of Affine Space of dimension 1 over Number Field in a with defining polynomial y^6 + 6*y^4 - 6*y^3 + 12*y^2 + 36*y + 17 with a = 1.442249570307409? + 1.414213562373095?*I @@ -1170,12 +1172,13 @@ def reduce_base_field(self): :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^3-x+1, embedding=(x^3+x+1).roots(ring=CC)[0][0]) - sage: A. = AffineSpace(K,1) - sage: A2. = AffineSpace(K,2) - sage: H = Hom(A, A2) - sage: f = H([x^2 + a*x + 3, 5*x]) - sage: f.reduce_base_field() + sage: K. = NumberField(x^3 - x + 1, # optional - sage.rings.number_field + ....: embedding=(x^3+x+1).roots(ring=CC)[0][0]) + sage: A. = AffineSpace(K, 1) # optional - sage.rings.number_field + sage: A2. = AffineSpace(K, 2) # optional - sage.rings.number_field + sage: H = Hom(A, A2) # optional - sage.rings.number_field + sage: f = H([x^2 + a*x + 3, 5*x]) # optional - sage.rings.number_field + sage: f.reduce_base_field() # optional - sage.rings.number_field Scheme morphism: From: Affine Space of dimension 1 over Number Field in a with defining polynomial x^3 - x + 1 with a = -1.324717957244746? @@ -1186,23 +1189,24 @@ def reduce_base_field(self): :: - sage: K. = QuadraticField(2) - sage: A. =AffineSpace(K,1) - sage: H = End(A) - sage: f = H([3*x^2 + x + 1]) - sage: f.reduce_base_field() + sage: K. = QuadraticField(2) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 1) # optional - sage.rings.number_field + sage: H = End(A) # optional - sage.rings.number_field + sage: f = H([3*x^2 + x + 1]) # optional - sage.rings.number_field + sage: f.reduce_base_field() # optional - sage.rings.number_field Scheme endomorphism of Affine Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x) to (3*x^2 + x + 1) :: - sage: K. = GF(5^6) - sage: A. = AffineSpace(K, 1) - sage: H = End(A) - sage: f = H([x^2 + x*(t^3 + 2*t^2 + 4*t) + (t^5 + 3*t^4 + t^2 + 4*t)]) - sage: f.reduce_base_field() - Scheme endomorphism of Affine Space of dimension 1 over Finite Field in t of size 5^6 + sage: K. = GF(5^6) # optional - sage.rings.finite_rings + sage: A. = AffineSpace(K, 1) # optional - sage.rings.finite_rings + sage: H = End(A) # optional - sage.rings.finite_rings + sage: f = H([x^2 + x*(t^3 + 2*t^2 + 4*t) + (t^5 + 3*t^4 + t^2 + 4*t)]) # optional - sage.rings.finite_rings + sage: f.reduce_base_field() # optional - sage.rings.finite_rings + Scheme endomorphism of Affine Space of dimension 1 over + Finite Field in t of size 5^6 Defn: Defined on coordinates by sending (x) to (x^2 + (t^3 + 2*t^2 - t)*x + (t^5 - 2*t^4 + t^2 - t)) """ @@ -1334,18 +1338,18 @@ def _fast_eval(self, x): EXAMPLES:: - sage: P. = AffineSpace(GF(7), 3) - sage: H = Hom(P, P) - sage: f = H([x^2+y^2,y^2, z^2 + y*z]) - sage: f._fast_eval([1, 1, 1]) + sage: P. = AffineSpace(GF(7), 3) # optional - sage.rings.finite_rings + sage: H = Hom(P, P) # optional - sage.rings.finite_rings + sage: f = H([x^2 + y^2,y ^2, z^2 + y*z]) # optional - sage.rings.finite_rings + sage: f._fast_eval([1, 1, 1]) # optional - sage.rings.finite_rings [2, 1, 2] :: - sage: P. = AffineSpace(GF(19), 3) - sage: H = Hom(P, P) - sage: f = H([x/(y+1), y, (z^2 + y^2)/(x^2 + 1)]) - sage: f._fast_eval([2, 1, 3]) + sage: P. = AffineSpace(GF(19), 3) # optional - sage.rings.finite_rings + sage: H = Hom(P, P) # optional - sage.rings.finite_rings + sage: f = H([x/(y+1), y, (z^2 + y^2)/(x^2 + 1)]) # optional - sage.rings.finite_rings + sage: f._fast_eval([2, 1, 3]) # optional - sage.rings.finite_rings [1, 1, 2] """ R = self.domain().ambient_space().coordinate_ring() diff --git a/src/sage/schemes/affine/affine_point.py b/src/sage/schemes/affine/affine_point.py index d7d50b2d064..d77ccf55ad4 100644 --- a/src/sage/schemes/affine/affine_point.py +++ b/src/sage/schemes/affine/affine_point.py @@ -194,9 +194,9 @@ def global_height(self, prec=None): :: sage: R. = PolynomialRing(QQ) - sage: k. = NumberField(x^2+5) - sage: A = AffineSpace(k, 2, 'z') - sage: A([3, 5*w+1]).global_height(prec=100) + sage: k. = NumberField(x^2 + 5) # optional - sage.rings.number_field + sage: A = AffineSpace(k, 2, 'z') # optional - sage.rings.number_field + sage: A([3, 5*w + 1]).global_height(prec=100) # optional - sage.rings.number_field 2.4181409534757389986565376694 .. TODO:: @@ -289,24 +289,24 @@ def weil_restriction(self): EXAMPLES:: - sage: A. = AffineSpace(GF(5^3, 't'), 3) - sage: X = A.subscheme([y^2-x*z, z^2+y]) - sage: Y = X.weil_restriction() - sage: P = X([1, -1, 1]) - sage: Q = P.weil_restriction();Q + sage: A. = AffineSpace(GF(5^3, 't'), 3) # optional - sage.rings.finite_rings + sage: X = A.subscheme([y^2 - x*z, z^2 + y]) # optional - sage.rings.finite_rings + sage: Y = X.weil_restriction() # optional - sage.rings.finite_rings + sage: P = X([1, -1, 1]) # optional - sage.rings.finite_rings + sage: Q = P.weil_restriction();Q # optional - sage.rings.finite_rings (1, 0, 0, 4, 0, 0, 1, 0, 0) - sage: Q.codomain() == Y + sage: Q.codomain() == Y # optional - sage.rings.finite_rings True :: sage: R. = QQ[] - sage: K. = NumberField(x^5-2) - sage: R. = K[] - sage: L. = K.extension(x^2+w) - sage: A. = AffineSpace(L, 2) - sage: P = A([w^3-v,1+w+w*v]) - sage: P.weil_restriction() + sage: K. = NumberField(x^5 - 2) # optional - sage.rings.number_field + sage: R. = K[] # optional - sage.rings.number_field + sage: L. = K.extension(x^2 + w) # optional - sage.rings.number_field + sage: A. = AffineSpace(L, 2) # optional - sage.rings.number_field + sage: P = A([w^3 - v, 1 + w + w*v]) # optional - sage.rings.number_field + sage: P.weil_restriction() # optional - sage.rings.number_field (w^3, -1, w + 1, w) """ L = self.codomain().base_ring() @@ -356,14 +356,14 @@ def intersection_multiplicity(self, X): EXAMPLES:: - sage: A. = AffineSpace(GF(17), 2) - sage: X = A.subscheme([y^2 - x^3 + 2*x^2 - x]) - sage: Y = A.subscheme([y - 2*x + 2]) - sage: Q1 = Y([1,0]) - sage: Q1.intersection_multiplicity(X) + sage: A. = AffineSpace(GF(17), 2) # optional - sage.rings.finite_rings + sage: X = A.subscheme([y^2 - x^3 + 2*x^2 - x]) # optional - sage.rings.finite_rings + sage: Y = A.subscheme([y - 2*x + 2]) # optional - sage.rings.finite_rings + sage: Q1 = Y([1,0]) # optional - sage.rings.finite_rings + sage: Q1.intersection_multiplicity(X) # optional - sage.rings.finite_rings 2 - sage: Q2 = X([4,6]) - sage: Q2.intersection_multiplicity(Y) + sage: Q2 = X([4,6]) # optional - sage.rings.finite_rings + sage: Q2.intersection_multiplicity(Y) # optional - sage.rings.finite_rings 1 :: @@ -416,27 +416,27 @@ def __hash__(self): EXAMPLES:: - sage: P. = AffineSpace(GF(5), 3) - sage: hash(P(2, 1, 2)) + sage: P. = AffineSpace(GF(5), 3) # optional - sage.rings.finite_rings + sage: hash(P(2, 1, 2)) # optional - sage.rings.finite_rings 57 :: - sage: P. = AffineSpace(GF(7), 3) - sage: X = P.subscheme(x^2-y^2) - sage: hash(X(1, 1, 2)) + sage: P. = AffineSpace(GF(7), 3) # optional - sage.rings.finite_rings + sage: X = P.subscheme(x^2 - y^2) # optional - sage.rings.finite_rings + sage: hash(X(1, 1, 2)) # optional - sage.rings.finite_rings 106 :: - sage: P. = AffineSpace(GF(13), 2) - sage: hash(P(3, 4)) + sage: P. = AffineSpace(GF(13), 2) # optional - sage.rings.finite_rings + sage: hash(P(3, 4)) # optional - sage.rings.finite_rings 55 :: - sage: P. = AffineSpace(GF(13^3, 't'), 2) - sage: hash(P(3, 4)) + sage: P. = AffineSpace(GF(13^3, 't'), 2) # optional - sage.rings.finite_rings + sage: hash(P(3, 4)) # optional - sage.rings.finite_rings 8791 """ p = self.codomain().base_ring().order() diff --git a/src/sage/schemes/affine/affine_rational_point.py b/src/sage/schemes/affine/affine_rational_point.py index 73a4c7d0ba6..023b80f3bf1 100644 --- a/src/sage/schemes/affine/affine_rational_point.py +++ b/src/sage/schemes/affine/affine_rational_point.py @@ -17,7 +17,7 @@ sage: from sage.schemes.affine.affine_rational_point import enum_affine_rational_field sage: A. = AffineSpace(3, QQ) - sage: S = A.subscheme([2*x-3*y]) + sage: S = A.subscheme([2*x - 3*y]) sage: enum_affine_rational_field(S, 2) [(0, 0, -2), (0, 0, -1), (0, 0, -1/2), (0, 0, 0), (0, 0, 1/2), (0, 0, 1), (0, 0, 2)] @@ -25,8 +25,8 @@ Affine over a finite field:: sage: from sage.schemes.affine.affine_rational_point import enum_affine_finite_field - sage: A. = AffineSpace(4, GF(2)) - sage: enum_affine_finite_field(A(GF(2))) + sage: A. = AffineSpace(4, GF(2)) # optional - sage.rings.finite_rings + sage: enum_affine_finite_field(A(GF(2))) # optional - sage.rings.finite_rings [(0, 0, 0, 0), (0, 0, 0, 1), (0, 0, 1, 0), (0, 0, 1, 1), (0, 1, 0, 0), (0, 1, 0, 1), (0, 1, 1, 0), (0, 1, 1, 1), (1, 0, 0, 0), (1, 0, 0, 1), (1, 0, 1, 0), (1, 0, 1, 1), (1, 1, 0, 0), (1, 1, 0, 1), (1, 1, 1, 0), @@ -85,7 +85,7 @@ def enum_affine_rational_field(X, B): :: sage: A. = AffineSpace(4, QQ) - sage: S = A.subscheme([x^2-y*z+1, w^3+z+y^2]) + sage: S = A.subscheme([x^2 - y*z + 1, w^3 + z + y^2]) sage: enum_affine_rational_field(S(QQ), 1) [(0, 0, -1, -1)] sage: enum_affine_rational_field(S(QQ), 2) @@ -94,7 +94,7 @@ def enum_affine_rational_field(X, B): :: sage: A. = AffineSpace(2, QQ) - sage: C = Curve(x^2+y-x) + sage: C = Curve(x^2 + y - x) sage: enum_affine_rational_field(C, 10) # long time (3 s) [(-2, -6), (-1, -2), (-2/3, -10/9), (-1/2, -3/4), (-1/3, -4/9), (0, 0), (1/3, 2/9), (1/2, 1/4), (2/3, 2/9), (1, 0), @@ -190,10 +190,10 @@ def enum_affine_number_field(X, **kwds): sage: from sage.schemes.affine.affine_rational_point import enum_affine_number_field sage: u = QQ['u'].0 - sage: K = NumberField(u^2 + 2, 'v') - sage: A. = AffineSpace(K, 3) - sage: X = A.subscheme([y^2 - x]) - sage: enum_affine_number_field(X(K), bound=2**0.5) + sage: K = NumberField(u^2 + 2, 'v') # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 3) # optional - sage.rings.number_field + sage: X = A.subscheme([y^2 - x]) # optional - sage.rings.number_field + sage: enum_affine_number_field(X(K), bound=2**0.5) # optional - sage.rings.number_field [(0, 0, -1), (0, 0, -v), (0, 0, -1/2*v), (0, 0, 0), (0, 0, 1/2*v), (0, 0, v), (0, 0, 1), (1, -1, -1), (1, -1, -v), (1, -1, -1/2*v), (1, -1, 0), (1, -1, 1/2*v), (1, -1, v), (1, -1, 1), (1, 1, -1), (1, 1, -v), (1, 1, -1/2*v), (1, 1, 0), (1, 1, 1/2*v), (1, 1, v), (1, 1, 1)] @@ -201,11 +201,11 @@ def enum_affine_number_field(X, **kwds): :: sage: u = QQ['u'].0 - sage: K = NumberField(u^2 + 3, 'v') - sage: A. = AffineSpace(K, 2) - sage: X=A.subscheme(x-y) - sage: from sage.schemes.affine.affine_rational_point import enum_affine_number_field - sage: enum_affine_number_field(X, bound=3**0.25) + sage: K = NumberField(u^2 + 3, 'v') # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 2) # optional - sage.rings.number_field + sage: X=A.subscheme(x - y) # optional - sage.rings.number_field + sage: from sage.schemes.affine.affine_rational_point import enum_affine_number_field # optional - sage.rings.number_field + sage: enum_affine_number_field(X, bound=3**0.25) # optional - sage.rings.number_field [(-1, -1), (-1/2*v - 1/2, -1/2*v - 1/2), (1/2*v - 1/2, 1/2*v - 1/2), (0, 0), (-1/2*v + 1/2, -1/2*v + 1/2), (1/2*v + 1/2, 1/2*v + 1/2), (1, 1)] """ @@ -248,14 +248,14 @@ def enum_affine_finite_field(X): EXAMPLES:: - sage: F = GF(7) - sage: A. = AffineSpace(4, F) - sage: C = A.subscheme([w^2+x+4, y*z*x-6, z*y+w*x]) + sage: F = GF(7) # optional - sage.rings.finite_rings + sage: A. = AffineSpace(4, F) # optional - sage.rings.finite_rings + sage: C = A.subscheme([w^2 + x + 4, y*z*x - 6, z*y + w*x]) # optional - sage.rings.finite_rings sage: from sage.schemes.affine.affine_rational_point import enum_affine_finite_field - sage: enum_affine_finite_field(C(F)) + sage: enum_affine_finite_field(C(F)) # optional - sage.rings.finite_rings [] - sage: C = A.subscheme([w^2+x+4, y*z*x-6]) - sage: enum_affine_finite_field(C(F)) + sage: C = A.subscheme([w^2 + x + 4, y*z*x - 6]) # optional - sage.rings.finite_rings + sage: enum_affine_finite_field(C(F)) # optional - sage.rings.finite_rings [(0, 3, 1, 2), (0, 3, 2, 1), (0, 3, 3, 3), (0, 3, 4, 4), (0, 3, 5, 6), (0, 3, 6, 5), (1, 2, 1, 3), (1, 2, 2, 5), (1, 2, 3, 1), (1, 2, 4, 6), (1, 2, 5, 2), (1, 2, 6, 4), (2, 6, 1, 1), (2, 6, 2, 4), (2, 6, 3, 5), @@ -268,9 +268,9 @@ def enum_affine_finite_field(X): :: - sage: A. = AffineSpace(3, GF(3)) - sage: S = A.subscheme(x+y) - sage: enum_affine_finite_field(S) + sage: A. = AffineSpace(3, GF(3)) # optional - sage.rings.finite_rings + sage: S = A.subscheme(x + y) # optional - sage.rings.finite_rings + sage: enum_affine_finite_field(S) # optional - sage.rings.finite_rings [(0, 0, 0), (0, 0, 1), (0, 0, 2), (1, 2, 0), (1, 2, 1), (1, 2, 2), (2, 1, 0), (2, 1, 1), (2, 1, 2)] diff --git a/src/sage/schemes/affine/affine_space.py b/src/sage/schemes/affine/affine_space.py index 52c13b29068..cc09cd7b826 100644 --- a/src/sage/schemes/affine/affine_space.py +++ b/src/sage/schemes/affine/affine_space.py @@ -48,7 +48,7 @@ def is_AffineSpace(x): sage: from sage.schemes.affine.affine_space import is_AffineSpace sage: is_AffineSpace(AffineSpace(5, names='x')) True - sage: is_AffineSpace(AffineSpace(5, GF(9, 'alpha'), names='x')) + sage: is_AffineSpace(AffineSpace(5, GF(9, 'alpha'), names='x')) # optional - sage.rings.finite_rings True sage: is_AffineSpace(Spec(ZZ)) False @@ -75,7 +75,7 @@ def AffineSpace(n, R=None, names=None, ambient_projective_space=None, Use the divide operator for base extension:: - sage: AffineSpace(5, names='x')/GF(17) + sage: AffineSpace(5, names='x')/GF(17) # optional - sage.rings.finite_rings Affine Space of dimension 5 over Finite Field of size 17 The default base ring is `\ZZ`:: @@ -85,10 +85,10 @@ def AffineSpace(n, R=None, names=None, ambient_projective_space=None, There is also an affine space associated to each polynomial ring:: - sage: R = GF(7)['x, y, z'] - sage: A = AffineSpace(R); A + sage: R = GF(7)['x, y, z'] # optional - sage.rings.finite_rings + sage: A = AffineSpace(R); A # optional - sage.rings.finite_rings Affine Space of dimension 3 over Finite Field of size 7 - sage: A.coordinate_ring() is R + sage: A.coordinate_ring() is R # optional - sage.rings.finite_rings True TESTS:: @@ -173,7 +173,7 @@ class AffineSpace_generic(AmbientSpace, AffineScheme): sage: AffineSpace(RealField(), 3, 'Z') Affine Space of dimension 3 over Real Field with 53 bits of precision - sage: AffineSpace(Qp(7), 2, 'x') + sage: AffineSpace(Qp(7), 2, 'x') # optional - sage.rings.padics Affine Space of dimension 2 over 7-adic Field with capped relative precision 20 Even 0-dimensional affine spaces are supported:: @@ -185,7 +185,7 @@ def __init__(self, n, R, names, ambient_projective_space, default_embedding_inde """ EXAMPLES:: - sage: AffineSpace(3, Zp(5), 'y') + sage: AffineSpace(3, Zp(5), 'y') # optional - sage.rings.padics Affine Space of dimension 3 over 5-adic Ring with capped relative precision 20 """ AmbientSpace.__init__(self, n, R) @@ -205,15 +205,15 @@ def __iter__(self): EXAMPLES:: - sage: FF = FiniteField(3) - sage: AA = AffineSpace(FF, 0) - sage: [ x for x in AA ] + sage: FF = FiniteField(3) # optional - sage.rings.finite_rings + sage: AA = AffineSpace(FF, 0) # optional - sage.rings.finite_rings + sage: [ x for x in AA ] # optional - sage.rings.finite_rings [()] - sage: AA = AffineSpace(FF, 1, 'Z') - sage: [ x for x in AA ] + sage: AA = AffineSpace(FF, 1, 'Z') # optional - sage.rings.finite_rings + sage: [ x for x in AA ] # optional - sage.rings.finite_rings [(0), (1), (2)] - sage: AA. = AffineSpace(FF, 2) - sage: [ x for x in AA ] + sage: AA. = AffineSpace(FF, 2) # optional - sage.rings.finite_rings + sage: [ x for x in AA ] # optional - sage.rings.finite_rings [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)] AUTHOR: @@ -249,13 +249,13 @@ def rational_points(self, F=None): EXAMPLES:: - sage: A = AffineSpace(1, GF(3)) - sage: A.rational_points() + sage: A = AffineSpace(1, GF(3)) # optional - sage.rings.finite_rings + sage: A.rational_points() # optional - sage.rings.finite_rings [(0), (1), (2)] - sage: A.rational_points(GF(3^2, 'b')) + sage: A.rational_points(GF(3^2, 'b')) # optional - sage.rings.finite_rings [(0), (b), (b + 1), (2*b + 1), (2), (2*b), (2*b + 2), (b + 2), (1)] - sage: AffineSpace(2, ZZ).rational_points(GF(2)) + sage: AffineSpace(2, ZZ).rational_points(GF(2)) # optional - sage.rings.finite_rings [(0, 0), (0, 1), (1, 0), (1, 1)] TESTS:: @@ -264,7 +264,7 @@ def rational_points(self, F=None): Traceback (most recent call last): ... TypeError: base ring (= Rational Field) must be a finite field - sage: AffineSpace(1, GF(3)).rational_points(ZZ) + sage: AffineSpace(1, GF(3)).rational_points(ZZ) # optional - sage.rings.finite_rings Traceback (most recent call last): ... TypeError: second argument (= Integer Ring) must be a finite field @@ -315,9 +315,9 @@ def __hash__(self): EXAMPLES:: - sage: hash(AffineSpace(QQ,3,'a')) == hash(AffineSpace(ZZ,3,'a')) + sage: hash(AffineSpace(QQ, 3, 'a')) == hash(AffineSpace(ZZ, 3, 'a')) False - sage: hash(AffineSpace(ZZ,1,'a')) == hash(AffineSpace(ZZ,0,'a')) + sage: hash(AffineSpace(ZZ, 1, 'a')) == hash(AffineSpace(ZZ, 0, 'a')) False """ return hash((self.dimension_relative(), self.coordinate_ring())) @@ -333,7 +333,7 @@ def _latex_(self): TESTS:: - sage: AffineSpace(3, Zp(5), 'y')._latex_() + sage: AffineSpace(3, Zp(5), 'y')._latex_() # optional - sage.rings.padics '\\mathbf{A}_{\\Bold{Z}_{5}}^3' """ return "\\mathbf{A}_{%s}^%s"%(latex(self.base_ring()), self.dimension_relative()) @@ -434,7 +434,7 @@ def _repr_(self): TESTS:: - sage: AffineSpace(3, Zp(5), 'y')._repr_() + sage: AffineSpace(3, Zp(5), 'y')._repr_() # optional - sage.rings.padics 'Affine Space of dimension 3 over 5-adic Ring with capped relative precision 20' """ return "Affine Space of dimension %s over %s"%(self.dimension_relative(), self.base_ring()) @@ -450,7 +450,7 @@ def _repr_generic_point(self, polys=None): EXAMPLES:: sage: A. = AffineSpace(2, ZZ) - sage: A._repr_generic_point([y-x^2]) + sage: A._repr_generic_point([y - x^2]) '(-x^2 + y)' sage: A._repr_generic_point() '(x, y)' @@ -470,7 +470,7 @@ def _latex_generic_point(self, v=None): EXAMPLES:: sage: A. = AffineSpace(2, ZZ) - sage: A._latex_generic_point([y-x^2]) + sage: A._latex_generic_point([y - x^2]) '\\left(-x^{2} + y\\right)' sage: A._latex_generic_point() '\\left(x, y\\right)' @@ -634,14 +634,14 @@ def change_ring(self, R): sage: A. = AffineSpace(3, ZZ) sage: AQ = A.change_ring(QQ); AQ Affine Space of dimension 3 over Rational Field - sage: AQ.change_ring(GF(5)) + sage: AQ.change_ring(GF(5)) # optional - sage.rings.finite_rings Affine Space of dimension 3 over Finite Field of size 5 :: - sage: K. = QuadraticField(5) - sage: A = AffineSpace(K,2,'t') - sage: A.change_ring(K.embeddings(CC)[1]) + sage: K. = QuadraticField(5) # optional - sage.rings.number_field + sage: A = AffineSpace(K, 2, 't') # optional - sage.rings.number_field + sage: A.change_ring(K.embeddings(CC)[1]) # optional - sage.rings.number_field Affine Space of dimension 2 over Complex Field with 53 bits of precision """ if isinstance(R, Map): @@ -655,9 +655,9 @@ def coordinate_ring(self): EXAMPLES:: - sage: R = AffineSpace(2, GF(9,'alpha'), 'z').coordinate_ring(); R + sage: R = AffineSpace(2, GF(9,'alpha'), 'z').coordinate_ring(); R # optional - sage.rings.finite_rings Multivariate Polynomial Ring in z0, z1 over Finite Field in alpha of size 3^2 - sage: AffineSpace(3, R, 'x').coordinate_ring() + sage: AffineSpace(3, R, 'x').coordinate_ring() # optional - sage.rings.finite_rings Multivariate Polynomial Ring in x0, x1, x2 over Multivariate Polynomial Ring in z0, z1 over Finite Field in alpha of size 3^2 """ @@ -854,7 +854,7 @@ def _an_element_(self): sage: AffineSpace(ZZ, 2, 'x').an_element() (5, 4) - sage: AffineSpace(Qp(5), 2, 'x').an_element() + sage: AffineSpace(Qp(5), 2, 'x').an_element() # optional - sage.rings.padics (5^2 + O(5^22), 4*5 + O(5^21)) """ n = self.dimension_relative() @@ -990,9 +990,9 @@ def _point(self, *args, **kwds): TESTS:: - sage: P2. = AffineSpace(3, GF(3)) - sage: point_homset = P2._point_homset(Spec(GF(3)), P2) - sage: P2._point(point_homset, [1, 2, 3]) + sage: P2. = AffineSpace(3, GF(3)) # optional - sage.rings.finite_rings + sage: point_homset = P2._point_homset(Spec(GF(3)), P2) # optional - sage.rings.finite_rings + sage: P2._point(point_homset, [1, 2, 3]) # optional - sage.rings.finite_rings (1, 2, 0) """ return SchemeMorphism_point_affine_field(*args, **kwds) @@ -1005,8 +1005,8 @@ def _morphism(self, *args, **kwds): TESTS:: - sage: P2. = AffineSpace(3, GF(3)) - sage: P2._morphism(P2.Hom(P2), [x, y, z]) + sage: P2. = AffineSpace(3, GF(3)) # optional - sage.rings.finite_rings + sage: P2._morphism(P2.Hom(P2), [x, y, z]) # optional - sage.rings.finite_rings Scheme endomorphism of Affine Space of dimension 3 over Finite Field of size 3 Defn: Defined on coordinates by sending (x, y, z) to (x, y, z) @@ -1058,8 +1058,8 @@ def points_of_bounded_height(self, **kwds): :: sage: u = QQ['u'].0 - sage: A. = AffineSpace(NumberField(u^2 - 2, 'v'), 2) - sage: len(list(A.points_of_bounded_height(bound=2, tolerance=0.1))) + sage: A. = AffineSpace(NumberField(u^2 - 2, 'v'), 2) # optional - sage.rings.number_field + sage: len(list(A.points_of_bounded_height(bound=2, tolerance=0.1))) # optional - sage.rings.number_field 529 """ if (is_RationalField(self.base_ring())): @@ -1113,14 +1113,14 @@ def weil_restriction(self): EXAMPLES:: sage: R. = QQ[] - sage: K. = NumberField(x^5-2) - sage: AK. = AffineSpace(K, 2) - sage: AK.weil_restriction() + sage: K. = NumberField(x^5 - 2) # optional - sage.rings.number_field + sage: AK. = AffineSpace(K, 2) # optional - sage.rings.number_field + sage: AK.weil_restriction() # optional - sage.rings.number_field Affine Space of dimension 10 over Rational Field - sage: R. = K[] - sage: L. = K.extension(x^2+1) - sage: AL. = AffineSpace(L, 2) - sage: AL.weil_restriction() + sage: R. = K[] # optional - sage.rings.number_field + sage: L. = K.extension(x^2 + 1) # optional - sage.rings.number_field + sage: AL. = AffineSpace(L, 2) # optional - sage.rings.number_field + sage: AL.weil_restriction() # optional - sage.rings.number_field Affine Space of dimension 4 over Number Field in w with defining polynomial x^5 - 2 """ @@ -1244,9 +1244,9 @@ def _point(self, *args, **kwds): TESTS:: - sage: P2. = AffineSpace(3, GF(3)) - sage: point_homset = P2._point_homset(Spec(GF(3)), P2) - sage: P2._point(point_homset, [1, 2, 3]) + sage: P2. = AffineSpace(3, GF(3)) # optional - sage.rings.finite_rings + sage: point_homset = P2._point_homset(Spec(GF(3)), P2) # optional - sage.rings.finite_rings + sage: P2._point(point_homset, [1, 2, 3]) # optional - sage.rings.finite_rings (1, 2, 0) """ return SchemeMorphism_point_affine_finite_field(*args, **kwds) @@ -1259,8 +1259,8 @@ def _morphism(self, *args, **kwds): TESTS:: - sage: P2. = AffineSpace(3, GF(3)) - sage: P2._morphism(P2.Hom(P2), [x, y, z]) + sage: P2. = AffineSpace(3, GF(3)) # optional - sage.rings.finite_rings + sage: P2._morphism(P2.Hom(P2), [x, y, z]) # optional - sage.rings.finite_rings Scheme endomorphism of Affine Space of dimension 3 over Finite Field of size 3 Defn: Defined on coordinates by sending (x, y, z) to (x, y, z) diff --git a/src/sage/schemes/affine/affine_subscheme.py b/src/sage/schemes/affine/affine_subscheme.py index 0ba77fd2b6d..9f8880296fc 100644 --- a/src/sage/schemes/affine/affine_subscheme.py +++ b/src/sage/schemes/affine/affine_subscheme.py @@ -42,14 +42,14 @@ class AlgebraicScheme_subscheme_affine(AlgebraicScheme_subscheme): EXAMPLES:: sage: A3. = AffineSpace(QQ, 3) - sage: A3.subscheme([x^2-y*z]) + sage: A3.subscheme([x^2 - y*z]) Closed subscheme of Affine Space of dimension 3 over Rational Field defined by: x^2 - y*z TESTS:: sage: from sage.schemes.affine.affine_subscheme import AlgebraicScheme_subscheme_affine - sage: AlgebraicScheme_subscheme_affine(A3, [x^2-y*z]) + sage: AlgebraicScheme_subscheme_affine(A3, [x^2 - y*z]) Closed subscheme of Affine Space of dimension 3 over Rational Field defined by: x^2 - y*z """ @@ -151,7 +151,7 @@ def projective_embedding(self, i=None, PP=None): EXAMPLES:: sage: A. = AffineSpace(3, ZZ) - sage: S = A.subscheme([x*y-z]) + sage: S = A.subscheme([x*y - z]) sage: S.projective_embedding() Scheme morphism: From: Closed subscheme of Affine Space of dimension 3 over Integer Ring defined by: @@ -164,9 +164,9 @@ def projective_embedding(self, i=None, PP=None): :: sage: A. = AffineSpace(3, ZZ) - sage: P = ProjectiveSpace(3,ZZ,'u') - sage: S = A.subscheme([x^2-y*z]) - sage: S.projective_embedding(1,P) + sage: P = ProjectiveSpace(3, ZZ, 'u') + sage: S = A.subscheme([x^2 - y*z]) + sage: S.projective_embedding(1, P) Scheme morphism: From: Closed subscheme of Affine Space of dimension 3 over Integer Ring defined by: @@ -271,7 +271,7 @@ def projective_closure(self, i=None, PP=None): EXAMPLES:: - sage: A. = AffineSpace(QQ,4) + sage: A. = AffineSpace(QQ, 4) sage: X = A.subscheme([x^2 - y, x*y - z, y^2 - w, x*z - w, y*z - x*w, z^2 - y*w]) sage: X.projective_closure() Closed subscheme of Projective Space of dimension 4 over Rational Field @@ -310,8 +310,8 @@ def is_smooth(self, point=None): EXAMPLES:: - sage: A2. = AffineSpace(2,QQ) - sage: cuspidal_curve = A2.subscheme([y^2-x^3]) + sage: A2. = AffineSpace(2, QQ) + sage: cuspidal_curve = A2.subscheme([y^2 - x^3]) sage: cuspidal_curve Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: -x^3 + y^2 @@ -374,13 +374,14 @@ def intersection_multiplicity(self, X, P): :: sage: R. = QQ[] - sage: K. = NumberField(a^6 - 3*a^5 + 5*a^4 - 5*a^3 + 5*a^2 - 3*a + 1) - sage: A. = AffineSpace(K, 4) - sage: X = A.subscheme([x*y, y*z + 7, w^3 - x^3]) - sage: Y = A.subscheme([x - z^3 + z + 1]) - sage: Q = A([0, -7*b^5 + 21*b^4 - 28*b^3 + 21*b^2 - 21*b + 14, -b^5 + 2*b^4 - 3*b^3 \ - + 2*b^2 - 2*b, 0]) - sage: X.intersection_multiplicity(Y, Q) + sage: K. = NumberField(a^6 - 3*a^5 + 5*a^4 - 5*a^3 + 5*a^2 - 3*a + 1) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 4) # optional - sage.rings.number_field + sage: X = A.subscheme([x*y, y*z + 7, w^3 - x^3]) # optional - sage.rings.number_field + sage: Y = A.subscheme([x - z^3 + z + 1]) # optional - sage.rings.number_field + sage: Q = A([0, # optional - sage.rings.number_field + ....: -7*b^5 + 21*b^4 - 28*b^3 + 21*b^2 - 21*b + 14, + ....: -b^5 + 2*b^4 - 3*b^3 + 2*b^2 - 2*b, 0]) + sage: X.intersection_multiplicity(Y, Q) # optional - sage.rings.number_field 3 :: @@ -463,22 +464,22 @@ def multiplicity(self, P): :: - sage: A. = AffineSpace(GF(23), 5) - sage: C = A.curve([x^8 - y, y^7 - z, z^3 - 1, w^5 - v^3]) - sage: Q = A([22,1,1,0,0]) - sage: C.multiplicity(Q) + sage: A. = AffineSpace(GF(23), 5) # optional - sage.rings.finite_rings + sage: C = A.curve([x^8 - y, y^7 - z, z^3 - 1, w^5 - v^3]) # optional - sage.rings.finite_rings + sage: Q = A([22,1,1,0,0]) # optional - sage.rings.finite_rings + sage: C.multiplicity(Q) # optional - sage.rings.finite_rings 3 :: - sage: K. = QuadraticField(-1) - sage: A. = AffineSpace(K, 5) - sage: X = A.subscheme([y^7 - x^2*z^5 + z^3*t^8 - x^2*y^4*z - t^8]) - sage: Q1 = A([1,1,0,1,-1]) - sage: X.multiplicity(Q1) + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 5) # optional - sage.rings.number_field + sage: X = A.subscheme([y^7 - x^2*z^5 + z^3*t^8 - x^2*y^4*z - t^8]) # optional - sage.rings.number_field + sage: Q1 = A([1,1,0,1,-1]) # optional - sage.rings.number_field + sage: X.multiplicity(Q1) # optional - sage.rings.number_field 1 - sage: Q2 = A([0,0,0,-a,0]) - sage: X.multiplicity(Q2) + sage: Q2 = A([0,0,0,-a,0]) # optional - sage.rings.number_field + sage: X.multiplicity(Q2) # optional - sage.rings.number_field 7 Check that :trac:`27479` is fixed:: @@ -553,7 +554,7 @@ def tangent_space(self, p): EXAMPLES:: sage: A3. = AffineSpace(3, QQ) - sage: X = A3.subscheme(z-x*y) + sage: X = A3.subscheme(z - x*y) sage: X.tangent_space(A3.origin()) Closed subscheme of Affine Space of dimension 3 over Rational Field defined by: diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index 6391bc54eeb..95de049cff9 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -44,7 +44,7 @@ Now we can write polynomial equations in the variables `x` and `y`. For example, one equation cuts out a curve (a one-dimensional subscheme):: - sage: V = A2.subscheme([x^2+y^2-1]); V + sage: V = A2.subscheme([x^2 + y^2 - 1]); V Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x^2 + y^2 - 1 @@ -169,7 +169,7 @@ def is_AlgebraicScheme(x): sage: A2 = AffineSpace(2, QQ, 'x, y') sage: A2.coordinate_ring().inject_variables() Defining x, y - sage: V = A2.subscheme([x^2+y^2]); V + sage: V = A2.subscheme([x^2 + y^2]); V Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x^2 + y^2 sage: from sage.schemes.generic.algebraic_scheme import is_AlgebraicScheme @@ -274,14 +274,14 @@ def is_projective(self): EXAMPLES:: - sage: PP. = ProjectiveSpace(3,QQ) + sage: PP. = ProjectiveSpace(3, QQ) sage: f = x^3 + y^3 + z^3 + w^3 sage: R = f.parent() sage: I = [f] + [f.derivative(zz) for zz in PP.gens()] sage: V = PP.subscheme(I) sage: V.is_projective() True - sage: AA. = AffineSpace(4,QQ) + sage: AA. = AffineSpace(4, QQ) sage: V = AA.subscheme(I) sage: V.is_projective() False @@ -310,7 +310,7 @@ def coordinate_ring(self): EXAMPLES:: sage: P. = ProjectiveSpace(2, ZZ) - sage: S = P.subscheme([x-y, x-z]) + sage: S = P.subscheme([x - y, x - z]) sage: S.coordinate_ring() Quotient of Multivariate Polynomial Ring in x, y, z over Integer Ring by the ideal (x - y, x - z) """ @@ -329,13 +329,13 @@ def ambient_space(self): EXAMPLES:: - sage: A. = AffineSpace(2, GF(5)) - sage: S = A.subscheme([]) - sage: S.ambient_space() + sage: A. = AffineSpace(2, GF(5)) # optional - sage.rings.finite_rings + sage: S = A.subscheme([]) # optional - sage.rings.finite_rings + sage: S.ambient_space() # optional - sage.rings.finite_rings Affine Space of dimension 2 over Finite Field of size 5 sage: P. = ProjectiveSpace(2, ZZ) - sage: S = P.subscheme([x-y, x-z]) + sage: S = P.subscheme([x - y, x - z]) sage: S.ambient_space() is P True """ @@ -389,8 +389,8 @@ def embedding_morphism(self): EXAMPLES:: - sage: A2. = AffineSpace(QQ,2) - sage: C = A2.subscheme(x^2+y^2-1) + sage: A2. = AffineSpace(QQ, 2) + sage: C = A2.subscheme(x^2 + y^2 - 1) sage: C.embedding_morphism() Scheme morphism: From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: @@ -399,7 +399,7 @@ def embedding_morphism(self): Defn: Defined on coordinates by sending (x, y) to (x, y) sage: P1xP1. = toric_varieties.P1xP1() - sage: P1 = P1xP1.subscheme(x-y) + sage: P1 = P1xP1.subscheme(x - y) sage: P1.embedding_morphism() Scheme morphism: From: Closed subscheme of 2-d CPR-Fano toric variety covered @@ -412,7 +412,7 @@ def embedding_morphism(self): So far, the embedding was just in the own ambient space. Now a bit more interesting examples:: - sage: P2. = ProjectiveSpace(QQ,2) + sage: P2. = ProjectiveSpace(QQ, 2) sage: X = P2.subscheme((x^2-y^2)*z) sage: p = (1,1,0) sage: nbhd = X.neighborhood(p) @@ -492,7 +492,7 @@ def embedding_center(self): EXAMPLES:: - sage: P3. = ProjectiveSpace(QQ,3) + sage: P3. = ProjectiveSpace(QQ, 3) sage: X = P3.subscheme( (w^2-x^2)*(y^2-z^2) ) sage: p = [1,-1,3,4] sage: nbhd = X.neighborhood(p); nbhd @@ -524,12 +524,12 @@ def ngens(self): EXAMPLES:: - sage: A. = AffineSpace(2, GF(5)) - sage: S = A.subscheme([]) - sage: S.ngens() + sage: A. = AffineSpace(2, GF(5)) # optional - sage.rings.finite_rings + sage: S = A.subscheme([]) # optional - sage.rings.finite_rings + sage: S.ngens() # optional - sage.rings.finite_rings 2 sage: P. = ProjectiveSpace(2, ZZ) - sage: S = P.subscheme([x-y, x-z]) + sage: S = P.subscheme([x - y, x - z]) sage: P.ngens() 3 """ @@ -567,7 +567,7 @@ def _homset(self, *args, **kwds): sage: P1. = toric_varieties.P1() sage: type(P1.Hom(P1)) - sage: X = P1.subscheme(x-y) + sage: X = P1.subscheme(x - y) sage: type(X.Hom(X)) @@ -575,7 +575,7 @@ def _homset(self, *args, **kwds): sage: P1xP1 = toric_varieties.P1xP1() sage: P1 = toric_varieties.P1() - sage: P1xP1._homset(P1xP1,P1) + sage: P1xP1._homset(P1xP1, P1) Set of morphisms From: 2-d CPR-Fano toric variety covered by 4 affine patches To: 1-d CPR-Fano toric variety covered by 2 affine patches @@ -628,7 +628,7 @@ class AlgebraicScheme_quasi(AlgebraicScheme): sage: P. = ProjectiveSpace(2, ZZ) sage: S = P.subscheme([]) - sage: T = P.subscheme([x-y]) + sage: T = P.subscheme([x - y]) sage: T.complement(S) Quasi-projective subscheme X - Y of Projective Space of dimension 2 over Integer Ring, where X is defined by: @@ -649,7 +649,7 @@ def __init__(self, X, Y): sage: P. = ProjectiveSpace(2, ZZ) sage: S = P.subscheme([]) - sage: T = P.subscheme([x-y]) + sage: T = P.subscheme([x - y]) sage: from sage.schemes.generic.algebraic_scheme import AlgebraicScheme_quasi sage: AlgebraicScheme_quasi(S, T) Quasi-projective subscheme X - Y of Projective Space of dimension 2 over Integer Ring, where X is defined by: @@ -680,7 +680,7 @@ def _latex_(self): sage: from sage.schemes.generic.algebraic_scheme import AlgebraicScheme_quasi sage: P. = ProjectiveSpace(2, ZZ) sage: S = P.subscheme([]) - sage: T = P.subscheme([x-y]) + sage: T = P.subscheme([x - y]) sage: U = AlgebraicScheme_quasi(S, T); U Quasi-projective subscheme X - Y of Projective Space of dimension 2 over Integer Ring, where X is defined by: @@ -717,7 +717,7 @@ def _repr_(self): sage: from sage.schemes.generic.algebraic_scheme import AlgebraicScheme_quasi sage: P. = ProjectiveSpace(2, ZZ) sage: S = P.subscheme([]) - sage: T = P.subscheme([x-y]) + sage: T = P.subscheme([x - y]) sage: U = AlgebraicScheme_quasi(S, T); U Quasi-projective subscheme X - Y of Projective Space of dimension 2 over Integer Ring, where X is defined by: (no polynomials) @@ -743,7 +743,7 @@ def X(self): sage: P. = ProjectiveSpace(2, ZZ) sage: S = P.subscheme([]) - sage: T = P.subscheme([x-y]) + sage: T = P.subscheme([x - y]) sage: U = T.complement(S) sage: U.X() is S True @@ -758,7 +758,7 @@ def Y(self): sage: P. = ProjectiveSpace(2, ZZ) sage: S = P.subscheme([]) - sage: T = P.subscheme([x-y]) + sage: T = P.subscheme([x - y]) sage: U = T.complement(S) sage: U.Y() is T True @@ -774,7 +774,7 @@ def _check_satisfies_equations(self, v): sage: P. = ProjectiveSpace(2, ZZ) sage: S = P.subscheme([]) - sage: T = P.subscheme([x-y]) + sage: T = P.subscheme([x - y]) sage: U = T.complement(S) sage: U._check_satisfies_equations([1, 2, 0]) True @@ -793,17 +793,17 @@ def _check_satisfies_equations(self, v): ... TypeError: number of arguments does not match number of variables in parent - sage: A. = AffineSpace(2, GF(7)) - sage: S = A.subscheme([x^2-y]) - sage: T = A.subscheme([x-y]) - sage: U = T.complement(S) - sage: U._check_satisfies_equations([2, 4]) + sage: A. = AffineSpace(2, GF(7)) # optional - sage.rings.finite_rings + sage: S = A.subscheme([x^2 - y]) # optional - sage.rings.finite_rings + sage: T = A.subscheme([x - y]) # optional - sage.rings.finite_rings + sage: U = T.complement(S) # optional - sage.rings.finite_rings + sage: U._check_satisfies_equations([2, 4]) # optional - sage.rings.finite_rings True - sage: U.point([2,4]) + sage: U.point([2,4]) # optional - sage.rings.finite_rings (2, 4) - sage: U._check_satisfies_equations(_) + sage: U._check_satisfies_equations(_) # optional - sage.rings.finite_rings True - sage: U._check_satisfies_equations([1, 1]) + sage: U._check_satisfies_equations([1, 1]) # optional - sage.rings.finite_rings Traceback (most recent call last): ... TypeError: Coordinates [1, 1] do not define a point on Quasi-affine @@ -812,7 +812,7 @@ def _check_satisfies_equations(self, v): x^2 - y and Y is defined by: x - y - sage: U._check_satisfies_equations([1, 0]) + sage: U._check_satisfies_equations([1, 0]) # optional - sage.rings.finite_rings Traceback (most recent call last): ... TypeError: Coordinates [1, 0] do not define a point on Quasi-affine @@ -860,13 +860,13 @@ def rational_points(self, **kwds): EXAMPLES:: - sage: A. = AffineSpace(2, GF(7)) - sage: S = A.subscheme([x^2-y]) - sage: T = A.subscheme([x-y]) - sage: U = T.complement(S) - sage: U.rational_points() + sage: A. = AffineSpace(2, GF(7)) # optional - sage.rings.finite_rings + sage: S = A.subscheme([x^2 - y]) # optional - sage.rings.finite_rings + sage: T = A.subscheme([x - y]) # optional - sage.rings.finite_rings + sage: U = T.complement(S) # optional - sage.rings.finite_rings + sage: U.rational_points() # optional - sage.rings.finite_rings [(2, 4), (3, 2), (4, 2), (5, 4), (6, 1)] - sage: U.rational_points(F=GF(7^2, 'b')) + sage: U.rational_points(F=GF(7^2, 'b')) # optional - sage.rings.finite_rings [(2, 4), (3, 2), (4, 2), (5, 4), (6, 1), (b, b + 4), (b + 1, 3*b + 5), (b + 2, 5*b + 1), (b + 3, 6), (b + 4, 2*b + 6), (b + 5, 4*b + 1), (b + 6, 6*b + 5), (2*b, 4*b + 2), (2*b + 1, b + 3), (2*b + 2, 5*b + 6), (2*b + 3, 2*b + 4), (2*b + 4, 6*b + 4), @@ -924,10 +924,10 @@ class AlgebraicScheme_subscheme(AlgebraicScheme): sage: from sage.schemes.generic.algebraic_scheme import AlgebraicScheme_subscheme sage: P. = ProjectiveSpace(2, QQ) - sage: P.subscheme([x^2-y*z]) + sage: P.subscheme([x^2 - y*z]) Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x^2 - y*z - sage: AlgebraicScheme_subscheme(P, [x^2-y*z]) + sage: AlgebraicScheme_subscheme(P, [x^2 - y*z]) Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x^2 - y*z """ @@ -940,10 +940,10 @@ def __init__(self, A, polynomials): sage: from sage.schemes.generic.algebraic_scheme import AlgebraicScheme_subscheme sage: P. = ProjectiveSpace(2, QQ) - sage: P.subscheme([x^2-y*z]) + sage: P.subscheme([x^2 - y*z]) Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x^2 - y*z - sage: AlgebraicScheme_subscheme(P, [x^2-y*z]) + sage: AlgebraicScheme_subscheme(P, [x^2 - y*z]) Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x^2 - y*z """ @@ -979,7 +979,7 @@ def _check_satisfies_equations(self, v): EXAMPLES:: sage: P. = ProjectiveSpace(2, QQ) - sage: S = P.subscheme([x^2-y*z]) + sage: S = P.subscheme([x^2 - y*z]) sage: S._check_satisfies_equations([1, 1, 1]) True sage: S._check_satisfies_equations([1, 0, 1]) @@ -1011,12 +1011,12 @@ def base_extend(self, R): EXAMPLES:: - sage: P. = ProjectiveSpace(2, GF(11)) - sage: S = P.subscheme([x^2-y*z]) - sage: S.base_extend(GF(11^2, 'b')) + sage: P. = ProjectiveSpace(2, GF(11)) # optional - sage.rings.finite_rings + sage: S = P.subscheme([x^2 - y*z]) # optional - sage.rings.finite_rings + sage: S.base_extend(GF(11^2, 'b')) # optional - sage.rings.finite_rings Closed subscheme of Projective Space of dimension 2 over Finite Field in b of size 11^2 defined by: x^2 - y*z - sage: S.base_extend(ZZ) + sage: S.base_extend(ZZ) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: no natural map from the base ring (=Finite Field of size 11) to R (=Integer Ring)! @@ -1051,19 +1051,19 @@ def _latex_(self): EXAMPLES:: - sage: P. = ProjectiveSpace(2, GF(11)) - sage: S = P.subscheme([x^2-y*z]) - sage: S + sage: P. = ProjectiveSpace(2, GF(11)) # optional - sage.rings.finite_rings + sage: S = P.subscheme([x^2 - y*z]) # optional - sage.rings.finite_rings + sage: S # optional - sage.rings.finite_rings Closed subscheme of Projective Space of dimension 2 over Finite Field of size 11 defined by: x^2 - y*z - sage: S._latex_() + sage: S._latex_() # optional - sage.rings.finite_rings '\\text{Closed subscheme of } {\\mathbf P}_{\\Bold{F}_{11}}^2 \\text{ defined by } x^{2} - y z' - sage: S = P.subscheme([x^2-y*z, x^5]) - sage: S + sage: S = P.subscheme([x^2 - y*z, x^5]) # optional - sage.rings.finite_rings + sage: S # optional - sage.rings.finite_rings Closed subscheme of Projective Space of dimension 2 over Finite Field of size 11 defined by: x^2 - y*z, x^5 - sage: S._latex_() + sage: S._latex_() # optional - sage.rings.finite_rings '\\text{Closed subscheme of } {\\mathbf P}_{\\Bold{F}_{11}}^2 \\text{ defined by } x^{2} - y z, x^{5}' """ polynomials = ', '.join(latex(f) for f in self.defining_polynomials()) @@ -1078,19 +1078,19 @@ def _repr_(self): EXAMPLES:: - sage: P. = ProjectiveSpace(2, GF(11)) - sage: S = P.subscheme([x^2-y*z]) - sage: S + sage: P. = ProjectiveSpace(2, GF(11)) # optional - sage.rings.finite_rings + sage: S = P.subscheme([x^2 - y*z]) # optional - sage.rings.finite_rings + sage: S # optional - sage.rings.finite_rings Closed subscheme of Projective Space of dimension 2 over Finite Field of size 11 defined by: x^2 - y*z - sage: S._repr_() + sage: S._repr_() # optional - sage.rings.finite_rings 'Closed subscheme of Projective Space of dimension 2 over Finite Field of size 11 defined by:\n x^2 - y*z' - sage: S = P.subscheme([x^2-y*z, x^5]) - sage: S + sage: S = P.subscheme([x^2 - y*z, x^5]) # optional - sage.rings.finite_rings + sage: S # optional - sage.rings.finite_rings Closed subscheme of Projective Space of dimension 2 over Finite Field of size 11 defined by: x^2 - y*z, x^5 - sage: S._repr_() + sage: S._repr_() # optional - sage.rings.finite_rings 'Closed subscheme of Projective Space of dimension 2 over Finite Field of size 11 defined by:\n x^2 - y*z,\n x^5' """ polynomials = ',\n '.join(str(f) for f in self.defining_polynomials()) @@ -1112,7 +1112,7 @@ def defining_polynomials(self): EXAMPLES:: sage: P. = ProjectiveSpace(2, ZZ) - sage: S = P.subscheme([x^2-y*z, x^3+z^3]) + sage: S = P.subscheme([x^2 - y*z, x^3 + z^3]) sage: S.defining_polynomials() (x^2 - y*z, x^3 + z^3) """ @@ -1170,7 +1170,7 @@ def defining_ideal(self): EXAMPLES:: sage: P. = ProjectiveSpace(2, ZZ) - sage: S = P.subscheme([x^2-y*z, x^3+z^3]) + sage: S = P.subscheme([x^2 - y*z, x^3 + z^3]) sage: S.defining_ideal() Ideal (x^2 - y*z, x^3 + z^3) of Multivariate Polynomial Ring in x, y, z over Integer Ring """ @@ -1192,7 +1192,7 @@ def codimension(self): EXAMPLES:: - sage: PP. = ProjectiveSpace(4,QQ) + sage: PP. = ProjectiveSpace(4, QQ) sage: V = PP.subscheme(x*y) sage: V.codimension() 1 @@ -1218,7 +1218,7 @@ def irreducible_components(self): We define what is clearly a union of four hypersurfaces in `\P^4_{\QQ}` then find the irreducible components:: - sage: PP. = ProjectiveSpace(4,QQ) + sage: PP. = ProjectiveSpace(4, QQ) sage: V = PP.subscheme( (x^2 - y^2 - z^2)*(w^5 - 2*v^2*z^3)* w * (v^3 - x^2*z) ) sage: V.irreducible_components() [ @@ -1235,7 +1235,7 @@ def irreducible_components(self): We verify that the irrelevant ideal is not accidentally returned (see :trac:`6920`):: - sage: PP. = ProjectiveSpace(3,QQ) + sage: PP. = ProjectiveSpace(3, QQ) sage: f = x^3 + y^3 + z^3 + w^3 sage: R = f.parent() sage: I = [f] + [f.derivative(zz) for zz in PP.gens()] @@ -1249,7 +1249,7 @@ def irreducible_components(self): nontrivial irreducible component in affine space (instead of the empty scheme as above):: - sage: AA. = AffineSpace(4,QQ) + sage: AA. = AffineSpace(4, QQ) sage: V = AA.subscheme(I) sage: V.irreducible_components() [ @@ -1291,10 +1291,10 @@ def is_irreducible(self): EXAMPLES:: - sage: K = QuadraticField(-3) - sage: P. = ProjectiveSpace(K, 5) - sage: X = P.subscheme([x*y - z^2 - K.0*t^2, t*w*x + y*z^2 - u^3]) - sage: X.is_irreducible() + sage: K = QuadraticField(-3) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 5) # optional - sage.rings.number_field + sage: X = P.subscheme([x*y - z^2 - K.0*t^2, t*w*x + y*z^2 - u^3]) # optional - sage.rings.number_field + sage: X.is_irreducible() # optional - sage.rings.number_field True :: @@ -1306,10 +1306,10 @@ def is_irreducible(self): :: - sage: A. = AffineSpace(GF(17), 4) - sage: X = A.subscheme([x*y*z^2 - x*y*z*w - z*w^2 + w^3, x^3*y*z*w - x*y^3*z - x^2*y*z*w \ - - x^2*w^3 + y^2*w^2 + x*w^3]) - sage: X.is_irreducible() + sage: A. = AffineSpace(GF(17), 4) # optional - sage.rings.finite_rings + sage: X = A.subscheme([x*y*z^2 - x*y*z*w - z*w^2 + w^3, + ....: x^3*y*z*w - x*y^3*z - x^2*y*z*w - x^2*w^3 + y^2*w^2 + x*w^3]) + sage: X.is_irreducible() # optional - sage.rings.finite_rings False """ return self.defining_ideal().is_prime() @@ -1326,7 +1326,7 @@ def Jacobian_matrix(self): EXAMPLES:: sage: P3. = ProjectiveSpace(3, QQ) - sage: twisted_cubic = P3.subscheme(matrix([[w, x, y],[x, y, z]]).minors(2)) + sage: twisted_cubic = P3.subscheme(matrix([[w, x, y], [x, y, z]]).minors(2)) sage: twisted_cubic.Jacobian_matrix() [ y -2*x w 0] [ z -y -x w] @@ -1365,7 +1365,7 @@ def Jacobian(self): EXAMPLES:: sage: P3. = ProjectiveSpace(3, QQ) - sage: twisted_cubic = P3.subscheme(matrix([[w, x, y],[x, y, z]]).minors(2)) + sage: twisted_cubic = P3.subscheme(matrix([[w, x, y], [x, y, z]]).minors(2)) sage: twisted_cubic.Jacobian() Ideal (-x^2 + w*y, -x*y + w*z, -y^2 + x*z, x*z, -2*w*z, w*y, 3*w*y, -2*w*x, w^2, y*z, -2*x*z, w*z, 3*w*z, -2*w*y, w*x, z^2, -2*y*z, x*z, 3*x*z, -2*w*z, @@ -1411,10 +1411,10 @@ def reduce(self): Finally, we verify that the reduced scheme `Y` is the union of those two lines:: - sage: L1 = A.subscheme([x-1]); L1 + sage: L1 = A.subscheme([x - 1]); L1 Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x - 1 - sage: L2 = A.subscheme([x-y]); L2 + sage: L2 = A.subscheme([x - y]); L2 Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x - y sage: W = L1.union(L2); W # taken in ambient space @@ -1444,9 +1444,9 @@ def union(self, other): :: sage: A. = AffineSpace(2, QQ) - sage: I = ideal([x,y])^3 + sage: I = ideal([x, y])^3 sage: P = A.subscheme(I) - sage: L = A.subscheme([y-1]) + sage: L = A.subscheme([y - 1]) sage: S = L.union(P); S Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: y^4 - y^3, @@ -1501,7 +1501,7 @@ def __pow__(self, m): x8 sage: A2. = AffineSpace(QQ, 2) - sage: V = A2.subscheme([x^2-y, x-1]) + sage: V = A2.subscheme([x^2 - y, x - 1]) sage: V**4 Closed subscheme of Affine Space of dimension 8 over Rational Field defined by: @@ -1605,8 +1605,8 @@ def __mul__(self, right): sage: A3. = AffineSpace(ZZ, 3) sage: X = A3.subscheme([x0*x2 - x1]) - sage: P1.=ProjectiveSpace(ZZ,1) - sage: Y = P1.subscheme([u-v]) + sage: P1. = ProjectiveSpace(ZZ, 1) + sage: Y = P1.subscheme([u - v]) sage: X*Y Traceback (most recent call last): ... @@ -1615,8 +1615,8 @@ def __mul__(self, right): Traceback (most recent call last): ... TypeError: Affine Space of dimension 3 over Integer Ring must be a projective space, product of projective spaces, or subscheme - sage: PP.=ProductProjectiveSpaces(ZZ, [1,1]) - sage: Z = PP.subscheme([a*d-b*c]) + sage: PP. = ProductProjectiveSpaces(ZZ, [1,1]) + sage: Z = PP.subscheme([a*d - b*c]) sage: X*Z Traceback (most recent call last): ... @@ -1645,7 +1645,7 @@ def intersection(self, other): EXAMPLES:: sage: A. = AffineSpace(2, ZZ) - sage: X = A.subscheme([x^2-y]) + sage: X = A.subscheme([x^2 - y]) sage: Y = A.subscheme([y]) sage: X.intersection(Y) Closed subscheme of Affine Space of dimension 2 over Integer Ring defined by: @@ -1671,8 +1671,8 @@ def complement(self, other=None): EXAMPLES:: sage: A. = AffineSpace(3, ZZ) - sage: X = A.subscheme([x+y-z]) - sage: Y = A.subscheme([x-y+z]) + sage: X = A.subscheme([x + y - z]) + sage: Y = A.subscheme([x - y + z]) sage: Y.complement(X) Quasi-affine subscheme X - Y of Affine Space of dimension 3 over Integer Ring, where X is defined by: @@ -1686,8 +1686,8 @@ def complement(self, other=None): and Y is defined by: x - y + z sage: P. = ProjectiveSpace(2, QQ) - sage: X = P.subscheme([x^2+y^2+z^2]) - sage: Y = P.subscheme([x*y+y*z+z*x]) + sage: X = P.subscheme([x^2 + y^2 + z^2]) + sage: Y = P.subscheme([x*y + y*z + z*x]) sage: Y.complement(X) Quasi-projective subscheme X - Y of Projective Space of dimension 2 over Rational Field, where X is defined by: @@ -1767,10 +1767,10 @@ def rational_points(self, **kwds): Enumerate over a projective scheme over a number field:: sage: u = QQ['u'].0 - sage: K. = NumberField(u^2 + 3) - sage: A. = ProjectiveSpace(K,1) - sage: X=A.subscheme(x^2 - y^2) - sage: X.rational_points(bound=3) + sage: K. = NumberField(u^2 + 3) # optional - sage.rings.number_field + sage: A. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: X = A.subscheme(x^2 - y^2) # optional - sage.rings.number_field + sage: X.rational_points(bound=3) # optional - sage.rings.number_field [(-1 : 1), (1 : 1)] One can enumerate points up to a given bound on a projective scheme @@ -1784,36 +1784,36 @@ def rational_points(self, **kwds): For a small finite field, the complete set of points can be enumerated. :: - sage: Etilde = E.base_extend(GF(3)) - sage: Etilde.rational_points() + sage: Etilde = E.base_extend(GF(3)) # optional - sage.rings.finite_rings + sage: Etilde.rational_points() # optional - sage.rings.finite_rings [(0 : 0 : 1), (0 : 1 : 0), (0 : 2 : 1), (1 : 0 : 1), (1 : 2 : 1), (2 : 0 : 1), (2 : 2 : 1)] The class of hyperelliptic curves does not (yet) support desingularization of the places at infinity into two points:: - sage: FF = FiniteField(7) - sage: P. = PolynomialRing(FiniteField(7)) - sage: C = HyperellipticCurve(x^8+x+1) - sage: C.rational_points() + sage: FF = FiniteField(7) # optional - sage.rings.finite_rings + sage: P. = PolynomialRing(FiniteField(7)) # optional - sage.rings.finite_rings + sage: C = HyperellipticCurve(x^8 + x + 1) # optional - sage.rings.finite_rings + sage: C.rational_points() # optional - sage.rings.finite_rings [(0 : 1 : 0), (0 : 1 : 1), (0 : 6 : 1), (2 : 0 : 1), (4 : 0 : 1), (6 : 1 : 1), (6 : 6 : 1)] :: - sage: K. = QuadraticField(-3) - sage: P. = ProjectiveSpace(K, 2) - sage: X = P.subscheme([x^2 - v^2*x*z, y*x-v*z^2]) - sage: X.rational_points(F=CC) + sage: K. = QuadraticField(-3) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field + sage: X = P.subscheme([x^2 - v^2*x*z, y*x - v*z^2]) # optional - sage.rings.number_field + sage: X.rational_points(F=CC) # optional - sage.rings.number_field [(-3.00000000000000 : -0.577350269189626*I : 1.00000000000000), (0.000000000000000 : 1.00000000000000 : 0.000000000000000)] :: - sage: K. = QuadraticField(3) - sage: A. = AffineSpace(K, 2) - sage: X = A.subscheme([x^2 - v^2*y, y*x-v]) - sage: X.rational_points(F=RR) + sage: K. = QuadraticField(3) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 2) # optional - sage.rings.number_field + sage: X = A.subscheme([x^2 - v^2*y, y*x - v]) # optional - sage.rings.number_field + sage: X.rational_points(F=RR) # optional - sage.rings.number_field [(1.73205080756888, 1.00000000000000)] .. TODO:: @@ -1856,7 +1856,7 @@ def change_ring(self, R): EXAMPLES:: sage: P. = ProjectiveSpace(QQ, 1) - sage: X = P.subscheme([3*x^2-y^2]) + sage: X = P.subscheme([3*x^2 - y^2]) sage: H = Hom(X,X) sage: X.change_ring(GF(3)) Closed subscheme of Projective Space of dimension 1 over Finite Field of size 3 defined by: @@ -1864,25 +1864,25 @@ def change_ring(self, R): :: - sage: K. = QuadraticField(2) - sage: R. = K[] - sage: L. = K.extension(z^3-5) - sage: P. = ProjectiveSpace(K, 1) - sage: X = P.subscheme(x - w*y) - sage: X.change_ring(L) + sage: K. = QuadraticField(2) # optional - sage.rings.number_field + sage: R. = K[] # optional - sage.rings.number_field + sage: L. = K.extension(z^3 - 5) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: X = P.subscheme(x - w*y) # optional - sage.rings.number_field + sage: X.change_ring(L) # optional - sage.rings.number_field Closed subscheme of Projective Space of dimension 1 over Number Field in v with defining polynomial z^3 - 5 over its base field defined by: x + (-w)*y :: - sage: K. = QuadraticField(2) - sage: R. = K[] - sage: L. = K.extension(z^3-5) - sage: P. = AffineSpace(L,3) - sage: X = P.subscheme([x-w*y, z^2-v*x]) - sage: emb = L.embeddings(QQbar) - sage: X.change_ring(emb[0]) + sage: K. = QuadraticField(2) # optional - sage.rings.number_field + sage: R. = K[] # optional - sage.rings.number_field + sage: L. = K.extension(z^3 - 5) # optional - sage.rings.number_field + sage: P. = AffineSpace(L, 3) # optional - sage.rings.number_field + sage: X = P.subscheme([x - w*y, z^2 - v*x]) # optional - sage.rings.number_field + sage: emb = L.embeddings(QQbar) # optional - sage.rings.number_field + sage: X.change_ring(emb[0]) # optional - sage.rings.number_field Closed subscheme of Affine Space of dimension 3 over Algebraic Field defined by: x + (-1.414213562373095? + 0.?e-16*I)*y, @@ -1890,13 +1890,13 @@ def change_ring(self, R): :: - sage: K. = QuadraticField(2) - sage: R. = K[] - sage: L. = K.extension(z^3-5) - sage: P. = AffineSpace(L,3) - sage: X = P.subscheme([x-w*y, z^2-v*x]) - sage: emb = L.embeddings(QQbar) - sage: X.change_ring(emb[1]) + sage: K. = QuadraticField(2) # optional - sage.rings.number_field + sage: R. = K[] # optional - sage.rings.number_field + sage: L. = K.extension(z^3 - 5) # optional - sage.rings.number_field + sage: P. = AffineSpace(L, 3) # optional - sage.rings.number_field + sage: X = P.subscheme([x - w*y, z^2 - v*x]) # optional - sage.rings.number_field + sage: emb = L.embeddings(QQbar) # optional - sage.rings.number_field + sage: X.change_ring(emb[1]) # optional - sage.rings.number_field Closed subscheme of Affine Space of dimension 3 over Algebraic Field defined by: x + (-1.414213562373095? + 0.?e-16*I)*y, @@ -1904,47 +1904,47 @@ def change_ring(self, R): :: - sage: K. = QuadraticField(-3) - sage: P. = ProjectiveSpace(K, 1) - sage: X = P.subscheme(x-w*y) - sage: X.change_ring(CC) + sage: K. = QuadraticField(-3) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: X = P.subscheme(x - w*y) # optional - sage.rings.number_field + sage: X.change_ring(CC) # optional - sage.rings.number_field Closed subscheme of Projective Space of dimension 1 over Complex Field with 53 bits of precision defined by: x + (-1.73205080756888*I)*y :: - sage: K. = QuadraticField(3) - sage: P. = ProjectiveSpace(K,1) - sage: X = P.subscheme(x-w*y) - sage: X.change_ring(RR) + sage: K. = QuadraticField(3) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: X = P.subscheme(x - w*y) # optional - sage.rings.number_field + sage: X.change_ring(RR) # optional - sage.rings.number_field Closed subscheme of Projective Space of dimension 1 over Real Field with 53 bits of precision defined by: x - 1.73205080756888*y :: - sage: K. = CyclotomicField(7) - sage: O = K.maximal_order() - sage: P. = ProjectiveSpace(O, 1) - sage: X = P.subscheme([x^2+O(v)*y^2]) - sage: X.change_ring(CC) + sage: K. = CyclotomicField(7) # optional - sage.rings.number_field + sage: O = K.maximal_order() # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(O, 1) # optional - sage.rings.number_field + sage: X = P.subscheme([x^2 + O(v)*y^2]) # optional - sage.rings.number_field + sage: X.change_ring(CC) # optional - sage.rings.number_field Closed subscheme of Projective Space of dimension 1 over Complex Field with 53 bits of precision defined by: x^2 + (0.623489801858734 + 0.781831482468030*I)*y^2 - sage: X.change_ring(K).change_ring(K.embeddings(QQbar)[3]) + sage: X.change_ring(K).change_ring(K.embeddings(QQbar)[3]) # optional - sage.rings.number_field Closed subscheme of Projective Space of dimension 1 over Algebraic Field defined by: x^2 + (-0.9009688679024191? - 0.4338837391175581?*I)*y^2 :: sage: R. = QQ[] - sage: f = x^6-2 - sage: L. = NumberField(f, embedding=f.roots(CC)[2][0]) - sage: A. = AffineSpace(L, 2) - sage: H = Hom(A,A) - sage: X = A.subscheme([b*x^2, y^2]) - sage: X.change_ring(CC) + sage: f = x^6 - 2 + sage: L. = NumberField(f, embedding=f.roots(CC)[2][0]) # optional - sage.rings.number_field + sage: A. = AffineSpace(L, 2) # optional - sage.rings.number_field + sage: H = Hom(A, A) # optional - sage.rings.number_field + sage: X = A.subscheme([b*x^2, y^2]) # optional - sage.rings.number_field + sage: X.change_ring(CC) # optional - sage.rings.number_field Closed subscheme of Affine Space of dimension 2 over Complex Field with 53 bits of precision defined by: (-0.561231024154687 - 0.972080648619833*I)*x^2, @@ -1991,24 +1991,24 @@ def weil_restriction(self): EXAMPLES:: sage: R. = QQ[] - sage: K. = NumberField(x^5-2) - sage: R. = K[] - sage: L. = K.extension(x^2+1) - sage: A. = AffineSpace(L,2) - sage: X = A.subscheme([y^2-L(w)*x^3-v]) - sage: X.weil_restriction() + sage: K. = NumberField(x^5 - 2) # optional - sage.rings.number_field + sage: R. = K[] # optional - sage.rings.number_field + sage: L. = K.extension(x^2 + 1) # optional - sage.rings.number_field + sage: A. = AffineSpace(L, 2) # optional - sage.rings.number_field + sage: X = A.subscheme([y^2 - L(w)*x^3 - v]) # optional - sage.rings.number_field + sage: X.weil_restriction() # optional - sage.rings.number_field Closed subscheme of Affine Space of dimension 4 over Number Field in w with defining polynomial x^5 - 2 defined by: (-w)*z0^3 + (3*w)*z0*z1^2 + z2^2 - z3^2, (-3*w)*z0^2*z1 + w*z1^3 + 2*z2*z3 - 1 - sage: X.weil_restriction().ambient_space() is A.weil_restriction() + sage: X.weil_restriction().ambient_space() is A.weil_restriction() # optional - sage.rings.number_field True :: - sage: A. = AffineSpace(GF(5^2,'t'),3) - sage: X = A.subscheme([y^2-x*z, z^2+2*y]) - sage: X.weil_restriction() + sage: A. = AffineSpace(GF(5^2, 't'), 3) # optional - sage.rings.finite_rings + sage: X = A.subscheme([y^2 - x*z, z^2 + 2*y]) # optional - sage.rings.finite_rings + sage: X.weil_restriction() # optional - sage.rings.finite_rings Closed subscheme of Affine Space of dimension 6 over Finite Field of size 5 defined by: z2^2 - 2*z3^2 - z0*z4 + 2*z1*z5, @@ -2063,8 +2063,8 @@ def specialization(self, D=None, phi=None): sage: R. = PolynomialRing(QQ) sage: S. = R[] - sage: P. = AffineSpace(S,3) - sage: X = P.subscheme([x^2+a*c*y^2 - b*z^2]) + sage: P. = AffineSpace(S, 3) + sage: X = P.subscheme([x^2 + a*c*y^2 - b*z^2]) sage: from sage.rings.polynomial.flatten import SpecializationMorphism sage: phi = SpecializationMorphism(P.coordinate_ring(),dict({c:2,a:1})) sage: X.specialization(phi=phi) diff --git a/src/sage/schemes/generic/ambient_space.py b/src/sage/schemes/generic/ambient_space.py index 0f9b9b55240..9b7b11feb74 100644 --- a/src/sage/schemes/generic/ambient_space.py +++ b/src/sage/schemes/generic/ambient_space.py @@ -29,7 +29,7 @@ def is_AmbientSpace(x): sage: is_AmbientSpace(AffineSpace(2, QQ)) True sage: P. = ProjectiveSpace(2, ZZ) - sage: is_AmbientSpace(P.subscheme([x+y+z])) + sage: is_AmbientSpace(P.subscheme([x + y + z])) False """ return isinstance(x, AmbientSpace) @@ -196,9 +196,9 @@ def is_projective(self): EXAMPLES:: - sage: AffineSpace(3,QQ).is_projective() + sage: AffineSpace(3, QQ).is_projective() False - sage: ProjectiveSpace(3,QQ).is_projective() + sage: ProjectiveSpace(3, QQ).is_projective() True """ # overloaded in the projective space derived class @@ -227,7 +227,7 @@ def base_extend(self, R): sage: P. = ProjectiveSpace(2, ZZ) sage: PQ = P.base_extend(QQ); PQ Projective Space of dimension 2 over Rational Field - sage: PQ.base_extend(GF(5)) + sage: PQ.base_extend(GF(5)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: no natural map from the base ring (=Rational Field) @@ -257,8 +257,8 @@ def ambient_space(self): sage: P.ambient_space() is P True - sage: A = AffineSpace(2, GF(3)) - sage: A.ambient_space() + sage: A = AffineSpace(2, GF(3)) # optional - sage.rings.finite_rings + sage: A.ambient_space() # optional - sage.rings.finite_rings Affine Space of dimension 2 over Finite Field of size 3 """ return self @@ -285,8 +285,8 @@ def identity_morphism(self): EXAMPLES:: - sage: A = AffineSpace(2, GF(3)) - sage: A.identity_morphism() + sage: A = AffineSpace(2, GF(3)) # optional - sage.rings.finite_rings + sage: A.identity_morphism() # optional - sage.rings.finite_rings Scheme endomorphism of Affine Space of dimension 2 over Finite Field of size 3 Defn: Identity map @@ -325,8 +325,8 @@ def gens(self): sage: AffineSpace(0, QQ).gens() () - sage: P. = ProjectiveSpace(2, GF(5)) - sage: P.gens() + sage: P. = ProjectiveSpace(2, GF(5)) # optional - sage.rings.finite_rings + sage: P.gens() # optional - sage.rings.finite_rings (x, y, z) """ return self.coordinate_ring().gens() diff --git a/src/sage/schemes/generic/divisor.py b/src/sage/schemes/generic/divisor.py index 336fee8304f..847bdfd6f80 100644 --- a/src/sage/schemes/generic/divisor.py +++ b/src/sage/schemes/generic/divisor.py @@ -13,22 +13,22 @@ EXAMPLES:: - sage: x,y,z = ProjectiveSpace(2, GF(5), names='x,y,z').gens() - sage: C = Curve(y^2*z^7 - x^9 - x*z^8) - sage: pts = C.rational_points(); pts + sage: x,y,z = ProjectiveSpace(2, GF(5), names='x,y,z').gens() # optional - sage.rings.finite_rings + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # optional - sage.rings.finite_rings + sage: pts = C.rational_points(); pts # optional - sage.rings.finite_rings [(0 : 0 : 1), (0 : 1 : 0), (2 : 2 : 1), (2 : 3 : 1), (3 : 1 : 1), (3 : 4 : 1)] - sage: D1 = C.divisor(pts[0])*3 - sage: D2 = C.divisor(pts[1]) - sage: D3 = 10*C.divisor(pts[5]) - sage: D1.parent() is D2.parent() + sage: D1 = C.divisor(pts[0])*3 # optional - sage.rings.finite_rings + sage: D2 = C.divisor(pts[1]) # optional - sage.rings.finite_rings + sage: D3 = 10*C.divisor(pts[5]) # optional - sage.rings.finite_rings + sage: D1.parent() is D2.parent() # optional - sage.rings.finite_rings True - sage: D = D1 - D2 + D3; D + sage: D = D1 - D2 + D3; D # optional - sage.rings.finite_rings 3*(x, y) - (x, z) + 10*(x + 2*z, y + z) - sage: D[1][0] + sage: D[1][0] # optional - sage.rings.finite_rings -1 - sage: D[1][1] + sage: D[1][1] # optional - sage.rings.finite_rings Ideal (x, z) of Multivariate Polynomial Ring in x, y, z over Finite Field of size 5 - sage: C.divisor([(3, pts[0]), (-1, pts[1]), (10,pts[5])]) + sage: C.divisor([(3, pts[0]), (-1, pts[1]), (10, pts[5])]) # optional - sage.rings.finite_rings 3*(x, y) - (x, z) + 10*(x + 2*z, y + z) """ #******************************************************************************* @@ -107,9 +107,9 @@ def is_Divisor(x): EXAMPLES:: sage: from sage.schemes.generic.divisor import is_Divisor - sage: x,y = AffineSpace(2, GF(5), names='xy').gens() - sage: C = Curve(y^2 - x^9 - x) - sage: is_Divisor( C.divisor([]) ) + sage: x,y = AffineSpace(2, GF(5), names='xy').gens() # optional - sage.rings.finite_rings + sage: C = Curve(y^2 - x^9 - x) # optional - sage.rings.finite_rings + sage: is_Divisor(C.divisor([])) # optional - sage.rings.finite_rings True sage: is_Divisor("Ceci n'est pas un diviseur") False @@ -223,13 +223,13 @@ def scheme(self): EXAMPLES:: - sage: A. = AffineSpace(2, GF(5)) - sage: C = Curve(y^2 - x^9 - x) - sage: pts = C.rational_points(); pts + sage: A. = AffineSpace(2, GF(5)) # optional - sage.rings.finite_rings + sage: C = Curve(y^2 - x^9 - x) # optional - sage.rings.finite_rings + sage: pts = C.rational_points(); pts # optional - sage.rings.finite_rings [(0, 0), (2, 2), (2, 3), (3, 1), (3, 4)] - sage: D = C.divisor(pts[0])*3 - C.divisor(pts[1]); D + sage: D = C.divisor(pts[0])*3 - C.divisor(pts[1]); D # optional - sage.rings.finite_rings 3*(x, y) - (x - 2, y - 2) - sage: D.scheme() + sage: D.scheme() # optional - sage.rings.finite_rings Affine Plane Curve over Finite Field of size 5 defined by -x^9 + y^2 - x """ return self.parent().scheme() @@ -291,7 +291,7 @@ def __init__(self, v, parent=None, check=True, reduce=True): sage: P = E(0,0) sage: from sage.schemes.generic.divisor import Divisor_curve sage: from sage.schemes.generic.divisor_group import DivisorGroup - sage: Divisor_curve([(1,P)], parent=DivisorGroup(E)) + sage: Divisor_curve([(1, P)], parent=DivisorGroup(E)) (x, y) """ from sage.schemes.generic.divisor_group import DivisorGroup_curve @@ -369,31 +369,31 @@ def support(self): EXAMPLES:: - sage: x,y = AffineSpace(2, GF(5), names='xy').gens() - sage: C = Curve(y^2 - x^9 - x) - sage: pts = C.rational_points(); pts + sage: x,y = AffineSpace(2, GF(5), names='xy').gens() # optional - sage.rings.finite_rings + sage: C = Curve(y^2 - x^9 - x) # optional - sage.rings.finite_rings + sage: pts = C.rational_points(); pts # optional - sage.rings.finite_rings [(0, 0), (2, 2), (2, 3), (3, 1), (3, 4)] - sage: D = C.divisor_group()([(3,pts[0]), (-1, pts[1])]); D + sage: D = C.divisor_group()([(3, pts[0]), (-1, pts[1])]); D # optional - sage.rings.finite_rings 3*(x, y) - (x - 2, y - 2) - sage: D.support() + sage: D.support() # optional - sage.rings.finite_rings [(0, 0), (2, 2)] TESTS: This checks that :trac:`10732` is fixed:: - sage: R. = GF(5)[] - sage: C = Curve(x^7 + y^7 + z^7) - sage: pts = C.rational_points() - sage: D = C.divisor([(2, pts[0])]) - sage: D.support() + sage: R. = GF(5)[] # optional - sage.rings.finite_rings + sage: C = Curve(x^7 + y^7 + z^7) # optional - sage.rings.finite_rings + sage: pts = C.rational_points() # optional - sage.rings.finite_rings + sage: D = C.divisor([(2, pts[0])]) # optional - sage.rings.finite_rings + sage: D.support() # optional - sage.rings.finite_rings [(0 : 4 : 1)] - sage: (D + D).support() + sage: (D + D).support() # optional - sage.rings.finite_rings [(0 : 4 : 1)] - sage: E = C.divisor([(-3, pts[1]), (1, pts[2])]) - sage: (D - 2*E).support() + sage: E = C.divisor([(-3, pts[1]), (1, pts[2])]) # optional - sage.rings.finite_rings + sage: (D - 2*E).support() # optional - sage.rings.finite_rings [(0 : 4 : 1), (1 : 2 : 1), (2 : 1 : 1)] - sage: (D - D).support() + sage: (D - D).support() # optional - sage.rings.finite_rings [] """ try: @@ -418,18 +418,18 @@ def coefficient(self, P): EXAMPLES:: - sage: x,y = AffineSpace(2, GF(5), names='xy').gens() - sage: C = Curve(y^2 - x^9 - x) - sage: pts = C.rational_points(); pts + sage: x,y = AffineSpace(2, GF(5), names='xy').gens() # optional - sage.rings.finite_rings + sage: C = Curve(y^2 - x^9 - x) # optional - sage.rings.finite_rings + sage: pts = C.rational_points(); pts # optional - sage.rings.finite_rings [(0, 0), (2, 2), (2, 3), (3, 1), (3, 4)] - sage: D = C.divisor(pts[0]) - sage: D.coefficient(pts[0]) + sage: D = C.divisor(pts[0]) # optional - sage.rings.finite_rings + sage: D.coefficient(pts[0]) # optional - sage.rings.finite_rings 1 - sage: D = C.divisor([(3,pts[0]), (-1,pts[1])]); D + sage: D = C.divisor([(3, pts[0]), (-1, pts[1])]); D # optional - sage.rings.finite_rings 3*(x, y) - (x - 2, y - 2) - sage: D.coefficient(pts[0]) + sage: D.coefficient(pts[0]) # optional - sage.rings.finite_rings 3 - sage: D.coefficient(pts[1]) + sage: D.coefficient(pts[1]) # optional - sage.rings.finite_rings -1 """ P = self.parent().scheme()(P) diff --git a/src/sage/schemes/generic/divisor_group.py b/src/sage/schemes/generic/divisor_group.py index 1301f783eb1..2399808c15c 100644 --- a/src/sage/schemes/generic/divisor_group.py +++ b/src/sage/schemes/generic/divisor_group.py @@ -171,7 +171,7 @@ def _element_constructor_(self, x, check=True, reduce=True): EXAMPLES:: sage: from sage.schemes.generic.divisor_group import DivisorGroup - sage: DivZZ=DivisorGroup(Spec(ZZ)) + sage: DivZZ = DivisorGroup(Spec(ZZ)) sage: DivZZ([(2,5)]) 2*V(5) """ @@ -222,16 +222,16 @@ def base_extend(self, R): EXAMPLES:: sage: from sage.schemes.generic.divisor_group import DivisorGroup - sage: DivisorGroup(Spec(ZZ),ZZ).base_extend(QQ) + sage: DivisorGroup(Spec(ZZ), ZZ).base_extend(QQ) Group of QQ-Divisors on Spectrum of Integer Ring - sage: DivisorGroup(Spec(ZZ),ZZ).base_extend(GF(7)) + sage: DivisorGroup(Spec(ZZ), ZZ).base_extend(GF(7)) Group of (Finite Field of size 7)-Divisors on Spectrum of Integer Ring Divisor groups are unique:: sage: A. = AffineSpace(2, CC) sage: C = Curve(y^2 - x^9 - x) - sage: DivisorGroup(C,ZZ).base_extend(QQ) is DivisorGroup(C,QQ) + sage: DivisorGroup(C, ZZ).base_extend(QQ) is DivisorGroup(C, QQ) True """ if self.base_ring().has_coerce_map_from(R): diff --git a/src/sage/schemes/generic/homset.py b/src/sage/schemes/generic/homset.py index c918e2f4395..224aa5e99c0 100644 --- a/src/sage/schemes/generic/homset.py +++ b/src/sage/schemes/generic/homset.py @@ -80,8 +80,8 @@ class SchemeHomsetFactory(UniqueFactory): EXAMPLES:: - sage: A2 = AffineSpace(QQ,2) - sage: A3 = AffineSpace(QQ,3) + sage: A2 = AffineSpace(QQ, 2) + sage: A3 = AffineSpace(QQ, 3) sage: Hom = A3.Hom(A2) The Hom-sets are uniquely determined by domain and codomain:: @@ -96,7 +96,7 @@ class SchemeHomsetFactory(UniqueFactory): sage: loads(Hom.dumps()) is Hom True - sage: A3_iso = AffineSpace(QQ,3) + sage: A3_iso = AffineSpace(QQ, 3) sage: A3_iso is A3 True sage: Hom_iso = A3_iso.Hom(A2) @@ -133,15 +133,15 @@ def create_key_and_extra_args(self, X, Y, category=None, base=None, EXAMPLES:: - sage: A2 = AffineSpace(QQ,2) - sage: A3 = AffineSpace(QQ,3) + sage: A2 = AffineSpace(QQ, 2) + sage: A3 = AffineSpace(QQ, 3) sage: A3.Hom(A2) # indirect doctest Set of morphisms From: Affine Space of dimension 3 over Rational Field To: Affine Space of dimension 2 over Rational Field sage: from sage.schemes.generic.homset import SchemeHomsetFactory sage: SHOMfactory = SchemeHomsetFactory('test') - sage: key, extra = SHOMfactory.create_key_and_extra_args(A3,A2,check=False) + sage: key, extra = SHOMfactory.create_key_and_extra_args(A3, A2, check=False) sage: key (..., ..., Category of schemes over Rational Field, False) sage: extra @@ -187,8 +187,8 @@ def create_object(self, version, key, **extra_args): EXAMPLES:: - sage: A2 = AffineSpace(QQ,2) - sage: A3 = AffineSpace(QQ,3) + sage: A2 = AffineSpace(QQ, 2) + sage: A3 = AffineSpace(QQ, 3) sage: A3.Hom(A2) is A3.Hom(A2) # indirect doctest True sage: from sage.schemes.generic.homset import SchemeHomsetFactory @@ -253,8 +253,8 @@ def __reduce__(self): EXAMPLES:: - sage: A2 = AffineSpace(QQ,2) - sage: A3 = AffineSpace(QQ,3) + sage: A2 = AffineSpace(QQ, 2) + sage: A3 = AffineSpace(QQ, 3) sage: Hom = A3.Hom(A2) sage: loads(Hom.dumps()) == Hom True @@ -271,7 +271,7 @@ def __call__(self, *args, **kwds): EXAMPLES:: - sage: A2 = AffineSpace(QQ,2) + sage: A2 = AffineSpace(QQ, 2) sage: A2(4,5) (4, 5) """ @@ -372,7 +372,7 @@ def _element_constructor_(self, x, check=True): sage: R. = QQ[] sage: A. = AffineSpace(R) - sage: C = A.subscheme(x*y-1) + sage: C = A.subscheme(x*y - 1) sage: H = C.Hom(C); H Set of morphisms From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: @@ -448,7 +448,7 @@ def __reduce__(self): EXAMPLES:: - sage: A2 = AffineSpace(QQ,2) + sage: A2 = AffineSpace(QQ, 2) sage: Hom = A2(QQ) sage: loads(Hom.dumps()) == Hom True @@ -481,7 +481,7 @@ def _coerce_map_from_(self, other): sage: A. = AffineSpace(QQ, 3) sage: H = A.subscheme(z) - sage: L = A.subscheme([z, y+z]) + sage: L = A.subscheme([z, y + z]) sage: A(QQ)._coerce_map_from_(H(QQ)) True sage: H(QQ)._coerce_map_from_(L(QQ)) @@ -516,10 +516,10 @@ def _coerce_map_from_(self, other): :: sage: PS = ProjectiveSpace(ZZ, 1, 'x') - sage: PS2 = ProjectiveSpace(Zp(7), 1, 'x') - sage: PS(ZZ).has_coerce_map_from(PS2(Zp(7))) + sage: PS2 = ProjectiveSpace(Zp(7), 1, 'x') # optional - sage.rings.padics + sage: PS(ZZ).has_coerce_map_from(PS2(Zp(7))) # optional - sage.rings.padics False - sage: PS2(Zp(7)).has_coerce_map_from(PS(ZZ)) + sage: PS2(Zp(7)).has_coerce_map_from(PS(ZZ)) # optional - sage.rings.padics True :: @@ -536,16 +536,16 @@ def _coerce_map_from_(self, other): :: - sage: K. = QuadraticField(2) - sage: A. = AffineSpace(QQ, 3) - sage: H = A.subscheme(z) - sage: A(K).has_coerce_map_from(H(QQ)) + sage: K. = QuadraticField(2) # optional - sage.rings.number_field + sage: A. = AffineSpace(QQ, 3) # optional - sage.rings.number_field + sage: H = A.subscheme(z) # optional - sage.rings.number_field + sage: A(K).has_coerce_map_from(H(QQ)) # optional - sage.rings.number_field True TESTS:: sage: P. = ProjectiveSpace(QQ, 1) - sage: X = P. subscheme ([x-y]) + sage: X = P.subscheme([x - y]) sage: P(1,1) == X(1,1) True @@ -631,24 +631,24 @@ def _element_constructor_(self, *v, **kwds): EXAMPLES:: - sage: A2 = AffineSpace(ZZ,2) + sage: A2 = AffineSpace(ZZ, 2) sage: F = GF(3) sage: F_points = A2(F); type(F_points) sage: F_points([2,5]) (2, 2) - sage: P2 = ProjectiveSpace(GF(3),2) - sage: F. = GF(9,'a') - sage: F_points = P2(F) - sage: type(F_points) + sage: P2 = ProjectiveSpace(GF(3), 2) # optional - sage.rings.finite_rings + sage: F. = GF(9, 'a') # optional - sage.rings.finite_rings + sage: F_points = P2(F) # optional - sage.rings.finite_rings + sage: type(F_points) # optional - sage.rings.finite_rings - sage: F_points([4,2*a]) + sage: F_points([4,2*a]) # optional - sage.rings.finite_rings (1 : 2*a : 1) TESTS:: - sage: F_points._element_constructor_([4,2*a]) + sage: F_points._element_constructor_([4,2*a]) # optional - sage.rings.finite_rings (1 : 2*a : 1) """ if len(v) == 1: @@ -667,16 +667,16 @@ def extended_codomain(self): EXAMPLES:: - sage: P2 = ProjectiveSpace(QQ,2) - sage: K. = NumberField(x^2 + x - (3^3-3)) - sage: K_points = P2(K); K_points + sage: P2 = ProjectiveSpace(QQ, 2) + sage: K. = NumberField(x^2 + x - (3^3-3)) # optional - sage.rings.number_field + sage: K_points = P2(K); K_points # optional - sage.rings.number_field Set of rational points of Projective Space of dimension 2 over Number Field in a with defining polynomial x^2 + x - 24 - sage: K_points.codomain() + sage: K_points.codomain() # optional - sage.rings.number_field Projective Space of dimension 2 over Rational Field - sage: K_points.extended_codomain() + sage: K_points.extended_codomain() # optional - sage.rings.number_field Projective Space of dimension 2 over Number Field in a with defining polynomial x^2 + x - 24 """ @@ -700,7 +700,7 @@ def _repr_(self): EXAMPLES:: - sage: P2 = ProjectiveSpace(ZZ,2) + sage: P2 = ProjectiveSpace(ZZ, 2) sage: P2(QQ)._repr_() 'Set of rational points of Projective Space of dimension 2 over Rational Field' """ @@ -716,7 +716,7 @@ def value_ring(self): EXAMPLES:: - sage: P2 = ProjectiveSpace(ZZ,2) + sage: P2 = ProjectiveSpace(ZZ, 2) sage: P2(QQ).value_ring() Rational Field """ @@ -738,8 +738,8 @@ def cardinality(self): sage: toric_varieties.P2().point_set().cardinality() +Infinity - sage: P2 = toric_varieties.P2(base_ring=GF(3)) - sage: P2.point_set().cardinality() + sage: P2 = toric_varieties.P2(base_ring=GF(3)) # optional - sage.rings.finite_rings + sage: P2.point_set().cardinality() # optional - sage.rings.finite_rings 13 """ if hasattr(self, 'is_finite') and not self.is_finite(): @@ -759,8 +759,8 @@ def list(self): EXAMPLES:: - sage: P1 = toric_varieties.P1(base_ring=GF(3)) - sage: P1.point_set().list() + sage: P1 = toric_varieties.P1(base_ring=GF(3)) # optional - sage.rings.finite_rings + sage: P1.point_set().list() # optional - sage.rings.finite_rings ([0 : 1], [1 : 0], [1 : 1], [1 : 2]) """ return tuple(self) diff --git a/src/sage/schemes/generic/hypersurface.py b/src/sage/schemes/generic/hypersurface.py index 090ffacf59a..94349a1b92c 100644 --- a/src/sage/schemes/generic/hypersurface.py +++ b/src/sage/schemes/generic/hypersurface.py @@ -31,13 +31,13 @@ def is_Hypersurface(self): sage: from sage.schemes.generic.hypersurface import is_Hypersurface sage: R. = ZZ[] - sage: H = ProjectiveHypersurface(x*z+y^2) + sage: H = ProjectiveHypersurface(x*z + y^2) sage: is_Hypersurface(H) True :: - sage: H = AffineHypersurface(x*z+y^2) + sage: H = AffineHypersurface(x*z + y^2) sage: is_Hypersurface(H) True @@ -56,13 +56,13 @@ class ProjectiveHypersurface(AlgebraicScheme_subscheme_projective): EXAMPLES:: sage: P. = ProjectiveSpace(ZZ, 2) - sage: ProjectiveHypersurface(x-y, P) + sage: ProjectiveHypersurface(x - y, P) Projective hypersurface defined by x - y in Projective Space of dimension 2 over Integer Ring :: sage: R. = QQ[] - sage: ProjectiveHypersurface(x-y) + sage: ProjectiveHypersurface(x - y) Projective hypersurface defined by x - y in Projective Space of dimension 2 over Rational Field """ @@ -77,18 +77,18 @@ def __init__(self, poly, ambient=None): EXAMPLES:: sage: P. = ProjectiveSpace(ZZ, 2) - sage: ProjectiveHypersurface(x-y, P) + sage: ProjectiveHypersurface(x - y, P) Projective hypersurface defined by x - y in Projective Space of dimension 2 over Integer Ring :: sage: R. = QQ[] - sage: ProjectiveHypersurface(x-y) + sage: ProjectiveHypersurface(x - y) Projective hypersurface defined by x - y in Projective Space of dimension 2 over Rational Field TESTS:: - sage: H = ProjectiveHypersurface(x-y) + sage: H = ProjectiveHypersurface(x - y) sage: H == loads(dumps(H)) True """ @@ -111,7 +111,7 @@ def _repr_(self): EXAMPLES:: sage: R. = ZZ[] - sage: H = ProjectiveHypersurface(x*z+y^2) + sage: H = ProjectiveHypersurface(x*z + y^2) sage: H Projective hypersurface defined by y^2 + x*z in Projective Space of dimension 2 over Integer Ring sage: H._repr_() @@ -128,7 +128,7 @@ def defining_polynomial(self): EXAMPLES:: sage: R. = ZZ[] - sage: H = ProjectiveHypersurface(x*z+y^2) + sage: H = ProjectiveHypersurface(x*z + y^2) sage: H.defining_polynomial() y^2 + x*z """ @@ -142,13 +142,13 @@ class AffineHypersurface(AlgebraicScheme_subscheme_affine): EXAMPLES:: sage: A. = AffineSpace(ZZ, 3) - sage: AffineHypersurface(x*y-z^3, A) + sage: AffineHypersurface(x*y - z^3, A) Affine hypersurface defined by -z^3 + x*y in Affine Space of dimension 3 over Integer Ring :: sage: A. = QQ[] - sage: AffineHypersurface(x*y-z^3) + sage: AffineHypersurface(x*y - z^3) Affine hypersurface defined by -z^3 + x*y in Affine Space of dimension 3 over Rational Field """ def __init__(self, poly, ambient=None): @@ -162,18 +162,18 @@ def __init__(self, poly, ambient=None): EXAMPLES:: sage: A. = AffineSpace(ZZ, 3) - sage: AffineHypersurface(x*y-z^3, A) + sage: AffineHypersurface(x*y - z^3, A) Affine hypersurface defined by -z^3 + x*y in Affine Space of dimension 3 over Integer Ring :: sage: A. = QQ[] - sage: AffineHypersurface(x*y-z^3) + sage: AffineHypersurface(x*y - z^3) Affine hypersurface defined by -z^3 + x*y in Affine Space of dimension 3 over Rational Field TESTS:: - sage: H = AffineHypersurface(x*y-z^3) + sage: H = AffineHypersurface(x*y - z^3) sage: H == loads(dumps(H)) True """ @@ -194,7 +194,7 @@ def _repr_(self): EXAMPLES:: sage: R. = ZZ[] - sage: H = AffineHypersurface(x*z+y^2) + sage: H = AffineHypersurface(x*z + y^2) sage: H Affine hypersurface defined by y^2 + x*z in Affine Space of dimension 3 over Integer Ring sage: H._repr_() @@ -211,7 +211,7 @@ def defining_polynomial(self): EXAMPLES:: sage: R. = ZZ[] - sage: H = AffineHypersurface(x*z+y^2) + sage: H = AffineHypersurface(x*z + y^2) sage: H.defining_polynomial() y^2 + x*z """ diff --git a/src/sage/schemes/generic/morphism.py b/src/sage/schemes/generic/morphism.py index d3fe7abd885..bff4d5442d4 100644 --- a/src/sage/schemes/generic/morphism.py +++ b/src/sage/schemes/generic/morphism.py @@ -105,8 +105,8 @@ def is_SchemeMorphism(f): EXAMPLES:: - sage: A. = AffineSpace(QQ,2); H = A.Hom(A) - sage: f = H([y,x^2+y]); f + sage: A. = AffineSpace(QQ, 2); H = A.Hom(A) + sage: f = H([y, x^2 + y]); f Scheme endomorphism of Affine Space of dimension 2 over Rational Field Defn: Defined on coordinates by sending (x, y) to (y, x^2 + y) @@ -143,7 +143,7 @@ class SchemeMorphism(Element): TESTS:: - sage: A2 = AffineSpace(QQ,2) + sage: A2 = AffineSpace(QQ, 2) sage: A2.structure_morphism().domain() Affine Space of dimension 2 over Rational Field sage: A2.structure_morphism().category() @@ -179,7 +179,7 @@ def domain(self): sage: A. = AffineSpace(QQ['x,y']) sage: H = A.Hom(A) - sage: f = H([y,x^2+y]) + sage: f = H([y, x^2 + y]) sage: f.domain() is A True """ @@ -194,7 +194,7 @@ def codomain(self): sage: A. = AffineSpace(QQ['x,y']) sage: H = A.Hom(A) - sage: f = H([y,x^2+y]) + sage: f = H([y, x^2 + y]) sage: f.codomain() is A True """ @@ -217,17 +217,17 @@ def __call__(self, x, *args, **kwds): sage: R. = QQ[] sage: A. = AffineSpace(R) sage: H = A.Hom(A) - sage: f = H([y,x^2+y]) + sage: f = H([y, x^2 + y]) sage: f([2,3]) # indirect doctest (3, 7) An example with optional arguments:: - sage: PS.=ProjectiveSpace(QQ,1) - sage: H=Hom(PS,PS) - sage: f=H([x^3,x*y^2]) - sage: P=PS(0,1) - sage: f(P,check=False) # indirect doctest + sage: PS. = ProjectiveSpace(QQ, 1) + sage: H = Hom(PS, PS) + sage: f = H([x^3, x*y^2]) + sage: P = PS(0, 1) + sage: f(P, check=False) # indirect doctest (0 : 0) """ P = parent(x) @@ -302,7 +302,7 @@ def _repr_type(self): EXAMPLES:: - sage: A2 = AffineSpace(QQ,2) + sage: A2 = AffineSpace(QQ, 2) sage: A2.structure_morphism() # indirect doctest Scheme morphism: From: Affine Space of dimension 2 over Rational Field @@ -353,7 +353,7 @@ def __mul__(self, right): Identity maps do not contribute to the product:: - sage: X = AffineSpace(QQ,2) + sage: X = AffineSpace(QQ, 2) sage: id = X.identity_morphism() sage: id^0 # indirect doctest Scheme endomorphism of Affine Space of dimension 2 over Rational Field @@ -364,7 +364,7 @@ def __mul__(self, right): Here, we see a formal composition:: - sage: X = AffineSpace(QQ,2) + sage: X = AffineSpace(QQ, 2) sage: f = X.structure_morphism() sage: Y = Spec(QQ) sage: g = Y.structure_morphism() @@ -418,7 +418,7 @@ def __pow__(self, n, dummy=None): EXAMPLES:: - sage: X = AffineSpace(QQ,2) + sage: X = AffineSpace(QQ, 2) sage: id = X.identity_morphism() sage: id^0 Scheme endomorphism of Affine Space of dimension 2 over Rational Field @@ -443,7 +443,7 @@ def category(self): EXAMPLES:: - sage: A2 = AffineSpace(QQ,2) + sage: A2 = AffineSpace(QQ, 2) sage: A2.structure_morphism().category() Category of homsets of schemes """ @@ -455,7 +455,7 @@ def category_for(self): EXAMPLES:: - sage: A2 = AffineSpace(QQ,2) + sage: A2 = AffineSpace(QQ, 2) sage: A2.structure_morphism().category_for() Category of schemes """ @@ -471,7 +471,7 @@ def is_endomorphism(self) -> bool: EXAMPLES:: - sage: X = AffineSpace(QQ,2) + sage: X = AffineSpace(QQ, 2) sage: X.structure_morphism().is_endomorphism() False sage: X.identity_morphism().is_endomorphism() @@ -491,7 +491,7 @@ def base_ring(self): EXAMPLES:: sage: P. = ProjectiveSpace(QQ, 1) - sage: H = Hom(P,P) + sage: H = Hom(P, P) sage: f = H([3/5*x^2, 6*y^2]) sage: f.base_ring() Rational Field @@ -514,9 +514,9 @@ def base_ring(self): :: - sage: E = EllipticCurve(GF((17,2)), [1,2,3,4,5]) - sage: P = E.random_point() - sage: P.base_ring() + sage: E = EllipticCurve(GF((17,2)), [1,2,3,4,5]) # optional - sage.rings.finite_rings + sage: P = E.random_point() # optional - sage.rings.finite_rings + sage: P.base_ring() # optional - sage.rings.finite_rings Finite Field in z2 of size 17^2 """ return self.domain().base_ring() @@ -532,7 +532,7 @@ def _composition(self, right): EXAMPLES:: - sage: X = AffineSpace(QQ,2) + sage: X = AffineSpace(QQ, 2) sage: f = X.structure_morphism() sage: Y = Spec(QQ) sage: g = Y.structure_morphism() @@ -582,7 +582,7 @@ def _composition_(self, right, homset): EXAMPLES:: - sage: X = AffineSpace(QQ,2) + sage: X = AffineSpace(QQ, 2) sage: f = X.structure_morphism() sage: Y = Spec(QQ) sage: g = Y.structure_morphism() @@ -956,8 +956,8 @@ class SchemeMorphism_polynomial(SchemeMorphism): sage: R. = QQ[] sage: A2 = AffineSpace(R) sage: H = A2.Hom(A2) - sage: f = H([x-y, x*y]) - sage: f([0,1]) + sage: f = H([x - y, x*y]) + sage: f([0, 1]) (-1, 0) An example involving the projective line:: @@ -965,8 +965,8 @@ class SchemeMorphism_polynomial(SchemeMorphism): sage: R. = QQ[] sage: P1 = ProjectiveSpace(R) sage: H = P1.Hom(P1) - sage: f = H([x^2+y^2,x*y]) - sage: f([0,1]) + sage: f = H([x^2 + y^2, x*y]) + sage: f([0, 1]) (1 : 0) Some checks are performed to make sure the given polynomials @@ -987,9 +987,9 @@ def __init__(self, parent, polys, check=True): EXAMPLES:: - sage: A2. = AffineSpace(QQ,2) + sage: A2. = AffineSpace(QQ, 2) sage: H = A2.Hom(A2) - sage: H([x-y, x*y]) + sage: H([x - y, x*y]) Scheme endomorphism of Affine Space of dimension 2 over Rational Field Defn: Defined on coordinates by sending (x, y) to (x - y, x*y) @@ -1054,7 +1054,7 @@ def defining_polynomials(self): sage: R. = QQ[] sage: A. = AffineSpace(R) sage: H = A.Hom(A) - sage: H([x^3+y, 1-x-y]).defining_polynomials() + sage: H([x^3 + y, 1 - x - y]).defining_polynomials() (x^3 + y, -x - y + 1) """ return self._polys @@ -1077,8 +1077,8 @@ def _call_(self, x): sage: R. = QQ[] sage: A. = AffineSpace(R) sage: H = A.Hom(A) - sage: f = H([y,x^2+y]) - sage: f([2,3]) # indirect doctest + sage: f = H([y, x^2 + y]) + sage: f([2, 3]) # indirect doctest (3, 7) An example with algebraic schemes:: @@ -1112,24 +1112,24 @@ def _call_(self, x): It is possible to avoid the checks on the resulting point which can be useful for indeterminacies, but be careful!! :: - sage: PS.=ProjectiveSpace(QQ,1) - sage: H=Hom(PS,PS) - sage: f=H([x^3,x*y^2]) - sage: P=PS(0,1) - sage: f(P,check=False) + sage: PS. = ProjectiveSpace(QQ, 1) + sage: H = Hom(PS, PS) + sage: f = H([x^3, x*y^2]) + sage: P = PS(0,1) + sage: f(P, check=False) (0 : 0) - sage: P.=ProjectiveSpace(ZZ,2) - sage: X=P.subscheme(x^2-y^2) - sage: H=Hom(X,X) - sage: f=H([x^2,y^2,z^2]) + sage: P. = ProjectiveSpace(ZZ, 2) + sage: X = P.subscheme(x^2 - y^2) + sage: H = Hom(X, X) + sage: f = H([x^2, y^2, z^2]) sage: f([4,4,1]) (16 : 16 : 1) - sage: P.=ProjectiveSpace(ZZ,2) - sage: X=P.subscheme(x^2-y^2) - sage: H=Hom(X,X) - sage: f=H([x^2,y^2,z^2]) + sage: P. = ProjectiveSpace(ZZ, 2) + sage: X = P.subscheme(x^2 - y^2) + sage: H = Hom(X, X) + sage: f = H([x^2, y^2, z^2]) sage: f(P([4,4,1])) (16 : 16 : 1) """ @@ -1155,7 +1155,7 @@ def _call_with_args(self, x, args, kwds): sage: R. = QQ[] sage: A. = AffineSpace(R) sage: H = A.Hom(A) - sage: f = H([y,x^2+y]) + sage: f = H([y, x^2 + y]) sage: f([2,3]) (3, 7) @@ -1190,19 +1190,19 @@ def _call_with_args(self, x, args, kwds): It is possible to avoid the checks on the resulting point which can be useful for indeterminacies, but be careful!! :: - sage: PS.=ProjectiveSpace(QQ,1) - sage: H=Hom(PS,PS) - sage: f=H([x^3,x*y^2]) - sage: P=PS(0,1) - sage: f(P,check=False) # indirect doctest + sage: PS. = ProjectiveSpace(QQ, 1) + sage: H = Hom(PS,PS) + sage: f = H([x^3, x*y^2]) + sage: P = PS(0,1) + sage: f(P, check=False) # indirect doctest (0 : 0) :: - sage: P.=ProjectiveSpace(ZZ,2) - sage: X=P.subscheme(x^2-y^2) - sage: H=Hom(X,X) - sage: f=H([x^2,y^2,z^2]) + sage: P. = ProjectiveSpace(ZZ, 2) + sage: X = P.subscheme(x^2 - y^2) + sage: H = Hom(X, X) + sage: f = H([x^2, y^2, z^2]) sage: f([4,4,1]) (16 : 16 : 1) @@ -1210,7 +1210,7 @@ def _call_with_args(self, x, args, kwds): sage: P. = ProjectiveSpace(ZZ, 2) sage: P2. = ProjectiveSpace(ZZ, 3) - sage: X = P.subscheme(x^2-y^2) + sage: X = P.subscheme(x^2 - y^2) sage: H = Hom(X, X) sage: f = H([x^2, y^2, z^2]) sage: f(P2([4,4,1,1])) @@ -1241,7 +1241,7 @@ def _repr_defn(self): sage: R. = QQ[] sage: A. = AffineSpace(R) sage: H = A.Hom(A) - sage: f = H([y,x^2+y]) + sage: f = H([y, x^2 + y]) sage: print(f._repr_defn()) Defined on coordinates by sending (x, y) to (y, x^2 + y) @@ -1264,9 +1264,9 @@ def __getitem__(self, i): EXAMPLES:: - sage: P. = ProjectiveSpace(QQ,1) - sage: H = Hom(P,P) - sage: f = H([3/5*x^2,6*y^2]) + sage: P. = ProjectiveSpace(QQ, 1) + sage: H = Hom(P, P) + sage: f = H([3/5*x^2, 6*y^2]) sage: f[1] 6*y^2 """ @@ -1282,7 +1282,7 @@ def __copy__(self): EXAMPLES:: - sage: P. = ProjectiveSpace(QQ,1) + sage: P. = ProjectiveSpace(QQ, 1) sage: H = Hom(P, P) sage: f = H([3/5*x^2, 6*y^2]) sage: g = copy(f) @@ -1293,7 +1293,7 @@ def __copy__(self): :: - sage: P. = ProjectiveSpace(QQ,2) + sage: P. = ProjectiveSpace(QQ, 2) sage: X = P.subscheme(x^2 - y^2) sage: Q = X(23, 23, 46) sage: P = X(1, 1, 1) @@ -1313,18 +1313,18 @@ def coordinate_ring(self): EXAMPLES:: - sage: P.=ProjectiveSpace(QQ,1) - sage: H=Hom(P,P) - sage: f=H([3/5*x^2,6*y^2]) + sage: P. = ProjectiveSpace(QQ, 1) + sage: H = Hom(P, P) + sage: f = H([3/5*x^2, 6*y^2]) sage: f.coordinate_ring() Multivariate Polynomial Ring in x, y over Rational Field :: - sage: R.=PolynomialRing(ZZ,1) - sage: P.=ProjectiveSpace(R,1) - sage: H=Hom(P,P) - sage: f=H([3*x^2,y^2]) + sage: R. = PolynomialRing(ZZ, 1) + sage: P. = ProjectiveSpace(R, 1) + sage: H = Hom(P, P) + sage: f = H([3*x^2, y^2]) sage: f.coordinate_ring() Multivariate Polynomial Ring in x, y over Multivariate Polynomial Ring in t over Integer Ring @@ -1351,25 +1351,26 @@ def change_ring(self, R, check=True): sage: R. = QQ[] sage: K. = QuadraticField(2) - sage: K2. = NumberField(t**4-2) - sage: P. = ProjectiveSpace(QQ,1) - sage: phi = K.embeddings(K2)[0] - sage: f = DynamicalSystem_projective([x**2+3*y**2,y**2]) - sage: f.change_ring(phi) - Dynamical System of Projective Space of dimension 1 over Number Field in w with defining polynomial t^4 - 2 + sage: K2. = NumberField(t**4 - 2) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(QQ, 1) # optional - sage.rings.number_field + sage: phi = K.embeddings(K2)[0] # optional - sage.rings.number_field + sage: f = DynamicalSystem_projective([x**2 + 3*y**2, y**2]) # optional - sage.rings.number_field + sage: f.change_ring(phi) # optional - sage.rings.number_field + Dynamical System of Projective Space of dimension 1 over + Number Field in w with defining polynomial t^4 - 2 Defn: Defined on coordinates by sending (x : y) to (x^2 + 3*y^2 : y^2) :: sage: R. = QQ[] - sage: K. = QuadraticField(2) - sage: K1. = NumberField(t^4-2) - sage: K2. = NumberField(t^8-2) - sage: P. = ProjectiveSpace(K,1) - sage: phi = K1.embeddings(K2)[0] - sage: f = DynamicalSystem_projective([x^2+3*y^2,y^2]) - sage: f.change_ring(phi) + sage: K. = QuadraticField(2) # optional - sage.rings.number_field + sage: K1. = NumberField(t^4 - 2) # optional - sage.rings.number_field + sage: K2. = NumberField(t^8 - 2) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: phi = K1.embeddings(K2)[0] # optional - sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2 + 3*y^2, y^2]) # optional - sage.rings.number_field + sage: f.change_ring(phi) # optional - sage.rings.number_field Traceback (most recent call last): ... ValueError: no canonical coercion of base ring of morphism to domain of embedding @@ -1378,9 +1379,9 @@ def change_ring(self, R, check=True): EXAMPLES:: sage: P. = ProjectiveSpace(ZZ, 1) - sage: H = Hom(P,P) + sage: H = Hom(P, P) sage: f = H([3*x^2, y^2]) - sage: f.change_ring(GF(3)) + sage: f.change_ring(GF(3)) # optional - sage.rings.finite_rings Scheme endomorphism of Projective Space of dimension 1 over Finite Field of size 3 Defn: Defined on coordinates by sending (x : y) to (0 : y^2) @@ -1388,9 +1389,9 @@ def change_ring(self, R, check=True): :: sage: P. = ProjectiveSpace(QQ, 2) - sage: H = Hom(P,P) - sage: f = H([5/2*x^3 + 3*x*y^2-y^3, 3*z^3 + y*x^2, x^3-z^3]) - sage: f.change_ring(GF(3)) + sage: H = Hom(P, P) + sage: f = H([5/2*x^3 + 3*x*y^2 - y^3, 3*z^3 + y*x^2, x^3 - z^3]) + sage: f.change_ring(GF(3)) # optional - sage.rings.finite_rings Scheme endomorphism of Projective Space of dimension 2 over Finite Field of size 3 Defn: Defined on coordinates by sending (x : y : z) to (x^3 - y^3 : x^2*y : x^3 - z^3) @@ -1399,9 +1400,9 @@ def change_ring(self, R, check=True): sage: P. = ProjectiveSpace(QQ, 1) sage: X = P.subscheme([5*x^2 - y^2]) - sage: H = Hom(X,X) + sage: H = Hom(X, X) sage: f = H([x, y]) - sage: f.change_ring(GF(3)) + sage: f.change_ring(GF(3)) # optional - sage.rings.finite_rings Scheme endomorphism of Closed subscheme of Projective Space of dimension 1 over Finite Field of size 3 defined by: -x^2 - y^2 @@ -1412,8 +1413,8 @@ def change_ring(self, R, check=True): Check that :trac:`16834` is fixed:: sage: A. = AffineSpace(RR, 3) - sage: h = Hom(A,A) - sage: f = h([x^2+1.5, y^3, z^5-2.0]) + sage: h = Hom(A, A) + sage: f = h([x^2 + 1.5, y^3, z^5 - 2.0]) sage: f.change_ring(CC) Scheme endomorphism of Affine Space of dimension 3 over Complex Field with 53 bits of precision Defn: Defined on coordinates by sending (x, y, z) to @@ -1434,8 +1435,8 @@ def change_ring(self, R, check=True): :: - sage: A. = AffineSpace(QQ,2) - sage: H = Hom(A,A) + sage: A. = AffineSpace(QQ, 2) + sage: H = Hom(A, A) sage: f = H([3*x^2/y, y^2/x]) sage: f.change_ring(RR) Scheme endomorphism of Affine Space of dimension 2 over Real Field with @@ -1446,17 +1447,17 @@ def change_ring(self, R, check=True): :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^3-x+1) - sage: P. = ProjectiveSpace(K, 1) - sage: H = End(P) - sage: f = H([x^2 + a*x*y + a^2*y^2, y^2]) - sage: emb = K.embeddings(QQbar) - sage: f.change_ring(emb[0]) + sage: K. = NumberField(x^3 - x + 1) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: H = End(P) # optional - sage.rings.number_field + sage: f = H([x^2 + a*x*y + a^2*y^2, y^2]) # optional - sage.rings.number_field + sage: emb = K.embeddings(QQbar) # optional - sage.rings.number_field + sage: f.change_ring(emb[0]) # optional - sage.rings.number_field Scheme endomorphism of Projective Space of dimension 1 over Algebraic Field Defn: Defined on coordinates by sending (x : y) to (x^2 + (-1.324717957244746?)*x*y + 1.754877666246693?*y^2 : y^2) - sage: f.change_ring(emb[1]) + sage: f.change_ring(emb[1]) # optional - sage.rings.number_field Scheme endomorphism of Projective Space of dimension 1 over Algebraic Field Defn: Defined on coordinates by sending (x : y) to @@ -1465,11 +1466,11 @@ def change_ring(self, R, check=True): :: - sage: K. = QuadraticField(2, embedding=QQbar(sqrt(2))) - sage: P. = ProjectiveSpace(K, 1) - sage: H = End(P) - sage: f = H([x^2+v*y^2, y^2]) - sage: f.change_ring(QQbar) + sage: K. = QuadraticField(2, embedding=QQbar(sqrt(2))) # optional - sage.rings.number_field sage.symbolic + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field sage.symbolic + sage: H = End(P) # optional - sage.rings.number_field sage.symbolic + sage: f = H([x^2 + v*y^2, y^2]) # optional - sage.rings.number_field sage.symbolic + sage: f.change_ring(QQbar) # optional - sage.rings.number_field sage.symbolic Scheme endomorphism of Projective Space of dimension 1 over Algebraic Field Defn: Defined on coordinates by sending (x : y) to @@ -1479,12 +1480,12 @@ def change_ring(self, R, check=True): sage: from sage.misc.verbose import set_verbose sage: set_verbose(-1) - sage: K. = QuadraticField(2, embedding=QQbar(-sqrt(2))) - sage: P. = ProjectiveSpace(K, 1) - sage: X = P.subscheme(x-y) - sage: H = End(X) - sage: f = H([6*x^2+2*x*y+16*y^2, -w*x^2-4*x*y-4*y^2]) - sage: f.change_ring(QQbar) + sage: K. = QuadraticField(2, embedding=QQbar(-sqrt(2))) # optional - sage.rings.number_field sage.symbolic + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field sage.symbolic + sage: X = P.subscheme(x - y) # optional - sage.rings.number_field sage.symbolic + sage: H = End(X) # optional - sage.rings.number_field sage.symbolic + sage: f = H([6*x^2 + 2*x*y + 16*y^2, -w*x^2 - 4*x*y - 4*y^2]) # optional - sage.rings.number_field sage.symbolic + sage: f.change_ring(QQbar) # optional - sage.rings.number_field sage.symbolic Scheme endomorphism of Closed subscheme of Projective Space of dimension 1 over Algebraic Field defined by: x - y @@ -1494,24 +1495,24 @@ def change_ring(self, R, check=True): :: sage: R. = QQ[] - sage: f = x^6-2 - sage: L. = NumberField(f, embedding=f.roots(QQbar)[1][0]) - sage: A. = AffineSpace(L,2) - sage: H = Hom(A,A) - sage: F = H([b*x/y, 1+y]) - sage: F.change_ring(QQbar) + sage: f = x^6 - 2 + sage: L. = NumberField(f, embedding=f.roots(QQbar)[1][0]) # optional - sage.rings.number_field + sage: A. = AffineSpace(L, 2) # optional - sage.rings.number_field + sage: H = Hom(A, A) # optional - sage.rings.number_field + sage: F = H([b*x/y, 1 + y]) # optional - sage.rings.number_field + sage: F.change_ring(QQbar) # optional - sage.rings.number_field Scheme endomorphism of Affine Space of dimension 2 over Algebraic Field Defn: Defined on coordinates by sending (x, y) to (1.122462048309373?*x/y, y + 1) :: - sage: K. = QuadraticField(-1) - sage: A. = AffineSpace(K, 2) - sage: H = End(A) - sage: phi = H([x/y, y]) - sage: emb = K.embeddings(QQbar)[0] - sage: phi.change_ring(emb) + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 2) # optional - sage.rings.number_field + sage: H = End(A) # optional - sage.rings.number_field + sage: phi = H([x/y, y]) # optional - sage.rings.number_field + sage: emb = K.embeddings(QQbar)[0] # optional - sage.rings.number_field + sage: phi.change_ring(emb) # optional - sage.rings.number_field Scheme endomorphism of Affine Space of dimension 2 over Algebraic Field Defn: Defined on coordinates by sending (x, y) to (x/y, y) @@ -1581,8 +1582,8 @@ def specialization(self, D=None, phi=None, homset=None): sage: R. = PolynomialRing(QQ) sage: P. = ProjectiveSpace(R, 1) sage: H = End(P) - sage: f = H([x^2 + c*y^2,y^2]) - sage: f.specialization({c:1}) + sage: f = H([x^2 + c*y^2, y^2]) + sage: f.specialization({c: 1}) Scheme endomorphism of Projective Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x : y) to (x^2 + y^2 : y^2) @@ -1594,12 +1595,12 @@ def specialization(self, D=None, phi=None, homset=None): sage: H = End(P) sage: f = H([x^3 + a*x*y^2 + b*y^3, y^3]) sage: from sage.rings.polynomial.flatten import SpecializationMorphism - sage: phi = SpecializationMorphism(P.coordinate_ring(), dict({a:2,b:-1})) + sage: phi = SpecializationMorphism(P.coordinate_ring(), {a: 2, b: -1}) sage: F = f.specialization(phi=phi); F Scheme endomorphism of Projective Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x : y) to (x^3 + 2*x*y^2 - y^3 : y^3) - sage: g = H([x^2 + a*y^2,y^2]) + sage: g = H([x^2 + a*y^2, y^2]) sage: G = g.specialization(phi=phi) sage: G.parent() is F.parent() True @@ -1614,8 +1615,9 @@ def specialization(self, D=None, phi=None, homset=None): sage: X = P.subscheme([x - c*y]) sage: H = End(X) sage: f = H([x^2, c*y^2]) - sage: f.specialization({c:2}) - Scheme endomorphism of Closed subscheme of Projective Space of dimension 1 over Rational Field defined by: + sage: f.specialization({c: 2}) + Scheme endomorphism of Closed subscheme of Projective Space of dimension 1 + over Rational Field defined by: x - 2*y Defn: Defined on coordinates by sending (x : y) to (x^2 : 2*y^2) @@ -1623,10 +1625,10 @@ def specialization(self, D=None, phi=None, homset=None): :: sage: R. = QQ[] - sage: P. = ProjectiveSpace(R,1) + sage: P. = ProjectiveSpace(R, 1) sage: f = DynamicalSystem_projective([x^2 + c*y^2, y^2], domain=P) sage: F = f.dynatomic_polynomial(3) - sage: g = F.specialization({c:1}); g + sage: g = F.specialization({c: 1}); g x^6 + x^5*y + 4*x^4*y^2 + 3*x^3*y^3 + 7*x^2*y^4 + 4*x*y^5 + 5*y^6 sage: g == f.specialization({c:1}).dynatomic_polynomial(3) True @@ -1634,13 +1636,14 @@ def specialization(self, D=None, phi=None, homset=None): :: sage: R1. = QQ[] - sage: A. = AffineSpace(Frac(R1),1) + sage: A. = AffineSpace(Frac(R1), 1) sage: f = DynamicalSystem_affine([alpha/(x^2 + 1/alpha)/(x - 1/beta^2)]) - sage: f.specialization({alpha:5,beta:10}) + sage: f.specialization({alpha: 5, beta: 10}) Dynamical System of Affine Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x) to (5/(x^3 - 1/100*x^2 + 1/5*x - 1/500)) - sage: f.specialization({alpha:5}).specialization({beta:10}) == f.specialization({alpha:5,beta:10}) + sage: f_5_10 = f.specialization({alpha: 5}).specialization({beta: 10}) + sage: f_5_10 == f.specialization({alpha: 5, beta: 10}) True """ if D is None: @@ -1677,10 +1680,10 @@ def _composition_(self, other, homset): TESTS:: - sage: P. = ProjectiveSpace(QQ,1) - sage: H = Hom(P,P) - sage: f = H([x^2 -29/16*y^2, y^2]) - sage: g = H([y,x+y]) + sage: P. = ProjectiveSpace(QQ, 1) + sage: H = Hom(P, P) + sage: f = H([x^2 - 29/16*y^2, y^2]) + sage: g = H([y, x + y]) sage: h = f*g sage: h Scheme endomorphism of Projective Space of dimension 1 over Rational @@ -1691,9 +1694,9 @@ def _composition_(self, other, homset): sage: h(p) == f(g(p)) True - sage: Q = ProjectiveSpace(QQ,2) - sage: H2 = Hom(P,Q) - sage: h2 = H2([x^2+y^2,x^2,y^2+2*x^2]) + sage: Q = ProjectiveSpace(QQ, 2) + sage: H2 = Hom(P, Q) + sage: h2 = H2([x^2 + y^2, x^2, y^2 + 2*x^2]) sage: h2 * f Scheme morphism: From: Projective Space of dimension 1 over Rational Field @@ -1706,7 +1709,7 @@ def _composition_(self, other, homset): sage: A. = AffineSpace(QQ, 2) sage: A1. = AffineSpace(QQ, 1) sage: H = End(A) - sage: f = H([x^2+y^2, y^2/x]) + sage: f = H([x^2 + y^2, y^2/x]) sage: H1 = Hom(A, A1) sage: g = H1([x + y^2]) sage: g*f @@ -1729,17 +1732,19 @@ def _composition_(self, other, homset): Not both defined by polynomials:: sage: x = polygen(QQ) - sage: K. = NumberField(x^2 - 2) - sage: p1, p2 = K.Hom(K) - sage: R. = K[] - sage: q1 = R.Hom(R)(p1) - sage: A = AffineSpace(R) - sage: f1 = A.Hom(A)(q1) - sage: g = A.Hom(A)([x^2-y, y+1]) - sage: g*f1 + sage: K. = NumberField(x^2 - 2) # optional - sage.rings.number_field + sage: p1, p2 = K.Hom(K) # optional - sage.rings.number_field + sage: R. = K[] # optional - sage.rings.number_field + sage: q1 = R.Hom(R)(p1) # optional - sage.rings.number_field + sage: A = AffineSpace(R) # optional - sage.rings.number_field + sage: f1 = A.Hom(A)(q1) # optional - sage.rings.number_field + sage: g = A.Hom(A)([x^2 - y, y + 1]) # optional - sage.rings.number_field + sage: g*f1 # optional - sage.rings.number_field Composite map: - From: Affine Space of dimension 2 over Number Field in a with defining polynomial x^2 - 2 - To: Affine Space of dimension 2 over Number Field in a with defining polynomial x^2 - 2 + From: Affine Space of dimension 2 over Number Field in a + with defining polynomial x^2 - 2 + To: Affine Space of dimension 2 over Number Field in a + with defining polynomial x^2 - 2 Defn: Generic endomorphism of Affine Space of dimension 2 over Number Field in a with defining polynomial x^2 - 2 then Generic endomorphism of Affine Space of dimension 2 over Number Field in a with defining polynomial x^2 - 2 @@ -1978,30 +1983,30 @@ def change_ring(self, R, check=True): EXAMPLES:: sage: P. = ProjectiveSpace(ZZ, 2) - sage: X = P.subscheme(x^2-y^2) - sage: X(23,23,1).change_ring(GF(13)) + sage: X = P.subscheme(x^2 - y^2) + sage: X(23,23,1).change_ring(GF(13)) # optional - sage.rings.finite_rings (10 : 10 : 1) :: - sage: P. = ProjectiveSpace(QQ,1) + sage: P. = ProjectiveSpace(QQ, 1) sage: P(-2/3,1).change_ring(CC) (-0.666666666666667 : 1.00000000000000) :: - sage: P. = ProjectiveSpace(ZZ,1) - sage: P(152,113).change_ring(Zp(5)) + sage: P. = ProjectiveSpace(ZZ, 1) + sage: P(152,113).change_ring(Zp(5)) # optional - sage.rings.padics (2 + 5^2 + 5^3 + O(5^20) : 3 + 2*5 + 4*5^2 + O(5^20)) :: - sage: K. = QuadraticField(-7) - sage: O = K.maximal_order() - sage: P. = ProjectiveSpace(O, 1) - sage: H = End(P) - sage: F = H([x^2+O(v)*y^2, y^2]) - sage: F.change_ring(K).change_ring(K.embeddings(QQbar)[0]) + sage: K. = QuadraticField(-7) # optional - sage.rings.number_field + sage: O = K.maximal_order() # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(O, 1) # optional - sage.rings.number_field + sage: H = End(P) # optional - sage.rings.number_field + sage: F = H([x^2 + O(v)*y^2, y^2]) # optional - sage.rings.number_field + sage: F.change_ring(K).change_ring(K.embeddings(QQbar)[0]) # optional - sage.rings.number_field Scheme endomorphism of Projective Space of dimension 1 over Algebraic Field Defn: Defined on coordinates by sending (x : y) to (x^2 + (-2.645751311064591?*I)*y^2 : y^2) @@ -2009,31 +2014,31 @@ def change_ring(self, R, check=True): :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2-x+1) - sage: P. = ProjectiveSpace(K,1) - sage: Q = P([a+1,1]) - sage: emb = K.embeddings(QQbar) - sage: Q.change_ring(emb[0]) + sage: K. = NumberField(x^2 - x + 1) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: Q = P([a + 1, 1]) # optional - sage.rings.number_field + sage: emb = K.embeddings(QQbar) # optional - sage.rings.number_field + sage: Q.change_ring(emb[0]) # optional - sage.rings.number_field (1.5000000000000000? - 0.866025403784439?*I : 1) - sage: Q.change_ring(emb[1]) + sage: Q.change_ring(emb[1]) # optional - sage.rings.number_field (1.5000000000000000? + 0.866025403784439?*I : 1) :: - sage: K. = QuadraticField(2) - sage: P. = ProjectiveSpace(K,1) - sage: Q = P([v,1]) - sage: Q.change_ring(K.embeddings(QQbar)[0]) + sage: K. = QuadraticField(2) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: Q = P([v,1]) # optional - sage.rings.number_field + sage: Q.change_ring(K.embeddings(QQbar)[0]) # optional - sage.rings.number_field (-1.414213562373095? : 1) :: sage: R. = QQ[] - sage: f = x^6-2 - sage: L. = NumberField(f, embedding=f.roots(QQbar)[1][0]) - sage: A. = AffineSpace(L,2) - sage: P = A([b,1]) - sage: P.change_ring(QQbar) + sage: f = x^6 - 2 + sage: L. = NumberField(f, embedding=f.roots(QQbar)[1][0]) # optional - sage.rings.number_field + sage: A. = AffineSpace(L, 2) # optional - sage.rings.number_field + sage: P = A([b,1]) # optional - sage.rings.number_field + sage: P.change_ring(QQbar) # optional - sage.rings.number_field (1.122462048309373?, 1) """ S = self.codomain().change_ring(R) @@ -2083,7 +2088,7 @@ def specialization(self, D=None, phi=None, ambient=None): sage: R. = PolynomialRing(QQ) sage: P. = ProjectiveSpace(R, 1) sage: Q = P([c,1]) - sage: Q.specialization({c:1}) + sage: Q.specialization({c: 1}) (1 : 1) :: @@ -2092,7 +2097,7 @@ def specialization(self, D=None, phi=None, ambient=None): sage: P. = ProjectiveSpace(R, 1) sage: Q = P([a^2 + 2*a*b + 34, 1]) sage: from sage.rings.polynomial.flatten import SpecializationMorphism - sage: phi = SpecializationMorphism(P.coordinate_ring(),dict({a:2,b:-1})) + sage: phi = SpecializationMorphism(P.coordinate_ring(), {a: 2, b: -1}) sage: T = Q.specialization(phi=phi); T (34 : 1) sage: Q2 = P([a,1]) @@ -2122,8 +2127,8 @@ def specialization(self, D=None, phi=None, ambient=None): sage: K. = S[] sage: P. = ProjectiveSpace(K, 1) sage: H = End(P) - sage: Q = P([a^2,b^2]) - sage: Q.specialization({a:2}) + sage: Q = P([a^2, b^2]) + sage: Q.specialization({a: 2}) (4 : b^2) """ if D is None: diff --git a/src/sage/schemes/generic/point.py b/src/sage/schemes/generic/point.py index 0cadc10957e..601862993c7 100644 --- a/src/sage/schemes/generic/point.py +++ b/src/sage/schemes/generic/point.py @@ -165,8 +165,9 @@ def __init__(self, S, P, check=False): corresponding to a prime ideal:: sage: P2. = ProjectiveSpace(2, QQ) - sage: SchemeTopologicalPoint_prime_ideal(P2, y*z-x^2) - Point on Projective Space of dimension 2 over Rational Field defined by the Ideal (-x^2 + y*z) of Multivariate Polynomial Ring in x, y, z over Rational Field + sage: SchemeTopologicalPoint_prime_ideal(P2, y*z - x^2) + Point on Projective Space of dimension 2 over Rational Field defined by + the Ideal (-x^2 + y*z) of Multivariate Polynomial Ring in x, y, z over Rational Field """ R = S.coordinate_ring() from sage.rings.ideal import is_Ideal @@ -190,8 +191,9 @@ def _repr_(self): sage: from sage.schemes.generic.point import SchemeTopologicalPoint_prime_ideal sage: P2. = ProjectiveSpace(2, QQ) - sage: pt = SchemeTopologicalPoint_prime_ideal(P2, y*z-x^2); pt - Point on Projective Space of dimension 2 over Rational Field defined by the Ideal (-x^2 + y*z) of Multivariate Polynomial Ring in x, y, z over Rational Field + sage: pt = SchemeTopologicalPoint_prime_ideal(P2, y*z - x^2); pt + Point on Projective Space of dimension 2 over Rational Field defined by + the Ideal (-x^2 + y*z) of Multivariate Polynomial Ring in x, y, z over Rational Field sage: pt._repr_() 'Point on Projective Space of dimension 2 over Rational Field defined by the Ideal (-x^2 + y*z) of Multivariate Polynomial Ring in x, y, z over Rational Field' """ @@ -205,7 +207,7 @@ def prime_ideal(self): sage: from sage.schemes.generic.point import SchemeTopologicalPoint_prime_ideal sage: P2. = ProjectiveSpace(2, QQ) - sage: pt = SchemeTopologicalPoint_prime_ideal(P2, y*z-x^2) + sage: pt = SchemeTopologicalPoint_prime_ideal(P2, y*z - x^2) sage: pt.prime_ideal() Ideal (-x^2 + y*z) of Multivariate Polynomial Ring in x, y, z over Rational Field """ diff --git a/src/sage/schemes/generic/scheme.py b/src/sage/schemes/generic/scheme.py index 520b1fa6b6d..13bce6084e2 100644 --- a/src/sage/schemes/generic/scheme.py +++ b/src/sage/schemes/generic/scheme.py @@ -223,10 +223,10 @@ def __call__(self, *args): Space of dimension 2 over Rational Field:: sage: R. = PolynomialRing(QQ) - sage: A(NumberField(x^2+1, 'a')) + sage: A(NumberField(x^2 + 1, 'a')) # optional - sage.rings.number_field Set of rational points of Affine Space of dimension 2 over Number Field in a with defining polynomial x^2 + 1 - sage: A(GF(7)) + sage: A(GF(7)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: There must be a natural map S --> R, but @@ -246,7 +246,7 @@ def __call__(self, *args): Check that :trac:`16832` is fixed:: sage: P. = ProjectiveSpace(ZZ, 2) - sage: X=P.subscheme(x^2 - y^2) + sage: X = P.subscheme(x^2 - y^2) sage: X(P([4, 4, 1])) (4 : 4 : 1) """ @@ -285,14 +285,14 @@ def point_homset(self, S=None): Set of rational points of Projective Space of dimension 3 over Integer Ring sage: P.point_homset(QQ) Set of rational points of Projective Space of dimension 3 over Rational Field - sage: P.point_homset(GF(11)) + sage: P.point_homset(GF(11)) # optional - sage.rings.finite_rings Set of rational points of Projective Space of dimension 3 over Finite Field of size 11 TESTS:: - sage: P = ProjectiveSpace(QQ,3) - sage: P.point_homset(GF(11)) + sage: P = ProjectiveSpace(QQ, 3) + sage: P.point_homset(GF(11)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: There must be a natural map S --> R, but @@ -321,8 +321,8 @@ def point(self, v, check=True): EXAMPLES:: - sage: A2 = AffineSpace(QQ,2) - sage: A2.point([4,5]) + sage: A2 = AffineSpace(QQ, 2) + sage: A2.point([4, 5]) (4, 5) sage: R. = PolynomialRing(QQ) @@ -386,7 +386,7 @@ def __truediv__(self, Y): Affine Space of dimension 3 over Integer Ring sage: A/QQ Affine Space of dimension 3 over Rational Field - sage: A/GF(7) + sage: A/GF(7) # optional - sage.rings.finite_rings Affine Space of dimension 3 over Finite Field of size 7 """ return self.base_extend(Y) @@ -671,18 +671,18 @@ def count_points(self, n): EXAMPLES:: - sage: P. = PolynomialRing(GF(3)) - sage: C = HyperellipticCurve(x^3+x^2+1) - sage: C.count_points(4) + sage: P. = PolynomialRing(GF(3)) # optional - sage.rings.finite_rings + sage: C = HyperellipticCurve(x^3 + x^2 + 1) # optional - sage.rings.finite_rings + sage: C.count_points(4) # optional - sage.rings.finite_rings [6, 12, 18, 96] - sage: C.base_extend(GF(9,'a')).count_points(2) + sage: C.base_extend(GF(9,'a')).count_points(2) # optional - sage.rings.finite_rings [12, 96] :: - sage: P. = ProjectiveSpace(GF(4,'t'), 2) - sage: X = P.subscheme([y^2*z - x^3 - z^3]) - sage: X.count_points(2) + sage: P. = ProjectiveSpace(GF(4, 't'), 2) # optional - sage.rings.finite_rings + sage: X = P.subscheme([y^2*z - x^3 - z^3]) # optional - sage.rings.finite_rings + sage: X.count_points(2) # optional - sage.rings.finite_rings [5, 17] """ F = self.base_ring() @@ -705,9 +705,9 @@ def zeta_function(self): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(4,'t'), 2) - sage: X = P.subscheme([y^2*z - x^3 - z^3]) - sage: X.zeta_function() + sage: P. = ProjectiveSpace(GF(4, 't'), 2) # optional - sage.rings.finite_rings + sage: X = P.subscheme([y^2*z - x^3 - z^3]) # optional - sage.rings.finite_rings + sage: X.zeta_function() # optional - sage.rings.finite_rings Traceback (most recent call last): ... NotImplementedError @@ -734,12 +734,12 @@ def zeta_series(self, n, t): EXAMPLES:: - sage: P. = PolynomialRing(GF(3)) - sage: C = HyperellipticCurve(x^3+x^2+1) + sage: P. = PolynomialRing(GF(3)) # optional - sage.rings.finite_rings + sage: C = HyperellipticCurve(x^3 + x^2 + 1) # optional - sage.rings.finite_rings sage: R. = PowerSeriesRing(Integers()) - sage: C.zeta_series(4,t) + sage: C.zeta_series(4, t) # optional - sage.rings.finite_rings 1 + 6*t + 24*t^2 + 78*t^3 + 240*t^4 + O(t^5) - sage: (1+2*t+3*t^2)/(1-t)/(1-3*t) + O(t^5) + sage: (1+2*t+3*t^2)/(1-t)/(1-3*t) + O(t^5) # optional - sage.rings.finite_rings 1 + 6*t + 24*t^2 + 78*t^3 + 240*t^4 + O(t^5) If the scheme has a method ``zeta_function``, this is used to @@ -749,23 +749,23 @@ def zeta_series(self, n, t): Nonetheless, since :trac:`15108` and :trac:`15148`, it supports hyperelliptic curves over non-prime fields:: - sage: C.base_extend(GF(9,'a')).zeta_series(4,t) + sage: C.base_extend(GF(9, 'a')).zeta_series(4, t) # optional - sage.rings.finite_rings 1 + 12*t + 120*t^2 + 1092*t^3 + 9840*t^4 + O(t^5) :: - sage: P. = ProjectiveSpace(GF(4,'t'), 2) - sage: X = P.subscheme([y^2*z - x^3 - z^3]) + sage: P. = ProjectiveSpace(GF(4, 't'), 2) # optional - sage.rings.finite_rings + sage: X = P.subscheme([y^2*z - x^3 - z^3]) # optional - sage.rings.finite_rings sage: R. = PowerSeriesRing(Integers()) - sage: X.zeta_series(2,t) + sage: X.zeta_series(2, t) # optional - sage.rings.finite_rings 1 + 5*t + 21*t^2 + O(t^3) TESTS:: sage: P. = PolynomialRing(ZZ) - sage: C = HyperellipticCurve(x^3+x+1) + sage: C = HyperellipticCurve(x^3 + x + 1) sage: R. = PowerSeriesRing(Integers()) - sage: C.zeta_series(4,t) + sage: C.zeta_series(4, t) Traceback (most recent call last): ... TypeError: zeta functions only defined for schemes @@ -1201,9 +1201,9 @@ def hom(self, x, Y=None): We can construct a morphism to an affine curve (:trac:`7956`):: sage: S. = QQ[] - sage: A1. = AffineSpace(QQ,1) - sage: A1_emb = Curve(p-2) - sage: A1.hom([2,r],A1_emb) + sage: A1. = AffineSpace(QQ, 1) + sage: A1_emb = Curve(p - 2) + sage: A1.hom([2, r], A1_emb) Scheme morphism: From: Affine Space of dimension 1 over Rational Field To: Affine Plane Curve over Rational Field defined by p - 2 diff --git a/src/sage/schemes/generic/spec.py b/src/sage/schemes/generic/spec.py index fcbda338c59..ec7a6e1728c 100644 --- a/src/sage/schemes/generic/spec.py +++ b/src/sage/schemes/generic/spec.py @@ -42,9 +42,10 @@ def Spec(R, S=None): Spectrum of Univariate Polynomial Ring in x over Rational Field sage: Spec(PolynomialRing(QQ, 'x', 3)) Spectrum of Multivariate Polynomial Ring in x0, x1, x2 over Rational Field - sage: X = Spec(PolynomialRing(GF(49,'a'), 3, 'x')); X - Spectrum of Multivariate Polynomial Ring in x0, x1, x2 over Finite Field in a of size 7^2 - sage: TestSuite(X).run() + sage: X = Spec(PolynomialRing(GF(49,'a'), 3, 'x')); X # optional - sage.rings.finite_rings + Spectrum of Multivariate Polynomial Ring in x0, x1, x2 + over Finite Field in a of size 7^2 + sage: TestSuite(X).run() # optional - sage.rings.finite_rings Applying ``Spec`` twice to the same ring gives identical output (see :trac:`17008`):: @@ -59,7 +60,7 @@ def Spec(R, S=None): Traceback (most recent call last): ... TypeError: x (=5) is not in Category of commutative rings - sage: Spec(FreeAlgebra(QQ,2, 'x')) + sage: Spec(FreeAlgebra(QQ, 2, 'x')) Traceback (most recent call last): ... TypeError: x (=Free Algebra on 2 generators (x0, x1) over Rational Field) is not in Category of commutative rings @@ -75,9 +76,9 @@ def Spec(R, S=None): Integer Ring sage: X.dimension() 1 - sage: Spec(QQ,QQ).base_scheme() + sage: Spec(QQ, QQ).base_scheme() Spectrum of Rational Field - sage: Spec(RDF,QQ).base_scheme() + sage: Spec(RDF, QQ).base_scheme() Spectrum of Rational Field """ return SpecFunctor(S)(R) @@ -168,11 +169,11 @@ def _apply_functor_to_morphism(self, f): EXAMPLES:: sage: from sage.schemes.generic.spec import SpecFunctor - sage: F = SpecFunctor(GF(7)) - sage: A. = GF(7)[] - sage: B. = GF(7)[] - sage: f = A.hom((t^2, t^3)) - sage: Spec(f) # indirect doctest + sage: F = SpecFunctor(GF(7)) # optional - sage.rings.finite_rings + sage: A. = GF(7)[] # optional - sage.rings.finite_rings + sage: B. = GF(7)[] # optional - sage.rings.finite_rings + sage: f = A.hom((t^2, t^3)) # optional - sage.rings.finite_rings + sage: Spec(f) # indirect doctest # optional - sage.rings.finite_rings Affine Scheme morphism: From: Spectrum of Univariate Polynomial Ring in t over Finite Field of size 7 To: Spectrum of Multivariate Polynomial Ring in x, y over Finite Field of size 7 diff --git a/src/sage/schemes/projective/proj_bdd_height.py b/src/sage/schemes/projective/proj_bdd_height.py index 2f90e1cc1f9..dad84b0000c 100644 --- a/src/sage/schemes/projective/proj_bdd_height.py +++ b/src/sage/schemes/projective/proj_bdd_height.py @@ -101,11 +101,11 @@ def IQ_points_of_bounded_height(PN, K, dim, bound): EXAMPLES: sage: from sage.schemes.projective.proj_bdd_height import IQ_points_of_bounded_height - sage: CF. = CyclotomicField(3) - sage: P. = ProjectiveSpace(CF, 2) - sage: len(list(IQ_points_of_bounded_height(P, CF, 2, -1))) + sage: CF. = CyclotomicField(3) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(CF, 2) # optional - sage.rings.number_field + sage: len(list(IQ_points_of_bounded_height(P, CF, 2, -1))) # optional - sage.rings.number_field 0 - sage: len(list(IQ_points_of_bounded_height(P, CF, 2, 1))) + sage: len(list(IQ_points_of_bounded_height(P, CF, 2, 1))) # optional - sage.rings.number_field 57 """ if bound < 1: @@ -181,9 +181,9 @@ def points_of_bounded_height(PN, K, dim, bound, prec=53): EXAMPLES: sage: from sage.schemes.projective.proj_bdd_height import points_of_bounded_height - sage: K. = NumberField(x^3 - 7) - sage: P. = ProjectiveSpace(K, 2) - sage: len(list(points_of_bounded_height(P, K, 2, 1))) + sage: K. = NumberField(x^3 - 7) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field + sage: len(list(points_of_bounded_height(P, K, 2, 1))) # optional - sage.rings.number_field 13 """ if bound < 1: diff --git a/src/sage/schemes/projective/projective_homset.py b/src/sage/schemes/projective/projective_homset.py index 3ee0b78876e..9a8f41a929a 100644 --- a/src/sage/schemes/projective/projective_homset.py +++ b/src/sage/schemes/projective/projective_homset.py @@ -112,7 +112,7 @@ def points(self, **kwds): EXAMPLES:: - sage: P. = ProjectiveSpace(QQ,1) + sage: P. = ProjectiveSpace(QQ, 1) sage: P(QQ).points(bound=4) [(-4 : 1), (-3 : 1), (-2 : 1), (-3/2 : 1), (-4/3 : 1), (-1 : 1), (-3/4 : 1), (-2/3 : 1), (-1/2 : 1), (-1/3 : 1), (-1/4 : 1), (0 : 1), @@ -122,22 +122,22 @@ def points(self, **kwds): :: sage: u = QQ['u'].0 - sage: K. = NumberField(u^2 + 3) - sage: P. = ProjectiveSpace(K,2) - sage: len(P(K).points(bound=1.8)) + sage: K. = NumberField(u^2 + 3) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field + sage: len(P(K).points(bound=1.8)) # optional - sage.rings.number_field 309 :: - sage: P1 = ProjectiveSpace(GF(2),1) - sage: F. = GF(4,'a') - sage: P1(F).points() + sage: P1 = ProjectiveSpace(GF(2), 1) # optional - sage.rings.finite_rings + sage: F. = GF(4, 'a') # optional - sage.rings.finite_rings + sage: P1(F).points() # optional - sage.rings.finite_rings [(0 : 1), (1 : 0), (1 : 1), (a : 1), (a + 1 : 1)] :: - sage: P. = ProjectiveSpace(QQ,2) - sage: E = P.subscheme([(y^3-y*z^2) - (x^3-x*z^2),(y^3-y*z^2) + (x^3-x*z^2)]) + sage: P. = ProjectiveSpace(QQ, 2) + sage: E = P.subscheme([(y^3-y*z^2) - (x^3-x*z^2), (y^3-y*z^2) + (x^3-x*z^2)]) sage: E(P.base_ring()).points() [(-1 : -1 : 1), (-1 : 0 : 1), (-1 : 1 : 1), (0 : -1 : 1), (0 : 0 : 1), (0 : 1 : 1), (1 : -1 : 1), (1 : 0 : 1), (1 : 1 : 1)] @@ -146,7 +146,7 @@ def points(self, **kwds): sage: P. = ProjectiveSpace(CC, 2) sage: E = P.subscheme([y^3 - x^3 - x*z^2, x*y*z]) - sage: L=E(P.base_ring()).points(); sorted(L, key=str) + sage: L = E(P.base_ring()).points(); sorted(L, key=str) verbose 0 (...: projective_homset.py, points) Warning: computations in the numerical fields are inexact;points may be computed partially or incorrectly. [(-0.500000000000000 + 0.866025403784439*I : 1.00000000000000 : 0.000000000000000), (-0.500000000000000 - 0.866025403784439*I : 1.00000000000000 : 0.000000000000000), @@ -333,10 +333,10 @@ def numerical_points(self, F=None, **kwds): :: sage: S. = QQ[] - sage: K. = NumberField(a^5 - 7, embedding=CC((7)**(1/5))) - sage: P. = ProjectiveSpace(K,2) - sage: X = P.subscheme([x^2 - v^2*z^2, y-v*z]) - sage: len(X(K).numerical_points(F=CDF)) + sage: K. = NumberField(a^5 - 7, embedding=CC((7)**(1/5))) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field + sage: X = P.subscheme([x^2 - v^2*z^2, y - v*z]) # optional - sage.rings.number_field + sage: len(X(K).numerical_points(F=CDF)) # optional - sage.rings.number_field 2 :: @@ -488,7 +488,7 @@ def points(self, B=0): EXAMPLES:: sage: from sage.schemes.projective.projective_homset import SchemeHomset_points_projective_ring - sage: H = SchemeHomset_points_projective_ring(Spec(ZZ), ProjectiveSpace(ZZ,2)) + sage: H = SchemeHomset_points_projective_ring(Spec(ZZ), ProjectiveSpace(ZZ, 2)) sage: H.points(3) [(0 : 0 : 1), (0 : 1 : -3), (0 : 1 : -2), (0 : 1 : -1), (0 : 1 : 0), (0 : 1 : 1), (0 : 1 : 2), (0 : 1 : 3), (0 : 2 : -3), (0 : 2 : -1), (0 : 2 : @@ -578,23 +578,23 @@ class SchemeHomset_points_abelian_variety_field(SchemeHomset_points_projective_f The bug reported at :trac:`1785` is fixed:: - sage: K. = NumberField(x^2 + x - (3^3-3)) - sage: E = EllipticCurve('37a') - sage: X = E(K) - sage: X + sage: K. = NumberField(x^2 + x - (3^3-3)) # optional - sage.rings.number_field + sage: E = EllipticCurve('37a') # optional - sage.rings.number_field + sage: X = E(K) # optional - sage.rings.number_field + sage: X # optional - sage.rings.number_field Abelian group of points on Elliptic Curve defined by y^2 + y = x^3 + (-1)*x over Number Field in a with defining polynomial x^2 + x - 24 - sage: P = X([3,a]) - sage: P + sage: P = X([3,a]) # optional - sage.rings.number_field + sage: P # optional - sage.rings.number_field (3 : a : 1) - sage: P in E + sage: P in E # optional - sage.rings.number_field False - sage: P in E.base_extend(K) + sage: P in E.base_extend(K) # optional - sage.rings.number_field True - sage: P in X.codomain() + sage: P in X.codomain() # optional - sage.rings.number_field False - sage: P in X.extended_codomain() + sage: P in X.extended_codomain() # optional - sage.rings.number_field True Check for :trac:`11982`:: diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 9c608f67a48..e2fab4be760 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -112,14 +112,14 @@ class SchemeMorphism_polynomial_projective_space(SchemeMorphism_polynomial): An example of a morphism between projective plane curves (see :trac:`10297`):: - sage: P2. = ProjectiveSpace(QQ,2) - sage: f = x^3+y^3+60*z^3 - sage: g = y^2*z-( x^3 - 6400*z^3/3) + sage: P2. = ProjectiveSpace(QQ, 2) + sage: f = x^3 + y^3 + 60*z^3 + sage: g = y^2*z - (x^3 - 6400*z^3/3) sage: C = Curve(f) sage: E = Curve(g) sage: xbar,ybar,zbar = C.coordinate_ring().gens() sage: H = C.Hom(E) - sage: H([zbar,xbar-ybar,-(xbar+ybar)/80]) + sage: H([zbar, xbar - ybar, -(xbar+ybar)/80]) Scheme morphism: From: Projective Plane Curve over Rational Field defined by x^3 + y^3 + 60*z^3 To: Projective Plane Curve over Rational Field defined by -x^3 + y^2*z + 6400/3*z^3 @@ -129,7 +129,7 @@ class SchemeMorphism_polynomial_projective_space(SchemeMorphism_polynomial): A more complicated example:: sage: P2. = ProjectiveSpace(2, QQ) - sage: P1 = P2.subscheme(x-y) + sage: P1 = P2.subscheme(x - y) sage: H12 = P1.Hom(P2) sage: H12([x^2, x*z, z^2]) Scheme morphism: @@ -144,17 +144,17 @@ class SchemeMorphism_polynomial_projective_space(SchemeMorphism_polynomial): sage: R. = QQ[] sage: P1 = ProjectiveSpace(R) sage: H = P1.Hom(P1) - sage: f = H([x-y, x*y]) + sage: f = H([x - y, x*y]) Traceback (most recent call last): ... ValueError: polys (=[x - y, x*y]) must be of the same degree - sage: H([x-1, x*y+x]) + sage: H([x - 1, x*y + x]) Traceback (most recent call last): ... ValueError: polys (=[x - 1, x*y + x]) must be homogeneous - sage: H([exp(x),exp(y)]) + sage: H([exp(x), exp(y)]) Traceback (most recent call last): ... TypeError: polys (=[e^x, e^y]) must be elements of @@ -216,7 +216,7 @@ def __init__(self, parent, polys, check=True): When elements of the quotient ring is used, they are reduced:: sage: P. = ProjectiveSpace(CC, 2) - sage: X = P.subscheme([x-y]) + sage: X = P.subscheme([x - y]) sage: u,v,w = X.coordinate_ring().gens() sage: H = End(X) sage: H([u^2, v^2, w*u]) @@ -301,14 +301,14 @@ def __call__(self, x, check=True): sage: P. = ProjectiveSpace(QQ, 2) sage: H = End(P) - sage: f = H([x^2+y^2, y^2, z^2 + y*z]) + sage: f = H([x^2 + y^2, y^2, z^2 + y*z]) sage: f(P([1,1,1])) (1 : 1/2 : 1) :: sage: PS. = ProjectiveSpace(QQ, 2) - sage: P1. = ProjectiveSpace(QQ,1) + sage: P1. = ProjectiveSpace(QQ, 1) sage: H = End(P1) sage: f = H([u^2, v^2]) sage: f(PS([0,1,1])) @@ -333,7 +333,7 @@ def __call__(self, x, check=True): sage: PS. = ProjectiveSpace(QQ, 3) sage: H = End(PS) sage: f = H([y^2, x^2, w^2, z^2]) - sage: X = PS.subscheme([z^2+y*w]) + sage: X = PS.subscheme([z^2 + y*w]) sage: f(X) Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: @@ -345,7 +345,7 @@ def __call__(self, x, check=True): sage: P1. = ProjectiveSpace(ZZ, 1) sage: H = End(PS) sage: f = H([x^2, y^2, z^2]) - sage: X = P1.subscheme([u-v]) + sage: X = P1.subscheme([u - v]) sage: f(X) Traceback (most recent call last): ... @@ -360,7 +360,7 @@ def __call__(self, x, check=True): sage: f([u-v]) Closed subscheme of Projective Space of dimension 1 over Integer Ring defined by: u - v - sage: X = PS.subscheme([x-z]) + sage: X = PS.subscheme([x - z]) sage: f([x-z]) Traceback (most recent call last): ... @@ -380,13 +380,13 @@ def __call__(self, x, check=True): Defn: Defined on coordinates by sending (u : v) to (u^2 + v^2 : u*v) - sage: F. = GF(4) - sage: P = T(F)(1, a) - sage: h(P) + sage: F. = GF(4) # optional - sage.rings.finite_rings + sage: P = T(F)(1, a) # optional - sage.rings.finite_rings + sage: h(P) # optional - sage.rings.finite_rings (a : a) - sage: h(P).domain() + sage: h(P).domain() # optional - sage.rings.finite_rings Spectrum of Finite Field in a of size 2^2 - sage: h.change_ring(F)(P) + sage: h.change_ring(F)(P) # optional - sage.rings.finite_rings (1 : 1) """ from sage.schemes.projective.projective_point import SchemeMorphism_point_projective_ring @@ -425,9 +425,9 @@ def _fastpolys(self): EXAMPLES:: - sage: P.=ProjectiveSpace(QQ,1) + sage: P. = ProjectiveSpace(QQ, 1) sage: H = Hom(P,P) - sage: f = H([x^2+y^2,y^2]) + sage: f = H([x^2 + y^2, y^2]) sage: [g.op_list() for g in f._fastpolys] [[('load_const', 0), ('load_const', 1), ('load_arg', ...), ('ipow', 2), 'mul', 'add', ('load_const', 1), ('load_arg', ...), ('ipow', 2), 'mul', 'add', 'return'], [('load_const', 0), ('load_const', 1), ('load_arg', 1), ('ipow', 2), 'mul', 'add', 'return']] """ @@ -460,18 +460,18 @@ def _fast_eval(self, x): EXAMPLES:: - sage: P. = ProjectiveSpace(QQ,2) - sage: H = Hom(P,P) - sage: f = H([x^2+y^2, y^2, z^2 + y*z]) + sage: P. = ProjectiveSpace(QQ, 2) + sage: H = Hom(P, P) + sage: f = H([x^2 + y^2, y^2, z^2 + y*z]) sage: f._fast_eval([1,1,1]) [2, 1, 2] :: sage: T. = LaurentSeriesRing(ZZ) - sage: P. = ProjectiveSpace(T,1) + sage: P. = ProjectiveSpace(T, 1) sage: H = End(P) - sage: f = H([x^2+x*y, y^2]) + sage: f = H([x^2 + x*y, y^2]) sage: Q = P(z,1) sage: f._fast_eval(list(Q)) [z + z^2, 1] @@ -480,9 +480,9 @@ def _fast_eval(self, x): sage: T. = PolynomialRing(CC) sage: I = T.ideal(z^3) - sage: P. = ProjectiveSpace(T.quotient_ring(I),1) + sage: P. = ProjectiveSpace(T.quotient_ring(I), 1) sage: H = End(P) - sage: f = H([x^2+x*y, y^2]) + sage: f = H([x^2 + x*y, y^2]) sage: Q = P(z^2, 1) sage: f._fast_eval(list(Q)) [zbar^2, 1.00000000000000] @@ -493,7 +493,7 @@ def _fast_eval(self, x): sage: R. = PolynomialRing(T) sage: P. = ProjectiveSpace(R,1) sage: H = End(P) - sage: f = H([x^2+x*y, y^2]) + sage: f = H([x^2 + x*y, y^2]) sage: Q = P(t^2, z) sage: f._fast_eval(list(Q)) [t^4 + z*t^2, z^2] @@ -517,8 +517,8 @@ def __eq__(self, right): EXAMPLES:: sage: P. = ProjectiveSpace(QQ, 2) - sage: H = Hom(P,P) - sage: f = H([x^2 - 2*x*y + z*x, z^2 -y^2 , 5*z*y]) + sage: H = Hom(P, P) + sage: f = H([x^2 - 2*x*y + z*x, z^2 - y^2, 5*z*y]) sage: g = H([x^2, y^2, z^2]) sage: f == g False @@ -567,17 +567,17 @@ def __ne__(self, right): EXAMPLES:: sage: P. = ProjectiveSpace(QQ, 1) - sage: H = Hom(P,P) - sage: f = H([x^3 - 2*x^2*y , 5*x*y^2]) - sage: g = f.change_ring(GF(7)) - sage: f != g + sage: H = Hom(P, P) + sage: f = H([x^3 - 2*x^2*y, 5*x*y^2]) + sage: g = f.change_ring(GF(7)) # optional - sage.rings.finite_rings + sage: f != g # optional - sage.rings.finite_rings True :: sage: P. = ProjectiveSpace(QQ, 2) sage: H = Hom(P, P) - sage: f = H([x^2 - 2*x*y + z*x, z^2 -y^2 , 5*z*y]) + sage: f = H([x^2 - 2*x*y + z*x, z^2 - y^2, 5*z*y]) sage: f != f False """ @@ -612,12 +612,13 @@ def _matrix_times_polymap_(self, mat, h): :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2+1) - sage: P. = ProjectiveSpace(QQ, 1) - sage: H = Hom(P,P) - sage: f = H([1/3*x^2 + 1/2*y^2, y^2]) - sage: matrix([[i,0], [0,i]]) * f - Scheme endomorphism of Projective Space of dimension 1 over Number Field in i with defining polynomial x^2 + 1 + sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(QQ, 1) # optional - sage.rings.number_field + sage: H = Hom(P, P) # optional - sage.rings.number_field + sage: f = H([1/3*x^2 + 1/2*y^2, y^2]) # optional - sage.rings.number_field + sage: matrix([[i,0], [0,i]]) * f # optional - sage.rings.number_field + Scheme endomorphism of Projective Space of dimension 1 over + Number Field in i with defining polynomial x^2 + 1 Defn: Defined on coordinates by sending (x : y) to ((1/3*i)*x^2 + (1/2*i)*y^2 : i*y^2) """ @@ -655,12 +656,13 @@ def _polymap_times_matrix_(self, mat, h): :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2+1) - sage: P. = ProjectiveSpace(QQ, 1) - sage: H = Hom(P,P) - sage: f = H([1/3*x^2 + 1/2*y^2, y^2]) - sage: f * matrix([[i,0], [0,i]]) - Scheme endomorphism of Projective Space of dimension 1 over Number Field in i with defining polynomial x^2 + 1 + sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(QQ, 1) # optional - sage.rings.number_field + sage: H = Hom(P, P) # optional - sage.rings.number_field + sage: f = H([1/3*x^2 + 1/2*y^2, y^2]) # optional - sage.rings.number_field + sage: f * matrix([[i,0], [0,i]]) # optional - sage.rings.number_field + Scheme endomorphism of Projective Space of dimension 1 over + Number Field in i with defining polynomial x^2 + 1 Defn: Defined on coordinates by sending (x : y) to (-1/3*x^2 - 1/2*y^2 : -y^2) """ @@ -703,10 +705,10 @@ def as_dynamical_system(self): :: - sage: P. = ProjectiveSpace(GF(5), 1) - sage: H = End(P) - sage: f = H([x^2, y^2]) - sage: type(f.as_dynamical_system()) + sage: P. = ProjectiveSpace(GF(5), 1) # optional - sage.rings.finite_rings + sage: H = End(P) # optional - sage.rings.finite_rings + sage: f = H([x^2, y^2]) # optional - sage.rings.finite_rings + sage: type(f.as_dynamical_system()) # optional - sage.rings.finite_rings :: @@ -749,9 +751,9 @@ def scale_by(self, t): EXAMPLES:: - sage: A. = ProjectiveSpace(QQ,1) - sage: H = Hom(A,A) - sage: f = H([x^3-2*x*y^2,x^2*y]) + sage: A. = ProjectiveSpace(QQ, 1) + sage: H = Hom(A, A) + sage: f = H([x^3 - 2*x*y^2, x^2*y]) sage: f.scale_by(1/x) sage: f Scheme endomorphism of Projective Space of dimension 1 over Rational @@ -762,9 +764,9 @@ def scale_by(self, t): :: sage: R. = PolynomialRing(QQ) - sage: P. = ProjectiveSpace(R,1) + sage: P. = ProjectiveSpace(R, 1) sage: H = Hom(P,P) - sage: f = H([3/5*x^2,6*y^2]) + sage: f = H([3/5*x^2, 6*y^2]) sage: f.scale_by(5/3*t); f Scheme endomorphism of Projective Space of dimension 1 over Univariate Polynomial Ring in t over Rational Field @@ -773,11 +775,11 @@ def scale_by(self, t): :: - sage: P. = ProjectiveSpace(GF(7),2) - sage: X = P.subscheme(x^2-y^2) - sage: H = Hom(X,X) - sage: f = H([x^2,y^2,z^2]) - sage: f.scale_by(x-y);f + sage: P. = ProjectiveSpace(GF(7), 2) # optional - sage.rings.finite_rings + sage: X = P.subscheme(x^2 - y^2) # optional - sage.rings.finite_rings + sage: H = Hom(X, X) # optional - sage.rings.finite_rings + sage: f = H([x^2, y^2, z^2]) # optional - sage.rings.finite_rings + sage: f.scale_by(x - y); f # optional - sage.rings.finite_rings Scheme endomorphism of Closed subscheme of Projective Space of dimension 2 over Finite Field of size 7 defined by: x^2 - y^2 @@ -841,11 +843,11 @@ def normalize_coordinates(self, **kwds): :: - sage: P. = ProjectiveSpace(GF(7), 2) - sage: X = P.subscheme(x^2 - y^2) - sage: H = Hom(X, X) - sage: f = H([x^3 + x*y^2, x*y^2, x*z^2]) - sage: f.normalize_coordinates(); f + sage: P. = ProjectiveSpace(GF(7), 2) # optional - sage.rings.finite_rings + sage: X = P.subscheme(x^2 - y^2) # optional - sage.rings.finite_rings + sage: H = Hom(X, X) # optional - sage.rings.finite_rings + sage: f = H([x^3 + x*y^2, x*y^2, x*z^2]) # optional - sage.rings.finite_rings + sage: f.normalize_coordinates(); f # optional - sage.rings.finite_rings Scheme endomorphism of Closed subscheme of Projective Space of dimension 2 over Finite Field of size 7 defined by: x^2 - y^2 @@ -866,10 +868,10 @@ def normalize_coordinates(self, **kwds): :: - sage: K. = QuadraticField(5) - sage: P. = ProjectiveSpace(K, 1) - sage: f = DynamicalSystem([w*x^2 + (1/5*w)*y^2, w*y^2]) - sage: f.normalize_coordinates(); f + sage: K. = QuadraticField(5) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: f = DynamicalSystem([w*x^2 + (1/5*w)*y^2, w*y^2]) # optional - sage.rings.number_field + sage: f.normalize_coordinates(); f # optional - sage.rings.number_field Dynamical System of Projective Space of dimension 1 over Number Field in w with defining polynomial x^2 - 5 with w = 2.236067977499790? Defn: Defined on coordinates by sending (x : y) to @@ -878,12 +880,13 @@ def normalize_coordinates(self, **kwds): :: sage: R. = PolynomialRing(ZZ) - sage: K. = NumberField(t^3 - 11) - sage: a = 7/(b - 1) - sage: P. = ProjectiveSpace(K, 1) - sage: f = DynamicalSystem_projective([a*y^2 - (a*y - x)^2, y^2]) - sage: f.normalize_coordinates(); f - Dynamical System of Projective Space of dimension 1 over Number Field in b with defining polynomial t^3 - 11 + sage: K. = NumberField(t^3 - 11) # optional - sage.rings.number_field + sage: a = 7/(b - 1) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: f = DynamicalSystem_projective([a*y^2 - (a*y - x)^2, y^2]) # optional - sage.rings.number_field + sage: f.normalize_coordinates(); f # optional - sage.rings.number_field + Dynamical System of Projective Space of dimension 1 over + Number Field in b with defining polynomial t^3 - 11 Defn: Defined on coordinates by sending (x : y) to (-100*x^2 + (140*b^2 + 140*b + 140)*x*y + (-77*b^2 - 567*b - 1057)*y^2 : 100*y^2) @@ -899,12 +902,12 @@ def normalize_coordinates(self, **kwds): :: sage: R. = QQ[] - sage: A. = NumberField(w^2 + 1) - sage: P. = ProjectiveSpace(A, 2) - sage: X = P.subscheme(x^2-y^2) - sage: H = Hom(X,X) - sage: f = H([(a+1)*x^3 + 2*x*y^2, 4*x*y^2, 8*x*z^2]) - sage: f.normalize_coordinates(ideal=A.prime_above(2)); f + sage: A. = NumberField(w^2 + 1) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(A, 2) # optional - sage.rings.number_field + sage: X = P.subscheme(x^2 - y^2) # optional - sage.rings.number_field + sage: H = Hom(X, X) # optional - sage.rings.number_field + sage: f = H([(a+1)*x^3 + 2*x*y^2, 4*x*y^2, 8*x*z^2]) # optional - sage.rings.number_field + sage: f.normalize_coordinates(ideal=A.prime_above(2)); f # optional - sage.rings.number_field Scheme endomorphism of Closed subscheme of Projective Space of dimension 2 over Number Field in a with defining polynomial w^2 + 1 defined by: x^2 - y^2 @@ -913,17 +916,18 @@ def normalize_coordinates(self, **kwds): We can pass in a valuation to ``valuation``:: - sage: g = H([(a+1)*x^3 + 2*x*y^2, 4*x*y^2, 8*x*z^2]) - sage: g.normalize_coordinates(valuation=A.valuation(A.prime_above(2))) - sage: g == f + sage: g = H([(a+1)*x^3 + 2*x*y^2, 4*x*y^2, 8*x*z^2]) # optional - sage.rings.number_field + sage: g.normalize_coordinates(valuation=A.valuation(A.prime_above(2))) # optional - sage.rings.number_field + sage: g == f # optional - sage.rings.number_field True :: - sage: P. = ProjectiveSpace(Qp(3), 1) - sage: f = DynamicalSystem_projective([3*x^2+6*y^2, 9*x*y]) - sage: f.normalize_coordinates(); f - Dynamical System of Projective Space of dimension 1 over 3-adic Field with capped relative precision 20 + sage: P. = ProjectiveSpace(Qp(3), 1) # optional - sage.rings.padics + sage: f = DynamicalSystem_projective([3*x^2 + 6*y^2, 9*x*y]) # optional - sage.rings.padics + sage: f.normalize_coordinates(); f # optional - sage.rings.padics + Dynamical System of Projective Space of dimension 1 over + 3-adic Field with capped relative precision 20 Defn: Defined on coordinates by sending (x : y) to (x^2 + (2 + O(3^20))*y^2 : (3 + O(3^21))*x*y) """ @@ -1038,34 +1042,34 @@ def degree(self): EXAMPLES:: - sage: P. = ProjectiveSpace(QQ,1) - sage: H = Hom(P,P) - sage: f = H([x^2+y^2, y^2]) + sage: P. = ProjectiveSpace(QQ, 1) + sage: H = Hom(P, P) + sage: f = H([x^2 + y^2, y^2]) sage: f.degree() 2 :: - sage: P. = ProjectiveSpace(CC,2) - sage: H = Hom(P,P) - sage: f = H([x^3+y^3, y^2*z, z*x*y]) + sage: P. = ProjectiveSpace(CC, 2) + sage: H = Hom(P, P) + sage: f = H([x^3 + y^3, y^2*z, z*x*y]) sage: f.degree() 3 :: sage: R. = PolynomialRing(QQ) - sage: P. = ProjectiveSpace(R,2) - sage: H = Hom(P,P) - sage: f = H([x^2+t*y^2, (2-t)*y^2, z^2]) + sage: P. = ProjectiveSpace(R, 2) + sage: H = Hom(P, P) + sage: f = H([x^2 + t*y^2, (2-t)*y^2, z^2]) sage: f.degree() 2 :: - sage: P. = ProjectiveSpace(ZZ,2) - sage: X = P.subscheme(x^2-y^2) - sage: H = Hom(X,X) + sage: P. = ProjectiveSpace(ZZ, 2) + sage: X = P.subscheme(x^2 - y^2) + sage: H = Hom(X, X) sage: f = H([x^2, y^2, z^2]) sage: f.degree() 2 @@ -1091,9 +1095,9 @@ def dehomogenize(self, n): EXAMPLES:: - sage: P. = ProjectiveSpace(ZZ,1) - sage: H = Hom(P,P) - sage: f = H([x^2+y^2, y^2]) + sage: P. = ProjectiveSpace(ZZ, 1) + sage: H = Hom(P, P) + sage: f = H([x^2 + y^2, y^2]) sage: f.dehomogenize(0) Scheme endomorphism of Affine Space of dimension 1 over Integer Ring Defn: Defined on coordinates by sending (y) to @@ -1101,9 +1105,9 @@ def dehomogenize(self, n): :: - sage: P. = ProjectiveSpace(QQ,1) - sage: H = Hom(P,P) - sage: f = H([x^2-y^2, y^2]) + sage: P. = ProjectiveSpace(QQ, 1) + sage: H = Hom(P, P) + sage: f = H([x^2 - y^2, y^2]) sage: f.dehomogenize((0,1)) Scheme morphism: From: Affine Space of dimension 1 over Rational Field @@ -1113,9 +1117,9 @@ def dehomogenize(self, n): :: - sage: P. = ProjectiveSpace(QQ,2) - sage: H = Hom(P,P) - sage: f = H([x^2+y^2, y^2-z^2, 2*z^2]) + sage: P. = ProjectiveSpace(QQ, 2) + sage: H = Hom(P, P) + sage: f = H([x^2 + y^2, y^2 - z^2, 2*z^2]) sage: f.dehomogenize(2) Scheme endomorphism of Affine Space of dimension 2 over Rational Field Defn: Defined on coordinates by sending (x, y) to @@ -1126,7 +1130,7 @@ def dehomogenize(self, n): sage: R. = PolynomialRing(QQ) sage: P. = ProjectiveSpace(FractionField(R),2) sage: H = Hom(P,P) - sage: f = H([x^2+t*y^2, t*y^2-z^2, t*z^2]) + sage: f = H([x^2 + t*y^2, t*y^2 - z^2, t*z^2]) sage: f.dehomogenize(2) Scheme endomorphism of Affine Space of dimension 2 over Fraction Field of Univariate Polynomial Ring in t over Rational Field @@ -1135,9 +1139,9 @@ def dehomogenize(self, n): :: - sage: P. = ProjectiveSpace(ZZ,2) - sage: X = P.subscheme(x^2-y^2) - sage: H = Hom(X,X) + sage: P. = ProjectiveSpace(ZZ, 2) + sage: X = P.subscheme(x^2 - y^2) + sage: H = Hom(X, X) sage: f = H([x^2, y^2, x*z]) sage: f.dehomogenize(2) Scheme endomorphism of Closed subscheme of Affine Space of dimension 2 over Integer Ring defined by: @@ -1147,7 +1151,7 @@ def dehomogenize(self, n): :: - sage: P. = ProjectiveSpace(QQ,1) + sage: P. = ProjectiveSpace(QQ, 1) sage: H = End(P) sage: f = H([x^2 - 2*x*y, y^2]) sage: f.dehomogenize(0).homogenize(0) == f @@ -1155,22 +1159,24 @@ def dehomogenize(self, n): :: - sage: K. = QuadraticField(3) - sage: O = K.ring_of_integers() - sage: P. = ProjectiveSpace(O,1) - sage: H = End(P) - sage: f = H([x^2 - O(w)*y^2,y^2]) - sage: f.dehomogenize(1) - Scheme endomorphism of Affine Space of dimension 1 over Maximal Order in Number Field in w with defining polynomial x^2 - 3 with w = 1.732050807568878? + sage: K. = QuadraticField(3) # optional - sage.rings.number_field + sage: O = K.ring_of_integers() # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(O, 1) # optional - sage.rings.number_field + sage: H = End(P) # optional - sage.rings.number_field + sage: f = H([x^2 - O(w)*y^2, y^2]) # optional - sage.rings.number_field + sage: f.dehomogenize(1) # optional - sage.rings.number_field + Scheme endomorphism of Affine Space of dimension 1 over + Maximal Order in Number Field in w with defining polynomial x^2 - 3 + with w = 1.732050807568878? Defn: Defined on coordinates by sending (x) to (x^2 - w) :: - sage: P1. = ProjectiveSpace(QQ,1) - sage: P2. = ProjectiveSpace(QQ,2) - sage: H = Hom(P2,P1) - sage: f = H([u*w,v^2 + w^2]) + sage: P1. = ProjectiveSpace(QQ, 1) + sage: P2. = ProjectiveSpace(QQ, 2) + sage: H = Hom(P2, P1) + sage: f = H([u*w, v^2 + w^2]) sage: f.dehomogenize((2,1)) Scheme morphism: From: Affine Space of dimension 2 over Rational Field @@ -1233,35 +1239,35 @@ def is_morphism(self): EXAMPLES:: - sage: P. = ProjectiveSpace(QQ,1) - sage: H = Hom(P,P) - sage: f = H([x^2+y^2, y^2]) + sage: P. = ProjectiveSpace(QQ, 1) + sage: H = Hom(P, P) + sage: f = H([x^2 + y^2, y^2]) sage: f.is_morphism() True :: - sage: P. = ProjectiveSpace(RR,2) - sage: H = Hom(P,P) - sage: f = H([x*z-y*z, x^2-y^2, z^2]) + sage: P. = ProjectiveSpace(RR, 2) + sage: H = Hom(P, P) + sage: f = H([x*z - y*z, x^2 - y^2, z^2]) sage: f.is_morphism() False :: - sage: R. = PolynomialRing(GF(5)) - sage: P. = ProjectiveSpace(R,2) - sage: H = Hom(P,P) - sage: f = H([x*z-t*y^2, x^2-y^2, t*z^2]) - sage: f.is_morphism() + sage: R. = PolynomialRing(GF(5)) # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(R, 2) # optional - sage.rings.finite_rings + sage: H = Hom(P, P) # optional - sage.rings.finite_rings + sage: f = H([x*z - t*y^2, x^2 - y^2, t*z^2]) # optional - sage.rings.finite_rings + sage: f.is_morphism() # optional - sage.rings.finite_rings True Map that is not morphism on projective space, but is over a subscheme:: - sage: P. = ProjectiveSpace(RR,2) + sage: P. = ProjectiveSpace(RR, 2) sage: X = P.subscheme([x*y + y*z]) - sage: H = Hom(X,X) - sage: f = H([x*z-y*z, x^2-y^2, z^2]) + sage: H = Hom(X, X) + sage: f = H([x*z - y*z, x^2 - y^2, z^2]) sage: f.is_morphism() True """ @@ -1321,21 +1327,21 @@ def global_height(self, prec=None): :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(z^2 - 2) - sage: O = K.maximal_order() - sage: P. = ProjectiveSpace(O, 1) - sage: H = Hom(P, P) - sage: f = H([2*x^2 + 3*O(w)*y^2, O(w)*y^2]) - sage: f.global_height() + sage: K. = NumberField(z^2 - 2) # optional - sage.rings.number_field + sage: O = K.maximal_order() # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(O, 1) # optional - sage.rings.number_field + sage: H = Hom(P, P) # optional - sage.rings.number_field + sage: f = H([2*x^2 + 3*O(w)*y^2, O(w)*y^2]) # optional - sage.rings.number_field + sage: f.global_height() # optional - sage.rings.number_field 1.09861228866811 :: - sage: P. = ProjectiveSpace(QQbar, 1) - sage: P2. = ProjectiveSpace(QQbar, 2) - sage: H = Hom(P, P2) - sage: f = H([x^2 + QQbar(I)*x*y + 3*y^2, y^2, QQbar(sqrt(5))*x*y]) - sage: f.global_height() + sage: P. = ProjectiveSpace(QQbar, 1) # optional - sage.rings.number_field + sage: P2. = ProjectiveSpace(QQbar, 2) # optional - sage.rings.number_field + sage: H = Hom(P, P2) # optional - sage.rings.number_field + sage: f = H([x^2 + QQbar(I)*x*y + 3*y^2, y^2, QQbar(sqrt(5))*x*y]) # optional - sage.rings.number_field + sage: f.global_height() # optional - sage.rings.number_field 1.09861228866811 :: @@ -1399,24 +1405,24 @@ def local_height(self, v, prec=None): EXAMPLES:: - sage: P. = ProjectiveSpace(QQ,1) - sage: H = Hom(P,P) + sage: P. = ProjectiveSpace(QQ, 1) + sage: H = Hom(P, P) sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]); sage: f.local_height(1331) 7.19368581839511 :: - sage: P. = ProjectiveSpace(QQ,1) - sage: H = Hom(P,P) + sage: P. = ProjectiveSpace(QQ, 1) + sage: H = Hom(P, P) sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]); sage: f.local_height(1331, prec=2) 8.0 This function does not automatically normalize:: - sage: P. = ProjectiveSpace(QQ,2) - sage: H = Hom(P,P) + sage: P. = ProjectiveSpace(QQ, 2) + sage: H = Hom(P, P) sage: f = H([4*x^2 + 3/100*y^2, 8/210*x*y, 1/10000*z^2]); sage: f.local_height(2) 2.77258872223978 @@ -1427,11 +1433,11 @@ def local_height(self, v, prec=None): :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(z^2-2) - sage: P. = ProjectiveSpace(K,1) - sage: H = Hom(P,P) - sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) - sage: f.local_height(K.ideal(3)) + sage: K. = NumberField(z^2 - 2) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: H = Hom(P, P) # optional - sage.rings.number_field + sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) # optional - sage.rings.number_field + sage: f.local_height(K.ideal(3)) # optional - sage.rings.number_field 1.09861228866811 """ K = FractionField(self.domain().base_ring()) @@ -1465,20 +1471,20 @@ def local_height_arch(self, i, prec=None): :: - sage: P. = ProjectiveSpace(QQ,1) - sage: H = Hom(P,P) - sage: f = H([1/1331*x^2+1/4000*y^2, 210*x*y]); + sage: P. = ProjectiveSpace(QQ, 1) + sage: H = Hom(P, P) + sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]); sage: f.local_height_arch(0, prec=5) 5.2 :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(z^2 - 2) - sage: P. = ProjectiveSpace(K,1) - sage: H = Hom(P, P) - sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) - sage: f.local_height_arch(1) + sage: K. = NumberField(z^2 - 2) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: H = Hom(P, P) # optional - sage.rings.number_field + sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) # optional - sage.rings.number_field + sage: f.local_height_arch(1) # optional - sage.rings.number_field 0.6931471805599453094172321214582 """ K = FractionField(self.domain().base_ring()) @@ -1501,20 +1507,20 @@ def wronskian_ideal(self): EXAMPLES:: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2+11) - sage: P. = ProjectiveSpace(K,1) - sage: H = End(P) - sage: f = H([x^2-w*y^2, w*y^2]) - sage: f.wronskian_ideal() + sage: K. = NumberField(x^2 + 11) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: H = End(P) # optional - sage.rings.number_field + sage: f = H([x^2 - w*y^2, w*y^2]) # optional - sage.rings.number_field + sage: f.wronskian_ideal() # optional - sage.rings.number_field Ideal ((4*w)*x*y) of Multivariate Polynomial Ring in x, y over Number Field in w with defining polynomial x^2 + 11 :: - sage: P. = ProjectiveSpace(QQ,1) - sage: P2. = ProjectiveSpace(K,2) + sage: P. = ProjectiveSpace(QQ, 1) + sage: P2. = ProjectiveSpace(K, 2) sage: H = Hom(P,P2) - sage: f = H([x^2-2*y^2, y^2, x*y]) + sage: f = H([x^2 - 2*y^2, y^2, x*y]) sage: f.wronskian_ideal() Ideal (4*x*y, 2*x^2 + 4*y^2, -2*y^2) of Multivariate Polynomial Ring in x, y over Rational Field @@ -1599,22 +1605,22 @@ def rational_preimages(self, Q, k=1): A number field example :: sage: z = QQ['z'].0 - sage: K. = NumberField(z^2 - 2); - sage: P. = ProjectiveSpace(K, 1) - sage: H = End(P) - sage: f = H([x^2 + y^2, y^2]) - sage: f.rational_preimages(P(3, 1)) + sage: K. = NumberField(z^2 - 2) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: H = End(P) # optional - sage.rings.number_field + sage: f = H([x^2 + y^2, y^2]) # optional - sage.rings.number_field + sage: f.rational_preimages(P(3, 1)) # optional - sage.rings.number_field [(-a : 1), (a : 1)] :: sage: z = QQ['z'].0 - sage: K. = NumberField(z^2 - 2); - sage: P. = ProjectiveSpace(K, 2) - sage: X = P.subscheme([x^2 - z^2]) - sage: H = End(X) - sage: f= H([x^2 - z^2, a*y^2, z^2 - x^2]) - sage: f.rational_preimages(X([1, 2, -1])) + sage: K. = NumberField(z^2 - 2) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field + sage: X = P.subscheme([x^2 - z^2]) # optional - sage.rings.number_field + sage: H = End(X) # optional - sage.rings.number_field + sage: f= H([x^2 - z^2, a*y^2, z^2 - x^2]) # optional - sage.rings.number_field + sage: f.rational_preimages(X([1, 2, -1])) # optional - sage.rings.number_field [] :: @@ -1634,7 +1640,7 @@ def rational_preimages(self, Q, k=1): sage: P. = ProjectiveSpace(QQ, 1) sage: H = End(P) - sage: f = H([x^2-y^2, y^2]) + sage: f = H([x^2 - y^2, y^2]) sage: f.rational_preimages(P.subscheme([x])) Closed subscheme of Projective Space of dimension 1 over Rational Field defined by: @@ -1707,10 +1713,10 @@ def _number_field_from_algebraics(self): EXAMPLES:: sage: R. = PolynomialRing(QQ) - sage: P. = ProjectiveSpace(QQbar,1) - sage: H = End(P) - sage: f = H([QQbar(3^(1/3))*x^2 + QQbar(sqrt(-2))*y^2, y^2]) - sage: f._number_field_from_algebraics() + sage: P. = ProjectiveSpace(QQbar, 1) # optional - sage.rings.number_field + sage: H = End(P) # optional - sage.rings.number_field + sage: f = H([QQbar(3^(1/3))*x^2 + QQbar(sqrt(-2))*y^2, y^2]) # optional - sage.rings.number_field + sage: f._number_field_from_algebraics() # optional - sage.rings.number_field Scheme endomorphism of Projective Space of dimension 1 over Number Field in a with defining polynomial y^6 + 6*y^4 - 6*y^3 + 12*y^2 + 36*y + 17 with a = 1.442249570307409? + 1.414213562373095?*I @@ -1721,11 +1727,11 @@ def _number_field_from_algebraics(self): :: - sage: P. = ProjectiveSpace(QQbar,1) - sage: P2. = ProjectiveSpace(QQbar,2) - sage: H = Hom(P, P2) - sage: f = H([x^2 + QQbar(I)*x*y + 3*y^2, y^2, QQbar(sqrt(5))*x*y]) - sage: f._number_field_from_algebraics() + sage: P. = ProjectiveSpace(QQbar, 1) # optional - sage.rings.number_field + sage: P2. = ProjectiveSpace(QQbar, 2) # optional - sage.rings.number_field + sage: H = Hom(P, P2) # optional - sage.rings.number_field + sage: f = H([x^2 + QQbar(I)*x*y + 3*y^2, y^2, QQbar(sqrt(5))*x*y]) # optional - sage.rings.number_field + sage: f._number_field_from_algebraics() # optional - sage.rings.number_field Scheme morphism: From: Projective Space of dimension 1 over Number Field in a with defining polynomial y^4 + 3*y^2 + 1 with a = 0.?e-113 + 0.618033988749895?*I @@ -1736,17 +1742,17 @@ def _number_field_from_algebraics(self): The following was fixed in :trac:`23808`:: - sage: R.=PolynomialRing(QQ) - sage: s = (t^3+t+1).roots(QQbar)[0][0] - sage: P.=ProjectiveSpace(QQbar,1) - sage: H = Hom(P,P) - sage: f = H([s*x^3-13*y^3, y^3-15*y^3]) - sage: f + sage: R. = PolynomialRing(QQ) + sage: s = (t^3 + t + 1).roots(QQbar)[0][0] # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(QQbar, 1) # optional - sage.rings.number_field + sage: H = Hom(P, P) # optional - sage.rings.number_field + sage: f = H([s*x^3 - 13*y^3, y^3 - 15*y^3]) # optional - sage.rings.number_field + sage: f # optional - sage.rings.number_field Scheme endomorphism of Projective Space of dimension 1 over Algebraic Field Defn: Defined on coordinates by sending (x : y) to ((-0.6823278038280193?)*x^3 + (-13)*y^3 : (-14)*y^3) - sage: f_alg = f._number_field_from_algebraics() - sage: f_alg.change_ring(QQbar) # Used to fail + sage: f_alg = f._number_field_from_algebraics() # optional - sage.rings.number_field + sage: f_alg.change_ring(QQbar) # Used to fail # optional - sage.rings.number_field Scheme endomorphism of Projective Space of dimension 1 over Algebraic Field Defn: Defined on coordinates by sending (x : y) to ((-0.6823278038280193?)*x^3 + (-13)*y^3 : (-14)*y^3) @@ -1806,9 +1812,9 @@ def base_indeterminacy_locus(self): EXAMPLES:: - sage: P. = ProjectiveSpace(QQ,2) + sage: P. = ProjectiveSpace(QQ, 2) sage: H = End(P) - sage: f = H([x*z-y*z, x^2-y^2, z^2]) + sage: f = H([x*z - y*z, x^2 - y^2, z^2]) sage: f.base_indeterminacy_locus() Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x*z - y*z, @@ -1817,7 +1823,7 @@ def base_indeterminacy_locus(self): :: - sage: P. = ProjectiveSpace(QQ,2) + sage: P. = ProjectiveSpace(QQ, 2) sage: H = End(P) sage: f = H([x^2, y^2, z^2]) sage: f.base_indeterminacy_locus() @@ -1829,9 +1835,9 @@ def base_indeterminacy_locus(self): :: - sage: P1. = ProjectiveSpace(RR,2) - sage: P2. = ProjectiveSpace(RR,3) - sage: H = Hom(P1,P2) + sage: P1. = ProjectiveSpace(RR, 2) + sage: P2. = ProjectiveSpace(RR, 3) + sage: H = Hom(P1, P2) sage: h = H([y^3*z^3, x^3*z^3, y^3*z^3, x^2*y^2*z^2]) sage: h.base_indeterminacy_locus() Closed subscheme of Projective Space of dimension 2 over Real Field with @@ -1843,9 +1849,9 @@ def base_indeterminacy_locus(self): If defining polynomials are not normalized, output scheme will not be normalized:: - sage: P.=ProjectiveSpace(QQ,2) - sage: H=End(P) - sage: f=H([x*x^2,x*y^2,x*z^2]) + sage: P. = ProjectiveSpace(QQ,2) + sage: H = End(P) + sage: f = H([x*x^2,x*y^2,x*z^2]) sage: f.base_indeterminacy_locus() Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: @@ -1868,7 +1874,7 @@ def indeterminacy_locus(self): EXAMPLES:: - sage: P. = ProjectiveSpace(QQ,2) + sage: P. = ProjectiveSpace(QQ, 2) sage: H = End(P) sage: f = H([x^2, y^2, z^2]) sage: f.indeterminacy_locus() @@ -1881,7 +1887,7 @@ def indeterminacy_locus(self): :: - sage: P. = ProjectiveSpace(QQ,2) + sage: P. = ProjectiveSpace(QQ, 2) sage: H = End(P) sage: f = H([x*z - y*z, x^2 - y^2, z^2]) sage: f.indeterminacy_locus() @@ -1893,7 +1899,7 @@ def indeterminacy_locus(self): computes the indeterminacy locus only from the defining polynomials of the map:: - sage: P. = ProjectiveSpace(QQ,2) + sage: P. = ProjectiveSpace(QQ, 2) sage: H = End(P) sage: f = H([x*z - y*z, x^2 - y^2, z^2]) sage: f.base_indeterminacy_locus() @@ -1925,9 +1931,9 @@ def indeterminacy_points(self, F=None, base=False): EXAMPLES:: - sage: P. = ProjectiveSpace(QQ,2) + sage: P. = ProjectiveSpace(QQ, 2) sage: H = End(P) - sage: f = H([x*z-y*z, x^2-y^2, z^2]) + sage: f = H([x*z - y*z, x^2 - y^2, z^2]) sage: f.indeterminacy_points() ... DeprecationWarning: The meaning of indeterminacy_locus() has changed. Read the docstring. See /~https://github.com/sagemath/sage/issues/29145 for details. @@ -1935,10 +1941,10 @@ def indeterminacy_points(self, F=None, base=False): :: - sage: P1. = ProjectiveSpace(RR,2) - sage: P2. = ProjectiveSpace(RR,3) - sage: H = Hom(P1,P2) - sage: h = H([x+y, y, z+y, y]) + sage: P1. = ProjectiveSpace(RR, 2) + sage: P2. = ProjectiveSpace(RR, 3) + sage: H = Hom(P1, P2) + sage: h = H([x + y, y, z + y, y]) sage: set_verbose(None) sage: h.indeterminacy_points(base=True) [] @@ -1950,17 +1956,17 @@ def indeterminacy_points(self, F=None, base=False): :: - sage: P. = ProjectiveSpace(QQ,2) + sage: P. = ProjectiveSpace(QQ, 2) sage: H = End(P) - sage: f = H([x^2+y^2, x*z, x^2+y^2]) + sage: f = H([x^2 + y^2, x*z, x^2 + y^2]) sage: f.indeterminacy_points() [(0 : 0 : 1)] sage: R. = QQ[] - sage: K. = NumberField(t^2+1) - sage: f.indeterminacy_points(F=K) + sage: K. = NumberField(t^2 + 1) # optional - sage.rings.number_field + sage: f.indeterminacy_points(F=K) # optional - sage.rings.number_field [(-a : 1 : 0), (0 : 0 : 1), (a : 1 : 0)] sage: set_verbose(None) - sage: f.indeterminacy_points(F=QQbar, base=True) + sage: f.indeterminacy_points(F=QQbar, base=True) # optional - sage.rings.number_field [(-1*I : 1 : 0), (0 : 0 : 1), (1*I : 1 : 0)] :: @@ -1976,10 +1982,10 @@ def indeterminacy_points(self, F=None, base=False): :: sage: set_verbose(None) - sage: P. = ProjectiveSpace(Qp(3), 2) - sage: H = End(P) - sage: f = H([x^2 - 7*y^2, y^2 - z^2, x^2 - 7*z^2]) - sage: f.indeterminacy_points(base=True) + sage: P. = ProjectiveSpace(Qp(3), 2) # optional - sage.rings.padics + sage: H = End(P) # optional - sage.rings.padics + sage: f = H([x^2 - 7*y^2, y^2 - z^2, x^2 - 7*z^2]) # optional - sage.rings.padics + sage: f.indeterminacy_points(base=True) # optional - sage.rings.padics [(2 + 3 + 3^2 + 2*3^3 + 2*3^5 + 2*3^6 + 3^8 + 3^9 + 2*3^11 + 3^15 + 2*3^16 + 3^18 + O(3^20) : 1 + O(3^20) : 1 + O(3^20)), (2 + 3 + 3^2 + 2*3^3 + 2*3^5 + 2*3^6 + 3^8 + 3^9 + 2*3^11 + 3^15 + @@ -2026,26 +2032,26 @@ def reduce_base_field(self): EXAMPLES:: - sage: K. = GF(3^4) - sage: P. = ProjectiveSpace(K, 1) - sage: P2. = ProjectiveSpace(K, 2) - sage: H = End(P) - sage: H2 = Hom(P,P2) - sage: H3 = Hom(P2,P) - sage: f = H([x^2 + (2*t^3 + 2*t^2 + 1)*y^2, y^2]) - sage: f.reduce_base_field() + sage: K. = GF(3^4) # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.finite_rings + sage: P2. = ProjectiveSpace(K, 2) # optional - sage.rings.finite_rings + sage: H = End(P) # optional - sage.rings.finite_rings + sage: H2 = Hom(P, P2) # optional - sage.rings.finite_rings + sage: H3 = Hom(P2, P) # optional - sage.rings.finite_rings + sage: f = H([x^2 + (2*t^3 + 2*t^2 + 1)*y^2, y^2]) # optional - sage.rings.finite_rings + sage: f.reduce_base_field() # optional - sage.rings.finite_rings Scheme endomorphism of Projective Space of dimension 1 over Finite Field in t2 of size 3^2 Defn: Defined on coordinates by sending (x : y) to (x^2 + t2*y^2 : y^2) - sage: f2 = H2([x^2 + 5*y^2,y^2, 2*x*y]) - sage: f2.reduce_base_field() + sage: f2 = H2([x^2 + 5*y^2, y^2, 2*x*y]) # optional - sage.rings.finite_rings + sage: f2.reduce_base_field() # optional - sage.rings.finite_rings Scheme morphism: From: Projective Space of dimension 1 over Finite Field of size 3 To: Projective Space of dimension 2 over Finite Field of size 3 Defn: Defined on coordinates by sending (x : y) to (x^2 - y^2 : y^2 : -x*y) - sage: f3 = H3([a^2 + t*b^2, c^2]) - sage: f3.reduce_base_field() + sage: f3 = H3([a^2 + t*b^2, c^2]) # optional - sage.rings.finite_rings + sage: f3.reduce_base_field() # optional - sage.rings.finite_rings Scheme morphism: From: Projective Space of dimension 2 over Finite Field in t of size 3^4 To: Projective Space of dimension 1 over Finite Field in t of size 3^4 @@ -2054,39 +2060,41 @@ def reduce_base_field(self): :: - sage: K. = CyclotomicField(4) - sage: P. = ProjectiveSpace(K, 1) - sage: H = End(P) - sage: f = H([x^2 + 2*y^2, y^2]) - sage: f.reduce_base_field() + sage: K. = CyclotomicField(4) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: H = End(P) # optional - sage.rings.number_field + sage: f = H([x^2 + 2*y^2, y^2]) # optional - sage.rings.number_field + sage: f.reduce_base_field() # optional - sage.rings.number_field Scheme endomorphism of Projective Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x : y) to (x^2 + 2*y^2 : y^2) :: - sage: K. = GF(5) - sage: L = K.algebraic_closure() - sage: P. = ProjectiveSpace(L, 1) - sage: H = End(P) - sage: f = H([(L.gen(2))*x^2 + L.gen(4)*y^2, x*y]) - sage: f.reduce_base_field() - Scheme endomorphism of Projective Space of dimension 1 over Finite Field in z4 of size 5^4 + sage: K. = GF(5) # optional - sage.rings.finite_rings + sage: L = K.algebraic_closure() # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(L, 1) # optional - sage.rings.finite_rings + sage: H = End(P) # optional - sage.rings.finite_rings + sage: f = H([(L.gen(2))*x^2 + L.gen(4)*y^2, x*y]) # optional - sage.rings.finite_rings + sage: f.reduce_base_field() # optional - sage.rings.finite_rings + Scheme endomorphism of Projective Space of dimension 1 + over Finite Field in z4 of size 5^4 Defn: Defined on coordinates by sending (x : y) to ((z4^3 + z4^2 + z4 - 2)*x^2 + z4*y^2 : x*y) - sage: f=DynamicalSystem_projective([L.gen(3)*x^2 + L.gen(2)*y^2, x*y]) - sage: f.reduce_base_field() - Dynamical System of Projective Space of dimension 1 over Finite Field in z6 of size 5^6 + sage: f = DynamicalSystem_projective([L.gen(3)*x^2 + L.gen(2)*y^2, x*y]) # optional - sage.rings.finite_rings + sage: f.reduce_base_field() # optional - sage.rings.finite_rings + Dynamical System of Projective Space of dimension 1 + over Finite Field in z6 of size 5^6 Defn: Defined on coordinates by sending (x : y) to ((-z6^5 + z6^4 - z6^3 - z6^2 - 2*z6 - 2)*x^2 + (z6^5 - 2*z6^4 + z6^2 - z6 + 1)*y^2 : x*y) TESTS:: - sage: F = GF(3).algebraic_closure() - sage: P. = ProjectiveSpace(F, 1) - sage: H = Hom(P, P) - sage: f = H([x^2 + y^2, y^2]) - sage: f.reduce_base_field() + sage: F = GF(3).algebraic_closure() # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(F, 1) # optional - sage.rings.finite_rings + sage: H = Hom(P, P) # optional - sage.rings.finite_rings + sage: f = H([x^2 + y^2, y^2]) # optional - sage.rings.finite_rings + sage: f.reduce_base_field() # optional - sage.rings.finite_rings Scheme endomorphism of Projective Space of dimension 1 over Finite Field of size 3 Defn: Defined on coordinates by sending (x : y) to (x^2 + y^2 : y^2) @@ -2209,7 +2217,7 @@ def image(self): sage: P2. = ProjectiveSpace(QQ, 2) sage: A2. = AffineSpace(QQ, 2) - sage: f = P2.hom([1,x0/x1], A2) + sage: f = P2.hom([1, x0/x1], A2) sage: f.image() Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: -x + 1 @@ -2227,10 +2235,10 @@ def _fast_eval(self, x): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(7),2) - sage: H = Hom(P,P) - sage: f = H([x^2+y^2, y^2, z^2 + y*z]) - sage: f._fast_eval([1,1,1]) + sage: P. = ProjectiveSpace(GF(7), 2) # optional - sage.rings.finite_rings + sage: H = Hom(P, P) # optional - sage.rings.finite_rings + sage: f = H([x^2 + y^2, y^2, z^2 + y*z]) # optional - sage.rings.finite_rings + sage: f._fast_eval([1,1,1]) # optional - sage.rings.finite_rings [2, 1, 2] """ if self._is_prime_finite_field: @@ -2324,7 +2332,7 @@ def representatives(self): EXAMPLES:: - sage: P2. = ProjectiveSpace(QQ,2) + sage: P2. = ProjectiveSpace(QQ, 2) sage: X = P2.subscheme(0) sage: f = X.hom([x^2*y, x^2*z, x*y*z], P2) sage: f.representatives() @@ -2337,8 +2345,8 @@ def representatives(self): :: - sage: P2. = ProjectiveSpace(QQ,2) - sage: P1. = ProjectiveSpace(QQ,1) + sage: P2. = ProjectiveSpace(QQ, 2) + sage: P1. = ProjectiveSpace(QQ, 1) sage: X = P2.subscheme([x^2 - y^2 - y*z]) sage: f = X.hom([x, y], P1) sage: f.representatives() @@ -2371,9 +2379,9 @@ def representatives(self): :: - sage: P2. = ProjectiveSpace(QQ,2) + sage: P2. = ProjectiveSpace(QQ, 2) sage: X = P2.subscheme([x^2 - y^2 - y*z]) - sage: A1. = AffineSpace(QQ,1) + sage: A1. = AffineSpace(QQ, 1) sage: g = X.hom([y/x], A1) sage: g.representatives() [Scheme morphism: @@ -2490,7 +2498,7 @@ def indeterminacy_locus(self): :: sage: P2. = ProjectiveSpace(QQ, 2) - sage: P1. = ProjectiveSpace(QQ,1) + sage: P1. = ProjectiveSpace(QQ, 1) sage: X = P2.subscheme([x^2 - y^2 - y*z]) sage: f = X.hom([x,y], P1) sage: f.indeterminacy_locus() @@ -2572,7 +2580,7 @@ def is_morphism(self): EXAMPLES:: sage: P2. = ProjectiveSpace(QQ,2) - sage: P1. = ProjectiveSpace(QQ,1) + sage: P1. = ProjectiveSpace(QQ, 1) sage: X = P2.subscheme([x^2 - y^2 - y*z]) sage: f = X.hom([x,y], P1) sage: f.is_morphism() @@ -2703,12 +2711,12 @@ def projective_degrees(self): EXAMPLES:: - sage: k = GF(11) - sage: E = EllipticCurve(k,[1,1]) - sage: Q = E(6,5) - sage: phi = E.scalar_multiplication(2) - sage: mor = phi.as_morphism() - sage: mor.projective_degrees() + sage: k = GF(11) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(k, [1,1]) # optional - sage.rings.finite_rings + sage: Q = E(6, 5) # optional - sage.rings.finite_rings + sage: phi = E.scalar_multiplication(2) # optional - sage.rings.finite_rings + sage: mor = phi.as_morphism() # optional - sage.rings.finite_rings + sage: mor.projective_degrees() # optional - sage.rings.finite_rings (12, 3) """ X = self.domain() @@ -2745,12 +2753,12 @@ def degree(self): EXAMPLES:: - sage: k = GF(11) - sage: E = EllipticCurve(k,[1,1]) - sage: Q = E(6,5) - sage: phi = E.scalar_multiplication(2) - sage: mor = phi.as_morphism() - sage: mor.degree() + sage: k = GF(11) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(k, [1,1]) # optional - sage.rings.finite_rings + sage: Q = E(6, 5) # optional - sage.rings.finite_rings + sage: phi = E.scalar_multiplication(2) # optional - sage.rings.finite_rings + sage: mor = phi.as_morphism() # optional - sage.rings.finite_rings + sage: mor.degree() # optional - sage.rings.finite_rings 4 """ return self.projective_degrees()[0] // self.image().degree() diff --git a/src/sage/schemes/projective/projective_point.py b/src/sage/schemes/projective/projective_point.py index d7441f0f463..c1da28f1748 100644 --- a/src/sage/schemes/projective/projective_point.py +++ b/src/sage/schemes/projective/projective_point.py @@ -130,20 +130,20 @@ def __init__(self, X, v, check=True): :: sage: P. = ProjectiveSpace(2, ZZ) - sage: X = P.subscheme([x^2-y*z]) + sage: X = P.subscheme([x^2 - y*z]) sage: X([2, 2, 2]) (2 : 2 : 2) :: sage: R. = PolynomialRing(ZZ) - sage: P = ProjectiveSpace(1, R.quo(t^2+1)) + sage: P = ProjectiveSpace(1, R.quo(t^2 + 1)) sage: P([2*t, 1]) (2*tbar : 1) :: - sage: P = ProjectiveSpace(ZZ,1) + sage: P = ProjectiveSpace(ZZ, 1) sage: P.point(Infinity) (1 : 0) sage: P(infinity) @@ -151,7 +151,7 @@ def __init__(self, X, v, check=True): :: - sage: P = ProjectiveSpace(ZZ,2) + sage: P = ProjectiveSpace(ZZ, 2) sage: P(Infinity) Traceback (most recent call last): ... @@ -234,17 +234,17 @@ def _richcmp_(self, right, op): :: - sage: PS = ProjectiveSpace(Zp(5), 1, 'x') - sage: P = PS([0, 1]) - sage: P == PS(0) + sage: PS = ProjectiveSpace(Zp(5), 1, 'x') # optional - sage.rings.padics + sage: P = PS([0, 1]) # optional - sage.rings.padics + sage: P == PS(0) # optional - sage.rings.padics True :: sage: R. = PolynomialRing(QQ) sage: PS = ProjectiveSpace(R, 1, 'x') - sage: P = PS([t, 1+t^2]) - sage: Q = PS([t^2, t+t^3]) + sage: P = PS([t, 1 + t^2]) + sage: Q = PS([t^2, t + t^3]) sage: P == Q True @@ -259,9 +259,9 @@ def _richcmp_(self, right, op): sage: PS = ProjectiveSpace(ZZ, 1, 'x') sage: P = PS([2, 1]) - sage: PS2 = ProjectiveSpace(Zp(7), 1, 'x') - sage: Q = PS2([2, 1]) - sage: P == Q + sage: PS2 = ProjectiveSpace(Zp(7), 1, 'x') # optional - sage.rings.padics + sage: Q = PS2([2, 1]) # optional - sage.rings.padics + sage: P == Q # optional - sage.rings.padics True :: @@ -283,23 +283,23 @@ def _richcmp_(self, right, op): :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(z^2+5) - sage: OK = K.ring_of_integers() - sage: t = OK.gen(1) - sage: PS. = ProjectiveSpace(OK,1) - sage: P = PS(2, 1+t) - sage: Q = PS(1-t, 3) - sage: P == Q + sage: K. = NumberField(z^2 + 5) # optional - sage.rings.number_field + sage: OK = K.ring_of_integers() # optional - sage.rings.number_field + sage: t = OK.gen(1) # optional - sage.rings.number_field + sage: PS. = ProjectiveSpace(OK, 1) # optional - sage.rings.number_field + sage: P = PS(2, 1 + t) # optional - sage.rings.number_field + sage: Q = PS(1 - t, 3) # optional - sage.rings.number_field + sage: P == Q # optional - sage.rings.number_field True Check that :trac:`17429` is fixed:: sage: R. = PolynomialRing(QQ) - sage: r = (x^2-x-3).polynomial(x).roots(ComplexIntervalField(), multiplicities=False) + sage: r = (x^2 - x - 3).polynomial(x).roots(ComplexIntervalField(), multiplicities=False) sage: P. = ProjectiveSpace(ComplexIntervalField(), 1) sage: P1 = P(r[0], 1) sage: H = End(P) - sage: f = H([x^2-3*y^2, y^2]) + sage: f = H([x^2 - 3*y^2, y^2]) sage: Q1 = f(P1) sage: Q1 == P1 False @@ -322,17 +322,17 @@ def _richcmp_(self, right, op): :: - sage: PS = ProjectiveSpace(Zp(5), 1, 'x') - sage: P = PS([0, 1]) - sage: P != PS(0) + sage: PS = ProjectiveSpace(Zp(5), 1, 'x') # optional - sage.rings.padics + sage: P = PS([0, 1]) # optional - sage.rings.padics + sage: P != PS(0) # optional - sage.rings.padics False :: sage: R. = PolynomialRing(QQ) sage: PS = ProjectiveSpace(R, 1, 'x') - sage: P = PS([t, 1+t^2]) - sage: Q = PS([t^2, t+t^3]) + sage: P = PS([t, 1 + t^2]) + sage: Q = PS([t^2, t + t^3]) sage: P != Q False @@ -347,9 +347,9 @@ def _richcmp_(self, right, op): sage: PS = ProjectiveSpace(ZZ, 1, 'x') sage: P = PS([2, 1]) - sage: PS2 = ProjectiveSpace(Zp(7), 1, 'x') - sage: Q = PS2([2, 1]) - sage: P != Q + sage: PS2 = ProjectiveSpace(Zp(7), 1, 'x') # optional - sage.rings.padics + sage: Q = PS2([2, 1]) # optional - sage.rings.padics + sage: P != Q # optional - sage.rings.padics False :: @@ -395,10 +395,10 @@ def __hash__(self): :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2 + 3) - sage: O = K.maximal_order() - sage: P. = ProjectiveSpace(O, 1) - sage: hash(P([1+w, 2])) == hash(P([2, 1-w])) + sage: K. = NumberField(x^2 + 3) # optional - sage.rings.number_field + sage: O = K.maximal_order() # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(O, 1) # optional - sage.rings.number_field + sage: hash(P([1 + w, 2])) == hash(P([2, 1 - w])) # optional - sage.rings.number_field True TESTS:: @@ -407,9 +407,9 @@ def __hash__(self): sage: Q. = ProjectiveSpace(Zmod(10), 1) sage: hash(P([2, 5])) == hash(Q([2, 5])) True - sage: hash(P([2, 5])) == hash(P([2,5])) + sage: hash(P([2, 5])) == hash(P([2, 5])) True - sage: hash(P([3, 7])) == hash(P([2,5])) + sage: hash(P([3, 7])) == hash(P([2, 5])) True """ R = self.codomain().base_ring() @@ -437,35 +437,35 @@ def _matrix_times_point_(self, mat, dom): EXAMPLES:: - sage: P = ProjectiveSpace(QQ,1) + sage: P = ProjectiveSpace(QQ, 1) sage: Q = P(1,1) - sage: m = matrix(QQ, 2, 2, [1,1,0,1]) + sage: m = matrix(QQ, 2, 2, [1,1, 0,1]) sage: m*Q (2 : 1) :: - sage: P. = ProjectiveSpace(QQ,2) - sage: X = P.subscheme(x-y) + sage: P. = ProjectiveSpace(QQ, 2) + sage: X = P.subscheme(x - y) sage: Q = X(1,1) - sage: m = matrix(CC, 3, 3, [1,CC.0,0,CC.0,1,0,1,1,1]) + sage: m = matrix(CC, 3, 3, [1,CC.0,0, CC.0,1,0, 1,1,1]) sage: m*Q (0.333333333333333 + 0.333333333333333*I : 0.333333333333333 + 0.333333333333333*I : 1.00000000000000) :: - sage: P = ProjectiveSpace(QQbar,1) - sage: Q = P(QQbar(sqrt(2)),1) - sage: m = matrix(ZZ, 2, 2, [1,-1,0,1]) - sage: m*Q + sage: P = ProjectiveSpace(QQbar, 1) # optional - sage.rings.number_field + sage: Q = P(QQbar(sqrt(2)),1) # optional - sage.rings.number_field sage.symbolic + sage: m = matrix(ZZ, 2, 2, [1,-1, 0,1]) # optional - sage.rings.number_field sage.symbolic + sage: m*Q # optional - sage.rings.number_field sage.symbolic (0.4142135623730951? : 1) :: - sage: P = ProjectiveSpace(QQ,1) + sage: P = ProjectiveSpace(QQ, 1) sage: Q = P(1,1) - sage: m = matrix(QQ, 3, 2, [1,1,0,1,1,1]) + sage: m = matrix(QQ, 3, 2, [1,1, 0,1, 1,1]) sage: m*Q Traceback (most recent call last): ... @@ -537,29 +537,29 @@ def normalize_coordinates(self): EXAMPLES:: - sage: P = ProjectiveSpace(ZZ,2,'x') + sage: P = ProjectiveSpace(ZZ, 2, 'x') sage: p = P([-5, -15, -20]) sage: p.normalize_coordinates(); p (1 : 3 : 4) :: - sage: P = ProjectiveSpace(Zp(7),2,'x') - sage: p = P([-5, -15, -2]) - sage: p.normalize_coordinates(); p + sage: P = ProjectiveSpace(Zp(7), 2, 'x') # optional - sage.rings.padics + sage: p = P([-5, -15, -2]) # optional - sage.rings.padics + sage: p.normalize_coordinates(); p # optional - sage.rings.padics (5 + O(7^20) : 1 + 2*7 + O(7^20) : 2 + O(7^20)) :: sage: R. = PolynomialRing(QQ) - sage: P = ProjectiveSpace(R,2,'x') + sage: P = ProjectiveSpace(R, 2, 'x') sage: p = P([3/5*t^3, 6*t, t]) sage: p.normalize_coordinates(); p (3/5*t^2 : 6 : 1) :: - sage: P. = ProjectiveSpace(Zmod(20),1) + sage: P. = ProjectiveSpace(Zmod(20), 1) sage: Q = P(3, 6) sage: Q.normalize_coordinates() sage: Q @@ -569,7 +569,7 @@ def normalize_coordinates(self): gcd `c` is removed. :: sage: R. = PolynomialRing(QQ) - sage: P = ProjectiveSpace(R,1) + sage: P = ProjectiveSpace(R, 1) sage: Q = P(2*c, 4*c) sage: Q.normalize_coordinates();Q (2 : 4) @@ -577,17 +577,17 @@ def normalize_coordinates(self): A polynomial ring over a ring gives the more intuitive result. :: sage: R. = PolynomialRing(ZZ) - sage: P = ProjectiveSpace(R,1) + sage: P = ProjectiveSpace(R, 1) sage: Q = P(2*c, 4*c) sage: Q.normalize_coordinates();Q (1 : 2) :: - sage: R. = PolynomialRing(QQ,1) + sage: R. = PolynomialRing(QQ, 1) sage: S = R.quotient_ring(R.ideal(t^3)) - sage: P. = ProjectiveSpace(S,1) - sage: Q = P(t+1, t^2+t) + sage: P. = ProjectiveSpace(S, 1) + sage: Q = P(t + 1, t^2 + t) sage: Q.normalize_coordinates() sage: Q (1 : tbar) @@ -636,8 +636,8 @@ def dehomogenize(self,n): EXAMPLES:: - sage: P. = ProjectiveSpace(QQ,2) - sage: X = P.subscheme(x^2-y^2); + sage: P. = ProjectiveSpace(QQ, 2) + sage: X = P.subscheme(x^2 - y^2) sage: Q = X(23, 23, 46) sage: Q.dehomogenize(2) (1/2, 1/2) @@ -646,23 +646,23 @@ def dehomogenize(self,n): sage: R. = PolynomialRing(QQ) sage: S = R.quo(R.ideal(t^3)) - sage: P. = ProjectiveSpace(S,2) + sage: P. = ProjectiveSpace(S, 2) sage: Q = P(t, 1, 1) sage: Q.dehomogenize(1) (tbar, 1) :: - sage: P. = ProjectiveSpace(GF(5),2) - sage: Q = P(1, 3, 1) - sage: Q.dehomogenize(0) + sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings + sage: Q = P(1, 3, 1) # optional - sage.rings.finite_rings + sage: Q.dehomogenize(0) # optional - sage.rings.finite_rings (3, 1) :: - sage: P.= ProjectiveSpace(GF(5),2) - sage: Q = P(1, 3, 0) - sage: Q.dehomogenize(2) + sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings + sage: Q = P(1, 3, 0) # optional - sage.rings.finite_rings + sage: Q.dehomogenize(2) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: can...t dehomogenize at 0 coordinate @@ -692,14 +692,14 @@ def global_height(self, prec=None): EXAMPLES:: - sage: P. = ProjectiveSpace(QQ,2) + sage: P. = ProjectiveSpace(QQ, 2) sage: Q = P.point([4, 4, 1/30]) sage: Q.global_height() 4.78749174278205 :: - sage: P. = ProjectiveSpace(ZZ,2) + sage: P. = ProjectiveSpace(ZZ, 2) sage: Q = P([4, 1, 30]) sage: Q.global_height() 3.40119738166216 @@ -707,36 +707,36 @@ def global_height(self, prec=None): :: sage: R. = PolynomialRing(QQ) - sage: k. = NumberField(x^2+5) - sage: A = ProjectiveSpace(k, 2, 'z') - sage: A([3, 5*w+1, 1]).global_height(prec=100) + sage: k. = NumberField(x^2 + 5) # optional - sage.rings.number_field + sage: A = ProjectiveSpace(k, 2, 'z') # optional - sage.rings.number_field + sage: A([3, 5*w + 1, 1]).global_height(prec=100) # optional - sage.rings.number_field 2.4181409534757389986565376694 :: - sage: P. = ProjectiveSpace(QQbar,2) - sage: Q = P([QQbar(sqrt(3)), QQbar(sqrt(-2)), 1]) - sage: Q.global_height() + sage: P. = ProjectiveSpace(QQbar, 2) # optional - sage.rings.number_field + sage: Q = P([QQbar(sqrt(3)), QQbar(sqrt(-2)), 1]) # optional - sage.rings.number_field + sage: Q.global_height() # optional - sage.rings.number_field 0.549306144334055 :: - sage: K = UniversalCyclotomicField() - sage: P. = ProjectiveSpace(K,2) - sage: Q = P.point([K(4/3), K.gen(7), K.gen(5)]) - sage: Q.global_height() + sage: K = UniversalCyclotomicField() # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field + sage: Q = P.point([K(4/3), K.gen(7), K.gen(5)]) # optional - sage.rings.number_field + sage: Q.global_height() # optional - sage.rings.number_field 1.38629436111989 TESTS:: sage: P = ProjectiveSpace(QQ, 2) - sage: P(1/1,2/3,5/8).global_height() + sage: P(1/1, 2/3, 5/8).global_height() 3.17805383034795 sage: x = polygen(QQ, 'x') - sage: F. = NumberField(x^3 - 5) - sage: P = ProjectiveSpace(F, 2) - sage: P(u,u^2/5,1).global_height() + sage: F. = NumberField(x^3 - 5) # optional - sage.rings.number_field + sage: P = ProjectiveSpace(F, 2) # optional - sage.rings.number_field + sage: P(u, u^2/5, 1).global_height() # optional - sage.rings.number_field 1.07295860828940 """ if prec is None: @@ -784,14 +784,14 @@ def local_height(self, v, prec=None): EXAMPLES:: - sage: P.= ProjectiveSpace(QQ,2) - sage: Q = P.point([4,4,1/150], False) + sage: P. = ProjectiveSpace(QQ, 2) + sage: Q = P.point([4, 4, 1/150], False) sage: Q.local_height(5) 3.21887582486820 :: - sage: P. = ProjectiveSpace(QQ,2) + sage: P. = ProjectiveSpace(QQ, 2) sage: Q = P([4, 1, 30]) sage: Q.local_height(2) 0.693147180559945 @@ -818,16 +818,16 @@ def local_height_arch(self, i, prec=None): EXAMPLES:: - sage: P. = ProjectiveSpace(QQ,2) + sage: P. = ProjectiveSpace(QQ, 2) sage: Q = P.point([4, 4, 1/150], False) sage: Q.local_height_arch(0) 1.38629436111989 :: - sage: P. = ProjectiveSpace(QuadraticField(5, 'w'), 2) - sage: Q = P.point([4, 1, 30], False) - sage: Q.local_height_arch(1) + sage: P. = ProjectiveSpace(QuadraticField(5, 'w'), 2) # optional - sage.rings.number_field + sage: Q = P.point([4, 1, 30], False) # optional - sage.rings.number_field + sage: Q.local_height_arch(1) # optional - sage.rings.number_field 3.401197381662155375413236691607 """ K = FractionField(self.domain().base_ring()) @@ -861,7 +861,7 @@ def multiplier(self, f, n, check=True): sage: P. = ProjectiveSpace(QQ,3) sage: f = DynamicalSystem_projective([x^2, y^2, 4*w^2, 4*z^2], domain=P) - sage: Q = P.point([4, 4, 1, 1], False); + sage: Q = P.point([4, 4, 1, 1], False) sage: Q.multiplier(f, 1) [ 2 0 -8] [ 0 2 -8] @@ -916,16 +916,16 @@ def is_preperiodic(self, f, err=0.1, return_period=False): EXAMPLES:: - sage: P. = ProjectiveSpace(QQ,1) - sage: f = DynamicalSystem_projective([x^3-3*x*y^2, y^3], domain=P) + sage: P. = ProjectiveSpace(QQ, 1) + sage: f = DynamicalSystem_projective([x^3 - 3*x*y^2, y^3], domain=P) sage: Q = P(-1, 1) sage: Q.is_preperiodic(f) True :: - sage: P. = ProjectiveSpace(QQ,1) - sage: f = DynamicalSystem_projective([x^2-29/16*y^2, y^2], domain=P) + sage: P. = ProjectiveSpace(QQ, 1) + sage: f = DynamicalSystem_projective([x^2 - 29/16*y^2, y^2], domain=P) sage: Q = P(1, 4) sage: Q.is_preperiodic(f, return_period=True) (1, 3) @@ -936,30 +936,37 @@ def is_preperiodic(self, f, err=0.1, return_period=False): :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2+1) - sage: P. = ProjectiveSpace(K, 1) - sage: f = DynamicalSystem_projective([x^5 + 5/4*x*y^4, y^5], domain=P) - sage: Q = P([-1/2*a+1/2, 1]) - sage: Q.is_preperiodic(f) + sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: f = DynamicalSystem_projective([x^5 + 5/4*x*y^4, y^5], domain=P) # optional - sage.rings.number_field + sage: Q = P([-1/2*a + 1/2, 1]) # optional - sage.rings.number_field + sage: Q.is_preperiodic(f) # optional - sage.rings.number_field True - sage: Q = P([a, 1]) - sage: Q.is_preperiodic(f) + sage: Q = P([a, 1]) # optional - sage.rings.number_field + sage: Q.is_preperiodic(f) # optional - sage.rings.number_field False :: - sage: P. = ProjectiveSpace(QQ,2) - sage: f = DynamicalSystem_projective([-38/45*x^2 + (2*y - 7/45*z)*x + (-1/2*y^2 - 1/2*y*z + z^2),\ - -67/90*x^2 + (2*y + z*157/90)*x - y*z, z^2], domain=P) + sage: P. = ProjectiveSpace(QQ, 2) + sage: f = DynamicalSystem_projective([ + ....: -38/45*x^2 + (2*y - 7/45*z)*x + (-1/2*y^2 - 1/2*y*z + z^2), + ....: -67/90*x^2 + (2*y + z*157/90)*x - y*z, + ....: z^2 + ....: ], domain=P) sage: Q = P([1, 3, 1]) sage: Q.is_preperiodic(f, return_period=True) (0, 9) :: - sage: P. = ProjectiveSpace(QQ,3) - sage: f = DynamicalSystem_projective([(-y - w)*x + (-13/30*y^2 + 13/30*w*y + w^2),\ - -1/2*x^2 + (-y + 3/2*w)*x + (-1/3*y^2 + 4/3*w*y),-3/2*z^2 + 5/2*z*w + w^2,w^2], domain=P) + sage: P. = ProjectiveSpace(QQ, 3) + sage: f = DynamicalSystem_projective([ + ....: (-y - w)*x + (-13/30*y^2 + 13/30*w*y + w^2), + ....: -1/2*x^2 + (-y + 3/2*w)*x + (-1/3*y^2 + 4/3*w*y), + ....: -3/2*z^2 + 5/2*z*w + w^2, + ....: w^2 + ....: ], domain=P) sage: Q = P([3,0,4/3,1]) sage: Q.is_preperiodic(f, return_period=True) (2, 24) @@ -968,42 +975,42 @@ def is_preperiodic(self, f, err=0.1, return_period=False): sage: from sage.misc.verbose import set_verbose sage: set_verbose(-1) - sage: P. = ProjectiveSpace(QQbar,2) - sage: f = DynamicalSystem_projective([x^2, QQbar(sqrt(-1))*y^2, z^2], domain=P) - sage: Q = P([1, 1, 1]) - sage: Q.is_preperiodic(f) + sage: P. = ProjectiveSpace(QQbar, 2) # optional - sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2, QQbar(sqrt(-1))*y^2, z^2], domain=P) # optional - sage.rings.number_field sage.symbolic + sage: Q = P([1, 1, 1]) # optional - sage.rings.number_field sage.symbolic + sage: Q.is_preperiodic(f) # optional - sage.rings.number_field sage.symbolic True :: sage: set_verbose(-1) - sage: P. = ProjectiveSpace(QQbar,2) - sage: f = DynamicalSystem_projective([x^2, y^2, z^2], domain=P) - sage: Q = P([QQbar(sqrt(-1)), 1, 1]) - sage: Q.is_preperiodic(f) + sage: P. = ProjectiveSpace(QQbar, 2) # optional - sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2, y^2, z^2], domain=P) # optional - sage.rings.number_field + sage: Q = P([QQbar(sqrt(-1)), 1, 1]) # optional - sage.rings.number_field sage.symbolic + sage: Q.is_preperiodic(f) # optional - sage.rings.number_field sage.symbolic True :: sage: P. = ProjectiveSpace(QQ, 1) - sage: f = DynamicalSystem_projective([16*x^2-29*y^2, 16*y^2], domain=P) + sage: f = DynamicalSystem_projective([16*x^2 - 29*y^2, 16*y^2], domain=P) sage: Q = P(-1,4) sage: Q.is_preperiodic(f) True :: - sage: P. =ProjectiveSpace(GF(3), 2) - sage: F = DynamicalSystem([x^2 - 2*y^2, y^2, z^2]) - sage: Q = P(1, 1, 1) - sage: Q.is_preperiodic(F, return_period=True) + sage: P. = ProjectiveSpace(GF(3), 2) # optional - sage.rings.finite_rings + sage: F = DynamicalSystem([x^2 - 2*y^2, y^2, z^2]) # optional - sage.rings.finite_rings + sage: Q = P(1, 1, 1) # optional - sage.rings.finite_rings + sage: Q.is_preperiodic(F, return_period=True) # optional - sage.rings.finite_rings (1, 1) TESTS:: sage: P. = ProjectiveSpace(QQ, 1) sage: H = End(P) - sage: f = H([16*x^2-29*y^2, 16*y^2]) + sage: f = H([16*x^2 - 29*y^2, 16*y^2]) sage: Q = P(-1,4) sage: Q.is_preperiodic(f) Traceback (most recent call last): @@ -1013,7 +1020,7 @@ def is_preperiodic(self, f, err=0.1, return_period=False): :: sage: P. = ProjectiveSpace(QQ, 1) - sage: f = DynamicalSystem_projective([16*x^2-29*y^2, 16*y^2]) + sage: f = DynamicalSystem_projective([16*x^2 - 29*y^2, 16*y^2]) sage: Q = P(11,4) sage: Q.is_preperiodic(f, err=2) False @@ -1072,20 +1079,20 @@ def __init__(self, X, v, check=True): :: sage: P. = ProjectiveSpace(2, QQ) - sage: X = P.subscheme([x^2-y*z]) + sage: X = P.subscheme([x^2 - y*z]) sage: X([2, 2, 2]) (1 : 1 : 1) :: - sage: P = ProjectiveSpace(1, GF(7)) - sage: Q=P([2, 1]) - sage: Q[0].parent() + sage: P = ProjectiveSpace(1, GF(7)) # optional - sage.rings.finite_rings + sage: Q=P([2, 1]) # optional - sage.rings.finite_rings + sage: Q[0].parent() # optional - sage.rings.finite_rings Finite Field of size 7 :: - sage: P = ProjectiveSpace(QQ,1) + sage: P = ProjectiveSpace(QQ, 1) sage: P.point(Infinity) (1 : 0) sage: P(infinity) @@ -1093,7 +1100,7 @@ def __init__(self, X, v, check=True): :: - sage: P = ProjectiveSpace(QQ,2) + sage: P = ProjectiveSpace(QQ, 2) sage: P(infinity) Traceback (most recent call last): ... @@ -1172,16 +1179,16 @@ def normalize_coordinates(self): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(5),2) - sage: Q = P.point([GF(5)(1), GF(5)(3), GF(5)(0)], False); Q + sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings + sage: Q = P.point([GF(5)(1), GF(5)(3), GF(5)(0)], False); Q # optional - sage.rings.finite_rings (1 : 3 : 0) - sage: Q.normalize_coordinates(); Q + sage: Q.normalize_coordinates(); Q # optional - sage.rings.finite_rings (2 : 1 : 0) :: sage: P. = ProjectiveSpace(QQ, 2) - sage: X = P.subscheme(x^2-y^2); + sage: X = P.subscheme(x^2 - y^2); sage: Q = X.point([23, 23, 46], False); Q (23 : 23 : 46) sage: Q.normalize_coordinates(); Q @@ -1204,25 +1211,26 @@ def _number_field_from_algebraics(self): EXAMPLES:: sage: R. = PolynomialRing(QQ) - sage: P. = ProjectiveSpace(QQbar,1) - sage: Q = P([-1/2*QQbar(sqrt(2)) + QQbar(I), 1]) - sage: S = Q._number_field_from_algebraics(); S + sage: P. = ProjectiveSpace(QQbar, 1) # optional - sage.rings.number_field + sage: Q = P([-1/2*QQbar(sqrt(2)) + QQbar(I), 1]) # optional - sage.rings.number_field sage.symbolic + sage: S = Q._number_field_from_algebraics(); S # optional - sage.rings.number_field sage.symbolic (1/2*a^3 + a^2 - 1/2*a : 1) - sage: S.codomain() - Projective Space of dimension 1 over Number Field in a with defining polynomial y^4 + 1 with a = 0.7071067811865475? + 0.7071067811865475?*I + sage: S.codomain() # optional - sage.rings.number_field sage.symbolic + Projective Space of dimension 1 over Number Field in a with defining + polynomial y^4 + 1 with a = 0.7071067811865475? + 0.7071067811865475?*I The following was fixed in :trac:`23808`:: sage: R. = PolynomialRing(QQ) - sage: P. = ProjectiveSpace(QQbar,1) - sage: Q = P([-1/2*QQbar(sqrt(2)) + QQbar(I), 1]);Q + sage: P. = ProjectiveSpace(QQbar, 1) # optional - sage.rings.number_field + sage: Q = P([-1/2*QQbar(sqrt(2)) + QQbar(I), 1]);Q # optional - sage.rings.number_field sage.symbolic (-0.7071067811865475? + 1*I : 1) - sage: S = Q._number_field_from_algebraics(); S + sage: S = Q._number_field_from_algebraics(); S # optional - sage.rings.number_field sage.symbolic (1/2*a^3 + a^2 - 1/2*a : 1) - sage: T = S.change_ring(QQbar) # Used to fail - sage: T + sage: T = S.change_ring(QQbar) # Used to fail # optional - sage.rings.number_field sage.symbolic + sage: T # optional - sage.rings.number_field sage.symbolic (-0.7071067811865475? + 1.000000000000000?*I : 1) - sage: Q[0] == T[0] + sage: Q[0] == T[0] # optional - sage.rings.number_field sage.symbolic True """ from sage.schemes.projective.projective_space import is_ProjectiveSpace @@ -1261,17 +1269,17 @@ def clear_denominators(self): :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2 - 3) - sage: P. = ProjectiveSpace(K, 2) - sage: Q = P([1/w, 3, 0]) - sage: Q.clear_denominators(); Q + sage: K. = NumberField(x^2 - 3) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field + sage: Q = P([1/w, 3, 0]) # optional - sage.rings.number_field + sage: Q.clear_denominators(); Q # optional - sage.rings.number_field (w : 9 : 0) :: sage: P. = ProjectiveSpace(QQ, 2) - sage: X = P.subscheme(x^2 - y^2); - sage: Q = X([1/2, 1/2, 1]); + sage: X = P.subscheme(x^2 - y^2) + sage: Q = X([1/2, 1/2, 1]) sage: Q.clear_denominators(); Q (1 : 1 : 2) @@ -1363,27 +1371,27 @@ def __hash__(self): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(5), 2) - sage: hash(P(2, 1, 2)) + sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings + sage: hash(P(2, 1, 2)) # optional - sage.rings.finite_rings 41 :: - sage: P. = ProjectiveSpace(GF(7), 2) - sage: X = P.subscheme(x^2 - y^2) - sage: hash(X(1, 1, 2)) + sage: P. = ProjectiveSpace(GF(7), 2) # optional - sage.rings.finite_rings + sage: X = P.subscheme(x^2 - y^2) # optional - sage.rings.finite_rings + sage: hash(X(1, 1, 2)) # optional - sage.rings.finite_rings 81 :: - sage: P. = ProjectiveSpace(GF(13), 1) - sage: hash(P(3, 4)) + sage: P. = ProjectiveSpace(GF(13), 1) # optional - sage.rings.finite_rings + sage: hash(P(3, 4)) # optional - sage.rings.finite_rings 17 :: - sage: P. = ProjectiveSpace(GF(13^3,'t'), 1) - sage: hash(P(3, 4)) + sage: P. = ProjectiveSpace(GF(13^3,'t'), 1) # optional - sage.rings.finite_rings + sage: hash(P(3, 4)) # optional - sage.rings.finite_rings 2201 """ p = self.codomain().base_ring().order() diff --git a/src/sage/schemes/projective/projective_rational_point.py b/src/sage/schemes/projective/projective_rational_point.py index 738f28cb993..9702ec87d32 100644 --- a/src/sage/schemes/projective/projective_rational_point.py +++ b/src/sage/schemes/projective/projective_rational_point.py @@ -15,8 +15,8 @@ Projective, over `\QQ`:: sage: from sage.schemes.projective.projective_rational_point import enum_projective_rational_field - sage: P. = ProjectiveSpace(2,QQ) - sage: C = P.subscheme([X+Y-Z]) + sage: P. = ProjectiveSpace(2, QQ) + sage: C = P.subscheme([X + Y - Z]) sage: enum_projective_rational_field(C, 3) [(-2 : 3 : 1), (-1 : 1 : 0), (-1 : 2 : 1), (-1/2 : 3/2 : 1), (0 : 1 : 1), (1/3 : 2/3 : 1), (1/2 : 1/2 : 1), (2/3 : 1/3 : 1), @@ -26,8 +26,8 @@ Projective over a finite field:: sage: from sage.schemes.projective.projective_rational_point import enum_projective_finite_field - sage: E = EllipticCurve('72').change_ring(GF(19)) - sage: enum_projective_finite_field(E) + sage: E = EllipticCurve('72').change_ring(GF(19)) # optional - sage.rings.finite_rings + sage: enum_projective_finite_field(E) # optional - sage.rings.finite_rings [(0 : 1 : 0), (1 : 0 : 1), (3 : 0 : 1), (4 : 9 : 1), (4 : 10 : 1), (6 : 6 : 1), (6 : 13 : 1), (7 : 6 : 1), (7 : 13 : 1), (9 : 4 : 1), (9 : 15 : 1), (12 : 8 : 1), (12 : 11 : 1), (13 : 8 : 1), (13 : 11 : 1), @@ -89,7 +89,7 @@ def enum_projective_rational_field(X, B): EXAMPLES:: sage: P. = ProjectiveSpace(2, QQ) - sage: C = P.subscheme([X+Y-Z]) + sage: C = P.subscheme([X + Y - Z]) sage: from sage.schemes.projective.projective_rational_point import enum_projective_rational_field sage: enum_projective_rational_field(C(QQ), 6) [(-5 : 6 : 1), (-4 : 5 : 1), (-3 : 4 : 1), (-2 : 3 : 1), @@ -187,20 +187,20 @@ def enum_projective_number_field(X, **kwds): sage: from sage.schemes.projective.projective_rational_point import enum_projective_number_field sage: u = QQ['u'].0 - sage: K = NumberField(u^3 - 5,'v') - sage: P. = ProjectiveSpace(K, 2) - sage: X = P.subscheme([x - y]) - sage: enum_projective_number_field(X(K), bound=RR(5^(1/3)), prec=2^10) + sage: K = NumberField(u^3 - 5, 'v') # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field + sage: X = P.subscheme([x - y]) # optional - sage.rings.number_field + sage: enum_projective_number_field(X(K), bound=RR(5^(1/3)), prec=2^10) # optional - sage.rings.number_field [(0 : 0 : 1), (1 : 1 : 0), (-1 : -1 : 1), (1 : 1 : 1)] :: sage: u = QQ['u'].0 - sage: K = NumberField(u^2 + 3, 'v') - sage: A. = ProjectiveSpace(K,1) - sage: X = A.subscheme(x-y) + sage: K = NumberField(u^2 + 3, 'v') # optional - sage.rings.number_field + sage: A. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: X = A.subscheme(x - y) # optional - sage.rings.number_field sage: from sage.schemes.projective.projective_rational_point import enum_projective_number_field - sage: enum_projective_number_field(X, bound=2) + sage: enum_projective_number_field(X, bound=2) # optional - sage.rings.number_field [(1 : 1)] """ B = kwds.pop('bound') @@ -244,29 +244,29 @@ def enum_projective_finite_field(X): EXAMPLES:: - sage: F = GF(53) - sage: P. = ProjectiveSpace(2,F) + sage: F = GF(53) # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(2, F) # optional - sage.rings.finite_rings sage: from sage.schemes.projective.projective_rational_point import enum_projective_finite_field - sage: len(enum_projective_finite_field(P(F))) + sage: len(enum_projective_finite_field(P(F))) # optional - sage.rings.finite_rings 2863 - sage: 53^2+53+1 + sage: 53^2 + 53 + 1 2863 :: - sage: F = GF(9,'a') - sage: P. = ProjectiveSpace(2,F) - sage: C = Curve(X^3-Y^3+Z^2*Y) - sage: enum_projective_finite_field(C(F)) + sage: F = GF(9, 'a') # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(2,F) # optional - sage.rings.finite_rings + sage: C = Curve(X^3 - Y^3 + Z^2*Y) # optional - sage.rings.finite_rings + sage: enum_projective_finite_field(C(F)) # optional - sage.rings.finite_rings [(0 : 0 : 1), (0 : 1 : 1), (0 : 2 : 1), (1 : 1 : 0), (a + 1 : 2*a : 1), (a + 1 : 2*a + 1 : 1), (a + 1 : 2*a + 2 : 1), (2*a + 2 : a : 1), (2*a + 2 : a + 1 : 1), (2*a + 2 : a + 2 : 1)] :: - sage: F = GF(5) - sage: P2F. = ProjectiveSpace(2,F) - sage: enum_projective_finite_field(P2F) + sage: F = GF(5) # optional - sage.rings.finite_rings + sage: P2F. = ProjectiveSpace(2, F) # optional - sage.rings.finite_rings + sage: enum_projective_finite_field(P2F) # optional - sage.rings.finite_rings [(0 : 0 : 1), (0 : 1 : 0), (0 : 1 : 1), (0 : 2 : 1), (0 : 3 : 1), (0 : 4 : 1), (1 : 0 : 0), (1 : 0 : 1), (1 : 1 : 0), (1 : 1 : 1), (1 : 2 : 1), (1 : 3 : 1), (1 : 4 : 1), (2 : 0 : 1), (2 : 1 : 0), (2 : 1 : 1), (2 : 2 : 1), (2 : 3 : 1), @@ -343,8 +343,8 @@ def sieve(X, bound): EXAMPLES:: sage: from sage.schemes.projective.projective_rational_point import sieve - sage: P.=ProjectiveSpace(QQ,3) - sage: Y=P.subscheme([x^2-3^2*y^2+z*q,x+z+4*q]) + sage: P. = ProjectiveSpace(QQ, 3) + sage: Y = P.subscheme([x^2 - 3^2*y^2 + z*q, x + z + 4*q]) sage: sorted(sieve(Y, 12)) # long time [(-4 : -4/3 : 0 : 1), (-4 : 4/3 : 0 : 1), (-1 : -1/3 : 1 : 0), (-1 : 1/3 : 1 : 0)] @@ -364,7 +364,7 @@ def sieve(X, bound): Algorithm works even if coefficients are fraction:: sage: from sage.schemes.projective.projective_rational_point import sieve - sage: P. = ProjectiveSpace(2,QQ) + sage: P. = ProjectiveSpace(2, QQ) sage: X = P.subscheme(3*x - 3/2*y) sage: sieve(X, 3) [(-1 : -2 : 1), (-1/2 : -1 : 1), (-1/3 : -2/3 : 1), (0 : 0 : 1), diff --git a/src/sage/schemes/projective/projective_space.py b/src/sage/schemes/projective/projective_space.py index e215da942e1..2696f4f6985 100644 --- a/src/sage/schemes/projective/projective_space.py +++ b/src/sage/schemes/projective/projective_space.py @@ -55,7 +55,7 @@ :: - sage: V = P2.subscheme([x+y+z, x+y-z]); V + sage: V = P2.subscheme([x + y + z, x + y - z]); V Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x + y + z, x + y - z @@ -139,7 +139,7 @@ def is_ProjectiveSpace(x): sage: from sage.schemes.projective.projective_space import is_ProjectiveSpace sage: is_ProjectiveSpace(ProjectiveSpace(5, names='x')) True - sage: is_ProjectiveSpace(ProjectiveSpace(5, GF(9,'alpha'), names='x')) + sage: is_ProjectiveSpace(ProjectiveSpace(5, GF(9, 'alpha'), names='x')) # optional - sage.rings.finite_rings True sage: is_ProjectiveSpace(Spec(ZZ)) False @@ -168,7 +168,7 @@ def ProjectiveSpace(n, R=None, names=None): :: - sage: ProjectiveSpace(5)/GF(17) + sage: ProjectiveSpace(5)/GF(17) # optional - sage.rings.finite_rings Projective Space of dimension 5 over Finite Field of size 17 The default base ring is `\ZZ`. @@ -182,27 +182,27 @@ def ProjectiveSpace(n, R=None, names=None): :: - sage: R = GF(7)['x,y,z'] - sage: P = ProjectiveSpace(R); P + sage: R = GF(7)['x,y,z'] # optional - sage.rings.finite_rings + sage: P = ProjectiveSpace(R); P # optional - sage.rings.finite_rings Projective Space of dimension 2 over Finite Field of size 7 - sage: P.coordinate_ring() + sage: P.coordinate_ring() # optional - sage.rings.finite_rings Multivariate Polynomial Ring in x, y, z over Finite Field of size 7 - sage: P.coordinate_ring() is R + sage: P.coordinate_ring() is R # optional - sage.rings.finite_rings True :: - sage: ProjectiveSpace(3, Zp(5), 'y') + sage: ProjectiveSpace(3, Zp(5), 'y') # optional - sage.rings.padics Projective Space of dimension 3 over 5-adic Ring with capped relative precision 20 :: - sage: ProjectiveSpace(2,QQ,'x,y,z') + sage: ProjectiveSpace(2, QQ, 'x,y,z') Projective Space of dimension 2 over Rational Field :: - sage: PS.=ProjectiveSpace(1,CC) + sage: PS. = ProjectiveSpace(1, CC) sage: PS Projective Space of dimension 1 over Complex Field with 53 bits of precision @@ -224,7 +224,7 @@ def ProjectiveSpace(n, R=None, names=None): TESTS:: - sage: R.=QQ[] + sage: R. = QQ[] sage: P. = ProjectiveSpace(R) Traceback (most recent call last): ... @@ -232,7 +232,7 @@ def ProjectiveSpace(n, R=None, names=None): :: - sage: R.=QQ[] + sage: R. = QQ[] sage: P. = ProjectiveSpace(R) sage: P.gens() == R.gens() True @@ -335,7 +335,7 @@ def __init__(self, n, R=ZZ, names=None): EXAMPLES:: - sage: ProjectiveSpace(3, Zp(5), 'y') + sage: ProjectiveSpace(3, Zp(5), 'y') # optional - sage.rings.padics Projective Space of dimension 3 over 5-adic Ring with capped relative precision 20 """ AmbientSpace.__init__(self, n, R) @@ -417,7 +417,7 @@ def coordinate_ring(self): EXAMPLES:: - sage: ProjectiveSpace(3, GF(19^2,'alpha'), 'abcd').coordinate_ring() + sage: ProjectiveSpace(3, GF(19^2,'alpha'), 'abcd').coordinate_ring() # optional - sage.rings.finite_rings Multivariate Polynomial Ring in a, b, c, d over Finite Field in alpha of size 19^2 :: @@ -588,7 +588,7 @@ def _latex_(self): TESTS:: - sage: ProjectiveSpace(3, Zp(5), 'y')._latex_() + sage: ProjectiveSpace(3, Zp(5), 'y')._latex_() # optional - sage.rings.padics '{\\mathbf P}_{\\Bold{Z}_{5}}^3' """ return "{\\mathbf P}_{%s}^%s" % (latex(self.base_ring()), @@ -620,9 +620,9 @@ def _linear_system_as_kernel(self, d, pt, m): If the degree `d` is 0, then a matrix consisting of the first unit vector is returned:: - sage: P = ProjectiveSpace(GF(5), 2, names='x') - sage: pt = P([1, 1, 1]) - sage: P._linear_system_as_kernel(0, pt, 3) + sage: P = ProjectiveSpace(GF(5), 2, names='x') # optional - sage.rings.finite_rings + sage: pt = P([1, 1, 1]) # optional - sage.rings.finite_rings + sage: P._linear_system_as_kernel(0, pt, 3) # optional - sage.rings.finite_rings [1] [0] [0] @@ -633,10 +633,10 @@ def _linear_system_as_kernel(self, d, pt, m): If the multiplicity `m` is 0, then a matrix with zero rows is returned:: - sage: P = ProjectiveSpace(GF(5), 2, names='x') - sage: pt = P([1, 1, 1]) - sage: M = P._linear_system_as_kernel(2, pt, 0) - sage: [M.nrows(), M.ncols()] + sage: P = ProjectiveSpace(GF(5), 2, names='x') # optional - sage.rings.finite_rings + sage: pt = P([1, 1, 1]) # optional - sage.rings.finite_rings + sage: M = P._linear_system_as_kernel(2, pt, 0) # optional - sage.rings.finite_rings + sage: [M.nrows(), M.ncols()] # optional - sage.rings.finite_rings [0, 6] The base ring does not need to be a field or even an integral domain. @@ -654,10 +654,10 @@ def _linear_system_as_kernel(self, d, pt, m): (even when the base ring is a field and the list gives a well-defined point in projective space):: - sage: R = GF(5) - sage: P = ProjectiveSpace(R, 2, names='x') - sage: pt = [R(3), R(3), R(0)] - sage: P._linear_system_as_kernel(3, pt, 2) + sage: R = GF(5) # optional - sage.rings.finite_rings + sage: P = ProjectiveSpace(R, 2, names='x') # optional - sage.rings.finite_rings + sage: pt = [R(3), R(3), R(0)] # optional - sage.rings.finite_rings + sage: P._linear_system_as_kernel(3, pt, 2) # optional - sage.rings.finite_rings Traceback (most recent call last): ... TypeError: at least one component of pt=[3, 3, 0] must be equal @@ -669,10 +669,10 @@ def _linear_system_as_kernel(self, d, pt, m): hypersurfaces of degree 2 in 3-space with multiplicity at least 2 at a general point in the third affine patch:: - sage: P = ProjectiveSpace(QQ,3,names='x') - sage: RPol. = PolynomialRing(QQ,4) + sage: P = ProjectiveSpace(QQ, 3, names='x') + sage: RPol. = PolynomialRing(QQ, 4) sage: pt = [t0,t1,1,t3] - sage: P._linear_system_as_kernel(2,pt,2) + sage: P._linear_system_as_kernel(2, pt, 2) [ 2*t0 t1 1 t3 0 0 0 0 0 0] [ 0 t0 0 0 2*t1 1 t3 0 0 0] [ t0^2 t0*t1 t0 t0*t3 t1^2 t1 t1*t3 1 t3 t3^2] @@ -734,8 +734,8 @@ def _morphism(self, *args, **kwds): TESTS:: - sage: P2. = ProjectiveSpace(2, GF(3)) - sage: P2._morphism(P2.Hom(P2), [x,y,z]) + sage: P2. = ProjectiveSpace(2, GF(3)) # optional - sage.rings.finite_rings + sage: P2._morphism(P2.Hom(P2), [x,y,z]) # optional - sage.rings.finite_rings Scheme endomorphism of Projective Space of dimension 2 over Finite Field of size 3 Defn: Defined on coordinates by sending (x : y : z) to (x : y : z) @@ -764,8 +764,8 @@ def _point_homset(self, *args, **kwds): TESTS:: - sage: P2. = ProjectiveSpace(2, GF(3)) - sage: P2._point_homset(Spec(GF(3)), P2) + sage: P2. = ProjectiveSpace(2, GF(3)) # optional - sage.rings.finite_rings + sage: P2._point_homset(Spec(GF(3)), P2) # optional - sage.rings.finite_rings Set of rational points of Projective Space of dimension 2 over Finite Field of size 3 """ return SchemeHomset_points_projective_ring(*args, **kwds) @@ -828,9 +828,9 @@ def _point(self, *args, **kwds): TESTS:: - sage: P2. = ProjectiveSpace(2, GF(3)) - sage: point_homset = P2._point_homset(Spec(GF(3)), P2) - sage: P2._point(point_homset, [1,2,3]) + sage: P2. = ProjectiveSpace(2, GF(3)) # optional - sage.rings.finite_rings + sage: point_homset = P2._point_homset(Spec(GF(3)), P2) # optional - sage.rings.finite_rings + sage: P2._point(point_homset, [1,2,3]) # optional - sage.rings.finite_rings (2 : 1 : 0) """ return SchemeMorphism_point_projective_ring(*args, **kwds) @@ -846,7 +846,7 @@ def _repr_(self): TESTS:: - sage: ProjectiveSpace(3, Zp(5), 'y')._repr_() + sage: ProjectiveSpace(3, Zp(5), 'y')._repr_() # optional - sage.rings.padics 'Projective Space of dimension 3 over 5-adic Ring with capped relative precision 20' """ return "Projective Space of dimension %s over %s" % (self.dimension_relative(), self.base_ring()) @@ -862,7 +862,7 @@ def _repr_generic_point(self, v=None): EXAMPLES:: sage: P. = ProjectiveSpace(2, ZZ) - sage: P._repr_generic_point([z*y-x^2]) + sage: P._repr_generic_point([z*y - x^2]) '(-x^2 + y*z)' sage: P._repr_generic_point() '(x : y : z)' @@ -882,7 +882,7 @@ def _latex_generic_point(self, v=None): EXAMPLES:: sage: P. = ProjectiveSpace(2, ZZ) - sage: P._latex_generic_point([z*y-x^2]) + sage: P._latex_generic_point([z*y - x^2]) '\\left(-x^{2} + y z\\right)' sage: P._latex_generic_point() '\\left(x : y : z\\right)' @@ -919,9 +919,9 @@ def change_ring(self, R): :: - sage: K. = QuadraticField(2) - sage: P = ProjectiveSpace(K,2,'t') - sage: P.change_ring(K.embeddings(QQbar)[0]) + sage: K. = QuadraticField(2) # optional - sage.rings.number_field + sage: P = ProjectiveSpace(K, 2, 't') # optional - sage.rings.number_field + sage: P.change_ring(K.embeddings(QQbar)[0]) # optional - sage.rings.number_field Projective Space of dimension 2 over Algebraic Field """ if isinstance(R, Map): @@ -1032,7 +1032,7 @@ def affine_patch(self, i, AA=None): :: - sage: P. = ProjectiveSpace(QQ,1) + sage: P. = ProjectiveSpace(QQ, 1) sage: P.affine_patch(0).projective_embedding(0).codomain() == P True """ @@ -1101,7 +1101,7 @@ def Lattes_map(self, E, m): EXAMPLES:: - sage: P. = ProjectiveSpace(QQ,1) + sage: P. = ProjectiveSpace(QQ, 1) sage: E = EllipticCurve(QQ,[-1, 0]) sage: P.Lattes_map(E, 2) Dynamical System of Projective Space of dimension 1 over Rational Field @@ -1110,9 +1110,9 @@ def Lattes_map(self, E, m): TESTS:: - sage: P. = ProjectiveSpace(GF(37), 1) - sage: E = EllipticCurve([1, 1]) - sage: f = P.Lattes_map(E, 2); f + sage: P. = ProjectiveSpace(GF(37), 1) # optional - sage.rings.finite_rings + sage: E = EllipticCurve([1, 1]) # optional - sage.rings.finite_rings + sage: f = P.Lattes_map(E, 2); f # optional - sage.rings.finite_rings Dynamical System of Projective Space of dimension 1 over Finite Field of size 37 Defn: Defined on coordinates by sending (x : y) to (-9*x^4 + 18*x^2*y^2 - 2*x*y^3 - 9*y^4 : x^3*y + x*y^3 + y^4) @@ -1220,7 +1220,7 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): :: - sage: P. = ProjectiveSpace(QQ,1) + sage: P. = ProjectiveSpace(QQ, 1) sage: P.chebyshev_polynomial(3, monic=True) Dynamical System of Projective Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x : y) to @@ -1229,8 +1229,8 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): :: sage: F. = FunctionField(QQ) - sage: P. = ProjectiveSpace(F,1) - sage: P.chebyshev_polynomial(4,monic=True) + sage: P. = ProjectiveSpace(F, 1) + sage: P.chebyshev_polynomial(4, monic=True) Dynamical System of Projective Space of dimension 1 over Rational function field in t over Rational Field Defn: Defined on coordinates by sending (y : z) to (y^4 + (-4)*y^2*z^2 + 2*z^4 : z^4) @@ -1349,9 +1349,9 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr EXAMPLES:: - sage: P1.=ProjectiveSpace(QQ, 2) - sage: points_source=[P1([1, 4, 1]), P1([1, 2, 2]), P1([3, 5, 1]), P1([1, -1, 1])] - sage: points_target=[P1([5, -2, 7]), P1([3, -2, 3]), P1([6, -5, 9]), P1([3, 6, 7])] + sage: P1. = ProjectiveSpace(QQ, 2) + sage: points_source = [P1([1, 4, 1]), P1([1, 2, 2]), P1([3, 5, 1]), P1([1, -1, 1])] + sage: points_target = [P1([5, -2, 7]), P1([3, -2, 3]), P1([6, -5, 9]), P1([3, 6, 7])] sage: m = P1.point_transformation_matrix(points_source, points_target); m [ -13/59 -128/59 -25/59] [538/177 8/59 26/177] @@ -1361,10 +1361,10 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr :: - sage: P. = ProjectiveSpace(GF(13), 1) - sage: points_source = [P([-6, 7]), P([1, 4]), P([3, 2])] - sage: points_target = [P([-1, 2]), P([0, 2]), P([-1, 6])] - sage: P.point_transformation_matrix(points_source, points_target) + sage: P. = ProjectiveSpace(GF(13), 1) # optional - sage.rings.finite_rings + sage: points_source = [P([-6, 7]), P([1, 4]), P([3, 2])] # optional - sage.rings.finite_rings + sage: points_target = [P([-1, 2]), P([0, 2]), P([-1, 6])] # optional - sage.rings.finite_rings + sage: P.point_transformation_matrix(points_source, points_target) # optional - sage.rings.finite_rings [10 4] [10 1] @@ -1390,9 +1390,9 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr :: - sage: P1.=ProjectiveSpace(RR, 2) - sage: points_source=[P1([1, 4, 1]), P1([1, 2, 2]), P1([3, 5, 1]), P1([1, -1, 1])] - sage: points_target=[P1([5, -2, 7]), P1([3, -2, 3]), P1([6, -5, 9]), P1([3, 6, 7])] + sage: P1. = ProjectiveSpace(RR, 2) + sage: points_source = [P1([1, 4, 1]), P1([1, 2, 2]), P1([3, 5, 1]), P1([1, -1, 1])] + sage: points_target = [P1([5, -2, 7]), P1([3, -2, 3]), P1([6, -5, 9]), P1([3, 6, 7])] sage: P1.point_transformation_matrix(points_source, points_target) # abs tol 1e-13 [-0.0619047619047597 -0.609523809523810 -0.119047619047621] [ 0.853968253968253 0.0380952380952380 0.0412698412698421] @@ -1400,9 +1400,9 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr :: - sage: P1.=ProjectiveSpace(ZZ, 2) - sage: points_source=[P1([1, 4, 1]), P1([1, 2, 2]), P1([3, 5, 1]), P1([1, -1, 1])] - sage: points_target=[P1([5, -2, 7]), P1([3, -2, 3]), P1([6, -5, 9]), P1([3, 6, 7])] + sage: P1. = ProjectiveSpace(ZZ, 2) + sage: points_source = [P1([1, 4, 1]), P1([1, 2, 2]), P1([3, 5, 1]), P1([1, -1, 1])] + sage: points_target = [P1([5, -2, 7]), P1([3, -2, 3]), P1([6, -5, 9]), P1([3, 6, 7])] sage: P1.point_transformation_matrix(points_source, points_target) [ -39 -384 -75] [ 538 24 26] @@ -1410,9 +1410,9 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr :: - sage: P1.=ProjectiveSpace(ZZ, 2) - sage: points_source=[P1([1, 4, 1]), P1([1, 2, 2]), P1([3, 5, 1]), P1([1, -1, 1])] - sage: points_target=[P1([5, -2, 7]), P1([3, -2, 3]), P1([6, -5, 9]), P1([3, 6, 7])] + sage: P1. = ProjectiveSpace(ZZ, 2) + sage: points_source = [P1([1, 4, 1]), P1([1, 2, 2]), P1([3, 5, 1]), P1([1, -1, 1])] + sage: points_target = [P1([5, -2, 7]), P1([3, -2, 3]), P1([6, -5, 9]), P1([3, 6, 7])] sage: P1.point_transformation_matrix(points_source, points_target, normalize=False) [-13/30 -64/15 -5/6] [269/45 4/15 13/45] @@ -1440,9 +1440,9 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr :: - sage: P.=ProjectiveSpace(QQ, 2) - sage: points_source=[P([1, 4, 1]), P([2, -7, 9]), P([3, 5, 1])] - sage: points_target=[P([5, -2, 7]), P([3, -2, 3]), P([6, -5, 9]), P([6, -1, 1])] + sage: P. = ProjectiveSpace(QQ, 2) + sage: points_source = [P([1, 4, 1]), P([2, -7, 9]), P([3, 5, 1])] + sage: points_target = [P([5, -2, 7]), P([3, -2, 3]), P([6, -5, 9]), P([6, -1, 1])] sage: P.point_transformation_matrix(points_source, points_target) Traceback (most recent call last): ... @@ -1450,9 +1450,9 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr :: - sage: P.=ProjectiveSpace(QQ, 2) - sage: points_source=[P([1, 4, 1]), P([2, -7, 9]), P([3, 5, 1]), P([1, -1, 1])] - sage: points_target=[P([5, -2, 7]), P([3, -2, 3]), P([6, -5, 9]), P([6, -1, 1]),P([7, 8, -9])] + sage: P. = ProjectiveSpace(QQ, 2) + sage: points_source = [P([1, 4, 1]), P([2, -7, 9]), P([3, 5, 1]), P([1, -1, 1])] + sage: points_target = [P([5, -2, 7]), P([3, -2, 3]), P([6, -5, 9]), P([6, -1, 1]), P([7, 8, -9])] sage: P.point_transformation_matrix(points_source, points_target) Traceback (most recent call last): ... @@ -1460,9 +1460,9 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr :: - sage: P.=ProjectiveSpace(QQ, 2) - sage: P1.=ProjectiveSpace(QQ, 2) - sage: points_source=[P([1, 4, 1]), P([2, -7, 9]), P([3, 5, 1]), P1([1, -1, 1])] + sage: P. = ProjectiveSpace(QQ, 2) + sage: P1. = ProjectiveSpace(QQ, 2) + sage: points_source = [P([1, 4, 1]), P([2, -7, 9]), P([3, 5, 1]), P1([1, -1, 1])] sage: points_target=[P([5, -2, 7]), P([3, -2, 3]), P([6, -5, 9]), P([6, -1, 1])] sage: P.point_transformation_matrix(points_source, points_target) Traceback (most recent call last): @@ -1471,10 +1471,10 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr :: - sage: P.=ProjectiveSpace(QQ, 2) - sage: P1.=ProjectiveSpace(QQ, 2) - sage: points_source=[P([1, 4, 1]), P([2, -7, 9]), P([3, 5, 1]), P([1, -1, 1])] - sage: points_target=[P([5, -2, 7]), P([3, -2, 3]), P([6, -5, 9]), P1([6, -1, 1])] + sage: P. = ProjectiveSpace(QQ, 2) + sage: P1. = ProjectiveSpace(QQ, 2) + sage: points_source = [P([1, 4, 1]), P([2, -7, 9]), P([3, 5, 1]), P([1, -1, 1])] + sage: points_target = [P([5, -2, 7]), P([3, -2, 3]), P([6, -5, 9]), P1([6, -1, 1])] sage: P.point_transformation_matrix(points_source, points_target) Traceback (most recent call last): ... @@ -1482,10 +1482,10 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr :: - sage: P.=ProjectiveSpace(ZZ,2) + sage: P. = ProjectiveSpace(ZZ, 2) sage: points_source = [P(1, 0, 0), P(0, 1, 0), P(0, 0, 1), P(1, -1, -1)] sage: points_target = [P(0, 1, 0), P(-2, 0, 1), P(0, 0, 1), P(1, -1, -1)] - sage: P.point_transformation_matrix(points_source,points_target,normalize=True) + sage: P.point_transformation_matrix(points_source, points_target, normalize=True) [ 0 -2 0] [-2 0 0] [ 0 1 1] @@ -1589,12 +1589,12 @@ def hyperplane_transformation_matrix(self, plane_1, plane_2): :: - sage: K. = CyclotomicField(3) - sage: P. = ProjectiveSpace(K, 2) - sage: plane1 = P.subscheme(x - 2*v*y + z) - sage: plane2 = P.subscheme(x + v*y + v*z) - sage: m = P.hyperplane_transformation_matrix(plane1, plane2) - sage: m + sage: K. = CyclotomicField(3) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field + sage: plane1 = P.subscheme(x - 2*v*y + z) # optional - sage.rings.number_field + sage: plane2 = P.subscheme(x + v*y + v*z) # optional - sage.rings.number_field + sage: m = P.hyperplane_transformation_matrix(plane1, plane2) # optional - sage.rings.number_field + sage: m # optional - sage.rings.number_field [ v 0 0] [ 0 -2*v 0] [ 0 0 1] @@ -1602,11 +1602,11 @@ def hyperplane_transformation_matrix(self, plane_1, plane_2): :: sage: R. = QQ[] - sage: K. = NumberField(x^2+1) - sage: P. = ProjectiveSpace(K, 3) - sage: plane1 = P.subscheme(k*x + 2*k*y + z) - sage: plane2 = P.subscheme(7*k*x + y + 9*z) - sage: m = P.hyperplane_transformation_matrix(plane1, plane2); m + sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 3) # optional - sage.rings.number_field + sage: plane1 = P.subscheme(k*x + 2*k*y + z) # optional - sage.rings.number_field + sage: plane2 = P.subscheme(7*k*x + y + 9*z) # optional - sage.rings.number_field + sage: m = P.hyperplane_transformation_matrix(plane1, plane2); m # optional - sage.rings.number_field [ 1 0 0 0] [ 0 14*k 0 0] [ 0 0 7/9 0] @@ -1614,23 +1614,23 @@ def hyperplane_transformation_matrix(self, plane_1, plane_2): :: - sage: K. = CyclotomicField(3) - sage: R. = K[] - sage: F. = K.extension(t^5 + 2) - sage: G. = F.absolute_field() - sage: P. = ProjectiveSpace(G, 2) - sage: plane1 = P.subscheme(x - 2*u*y + z) - sage: plane2 = P.subscheme(x + u*y + z) - sage: m = P.hyperplane_transformation_matrix(plane1, plane2) - sage: plane2(m*P((2*u, 1, 0))) + sage: K. = CyclotomicField(3) # optional - sage.rings.number_field + sage: R. = K[] # optional - sage.rings.number_field + sage: F. = K.extension(t^5 + 2) # optional - sage.rings.number_field + sage: G. = F.absolute_field() # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(G, 2) # optional - sage.rings.number_field + sage: plane1 = P.subscheme(x - 2*u*y + z) # optional - sage.rings.number_field + sage: plane2 = P.subscheme(x + u*y + z) # optional - sage.rings.number_field + sage: m = P.hyperplane_transformation_matrix(plane1, plane2) # optional - sage.rings.number_field + sage: plane2(m*P((2*u, 1, 0))) # optional - sage.rings.number_field (-u : 1 : 0) :: - sage: P. = ProjectiveSpace(FiniteField(2), 2) - sage: plane1 = P.subscheme(x + y + z) - sage: plane2 = P.subscheme(z) - sage: P.hyperplane_transformation_matrix(plane1, plane2) + sage: P. = ProjectiveSpace(FiniteField(2), 2) # optional - sage.rings.finite_rings + sage: plane1 = P.subscheme(x + y + z) # optional - sage.rings.finite_rings + sage: plane2 = P.subscheme(z) # optional - sage.rings.finite_rings + sage: P.hyperplane_transformation_matrix(plane1, plane2) # optional - sage.rings.finite_rings [1 0 0] [1 1 0] [1 1 1] @@ -1751,16 +1751,16 @@ def is_linearly_independent(self, points, n=None): :: - sage: P. = ProjectiveSpace(GF(5), 2) - sage: points = [P((1, 0, 1)), P((1, 2, 1)), P((1, 3, 4)), P((0, 0 ,1))] - sage: P.is_linearly_independent(points, 2) + sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings + sage: points = [P((1, 0, 1)), P((1, 2, 1)), P((1, 3, 4)), P((0, 0, 1))] # optional - sage.rings.finite_rings + sage: P.is_linearly_independent(points, 2) # optional - sage.rings.finite_rings True :: sage: R. = QQ[] sage: P. = ProjectiveSpace(R, 2) - sage: points = [P((c, 0, 1)), P((0, c, 1)), P((1, 0, 4)), P((0, 0 ,1))] + sage: points = [P((c, 0, 1)), P((0, c, 1)), P((1, 0, 4)), P((0, 0, 1))] sage: P.is_linearly_independent(points, 3) False @@ -1768,16 +1768,16 @@ def is_linearly_independent(self, points, n=None): sage: R. = QQ[] sage: P. = ProjectiveSpace(FractionField(R), 2) - sage: points = [P((c, 0, 1)), P((0, c, 1)), P((1, 3, 4)), P((0, 0 ,1))] + sage: points = [P((c, 0, 1)), P((0, c, 1)), P((1, 3, 4)), P((0, 0, 1))] sage: P.is_linearly_independent(points, 3) True :: - sage: K. = CyclotomicField(3) - sage: P. = ProjectiveSpace(K, 2) - sage: points = [P((k, k^2, 1)), P((0, k, 1)), P((1, 0, 4)), P((0, 0 ,1))] - sage: P.is_linearly_independent(points, 3) + sage: K. = CyclotomicField(3) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field + sage: points = [P((k, k^2, 1)), P((0, k, 1)), P((1, 0, 4)), P((0, 0, 1))] # optional - sage.rings.number_field + sage: P.is_linearly_independent(points, 3) # optional - sage.rings.number_field True :: @@ -1829,8 +1829,8 @@ def _point_homset(self, *args, **kwds): TESTS:: - sage: P2. = ProjectiveSpace(2, GF(3)) - sage: P2._point_homset(Spec(GF(3)), P2) + sage: P2. = ProjectiveSpace(2, GF(3)) # optional - sage.rings.finite_rings + sage: P2._point_homset(Spec(GF(3)), P2) # optional - sage.rings.finite_rings Set of rational points of Projective Space of dimension 2 over Finite Field of size 3 """ return SchemeHomset_points_projective_field(*args, **kwds) @@ -1843,9 +1843,9 @@ def _point(self, *args, **kwds): TESTS:: - sage: P2. = ProjectiveSpace(2, GF(3)) - sage: point_homset = P2._point_homset(Spec(GF(3)), P2) - sage: P2._point(point_homset, [1,2,3]) + sage: P2. = ProjectiveSpace(2, GF(3)) # optional - sage.rings.finite_rings + sage: point_homset = P2._point_homset(Spec(GF(3)), P2) # optional - sage.rings.finite_rings + sage: P2._point(point_homset, [1,2,3]) # optional - sage.rings.finite_rings (2 : 1 : 0) """ return SchemeMorphism_point_projective_field(*args, **kwds) @@ -1858,8 +1858,8 @@ def _morphism(self, *args, **kwds): TESTS:: - sage: P2. = ProjectiveSpace(2, GF(3)) - sage: P2._morphism(P2.Hom(P2), [x,y,z]) + sage: P2. = ProjectiveSpace(2, GF(3)) # optional - sage.rings.finite_rings + sage: P2._morphism(P2.Hom(P2), [x,y,z]) # optional - sage.rings.finite_rings Scheme endomorphism of Projective Space of dimension 2 over Finite Field of size 3 Defn: Defined on coordinates by sending (x : y : z) to (x : y : z) @@ -1897,58 +1897,59 @@ def points_of_bounded_height(self, **kwds): :: sage: u = QQ['u'].0 - sage: P. = ProjectiveSpace(NumberField(u^2 - 2, 'v'), 2) - sage: len(list(P.points_of_bounded_height(bound=2))) + sage: P. = ProjectiveSpace(NumberField(u^2 - 2, 'v'), 2) # optional - sage.rings.number_field + sage: len(list(P.points_of_bounded_height(bound=2))) # optional - sage.rings.number_field 265 :: - sage: CF. = CyclotomicField(3) - sage: R. = CF[] - sage: L. = CF.extension(x^3 + 2) - sage: Q. = ProjectiveSpace(L, 1) - sage: sorted(list(Q.points_of_bounded_height(bound=1))) + sage: CF. = CyclotomicField(3) # optional - sage.rings.number_field + sage: R. = CF[] # optional - sage.rings.number_field + sage: L. = CF.extension(x^3 + 2) # optional - sage.rings.number_field + sage: Q. = ProjectiveSpace(L, 1) # optional - sage.rings.number_field + sage: sorted(list(Q.points_of_bounded_height(bound=1))) # optional - sage.rings.number_field [(0 : 1), (1 : 0), (a + 1 : 1), (a : 1), (-1 : 1), (-a - 1 : 1), (-a : 1), (1 : 1)] :: sage: R. = QQ[] - sage: F. = NumberField(x^4 - 8*x^2 + 3) - sage: P. = ProjectiveSpace(F, 2) - sage: all([exp(p.global_height()) <= 1 for p in P.points_of_bounded_height(bound=1)]) + sage: F. = NumberField(x^4 - 8*x^2 + 3) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(F, 2) # optional - sage.rings.number_field + sage: all(exp(p.global_height()) <= 1 # optional - sage.rings.number_field + ....: for p in P.points_of_bounded_height(bound=1)) True :: - sage: K. = CyclotomicField(3) - sage: P. = ProjectiveSpace(K, 2) - sage: len(list(P.points_of_bounded_height(bound=1))) + sage: K. = CyclotomicField(3) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field + sage: len(list(P.points_of_bounded_height(bound=1))) # optional - sage.rings.number_field 57 :: sage: u = QQ['u'].0 - sage: K. = NumberField(u^2 - 2) - sage: P. = ProjectiveSpace(K, 1) - sage: len(list(P.points_of_bounded_height(bound=2))) + sage: K. = NumberField(u^2 - 2) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: len(list(P.points_of_bounded_height(bound=2))) # optional - sage.rings.number_field 24 :: sage: R. = QQ[] - sage: K. = NumberField(x^4 - 8*x^2 + 3) - sage: P. = ProjectiveSpace(K, 1) - sage: len(list(P.points_of_bounded_height(bound=2))) + sage: K. = NumberField(x^4 - 8*x^2 + 3) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: len(list(P.points_of_bounded_height(bound=2))) # optional - sage.rings.number_field 108 :: sage: R. = QQ[] - sage: K. = NumberField(x^5 + x^3 + 1) - sage: P. = ProjectiveSpace(K, 2) - sage: L = P.points_of_bounded_height(bound=1.2) - sage: len(list(L)) + sage: K. = NumberField(x^5 + x^3 + 1) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field + sage: L = P.points_of_bounded_height(bound=1.2) # optional - sage.rings.number_field + sage: len(list(L)) # optional - sage.rings.number_field 109 """ from sage.schemes.projective.proj_bdd_height import QQ_points_of_bounded_height, IQ_points_of_bounded_height, points_of_bounded_height @@ -2017,7 +2018,7 @@ def subscheme_from_Chow_form(self, Ch, dim): sage: P = ProjectiveSpace(QQ, 4, 'z') sage: R. = PolynomialRing(QQ) sage: H = x1^2 + x2^2 + 5*x3*x4 - sage: P.subscheme_from_Chow_form(H,3) + sage: P.subscheme_from_Chow_form(H, 3) Closed subscheme of Projective Space of dimension 4 over Rational Field defined by: -5*z0*z1 + z2^2 + z3^2 @@ -2025,7 +2026,7 @@ def subscheme_from_Chow_form(self, Ch, dim): sage: P = ProjectiveSpace(QQ, 3, 'z') sage: R. = PolynomialRing(QQ) - sage: H = x1-x2-x3+x5+2*x0 + sage: H = x1 - x2 - x3 + x5 + 2*x0 sage: P.subscheme_from_Chow_form(H, 1) Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: @@ -2036,11 +2037,11 @@ def subscheme_from_Chow_form(self, Ch, dim): :: - sage: P. = ProjectiveSpace(GF(7), 3) - sage: X = P.subscheme([x3^2+x1*x2,x2-x0]) - sage: Ch = X.Chow_form();Ch + sage: P. = ProjectiveSpace(GF(7), 3) # optional - sage.rings.finite_rings + sage: X = P.subscheme([x3^2 + x1*x2, x2 - x0]) # optional - sage.rings.finite_rings + sage: Ch = X.Chow_form(); Ch # optional - sage.rings.finite_rings t0^2 - 2*t0*t3 + t3^2 - t2*t4 - t4*t5 - sage: Y = P.subscheme_from_Chow_form(Ch, 1); Y + sage: Y = P.subscheme_from_Chow_form(Ch, 1); Y # optional - sage.rings.finite_rings Closed subscheme of Projective Space of dimension 3 over Finite Field of size 7 defined by: x1*x2 + x3^2, @@ -2051,8 +2052,8 @@ def subscheme_from_Chow_form(self, Ch, dim): -2*x0*x3 + 2*x2*x3, 2*x0*x3 - 2*x2*x3, x0^2 - 2*x0*x2 + x2^2 - sage: I = Y.defining_ideal() - sage: I.saturation(I.ring().ideal(list(I.ring().gens())))[0] + sage: I = Y.defining_ideal() # optional - sage.rings.finite_rings + sage: I.saturation(I.ring().ideal(list(I.ring().gens())))[0] # optional - sage.rings.finite_rings Ideal (x0 - x2, x1*x2 + x3^2) of Multivariate Polynomial Ring in x0, x1, x2, x3 over Finite Field of size 7 """ @@ -2159,9 +2160,9 @@ def _point(self, *args, **kwds): TESTS:: - sage: P2. = ProjectiveSpace(2, GF(3)) - sage: point_homset = P2._point_homset(Spec(GF(3)), P2) - sage: P2._point(point_homset, [1,2,3]) + sage: P2. = ProjectiveSpace(2, GF(3)) # optional - sage.rings.finite_rings + sage: point_homset = P2._point_homset(Spec(GF(3)), P2) # optional - sage.rings.finite_rings + sage: P2._point(point_homset, [1,2,3]) # optional - sage.rings.finite_rings (2 : 1 : 0) """ return SchemeMorphism_point_projective_finite_field(*args, **kwds) @@ -2174,8 +2175,8 @@ def _morphism(self, *args, **kwds): TESTS:: - sage: P2. = ProjectiveSpace(2, GF(3)) - sage: P2._morphism(P2.Hom(P2), [x,y,z]) + sage: P2. = ProjectiveSpace(2, GF(3)) # optional - sage.rings.finite_rings + sage: P2._morphism(P2.Hom(P2), [x,y,z]) # optional - sage.rings.finite_rings Scheme endomorphism of Projective Space of dimension 2 over Finite Field of size 3 Defn: Defined on coordinates by sending (x : y : z) to (x : y : z) @@ -2194,15 +2195,15 @@ def __iter__(self): EXAMPLES:: - sage: FF = FiniteField(3) - sage: PP = ProjectiveSpace(0,FF) - sage: [ x for x in PP ] + sage: FF = FiniteField(3) # optional - sage.rings.finite_rings + sage: PP = ProjectiveSpace(0, FF) # optional - sage.rings.finite_rings + sage: [ x for x in PP ] # optional - sage.rings.finite_rings [(1)] - sage: PP = ProjectiveSpace(1,FF) - sage: [ x for x in PP ] + sage: PP = ProjectiveSpace(1, FF) # optional - sage.rings.finite_rings + sage: [ x for x in PP ] # optional - sage.rings.finite_rings [(0 : 1), (1 : 1), (2 : 1), (1 : 0)] - sage: PP = ProjectiveSpace(2,FF) - sage: [ x for x in PP ] + sage: PP = ProjectiveSpace(2, FF) # optional - sage.rings.finite_rings + sage: [ x for x in PP ] # optional - sage.rings.finite_rings [(0 : 0 : 1), (0 : 1 : 1), (0 : 2 : 1), @@ -2245,10 +2246,10 @@ def rational_points(self, F=None): EXAMPLES:: - sage: P = ProjectiveSpace(1, GF(3)) - sage: P.rational_points() + sage: P = ProjectiveSpace(1, GF(3)) # optional - sage.rings.finite_rings + sage: P.rational_points() # optional - sage.rings.finite_rings [(0 : 1), (1 : 1), (2 : 1), (1 : 0)] - sage: P.rational_points(GF(3^2, 'b')) + sage: P.rational_points(GF(3^2, 'b')) # optional - sage.rings.finite_rings [(0 : 1), (b : 1), (b + 1 : 1), (2*b + 1 : 1), (2 : 1), (2*b : 1), (2*b + 2 : 1), (b + 2 : 1), (1 : 1), (1 : 0)] """ if F is None: @@ -2267,8 +2268,8 @@ def rational_points_dictionary(self): EXAMPLES:: - sage: P1 = ProjectiveSpace(GF(7),1,'x') - sage: P1.rational_points_dictionary() + sage: P1 = ProjectiveSpace(GF(7), 1, 'x') # optional - sage.rings.finite_rings + sage: P1.rational_points_dictionary() # optional - sage.rings.finite_rings {(0 : 1): 0, (1 : 0): 7, (1 : 1): 1, diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index 4a178c53766..7ead2ef9fe0 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -60,7 +60,7 @@ class AlgebraicScheme_subscheme_projective(AlgebraicScheme_subscheme): EXAMPLES:: sage: P. = ProjectiveSpace(2, QQ) - sage: P.subscheme([x^2-y*z]) + sage: P.subscheme([x^2 - y*z]) Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x^2 - y*z @@ -87,7 +87,7 @@ def point(self, v, check=True): EXAMPLES:: sage: P2. = ProjectiveSpace(QQ, 2) - sage: X = P2.subscheme([x-y,y-z]) + sage: X = P2.subscheme([x - y, y - z]) sage: X.point([1,1,1]) (1 : 1 : 1) @@ -101,7 +101,7 @@ def point(self, v, check=True): :: sage: P. = ProjectiveSpace(QQ, 1) - sage: X = P.subscheme(x^2+2*y^2) + sage: X = P.subscheme(x^2 + 2*y^2) sage: X.point(infinity) Traceback (most recent call last): ... @@ -142,16 +142,16 @@ def _morphism(self, *args, **kwds): TESTS:: - sage: P1. = ProjectiveSpace(1,QQ) - sage: P2 = ProjectiveSpace(2,QQ) + sage: P1. = ProjectiveSpace(1, QQ) + sage: P2 = ProjectiveSpace(2, QQ) sage: H12 = P1.Hom(P2) - sage: H12([x^2,x*y, y^2]) # indirect doctest + sage: H12([x^2, x*y, y^2]) # indirect doctest Scheme morphism: From: Projective Space of dimension 1 over Rational Field To: Projective Space of dimension 2 over Rational Field Defn: Defined on coordinates by sending (x : y) to (x^2 : x*y : y^2) - sage: P1._morphism(H12, [x^2,x*y, y^2]) + sage: P1._morphism(H12, [x^2, x*y, y^2]) Scheme morphism: From: Projective Space of dimension 1 over Rational Field To: Projective Space of dimension 2 over Rational Field @@ -243,16 +243,16 @@ def affine_patch(self, i, AA=None): :: - sage: A. = AffineSpace(QQ,3) - sage: X = A.subscheme([x-y*z]) + sage: A. = AffineSpace(QQ, 3) + sage: X = A.subscheme([x - y*z]) sage: Y = X.projective_embedding(1).codomain() - sage: Y.affine_patch(1,A).ambient_space() == A + sage: Y.affine_patch(1, A).ambient_space() == A True :: - sage: P. = ProjectiveSpace(2,ZZ) - sage: S = P.subscheme([u^2-v*w]) + sage: P. = ProjectiveSpace(2, ZZ) + sage: S = P.subscheme([u^2 - v*w]) sage: A. = AffineSpace(2, ZZ) sage: S.affine_patch(1, A) Closed subscheme of Affine Space of dimension 2 over Integer Ring @@ -305,8 +305,8 @@ def _best_affine_patch(self, point): EXAMPLES:: - sage: P.= ProjectiveSpace(QQ,2) - sage: S = P.subscheme(x+2*y+3*z) + sage: P. = ProjectiveSpace(QQ, 2) + sage: S = P.subscheme(x + 2*y + 3*z) sage: S._best_affine_patch(P.point([0,-3,2])) 1 sage: S._best_affine_patch([0,-3,2]) @@ -314,9 +314,9 @@ def _best_affine_patch(self, point): TESTS:: - sage: F = GF(3) - sage: P.= ProjectiveSpace(F,2) - sage: S._best_affine_patch([0,1,2]) + sage: F = GF(3) # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(F, 2) # optional - sage.rings.finite_rings + sage: S._best_affine_patch([0,1,2]) # optional - sage.rings.finite_rings 2 """ point = list(point) @@ -357,8 +357,8 @@ def neighborhood(self, point): EXAMPLES:: - sage: P.= ProjectiveSpace(QQ,2) - sage: S = P.subscheme(x+2*y+3*z) + sage: P.= ProjectiveSpace(QQ, 2) + sage: S = P.subscheme(x + 2*y + 3*z) sage: s = S.point([0,-3,2]); s (0 : -3/2 : 1) sage: patch = S.neighborhood(s); patch @@ -415,8 +415,8 @@ def is_smooth(self, point=None): EXAMPLES:: - sage: P2. = ProjectiveSpace(2,QQ) - sage: cuspidal_curve = P2.subscheme([y^2*z-x^3]) + sage: P2. = ProjectiveSpace(2, QQ) + sage: cuspidal_curve = P2.subscheme([y^2*z - x^3]) sage: cuspidal_curve Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: -x^3 + y^2*z @@ -426,7 +426,7 @@ def is_smooth(self, point=None): False sage: cuspidal_curve.is_smooth() False - sage: P2.subscheme([y^2*z-x^3+z^3+1/10*x*y*z]).is_smooth() + sage: P2.subscheme([y^2*z - x^3 + z^3 + 1/10*x*y*z]).is_smooth() True TESTS:: @@ -473,8 +473,8 @@ def orbit(self, f, N): EXAMPLES:: sage: P. = ProjectiveSpace(QQ, 3) - sage: f = DynamicalSystem_projective([(x-2*y)^2,(x-2*z)^2,(x-2*w)^2,x^2]) - sage: f.orbit(P.subscheme([x]),5) + sage: f = DynamicalSystem_projective([(x-2*y)^2, (x-2*z)^2, (x-2*w)^2, x^2]) + sage: f.orbit(P.subscheme([x]), 5) [Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: x, @@ -500,8 +500,8 @@ def orbit(self, f, N): sage: P1. = ProjectiveSpace(QQ, 1) sage: H = Hom(PS, P1) sage: f = H([x^2, y^2]) - sage: X = PS.subscheme([x-y]) - sage: X.orbit(f,2) + sage: X = PS.subscheme([x - y]) + sage: X.orbit(f, 2) Traceback (most recent call last): ... TypeError: map must be a dynamical system for iteration @@ -510,8 +510,8 @@ def orbit(self, f, N): sage: PS. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([x^2, y^2, z^2]) - sage: X = PS.subscheme([x-y]) - sage: X.orbit(f,[-1,2]) + sage: X = PS.subscheme([x - y]) + sage: X.orbit(f, [-1,2]) Traceback (most recent call last): ... TypeError: orbit bounds must be non-negative @@ -556,7 +556,7 @@ def nth_iterate(self, f, n): sage: P. = ProjectiveSpace(QQ, 3) sage: f = DynamicalSystem_projective([y^2, z^2, x^2, w^2]) - sage: f.nth_iterate(P.subscheme([x-w,y-z]), 3) + sage: f.nth_iterate(P.subscheme([x - w, y - z]), 3) Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: y - z, @@ -566,8 +566,8 @@ def nth_iterate(self, f, n): sage: PS. = ProjectiveSpace(ZZ, 2) sage: f = DynamicalSystem_projective([x^2, y^2, z^2]) - sage: X = PS.subscheme([x-y]) - sage: X.nth_iterate(f,-2) + sage: X = PS.subscheme([x - y]) + sage: X.nth_iterate(f, -2) Traceback (most recent call last): ... TypeError: must be a forward orbit @@ -575,11 +575,11 @@ def nth_iterate(self, f, n): :: sage: PS. = ProjectiveSpace(ZZ, 2) - sage: P2.=ProjectiveSpace(QQ, 2) + sage: P2. = ProjectiveSpace(QQ, 2) sage: H = Hom(PS, P2) sage: f = H([x^2, y^2, z^2]) - sage: X = PS.subscheme([x-y]) - sage: X.nth_iterate(f,2) + sage: X = PS.subscheme([x - y]) + sage: X.nth_iterate(f, 2) Traceback (most recent call last): ... TypeError: map must be a dynamical system for iteration @@ -588,8 +588,8 @@ def nth_iterate(self, f, n): sage: PS. = ProjectiveSpace(QQ, 2) sage: f = DynamicalSystem_projective([x^2, y^2, z^2]) - sage: X = PS.subscheme([x-y]) - sage: X.nth_iterate(f,2.5) + sage: X = PS.subscheme([x - y]) + sage: X.nth_iterate(f, 2.5) Traceback (most recent call last): ... TypeError: Attempt to coerce non-integral RealNumber to Integer @@ -624,8 +624,8 @@ def _forward_image(self, f, check=True): sage: PS. = ProjectiveSpace(QQ, 2) sage: H = End(PS) - sage: f = H([x^2, y^2-2*z^2, z^2]) - sage: X = PS.subscheme(y-2*z) + sage: f = H([x^2, y^2 - 2*z^2, z^2]) + sage: X = PS.subscheme(y - 2*z) sage: X._forward_image(f) Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: @@ -637,7 +637,7 @@ def _forward_image(self, f, check=True): sage: PS. = ProjectiveSpace(ZZ, 3) sage: H = End(PS) sage: f = H([y^2, x^2, w^2, z^2]) - sage: X = PS.subscheme([z^2+y*w, x-w]) + sage: X = PS.subscheme([z^2 + y*w, x - w]) sage: f(X) Closed subscheme of Projective Space of dimension 3 over Integer Ring defined by: @@ -649,7 +649,7 @@ def _forward_image(self, f, check=True): sage: PS. = ProjectiveSpace(CC, 3) sage: H = End(PS) sage: f = H([x^2 + y^2, y^2, z^2-y^2, w^2]) - sage: X = PS.subscheme([z-2*w]) + sage: X = PS.subscheme([z - 2*w]) sage: f(X) Closed subscheme of Projective Space of dimension 3 over Complex Field with 53 bits of precision defined by: @@ -661,7 +661,7 @@ def _forward_image(self, f, check=True): sage: P. = ProjectiveSpace(FractionField(R), 2) sage: H = End(P) sage: f = H([x^2 + 2*y*z, t^2*y^2, z^2]) - sage: f([t^2*y-z]) + sage: f([t^2*y - z]) Closed subscheme of Projective Space of dimension 2 over Fraction Field of Univariate Polynomial Ring in t over Rational Field defined by: y - 1/(t^2)*z @@ -669,11 +669,11 @@ def _forward_image(self, f, check=True): :: sage: set_verbose(-1) - sage: PS. = ProjectiveSpace(Qp(3), 2) - sage: H = End(PS) - sage: f = H([x^2,2*y^2,z^2]) - sage: X = PS.subscheme([2*x-y,z]) - sage: f(X) + sage: PS. = ProjectiveSpace(Qp(3), 2) # optional - sage.rings.padics + sage: H = End(PS) # optional - sage.rings.padics + sage: f = H([x^2, 2*y^2, z^2]) # optional - sage.rings.padics + sage: X = PS.subscheme([2*x - y, z]) # optional - sage.rings.padics + sage: f(X) # optional - sage.rings.padics Closed subscheme of Projective Space of dimension 2 over 3-adic Field with capped relative precision 20 defined by: z, @@ -685,7 +685,7 @@ def _forward_image(self, f, check=True): sage: R. = PolynomialRing(QQ) sage: P. = ProjectiveSpace(FractionField(R), 2) sage: H = End(P) - sage: f = H([y0*x^2+y1*z^2, y2*y^2+y3*z^2, z^2]) + sage: f = H([y0*x^2 + y1*z^2, y2*y^2 + y3*z^2, z^2]) sage: X = P.subscheme(x*z) sage: X._forward_image(f) Closed subscheme of Projective Space of dimension 2 over Fraction Field @@ -698,7 +698,7 @@ def _forward_image(self, f, check=True): sage: P2. = ProjectiveSpace(QQ, 2) sage: P5. = ProjectiveSpace(QQ, 5) sage: H = Hom(P2, P5) - sage: f = H([x^2,x*y,x*z,y^2,y*z,z^2]) #Veronese map + sage: f = H([x^2, x*y, x*z, y^2, y*z, z^2]) # Veronese map sage: X = P2.subscheme([]) sage: f(X) Closed subscheme of Projective Space of dimension 5 over Rational Field @@ -712,11 +712,11 @@ def _forward_image(self, f, check=True): :: - sage: P2.=ProjectiveSpace(QQ, 2) - sage: P3.=ProjectiveSpace(QQ, 3) + sage: P2. = ProjectiveSpace(QQ, 2) + sage: P3. = ProjectiveSpace(QQ, 3) sage: H = Hom(P2, P3) - sage: X = P2.subscheme([x-y,x-z]) - sage: f = H([x^2,y^2,z^2,x*y]) + sage: X = P2.subscheme([x - y, x - z]) + sage: f = H([x^2, y^2, z^2, x*y]) sage: f(X) Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: @@ -728,9 +728,9 @@ def _forward_image(self, f, check=True): sage: P1. = ProjectiveSpace(QQ, 1) sage: P2. = ProjectiveSpace(QQ, 2) - sage: H = Hom(P2,P1) - sage: f = H([x^2,y*z]) - sage: X = P2.subscheme([x-y]) + sage: H = Hom(P2, P1) + sage: f = H([x^2, y*z]) + sage: X = P2.subscheme([x - y]) sage: f(X) Traceback (most recent call last): ... @@ -741,7 +741,7 @@ def _forward_image(self, f, check=True): sage: PS. = ProjectiveSpace(ZZ, 2) sage: H = End(PS) sage: f = H([x^3, x*y^2, x*z^2]) - sage: X = PS.subscheme([x-y]) + sage: X = PS.subscheme([x - y]) sage: X._forward_image(f) Traceback (most recent call last): ... @@ -751,7 +751,7 @@ def _forward_image(self, f, check=True): sage: PS. = ProjectiveSpace(QQ, 2) sage: P1. = ProjectiveSpace(QQ, 1) - sage: Y = P1.subscheme([u-v]) + sage: Y = P1.subscheme([u - v]) sage: H = End(PS) sage: f = H([x^2, y^2, z^2]) sage: Y._forward_image(f) @@ -812,7 +812,7 @@ def preimage(self, f, k=1, check=True): sage: PS. = ProjectiveSpace(ZZ, 2) sage: H = End(PS) sage: f = H([y^2, x^2, z^2]) - sage: X = PS.subscheme([x-y]) + sage: X = PS.subscheme([x - y]) sage: X.preimage(f) Closed subscheme of Projective Space of dimension 2 over Integer Ring defined by: @@ -822,8 +822,8 @@ def preimage(self, f, k=1, check=True): sage: P. = ProjectiveSpace(QQ, 4) sage: H = End(P) - sage: f = H([x^2-y^2, y^2, z^2, w^2, t^2+w^2]) - sage: f.rational_preimages(P.subscheme([x-z, t^2, w-t])) + sage: f = H([x^2 - y^2, y^2, z^2, w^2, t^2 + w^2]) + sage: f.rational_preimages(P.subscheme([x - z, t^2, w - t])) Closed subscheme of Projective Space of dimension 4 over Rational Field defined by: x^2 - y^2 - z^2, @@ -835,8 +835,8 @@ def preimage(self, f, k=1, check=True): sage: P1. = ProjectiveSpace(QQ, 1) sage: P3. = ProjectiveSpace(QQ, 3) sage: H = Hom(P1, P3) - sage: X = P3.subscheme([u-v, 2*u-w, u+t]) - sage: f = H([x^2,y^2, x^2+y^2, x*y]) + sage: X = P3.subscheme([u - v, 2*u - w, u + t]) + sage: f = H([x^2, y^2, x^2 + y^2, x*y]) sage: X.preimage(f) Closed subscheme of Projective Space of dimension 1 over Rational Field defined by: @@ -849,7 +849,7 @@ def preimage(self, f, k=1, check=True): sage: P1. = ProjectiveSpace(QQ, 1) sage: P3. = ProjectiveSpace(QQ, 3) sage: H = Hom(P3, P1) - sage: X = P1.subscheme([x-y]) + sage: X = P1.subscheme([x - y]) sage: f = H([u^2, v^2]) sage: X.preimage(f) Traceback (most recent call last): @@ -861,7 +861,7 @@ def preimage(self, f, k=1, check=True): sage: PS. = ProjectiveSpace(ZZ, 2) sage: H = End(PS) sage: f = H([x^2, x^2, x^2]) - sage: X = PS.subscheme([x-y]) + sage: X = PS.subscheme([x - y]) sage: X.preimage(f) Traceback (most recent call last): ... @@ -871,7 +871,7 @@ def preimage(self, f, k=1, check=True): sage: PS. = ProjectiveSpace(ZZ, 2) sage: P1. = ProjectiveSpace(ZZ, 1) - sage: Y = P1.subscheme([u^2-v^2]) + sage: Y = P1.subscheme([u^2 - v^2]) sage: H = End(PS) sage: f = H([x^2, y^2, z^2]) sage: Y.preimage(f) @@ -882,7 +882,7 @@ def preimage(self, f, k=1, check=True): :: sage: P. = ProjectiveSpace(QQ, 2) - sage: Y = P.subscheme([x-y]) + sage: Y = P.subscheme([x - y]) sage: H = End(P) sage: f = H([x^2, y^2, z^2]) sage: Y.preimage(f, k=2) @@ -961,20 +961,20 @@ def dual(self): An example over a finite field:: - sage: R = PolynomialRing(GF(61), 'a,b,c') - sage: P. = ProjectiveSpace(2, R.base_ring()) - sage: X = P.subscheme(R.ideal(a*a+2*b*b+3*c*c)) - sage: X.dual() + sage: R = PolynomialRing(GF(61), 'a,b,c') # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(2, R.base_ring()) # optional - sage.rings.finite_rings + sage: X = P.subscheme(R.ideal(a*a + 2*b*b + 3*c*c)) # optional - sage.rings.finite_rings + sage: X.dual() # optional - sage.rings.finite_rings Closed subscheme of Projective Space of dimension 2 over Finite Field of size 61 defined by: y0^2 - 30*y1^2 - 20*y2^2 TESTS:: - sage: R = PolynomialRing(Qp(3), 'a,b,c') - sage: P. = ProjectiveSpace(2, R.base_ring()) - sage: X = P.subscheme(R.ideal(a*a+2*b*b+3*c*c)) - sage: X.dual() + sage: R = PolynomialRing(Qp(3), 'a,b,c') # optional - sage.rings.padics + sage: P. = ProjectiveSpace(2, R.base_ring()) # optional - sage.rings.padics + sage: X = P.subscheme(R.ideal(a*a + 2*b*b + 3*c*c)) # optional - sage.rings.padics + sage: X.dual() # optional - sage.rings.padics Traceback (most recent call last): ... NotImplementedError: base ring must be QQ or a finite field @@ -1036,9 +1036,9 @@ def degree(self): sage: X.degree() 7 - sage: P. = ProjectiveSpace(GF(13), 3) - sage: X = P.subscheme([y^3 - w^3, x + 7*z]) - sage: X.degree() + sage: P. = ProjectiveSpace(GF(13), 3) # optional - sage.rings.finite_rings + sage: X = P.subscheme([y^3 - w^3, x + 7*z]) # optional - sage.rings.finite_rings + sage: X.degree() # optional - sage.rings.finite_rings 3 sage: P. = ProjectiveSpace(QQ, 4) @@ -1066,28 +1066,28 @@ def intersection_multiplicity(self, X, P): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(5), 2) - sage: C = Curve([x^4 - z^2*y^2], P) - sage: D = Curve([y^4*z - x^5 - x^3*z^2], P) - sage: Q1 = P([0,1,0]) - sage: C.intersection_multiplicity(D, Q1) + sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings + sage: C = Curve([x^4 - z^2*y^2], P) # optional - sage.rings.finite_rings + sage: D = Curve([y^4*z - x^5 - x^3*z^2], P) # optional - sage.rings.finite_rings + sage: Q1 = P([0,1,0]) # optional - sage.rings.finite_rings + sage: C.intersection_multiplicity(D, Q1) # optional - sage.rings.finite_rings 4 - sage: Q2 = P([0,0,1]) - sage: C.intersection_multiplicity(D, Q2) + sage: Q2 = P([0,0,1]) # optional - sage.rings.finite_rings + sage: C.intersection_multiplicity(D, Q2) # optional - sage.rings.finite_rings 6 :: sage: R. = QQ[] - sage: K. = NumberField(a^4 + 1) - sage: P. = ProjectiveSpace(K, 3) - sage: X = P.subscheme([x^2 + y^2 - z*w]) - sage: Y = P.subscheme([y*z - x*w, z - w]) - sage: Q1 = P([b^2,1,0,0]) - sage: X.intersection_multiplicity(Y, Q1) + sage: K. = NumberField(a^4 + 1) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 3) # optional - sage.rings.number_field + sage: X = P.subscheme([x^2 + y^2 - z*w]) # optional - sage.rings.number_field + sage: Y = P.subscheme([y*z - x*w, z - w]) # optional - sage.rings.number_field + sage: Q1 = P([b^2,1,0,0]) # optional - sage.rings.number_field + sage: X.intersection_multiplicity(Y, Q1) # optional - sage.rings.number_field 1 - sage: Q2 = P([1/2*b^3-1/2*b,1/2*b^3-1/2*b,1,1]) - sage: X.intersection_multiplicity(Y, Q2) + sage: Q2 = P([1/2*b^3 - 1/2*b, 1/2*b^3 - 1/2*b, 1, 1]) # optional - sage.rings.number_field + sage: X.intersection_multiplicity(Y, Q2) # optional - sage.rings.number_field 1 :: @@ -1157,10 +1157,10 @@ def multiplicity(self, P): :: - sage: P. = ProjectiveSpace(GF(29), 3) - sage: C = Curve([y^17 - x^5*w^4*z^8, x*y - z^2], P) - sage: Q = P([3,0,0,1]) - sage: C.multiplicity(Q) + sage: P. = ProjectiveSpace(GF(29), 3) # optional - sage.rings.finite_rings + sage: C = Curve([y^17 - x^5*w^4*z^8, x*y - z^2], P) # optional - sage.rings.finite_rings + sage: Q = P([3,0,0,1]) # optional - sage.rings.finite_rings + sage: C.multiplicity(Q) # optional - sage.rings.finite_rings 8 """ if self.base_ring() not in Fields(): @@ -1266,16 +1266,16 @@ def _morphism(self, *args, **kwds): TESTS:: - sage: P1. = ProjectiveSpace(1,QQ) - sage: P2 = ProjectiveSpace(2,QQ) + sage: P1. = ProjectiveSpace(1, QQ) + sage: P2 = ProjectiveSpace(2, QQ) sage: H12 = P1.Hom(P2) - sage: H12([x^2,x*y, y^2]) # indirect doctest + sage: H12([x^2, x*y, y^2]) # indirect doctest Scheme morphism: From: Projective Space of dimension 1 over Rational Field To: Projective Space of dimension 2 over Rational Field Defn: Defined on coordinates by sending (x : y) to (x^2 : x*y : y^2) - sage: P1._morphism(H12, [x^2,x*y, y^2]) + sage: P1._morphism(H12, [x^2, x*y, y^2]) Scheme morphism: From: Projective Space of dimension 1 over Rational Field To: Projective Space of dimension 2 over Rational Field @@ -1311,22 +1311,22 @@ def Chow_form(self): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(17), 3) - sage: X = P.subscheme([x3+x1,x2-x0,x2-x3]) - sage: X.Chow_form() + sage: P. = ProjectiveSpace(GF(17), 3) # optional - sage.rings.finite_rings + sage: X = P.subscheme([x3 + x1, x2 - x0, x2 - x3]) # optional - sage.rings.finite_rings + sage: X.Chow_form() # optional - sage.rings.finite_rings t0 - t1 + t2 + t3 :: - sage: P. = ProjectiveSpace(QQ,3) - sage: X = P.subscheme([x3^2 -101*x1^2 - 3*x2*x0]) + sage: P. = ProjectiveSpace(QQ, 3) + sage: X = P.subscheme([x3^2 - 101*x1^2 - 3*x2*x0]) sage: X.Chow_form() t0^2 - 101*t2^2 - 3*t1*t3 :: - sage: P.=ProjectiveSpace(QQ,3) - sage: X = P.subscheme([x0*x2-x1^2, x0*x3-x1*x2, x1*x3-x2^2]) + sage: P. = ProjectiveSpace(QQ, 3) + sage: X = P.subscheme([x0*x2 - x1^2, x0*x3 - x1*x2, x1*x3 - x2^2]) sage: Ch = X.Chow_form(); Ch t2^3 + 2*t2^2*t3 + t2*t3^2 - 3*t1*t2*t4 - t1*t3*t4 + t0*t4^2 + t1^2*t5 sage: Y = P.subscheme_from_Chow_form(Ch, 1); Y From e5e29f75984e314b9dea6a2bd99aedb0ebc67571 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 20 Mar 2023 10:30:13 -0700 Subject: [PATCH 078/135] src/sage/schemes/generic/algebraic_scheme.py: Fix up # optional --- src/sage/schemes/generic/algebraic_scheme.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index 95de049cff9..05b04d0f08d 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -1307,8 +1307,10 @@ def is_irreducible(self): :: sage: A. = AffineSpace(GF(17), 4) # optional - sage.rings.finite_rings - sage: X = A.subscheme([x*y*z^2 - x*y*z*w - z*w^2 + w^3, - ....: x^3*y*z*w - x*y^3*z - x^2*y*z*w - x^2*w^3 + y^2*w^2 + x*w^3]) + sage: X = A.subscheme([ # optional - sage.rings.finite_rings + ....: x*y*z^2 - x*y*z*w - z*w^2 + w^3, + ....: x^3*y*z*w - x*y^3*z - x^2*y*z*w - x^2*w^3 + y^2*w^2 + x*w^3 + ....: ]) sage: X.is_irreducible() # optional - sage.rings.finite_rings False """ From 5e7d3f0797922ef64ac69510aea1b95b2bf2b5e8 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 21 Mar 2023 01:34:30 -0700 Subject: [PATCH 079/135] sage.schemes: More # optional --- .../schemes/berkovich/berkovich_cp_element.py | 742 +++++++++--------- src/sage/schemes/berkovich/berkovich_space.py | 223 +++--- .../schemes/jacobians/abstract_jacobian.py | 11 +- src/sage/schemes/overview.py | 8 +- src/sage/schemes/product_projective/homset.py | 25 +- .../schemes/product_projective/morphism.py | 44 +- src/sage/schemes/product_projective/point.py | 80 +- .../product_projective/rational_point.py | 38 +- src/sage/schemes/product_projective/space.py | 97 +-- .../schemes/product_projective/subscheme.py | 70 +- src/sage/schemes/toric/chow_group.py | 10 +- src/sage/schemes/toric/divisor.py | 18 +- src/sage/schemes/toric/fano_variety.py | 6 +- src/sage/schemes/toric/homset.py | 84 +- src/sage/schemes/toric/ideal.py | 32 +- src/sage/schemes/toric/library.py | 2 +- src/sage/schemes/toric/morphism.py | 40 +- src/sage/schemes/toric/points.py | 323 ++++---- src/sage/schemes/toric/sheaf/constructor.py | 6 +- src/sage/schemes/toric/sheaf/klyachko.py | 32 +- src/sage/schemes/toric/toric_subscheme.py | 70 +- src/sage/schemes/toric/variety.py | 71 +- src/sage/schemes/toric/weierstrass.py | 59 +- .../schemes/toric/weierstrass_covering.py | 25 +- src/sage/schemes/toric/weierstrass_higher.py | 30 +- 25 files changed, 1090 insertions(+), 1056 deletions(-) diff --git a/src/sage/schemes/berkovich/berkovich_cp_element.py b/src/sage/schemes/berkovich/berkovich_cp_element.py index 7c922fefb90..262e44db4f7 100644 --- a/src/sage/schemes/berkovich/berkovich_cp_element.py +++ b/src/sage/schemes/berkovich/berkovich_cp_element.py @@ -62,13 +62,13 @@ class Berkovich_Element_Cp(Berkovich_Element): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) - sage: B(2) + sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: B(2) # optional - sage.rings.padics Type I point centered at 2 + O(3^20) :: - sage: B(0, 1) + sage: B(0, 1) # optional - sage.rings.padics Type II point centered at 0 of radius 3^0 """ @@ -78,8 +78,8 @@ def __init__(self, parent, center, radius=None, power=None, prec=20, space_type= EXAMPLES:: - sage: B = Berkovich_Cp_Affine(5) - sage: B(4) + sage: B = Berkovich_Cp_Affine(5) # optional - sage.rings.padics + sage: B(4) # optional - sage.rings.padics Type I point centered at 4 + O(5^20) """ from sage.rings.function_field.element import is_FunctionFieldElement @@ -426,9 +426,9 @@ def _custom_abs(self, x): :: - sage: B = Berkovich_Cp_Affine(Qp(3)) - sage: Q1 = B(9) - sage: Q1._custom_abs(Q1.center()) + sage: B = Berkovich_Cp_Affine(Qp(3)) # optional - sage.rings.padics + sage: Q1 = B(9) # optional - sage.rings.padics + sage: Q1._custom_abs(Q1.center()) # optional - sage.rings.padics 1/9 """ if self._base_type == 'padic field': @@ -450,15 +450,15 @@ def center_function(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(5) - sage: L. = PolynomialRing(Qp(5)) - sage: T = FractionField(L) - sage: f = T(1/t) + sage: B = Berkovich_Cp_Projective(5) # optional - sage.rings.padics + sage: L. = PolynomialRing(Qp(5)) # optional - sage.rings.padics + sage: T = FractionField(L) # optional - sage.rings.padics + sage: f = T(1/t) # optional - sage.rings.padics sage: R. = RR[] sage: Y = FractionField(R) - sage: g = (40*pi)/x - sage: Q1 = B(f, g) - sage: Q1.center_function() + sage: g = (40*pi)/x # optional - sage.symbolic + sage: Q1 = B(f, g) # optional - sage.rings.padics sage.symbolic + sage: Q1.center_function() # optional - sage.rings.padics sage.symbolic (1 + O(5^20))/((1 + O(5^20))*t) """ if self.type_of_point() != 4: @@ -478,15 +478,15 @@ def radius_function(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(5) - sage: L. = PolynomialRing(Qp(5)) - sage: T = FractionField(L) - sage: f = T(1/t) + sage: B = Berkovich_Cp_Projective(5) # optional - sage.rings.padics + sage: L. = PolynomialRing(Qp(5)) # optional - sage.rings.padics + sage: T = FractionField(L) # optional - sage.rings.padics + sage: f = T(1/t) # optional - sage.rings.padics sage: R. = RR[] sage: Y = FractionField(R) - sage: g = (40*pi)/x - sage: Q1 = B(f, g) - sage: Q1.radius_function() + sage: g = (40*pi)/x # optional - sage.symbolic + sage: Q1 = B(f, g) # optional - sage.rings.padics sage.symbolic + sage: Q1.radius_function() # optional - sage.rings.padics sage.symbolic 40.0000000000000*pi/x """ if self.type_of_point() != 4: @@ -506,14 +506,14 @@ def precision(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(Qp(3)) - sage: d = B([2, 2, 2], [1.761, 1.123, 1.112]) - sage: d.precision() + sage: B = Berkovich_Cp_Affine(Qp(3)) # optional - sage.rings.padics + sage: d = B([2, 2, 2], [1.761, 1.123, 1.112]) # optional - sage.rings.padics + sage: d.precision() # optional - sage.rings.padics 3 TESTS:: - sage: d.precision == d.prec + sage: d.precision == d.prec # optional - sage.rings.padics True """ if self._type in [1, 2, 3]: @@ -537,8 +537,8 @@ def ideal(self): :: - sage: B = Berkovich_Cp_Projective(3) - sage: B(0).ideal() + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: B(0).ideal() # optional - sage.rings.padics """ return self.parent().ideal() @@ -557,15 +557,15 @@ def power(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) - sage: Q1 = B(1, 9) - sage: Q1.power() + sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: Q1 = B(1, 9) # optional - sage.rings.padics + sage: Q1.power() # optional - sage.rings.padics 2 :: - sage: Q2 = B(1, 4) - sage: Q2.power() + sage: Q2 = B(1, 4) # optional - sage.rings.padics + sage: Q2.power() # optional - sage.rings.padics 1.26185950714291 """ if self._type in [1, 4]: @@ -583,15 +583,15 @@ def radius(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) - sage: Q1 = B(1, 2/5) - sage: Q1.radius() + sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: Q1 = B(1, 2/5) # optional - sage.rings.padics + sage: Q1.radius() # optional - sage.rings.padics 0.400000000000000 :: - sage: d = B([2, 2, 2], [1.761, 1.123, 1.112]) - sage: d.radius() + sage: d = B([2, 2, 2], [1.761, 1.123, 1.112]) # optional - sage.rings.padics + sage: d.radius() # optional - sage.rings.padics [1.76100000000000, 1.12300000000000, 1.11200000000000] """ if self._type == 4: @@ -618,38 +618,38 @@ def diameter(self, basepoint=Infinity): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) - sage: Q1 = B(3) - sage: Q1.diameter() + sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: Q1 = B(3) # optional - sage.rings.padics + sage: Q1.diameter() # optional - sage.rings.padics 0 :: - sage: Q2 = B(1/2, 9) - sage: Q2.diameter() + sage: Q2 = B(1/2, 9) # optional - sage.rings.padics + sage: Q2.diameter() # optional - sage.rings.padics 9.00000000000000 The diameter of a type IV point is the limit of the radii:: - sage: R. = PolynomialRing(Qp(3)) - sage: f = R(2) - sage: S. = PolynomialRing(RR) - sage: S = FractionField(S) - sage: g = (y+1)/y - sage: B(f,g).diameter() + sage: R. = PolynomialRing(Qp(3)) # optional - sage.rings.padics + sage: f = R(2) # optional - sage.rings.padics + sage: S. = PolynomialRing(RR) # optional - sage.rings.padics + sage: S = FractionField(S) # optional - sage.rings.padics + sage: g = (y+1)/y # optional - sage.rings.padics + sage: B(f,g).diameter() # optional - sage.rings.padics 1.0 :: - sage: B = Berkovich_Cp_Affine(3) - sage: Q1 = B(1/81, 1) - sage: Q2 = B(1/3) - sage: Q1.diameter(Q2) + sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: Q1 = B(1/81, 1) # optional - sage.rings.padics + sage: Q2 = B(1/3) # optional - sage.rings.padics + sage: Q1.diameter(Q2) # optional - sage.rings.padics 0.00137174211248285 :: - sage: Q2.diameter(Q2) + sage: Q2.diameter(Q2) # optional - sage.rings.padics +infinity """ if basepoint == Infinity: @@ -693,21 +693,21 @@ def path_distance_metric(self, other): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) - sage: Q1 = B(1/4, 4) - sage: Q2 = B(1/4, 6) - sage: Q1.path_distance_metric(Q2) + sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: Q1 = B(1/4, 4) # optional - sage.rings.padics + sage: Q2 = B(1/4, 6) # optional - sage.rings.padics + sage: Q1.path_distance_metric(Q2) # optional - sage.rings.padics 0.369070246428542 :: - sage: Q3 = B(1) - sage: Q3.path_distance_metric(Q1) + sage: Q3 = B(1) # optional - sage.rings.padics + sage: Q3.path_distance_metric(Q1) # optional - sage.rings.padics +infinity :: - sage: Q3.path_distance_metric(Q3) + sage: Q3.path_distance_metric(Q3) # optional - sage.rings.padics 0 """ if not isinstance(other, type(self)): @@ -744,20 +744,20 @@ def Hsia_kernel(self, other, basepoint): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) - sage: Q1 = B(2, 9) - sage: Q2 = B(1/27, 1/27) - sage: Q3 = B(1, 1/3) - sage: Q1.Hsia_kernel(Q2, Q3) + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: Q1 = B(2, 9) # optional - sage.rings.padics + sage: Q2 = B(1/27, 1/27) # optional - sage.rings.padics + sage: Q3 = B(1, 1/3) # optional - sage.rings.padics + sage: Q1.Hsia_kernel(Q2, Q3) # optional - sage.rings.padics 0.111111111111111 :: - sage: B = Berkovich_Cp_Projective(3) - sage: Q1 = B(2, 9) - sage: Q2 = B(1/2) - sage: Q3 = B(1/2) - sage: Q1.Hsia_kernel(Q2, Q3) + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: Q1 = B(2, 9) # optional - sage.rings.padics + sage: Q2 = B(1/2) # optional - sage.rings.padics + sage: Q3 = B(1/2) # optional - sage.rings.padics + sage: Q1.Hsia_kernel(Q2, Q3) # optional - sage.rings.padics +infinity """ @@ -790,10 +790,10 @@ def small_metric(self, other): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) - sage: Q1 = B(1/4, 4) - sage: Q2 = B(1/4, 6) - sage: Q1.small_metric(Q2) + sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: Q1 = B(1/4, 4) # optional - sage.rings.padics + sage: Q2 = B(1/4, 6) # optional - sage.rings.padics + sage: Q1.small_metric(Q2) # optional - sage.rings.padics 0.0833333333333333 :: @@ -853,20 +853,20 @@ def potential_kernel(self, other, basepoint): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) - sage: Q1 = B(27, 1) - sage: Q2 = B(1/3, 2) - sage: Q3 = B(1/9, 1/2) - sage: Q3.potential_kernel(Q1, Q2) + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: Q1 = B(27, 1) # optional - sage.rings.padics + sage: Q2 = B(1/3, 2) # optional - sage.rings.padics + sage: Q3 = B(1/9, 1/2) # optional - sage.rings.padics + sage: Q3.potential_kernel(Q1, Q2) # optional - sage.rings.padics 0.369070246428543 :: - sage: B = Berkovich_Cp_Affine(3) - sage: Q1 = B(27, 1) - sage: Q2 = B(1/3, 2) - sage: Q3 = B(1/9, 1/2) - sage: Q3.potential_kernel(Q1, Q2) + sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: Q1 = B(27, 1) # optional - sage.rings.padics + sage: Q2 = B(1/3, 2) # optional - sage.rings.padics + sage: Q3 = B(1/9, 1/2) # optional - sage.rings.padics + sage: Q3.potential_kernel(Q1, Q2) # optional - sage.rings.padics 0.369070246428543 """ if not isinstance(other, type(self)): @@ -895,16 +895,16 @@ def spherical_kernel(self, other): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) - sage: Q1 = B(2, 2) - sage: Q2 = B(1/9, 1) - sage: Q1.spherical_kernel(Q2) + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: Q1 = B(2, 2) # optional - sage.rings.padics + sage: Q2 = B(1/9, 1) # optional - sage.rings.padics + sage: Q1.spherical_kernel(Q2) # optional - sage.rings.padics 0.500000000000000 :: - sage: Q3 = B(2) - sage: Q3.spherical_kernel(Q3) + sage: Q3 = B(2) # optional - sage.rings.padics + sage: Q3.spherical_kernel(Q3) # optional - sage.rings.padics 0 """ if not isinstance(other, type(self)): @@ -933,21 +933,21 @@ def Hsia_kernel_infinity(self, other): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(Qp(3)) - sage: Q1 = B(1/4, 4) - sage: Q2 = B(1/4, 6) - sage: Q1.Hsia_kernel_infinity(Q2) + sage: B = Berkovich_Cp_Affine(Qp(3)) # optional - sage.rings.padics + sage: Q1 = B(1/4, 4) # optional - sage.rings.padics + sage: Q2 = B(1/4, 6) # optional - sage.rings.padics + sage: Q1.Hsia_kernel_infinity(Q2) # optional - sage.rings.padics 6.00000000000000 :: sage: R. = QQ[] - sage: A. = NumberField(x^3 + 20) - sage: ideal = A.ideal(-1/2*a^2 + a - 3) - sage: B = Berkovich_Cp_Projective(A, ideal) - sage: Q1 = B(4) - sage: Q2 = B(0, 1.5) - sage: Q1.Hsia_kernel_infinity(Q2) + sage: A. = NumberField(x^3 + 20) # optional - sage.rings.number_field + sage: ideal = A.ideal(-1/2*a^2 + a - 3) # optional - sage.rings.number_field + sage: B = Berkovich_Cp_Projective(A, ideal) # optional - sage.rings.number_field + sage: Q1 = B(4) # optional - sage.rings.number_field + sage: Q2 = B(0, 1.5) # optional - sage.rings.number_field + sage: Q1.Hsia_kernel_infinity(Q2) # optional - sage.rings.number_field 1.50000000000000 """ return self.join(other).diameter() @@ -961,23 +961,23 @@ def center(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) - sage: B(3, 1).center() + sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: B(3, 1).center() # optional - sage.rings.padics 3 + O(3^21) :: - sage: C = Berkovich_Cp_Projective(3) - sage: C(3, 1).center() + sage: C = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: C(3, 1).center() # optional - sage.rings.padics (3 + O(3^21) : 1 + O(3^20)) :: sage: R. = QQ[] - sage: A. = NumberField(x^3 + 20) - sage: ideal = A.ideal(-1/2*a^2 + a - 3) - sage: B = Berkovich_Cp_Projective(A, ideal) - sage: B(a^2 + 4).center() + sage: A. = NumberField(x^3 + 20) # optional - sage.rings.number_field + sage: ideal = A.ideal(-1/2*a^2 + a - 3) # optional - sage.rings.number_field + sage: B = Berkovich_Cp_Projective(A, ideal) # optional - sage.rings.number_field + sage: B(a^2 + 4).center() # optional - sage.rings.number_field (a^2 + 4 : 1) """ if self._type == 4: @@ -992,13 +992,13 @@ def type_of_point(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) - sage: B(1).type_of_point() + sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: B(1).type_of_point() # optional - sage.rings.padics 1 :: - sage: B(0, 1).type_of_point() + sage: B(0, 1).type_of_point() # optional - sage.rings.padics 2 """ return ZZ(self._type) @@ -1011,8 +1011,8 @@ def prime(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) - sage: B(1).prime() + sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: B(1).prime() # optional - sage.rings.padics 3 """ return ZZ(self._p) @@ -1023,10 +1023,10 @@ def __ne__(self, other): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) - sage: Q1 = B(3, 3**(1/2)) - sage: Q2 = B(3, RR(3**(1/2))) - sage: Q1 != Q2 + sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: Q1 = B(3, 3**(1/2)) # optional - sage.rings.padics sage.symbolic + sage: Q2 = B(3, RR(3**(1/2))) # optional - sage.rings.padics sage.symbolic + sage: Q1 != Q2 # optional - sage.rings.padics sage.symbolic False """ return not (self == other) @@ -1037,8 +1037,8 @@ def _repr_(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) - sage: B(2, 1) + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: B(2, 1) # optional - sage.rings.padics Type II point centered at (2 + O(3^20) : 1 + O(3^20)) of radius 3^0 """ if self._type == 1: @@ -1067,8 +1067,8 @@ def _latex_(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) - sage: latex(B(2, 1)) + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: latex(B(2, 1)) # optional - sage.rings.padics \text{type 2 Point of } \text{Projective Berkovich line over } \Bold{C}_{3} \text{equivalent to the disk centered at (2 + O(3^20) : 1 + O(3^20)) of radius 1.00000000000000 in } \Bold{C}_3 @@ -1132,122 +1132,122 @@ class Berkovich_Element_Cp_Affine(Berkovich_Element_Cp): Type I points can be created by specifying the corresponding point of ``Cp``:: - sage: B = Berkovich_Cp_Affine(Qp(3)) - sage: B(4) + sage: B = Berkovich_Cp_Affine(Qp(3)) # optional - sage.rings.padics + sage: B(4) # optional - sage.rings.padics Type I point centered at 1 + 3 + O(3^20) The center of a point can be an element of a finite extension of ``Qp``:: - sage: A. = Qq(27) - sage: B(1 + t) + sage: A. = Qq(27) # optional - sage.rings.padics + sage: B(1 + t) # optional - sage.rings.padics Type I point centered at (t + 1) + O(3^20) Type II and III points can be created by specifying a center and a radius:: - sage: B(2, 3**(1/2)) + sage: B(2, 3**(1/2)) # optional - sage.rings.padics sage.symbolic Type II point centered at 2 + O(3^20) of radius 3^1/2 :: - sage: B(2, 1.6) + sage: B(2, 1.6) # optional - sage.rings.padics Type III point centered at 2 + O(3^20) of radius 1.60000000000000 Some type II points may be mistaken for type III points:: - sage: B(3, 3**0.5) #not tested + sage: B(3, 3**0.5) #not tested # optional - sage.rings.padics Type III point centered at 3 + O(3^21) of radius 1.73205080756888 To avoid these errors, specify the power instead of the radius:: - sage: B(3, power=RR(1/100000)) + sage: B(3, power=RR(1/100000)) # optional - sage.rings.padics Type II point centered at 3 + O(3^21) of radius 3^1/100000 Type IV points can be constructed in a number of ways, the first being from a list of centers and radii used to approximate the point:: - sage: B([Qp(3)(2), Qp(3)(2), Qp(3)(2)], [1.761, 1.123, 1.112]) + sage: B([Qp(3)(2), Qp(3)(2), Qp(3)(2)], [1.761, 1.123, 1.112]) # optional - sage.rings.padics Type IV point of precision 3, approximated by disks centered at [2 + O(3^20), 2 + O(3^20)] ... with radii [1.76100000000000, 1.12300000000000] ... Type IV points can be constructed from univariate functions, with arbitrary precision:: - sage: A. = Qq(27) - sage: R. = PolynomialRing(A) - sage: f = (1 + t)^2*x - sage: S. = PolynomialRing(RR) - sage: S = FractionField(S) - sage: g = (y + 1)/y - sage: d = B(f, g, prec=100); d + sage: A. = Qq(27) # optional - sage.rings.padics + sage: R. = PolynomialRing(A) # optional - sage.rings.padics + sage: f = (1 + t)^2*x # optional - sage.rings.padics + sage: S. = PolynomialRing(RR) # optional - sage.rings.padics + sage: S = FractionField(S) # optional - sage.rings.padics + sage: g = (y + 1)/y # optional - sage.rings.padics + sage: d = B(f, g, prec=100); d # optional - sage.rings.padics Type IV point of precision 100 with centers given by ((t^2 + 2*t + 1) + O(3^20))*x and radii given by (y + 1.00000000000000)/y For increased performance, error_check can be set to ``False``. WARNING: with error check set to ``False``, any error in the input will lead to incorrect results:: - sage: B(f, g, prec=100, error_check=False) + sage: B(f, g, prec=100, error_check=False) # optional - sage.rings.padics Type IV point of precision 100 with centers given by ((t^2 + 2*t + 1) + O(3^20))*x and radii given by (y + 1.00000000000000)/y When creating a Berkovich space backed by a number field, points can be created similarly:: sage: R. = QQ[] - sage: A. = NumberField(x^3 + 20) - sage: ideal = A.prime_above(3) - sage: B = Berkovich_Cp_Projective(A, ideal) - sage: Q1 = B(a); Q1 + sage: A. = NumberField(x^3 + 20) # optional - sage.rings.number_field + sage: ideal = A.prime_above(3) # optional - sage.rings.number_field + sage: B = Berkovich_Cp_Projective(A, ideal) # optional - sage.rings.number_field + sage: Q1 = B(a); Q1 # optional - sage.rings.number_field Type I point centered at (a : 1) :: - sage: B(a + 1, 3) + sage: B(a + 1, 3) # optional - sage.rings.number_field Type II point centered at (a + 1 : 1) of radius 3^1 TESTS:: - sage: A = Berkovich_Cp_Affine(3) - sage: Q1 = A(3, 1); Q1 + sage: A = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: Q1 = A(3, 1); Q1 # optional - sage.rings.padics Type II point centered at 3 + O(3^21) of radius 3^0 - sage: Q2 = A(2.5, 1); Q2 + sage: Q2 = A(2.5, 1); Q2 # optional - sage.rings.padics Type II point centered at 1 + 2*3 + 3^2 + 3^3 + 3^4 + 3^5 + 3^6 + 3^7 + 3^8 + 3^9 + 3^10 + 3^11 + 3^12 + 3^13 + 3^14 + 3^15 + 3^16 + 3^17 + 3^18 + 3^19 + O(3^20) of radius 3^0 - sage: Q5 = A(3, 0); Q5 + sage: Q5 = A(3, 0); Q5 # optional - sage.rings.padics Type I point centered at 3 + O(3^21) - sage: A(Zp(3)(2), 2).center().parent() == A(Qp(3)(2), 2).center().parent() + sage: A(Zp(3)(2), 2).center().parent() == A(Qp(3)(2), 2).center().parent() # optional - sage.rings.padics True - sage: Q1 == Q2 + sage: Q1 == Q2 # optional - sage.rings.padics True - sage: Q1 == Q5 + sage: Q1 == Q5 # optional - sage.rings.padics False - sage: Q3 = A(Qp(3)(3), power=0, error_check=False); Q3 + sage: Q3 = A(Qp(3)(3), power=0, error_check=False); Q3 # optional - sage.rings.padics Type II point centered at 3 + O(3^21) of radius 3^0 - sage: Q4 = A(3, 3**0); Q4 + sage: Q4 = A(3, 3**0); Q4 # optional - sage.rings.padics Type II point centered at 3 + O(3^21) of radius 3^0 - sage: Q5 = A(3, power=1/2); Q5 + sage: Q5 = A(3, power=1/2); Q5 # optional - sage.rings.padics Type II point centered at 3 + O(3^21) of radius 3^1/2 - sage: Q6 = A(3, RR(3**(1/2))); Q6 + sage: Q6 = A(3, RR(3**(1/2))); Q6 # optional - sage.rings.padics sage.symbolic Type III point centered at 3 + O(3^21) of radius 1.73205080756888 - sage: Q5 == Q6 + sage: Q5 == Q6 # optional - sage.rings.padics sage.symbolic True - sage: k = Qp(5) - sage: R. = k[] - sage: l. = k.extension(x^2 - 5) - sage: B = Berkovich_Cp_Affine(5) - sage: B(w, power=1) + sage: k = Qp(5) # optional - sage.rings.padics + sage: R. = k[] # optional - sage.rings.padics + sage: l. = k.extension(x^2 - 5) # optional - sage.rings.padics + sage: B = Berkovich_Cp_Affine(5) # optional - sage.rings.padics + sage: B(w, power=1) # optional - sage.rings.padics Type II point centered at w + O(w^41) of radius 5^1 - sage: TestSuite(Q5).run() + sage: TestSuite(Q5).run() # optional - sage.rings.padics """ def __init__(self, parent, center, radius=None, power=None, prec=20, error_check=True): @@ -1256,8 +1256,8 @@ def __init__(self, parent, center, radius=None, power=None, prec=20, error_check EXAMPLES:: - sage: A = Berkovich_Cp_Affine(17) - sage: A(5, 1) + sage: A = Berkovich_Cp_Affine(17) # optional - sage.rings.padics + sage: A(5, 1) # optional - sage.rings.padics Type II point centered at 5 + O(17^20) of radius 17^0 """ # we call Berkovich_Element_Cp constructor which is shared with projective Berkovich space @@ -1283,25 +1283,25 @@ def as_projective_point(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(5) - sage: B(5).as_projective_point() + sage: B = Berkovich_Cp_Affine(5) # optional - sage.rings.padics + sage: B(5).as_projective_point() # optional - sage.rings.padics Type I point centered at (5 + O(5^21) : 1 + O(5^20)) :: - sage: B(0, 1).as_projective_point() + sage: B(0, 1).as_projective_point() # optional - sage.rings.padics Type II point centered at (0 : 1 + O(5^20)) of radius 5^0 :: - sage: L. = PolynomialRing(Qp(5)) - sage: T = FractionField(L) - sage: f = T(1/t) - sage: R. = RR[] - sage: Y = FractionField(R) - sage: g = (40*pi)/x - sage: Q2 = B(f, g) - sage: Q2.as_projective_point() + sage: L. = PolynomialRing(Qp(5)) # optional - sage.rings.padics + sage: T = FractionField(L) # optional - sage.rings.padics + sage: f = T(1/t) # optional - sage.rings.padics + sage: R. = RR[] # optional - sage.rings.padics + sage: Y = FractionField(R) # optional - sage.rings.padics + sage: g = (40*pi)/x # optional - sage.rings.padics sage.symbolic + sage: Q2 = B(f, g) # optional - sage.rings.padics sage.symbolic + sage: Q2.as_projective_point() # optional - sage.rings.padics sage.symbolic Type IV point of precision 20 with centers given by (1 + O(5^20))/((1 + O(5^20))*t) and radii given by 40.0000000000000*pi/x """ @@ -1329,28 +1329,28 @@ def __eq__(self, other): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) - sage: Q1 = B(1, RR(3**(1/2))) - sage: Q2 = B(1, 3**(1/2)) - sage: Q1 == Q2 + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: Q1 = B(1, RR(3**(1/2))) # optional - sage.rings.padics sage.symbolic + sage: Q2 = B(1, 3**(1/2)) # optional - sage.rings.padics sage.symbolic + sage: Q1 == Q2 # optional - sage.rings.padics sage.symbolic True :: - sage: Q3 = B(1) - sage: Q4 = B(4) - sage: Q3 == Q4 + sage: Q3 = B(1) # optional - sage.rings.padics + sage: Q4 = B(4) # optional - sage.rings.padics + sage: Q3 == Q4 # optional - sage.rings.padics False :: - sage: Q5 = B(1, 4) - sage: Q1 == Q5 + sage: Q5 = B(1, 4) # optional - sage.rings.padics + sage: Q1 == Q5 # optional - sage.rings.padics sage.symbolic False :: - sage: Q1 == Q3 + sage: Q1 == Q3 # optional - sage.rings.padics sage.symbolic False """ if other is self: @@ -1379,21 +1379,21 @@ def __hash__(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) - sage: Q1 = B(1, RR(3**(1/2))) - sage: Q2 = B(1, 3**(1/2)) - sage: hash(Q1) == hash(Q2) + sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: Q1 = B(1, RR(3**(1/2))) # optional - sage.rings.padics sage.symbolic + sage: Q2 = B(1, 3**(1/2)) # optional - sage.rings.padics sage.symbolic + sage: hash(Q1) == hash(Q2) # optional - sage.rings.padics sage.symbolic True :: sage: R. = QQ[] - sage: A. = NumberField(x^3+20) - sage: ideal = A.ideal(-1/2*a^2 + a - 3) - sage: B = Berkovich_Cp_Projective(A, ideal) - sage: Q1 = B(a^2+1, 2) - sage: Q2 = B(0, 2) - sage: hash(Q1) == hash(Q2) + sage: A. = NumberField(x^3 + 20) # optional - sage.rings.number_field + sage: ideal = A.ideal(-1/2*a^2 + a - 3) # optional - sage.rings.number_field + sage: B = Berkovich_Cp_Projective(A, ideal) # optional - sage.rings.number_field + sage: Q1 = B(a^2 + 1, 2) # optional - sage.rings.number_field + sage: Q2 = B(0, 2) # optional - sage.rings.number_field + sage: hash(Q1) == hash(Q2) # optional - sage.rings.number_field True """ if self.type_of_point() == 1: @@ -1425,40 +1425,40 @@ def lt(self, other): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) - sage: Q1 = B(5, 0.5) - sage: Q2 = B(5, 1) - sage: Q1.lt(Q2) + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: Q1 = B(5, 0.5) # optional - sage.rings.padics + sage: Q2 = B(5, 1) # optional - sage.rings.padics + sage: Q1.lt(Q2) # optional - sage.rings.padics True :: - sage: Q3 = B(1) - sage: Q1.lt(Q3) + sage: Q3 = B(1) # optional - sage.rings.padics + sage: Q1.lt(Q3) # optional - sage.rings.padics False TESTS:: - sage: B = Berkovich_Cp_Projective(3) - sage: Q1 = B(5) - sage: Q1.lt(Q1) + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: Q1 = B(5) # optional - sage.rings.padics + sage: Q1.lt(Q1) # optional - sage.rings.padics False :: - sage: Q2 = B([4, 1/3], [5, 1]) - sage: Q1.lt(Q2) + sage: Q2 = B([4, 1/3], [5, 1]) # optional - sage.rings.padics + sage: Q1.lt(Q2) # optional - sage.rings.padics False :: - sage: Q4 = B(0, 1) - sage: Q1.lt(Q4) + sage: Q4 = B(0, 1) # optional - sage.rings.padics + sage: Q1.lt(Q4) # optional - sage.rings.padics True :: - sage: Q2.lt(Q4) + sage: Q2.lt(Q4) # optional - sage.rings.padics False """ if not isinstance(other, Berkovich_Element_Cp_Affine): @@ -1569,40 +1569,40 @@ def join(self, other, basepoint=Infinity): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) - sage: Q1 = B(2, 1) - sage: Q2 = B(2, 2) - sage: Q1.join(Q2) + sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: Q1 = B(2, 1) # optional - sage.rings.padics + sage: Q2 = B(2, 2) # optional - sage.rings.padics + sage: Q1.join(Q2) # optional - sage.rings.padics Type III point centered at 2 + O(3^20) of radius 2.00000000000000 :: - sage: Q3 = B(5) - sage: Q3.join(Q1) + sage: Q3 = B(5) # optional - sage.rings.padics + sage: Q3.join(Q1) # optional - sage.rings.padics Type II point centered at 2 + 3 + O(3^20) of radius 3^0 :: - sage: Q3.join(Q1, basepoint=Q2) + sage: Q3.join(Q1, basepoint=Q2) # optional - sage.rings.padics Type II point centered at 2 + O(3^20) of radius 3^0 TESTS:: - sage: Q4 = B(1/3**8 + 2, 1) - sage: Q2.join(Q4, basepoint = Q1) + sage: Q4 = B(1/3**8 + 2, 1) # optional - sage.rings.padics + sage: Q2.join(Q4, basepoint=Q1) # optional - sage.rings.padics Type III point centered at 2 + O(3^20) of radius 2.00000000000000 :: - sage: Q5 = B(2, 1/9) - sage: Q6 = B(1, 1/27) - sage: Q4.join(Q5, basepoint=Q6) + sage: Q5 = B(2, 1/9) # optional - sage.rings.padics + sage: Q6 = B(1, 1/27) # optional - sage.rings.padics + sage: Q4.join(Q5, basepoint=Q6) # optional - sage.rings.padics Type II point centered at 1 + O(3^20) of radius 3^0 :: - sage: Q7 = B(1/27, 1/27) - sage: Q1.join(Q7, Q2) + sage: Q7 = B(1/27, 1/27) # optional - sage.rings.padics + sage: Q1.join(Q7, Q2) # optional - sage.rings.padics Type III point centered at 2 + O(3^20) of radius 2.00000000000000 """ # we error check and then pass to projective space to do the join @@ -1648,46 +1648,46 @@ def involution_map(self): The involution map is 1/z on type I points:: - sage: B = Berkovich_Cp_Affine(3) - sage: Q1 = B(1/2) - sage: Q1.involution_map() + sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: Q1 = B(1/2) # optional - sage.rings.padics + sage: Q1.involution_map() # optional - sage.rings.padics Type I point centered at 2 + O(3^20) :: - sage: Q2 = B(0, 1/3) - sage: Q2.involution_map() + sage: Q2 = B(0, 1/3) # optional - sage.rings.padics + sage: Q2.involution_map() # optional - sage.rings.padics Type II point centered at 0 of radius 3^1 :: - sage: Q3 = B(1/3, 1/3) - sage: Q3.involution_map() + sage: Q3 = B(1/3, 1/3) # optional - sage.rings.padics + sage: Q3.involution_map() # optional - sage.rings.padics Type II point centered at 3 + O(3^21) of radius 3^-3 TESTS:: - sage: B = Berkovich_Cp_Affine(3) - sage: B(0).involution_map() + sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: B(0).involution_map() # optional - sage.rings.padics Traceback (most recent call last): ... ValueError: involution map not defined on affine type I point centered at 0 :: - sage: B(1/81, 1.5).involution_map() + sage: B(1/81, 1.5).involution_map() # optional - sage.rings.padics Type III point centered at 3^4 + O(3^24) of radius 0.000228623685413809 :: - sage: B([1, 2], [3, 1]).involution_map() + sage: B([1, 2], [3, 1]).involution_map() # optional - sage.rings.padics Traceback (most recent call last): ... ValueError: precision of type IV is not high enough to define image :: - sage: B([1/81, 10/81], [10, 9]).involution_map() + sage: B([1/81, 10/81], [10, 9]).involution_map() # optional - sage.rings.padics Type IV point of precision 2, approximated by disks centered at [3^4 + O(3^24), 3^4 + 2*3^6 + 2*3^7 + 2*3^10 + 2*3^11 + 2*3^14 + 2*3^15 + 2*3^18 + 2*3^19 + 2*3^22 + 2*3^23 + O(3^24)] ... with radii [0.00152415790275873, 0.00137174211248285] ... @@ -1741,17 +1741,17 @@ def contained_in_interval(self, start, end): EXAMPLES:: - sage: B = Berkovich_Cp_Projective((3)) - sage: Q1 = B(2, 1) - sage: Q2 = B(2, 4) - sage: Q3 = B(1/3) - sage: Q2.contained_in_interval(Q1, Q3.join(Q1)) + sage: B = Berkovich_Cp_Projective((3)) # optional - sage.rings.padics + sage: Q1 = B(2, 1) # optional - sage.rings.padics + sage: Q2 = B(2, 4) # optional - sage.rings.padics + sage: Q3 = B(1/3) # optional - sage.rings.padics + sage: Q2.contained_in_interval(Q1, Q3.join(Q1)) # optional - sage.rings.padics False :: - sage: Q4 = B(1/81, 1) - sage: Q2.contained_in_interval(Q1, Q4.join(Q1)) + sage: Q4 = B(1/81, 1) # optional - sage.rings.padics + sage: Q2.contained_in_interval(Q1, Q4.join(Q1)) # optional - sage.rings.padics True """ if not isinstance(start, Berkovich_Element_Cp_Affine): @@ -1821,39 +1821,39 @@ class Berkovich_Element_Cp_Projective(Berkovich_Element_Cp): Type I points can be created by specifying the corresponding point of `P^1(\CC_p)`:: - sage: S = ProjectiveSpace(Qp(5), 1) - sage: P = Berkovich_Cp_Projective(S); P + sage: S = ProjectiveSpace(Qp(5), 1) # optional - sage.rings.padics + sage: P = Berkovich_Cp_Projective(S); P # optional - sage.rings.padics Projective Berkovich line over Cp(5) of precision 20 :: - sage: a = S(0, 1) - sage: Q1 = P(a); Q1 + sage: a = S(0, 1) # optional - sage.rings.padics + sage: Q1 = P(a); Q1 # optional - sage.rings.padics Type I point centered at (0 : 1 + O(5^20)) :: - sage: Q2 = P((1,0)); Q2 + sage: Q2 = P((1,0)); Q2 # optional - sage.rings.padics Type I point centered at (1 + O(5^20) : 0) Type II and III points can be created by specifying a center and a radius:: - sage: Q3 = P((0,5), 5**(3/2)); Q3 + sage: Q3 = P((0,5), 5**(3/2)); Q3 # optional - sage.rings.padics sage.symbolic Type II point centered at (0 : 1 + O(5^20)) of radius 5^3/2 :: - sage: Q4 = P(0, 3**(3/2)); Q4 + sage: Q4 = P(0, 3**(3/2)); Q4 # optional - sage.rings.padics sage.symbolic Type III point centered at (0 : 1 + O(5^20)) of radius 5.19615242270663 Type IV points can be created from lists of centers and radii:: - sage: b = S((3,2)) #create centers - sage: c = S((4,3)) - sage: d = S((2,3)) - sage: L = [b, c, d] - sage: R = [1.761, 1.123, 1.112] - sage: Q5 = P(L, R); Q5 + sage: b = S((3,2)) # create centers # optional - sage.rings.padics + sage: c = S((4,3)) # optional - sage.rings.padics + sage: d = S((2,3)) # optional - sage.rings.padics + sage: L = [b, c, d] # optional - sage.rings.padics + sage: R = [1.761, 1.123, 1.112] # optional - sage.rings.padics + sage: Q5 = P(L, R); Q5 # optional - sage.rings.padics Type IV point of precision 3, approximated by disks centered at [(4 + 2*5 + 2*5^2 + 2*5^3 + 2*5^4 + 2*5^5 + 2*5^6 + 2*5^7 + 2*5^8 + 2*5^9 + 2*5^10 + 2*5^11 + 2*5^12 + 2*5^13 + 2*5^14 + 2*5^15 + 2*5^16 + 2*5^17 + 2*5^18 + 2*5^19 + O(5^20) : @@ -1865,26 +1865,26 @@ class Berkovich_Element_Cp_Projective(Berkovich_Element_Cp): the sequence of disks can not be the point at infinity in `P^1(\CC_p)`, only functions into `\CC_p` are supported:: - sage: L. = PolynomialRing(Qp(5)) - sage: T = FractionField(L) - sage: f = T(1/t) + sage: L. = PolynomialRing(Qp(5)) # optional - sage.rings.padics + sage: T = FractionField(L) # optional - sage.rings.padics + sage: f = T(1/t) # optional - sage.rings.padics sage: R. = RR[] sage: Y = FractionField(R) - sage: g = (40*pi)/x - sage: Q6 = P(f, g); Q6 + sage: g = (40*pi)/x # optional - sage.rings.padics sage.symbolic + sage: Q6 = P(f, g); Q6 # optional - sage.rings.padics sage.symbolic Type IV point of precision 20 with centers given by (1 + O(5^20))/((1 + O(5^20))*t) and radii given by 40.0000000000000*pi/x TESTS:: - sage: P((1,0), 3) + sage: P((1,0), 3) # optional - sage.rings.padics Traceback (most recent call last): ... ValueError: type II and III points can not be centered at infinity - sage: B = Berkovich_Cp_Projective(3) - sage: Q1 = B(3) - sage: TestSuite(Q1).run() + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: Q1 = B(3) # optional - sage.rings.padics + sage: TestSuite(Q1).run() # optional - sage.rings.padics """ def __init__(self, parent, center, radius=None, power=None, prec=20, error_check=True): @@ -1893,9 +1893,9 @@ def __init__(self, parent, center, radius=None, power=None, prec=20, error_check EXAMPLES:: - sage: S = ProjectiveSpace(Qp(7), 1) - sage: P = Berkovich_Cp_Projective(S) - sage: P(0,1) + sage: S = ProjectiveSpace(Qp(7), 1) # optional - sage.rings.padics + sage: P = Berkovich_Cp_Projective(S) # optional - sage.rings.padics + sage: P(0,1) # optional - sage.rings.padics Type II point centered at (0 : 1 + O(7^20)) of radius 7^0 """ # if we are given a point of Affine Berkovich Space, we do the conversion @@ -1921,27 +1921,27 @@ def as_affine_point(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(5) - sage: B(5).as_affine_point() + sage: B = Berkovich_Cp_Projective(5) # optional - sage.rings.padics + sage: B(5).as_affine_point() # optional - sage.rings.padics Type I point centered at 5 + O(5^21) :: - sage: Q = B(0, 1).as_affine_point(); Q + sage: Q = B(0, 1).as_affine_point(); Q # optional - sage.rings.padics Type II point centered at 0 of radius 5^0 - sage: Q.parent() + sage: Q.parent() # optional - sage.rings.padics Affine Berkovich line over Cp(5) of precision 20 :: - sage: L. = PolynomialRing(Qp(5)) - sage: T = FractionField(L) - sage: f = T(1/t) + sage: L. = PolynomialRing(Qp(5)) # optional - sage.rings.padics + sage: T = FractionField(L) # optional - sage.rings.padics + sage: f = T(1/t) # optional - sage.rings.padics sage: R. = RR[] sage: Y = FractionField(R) - sage: g = (40*pi)/x - sage: Q2 = B(f, g) - sage: Q2.as_affine_point() + sage: g = (40*pi)/x # optional - sage.rings.padics sage.symbolic + sage: Q2 = B(f, g) # optional - sage.rings.padics sage.symbolic + sage: Q2.as_affine_point() # optional - sage.rings.padics sage.symbolic Type IV point of precision 20 with centers given by (1 + O(5^20))/((1 + O(5^20))*t) and radii given by 40.0000000000000*pi/x """ @@ -1973,28 +1973,28 @@ def __eq__(self, other): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) - sage: Q1 = B([2, 2], RR(3**(1/2))) - sage: Q2 = B([1, 1], 3**(1/2)) - sage: Q1 == Q2 + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: Q1 = B([2, 2], RR(3**(1/2))) # optional - sage.rings.padics sage.symbolic + sage: Q2 = B([1, 1], 3**(1/2)) # optional - sage.rings.padics sage.symbolic + sage: Q1 == Q2 # optional - sage.rings.padics sage.symbolic True :: - sage: Q3 = B(1) - sage: Q4 = B(4) - sage: Q3 == Q4 + sage: Q3 = B(1) # optional - sage.rings.padics + sage: Q4 = B(4) # optional - sage.rings.padics + sage: Q3 == Q4 # optional - sage.rings.padics False :: - sage: Q5 = B(1, 4) - sage: Q1 == Q5 + sage: Q5 = B(1, 4) # optional - sage.rings.padics + sage: Q1 == Q5 # optional - sage.rings.padics sage.symbolic False :: - sage: Q1 == Q3 + sage: Q1 == Q3 # optional - sage.rings.padics sage.symbolic False """ if other is self: @@ -2025,22 +2025,22 @@ def __hash__(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) - sage: P = ProjectiveSpace(B.base_ring(), 1) - sage: Q1 = B(P.point([2, 2], False), RR(3**(1/2))) - sage: Q2 = B([1, 1], 3**(1/2)) - sage: hash(Q1) == hash(Q2) + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: P = ProjectiveSpace(B.base_ring(), 1) # optional - sage.rings.padics + sage: Q1 = B(P.point([2, 2], False), RR(3**(1/2))) # optional - sage.rings.padics sage.symbolic + sage: Q2 = B([1, 1], 3**(1/2)) # optional - sage.rings.padics sage.symbolic + sage: hash(Q1) == hash(Q2) # optional - sage.rings.padics sage.symbolic True :: sage: R. = QQ[] - sage: A. = NumberField(x^3 + 20) - sage: ideal = A.ideal(-1/2*a^2 + a - 3) - sage: B = Berkovich_Cp_Projective(A, ideal) - sage: Q1 = B(a^2 + 1, 2) - sage: Q2 = B(0, 2) - sage: hash(Q1) == hash(Q2) + sage: A. = NumberField(x^3 + 20) # optional - sage.rings.number_field + sage: ideal = A.ideal(-1/2*a^2 + a - 3) # optional - sage.rings.number_field + sage: B = Berkovich_Cp_Projective(A, ideal) # optional - sage.rings.number_field + sage: Q1 = B(a^2 + 1, 2) # optional - sage.rings.number_field + sage: Q2 = B(0, 2) # optional - sage.rings.number_field + sage: hash(Q1) == hash(Q2) # optional - sage.rings.number_field True """ if self.type_of_point() == 1: @@ -2072,51 +2072,51 @@ def lt(self, other): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) - sage: Q1 = B(5, 0.5) - sage: Q2 = B(5, 1) - sage: Q1.lt(Q2) + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: Q1 = B(5, 0.5) # optional - sage.rings.padics + sage: Q2 = B(5, 1) # optional - sage.rings.padics + sage: Q1.lt(Q2) # optional - sage.rings.padics True :: - sage: Q3 = B(1) - sage: Q1.lt(Q3) + sage: Q3 = B(1) # optional - sage.rings.padics + sage: Q1.lt(Q3) # optional - sage.rings.padics False TESTS:: - sage: B = Berkovich_Cp_Projective(3) - sage: Q1 = B(5) - sage: Q1.lt(Q1) + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: Q1 = B(5) # optional - sage.rings.padics + sage: Q1.lt(Q1) # optional - sage.rings.padics False :: - sage: Q2 = B([4, 1/3], [5, 1]) - sage: Q1.lt(Q2) + sage: Q2 = B([4, 1/3], [5, 1]) # optional - sage.rings.padics + sage: Q1.lt(Q2) # optional - sage.rings.padics False :: - sage: Q3 = B((1,0)) - sage: Q4 = B(0, 1) - sage: Q3.lt(Q4) + sage: Q3 = B((1,0)) # optional - sage.rings.padics + sage: Q4 = B(0, 1) # optional - sage.rings.padics + sage: Q3.lt(Q4) # optional - sage.rings.padics False :: - sage: Q4.lt(Q3) + sage: Q4.lt(Q3) # optional - sage.rings.padics True :: - sage: Q1.lt(Q4) + sage: Q1.lt(Q4) # optional - sage.rings.padics True :: - sage: Q2.lt(Q4) + sage: Q2.lt(Q4) # optional - sage.rings.padics False """ if not isinstance(other, Berkovich_Element_Cp_Projective): @@ -2251,58 +2251,58 @@ def join(self, other, basepoint=Infinity): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) - sage: Q1 = B(2, 1) - sage: Q2 = B(2, 2) - sage: Q1.join(Q2) + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: Q1 = B(2, 1) # optional - sage.rings.padics + sage: Q2 = B(2, 2) # optional - sage.rings.padics + sage: Q1.join(Q2) # optional - sage.rings.padics Type III point centered at (2 + O(3^20) : 1 + O(3^20)) of radius 2.00000000000000 :: - sage: Q3 = B(5) - sage: Q3.join(Q1) + sage: Q3 = B(5) # optional - sage.rings.padics + sage: Q3.join(Q1) # optional - sage.rings.padics Type II point centered at (2 + 3 + O(3^20) : 1 + O(3^20)) of radius 3^0 :: - sage: Q3.join(Q1, basepoint=Q2) + sage: Q3.join(Q1, basepoint=Q2) # optional - sage.rings.padics Type II point centered at (2 + O(3^20) : 1 + O(3^20)) of radius 3^0 TESTS:: - sage: Q4 = B(1/3**8 + 2, 1) - sage: Q2.join(Q4, basepoint=Q1) + sage: Q4 = B(1/3**8 + 2, 1) # optional - sage.rings.padics + sage: Q2.join(Q4, basepoint=Q1) # optional - sage.rings.padics Type III point centered at (2 + O(3^20) : 1 + O(3^20)) of radius 2.00000000000000 - sage: Q5 = B(2, 1/9) - sage: Q6 = B(1, 1/27) - sage: Q4.join(Q5, basepoint=Q6) + sage: Q5 = B(2, 1/9) # optional - sage.rings.padics + sage: Q6 = B(1, 1/27) # optional - sage.rings.padics + sage: Q4.join(Q5, basepoint=Q6) # optional - sage.rings.padics Type II point centered at (1 + O(3^20) : 1 + O(3^20)) of radius 3^0 - sage: Q7 = B(1/27, 1/27) - sage: Q1.join(Q7, Q2) + sage: Q7 = B(1/27, 1/27) # optional - sage.rings.padics + sage: Q1.join(Q7, Q2) # optional - sage.rings.padics Type III point centered at (2 + O(3^20) : 1 + O(3^20)) of radius 2.00000000000000 - sage: Q1.join(Q2, Q7) + sage: Q1.join(Q2, Q7) # optional - sage.rings.padics Type III point centered at (2 + O(3^20) : 1 + O(3^20)) of radius 2.00000000000000 - sage: Q8 = B(0, power=1/3) - sage: Q9 = B(0, power=1/2) - sage: Q8.join(Q9) + sage: Q8 = B(0, power=1/3) # optional - sage.rings.padics + sage: Q9 = B(0, power=1/2) # optional - sage.rings.padics + sage: Q8.join(Q9) # optional - sage.rings.padics Type II point centered at (0 : 1 + O(3^20)) of radius 3^1/2 sage: R. = QQ[] - sage: A. = NumberField(x^3 + 20) - sage: ideal = A.prime_above(3) - sage: C = Berkovich_Cp_Projective(A, ideal) - sage: Q10 = C(a, 1/9) - sage: Q10.join(Q9) + sage: A. = NumberField(x^3 + 20) # optional - sage.rings.number_field + sage: ideal = A.prime_above(3) # optional - sage.rings.number_field + sage: C = Berkovich_Cp_Projective(A, ideal) # optional - sage.rings.number_field + sage: Q10 = C(a, 1/9) # optional - sage.rings.number_field + sage: Q10.join(Q9) # optional - sage.rings.number_field Traceback (most recent call last): ... ValueError: other must be a point of the same projective Berkovich line - sage: Q11 = C(0, 1/3) - sage: Q11.join(Q10) + sage: Q11 = C(0, 1/3) # optional - sage.rings.number_field + sage: Q11.join(Q10) # optional - sage.rings.number_field Type II point centered at (0 : 1) of radius 3^0 """ if not isinstance(other, Berkovich_Element_Cp_Projective): @@ -2415,49 +2415,49 @@ def involution_map(self): The involution map is 1/z on type I points:: - sage: B = Berkovich_Cp_Projective(3) - sage: Q1 = B(1/2) - sage: Q1.involution_map() + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: Q1 = B(1/2) # optional - sage.rings.padics + sage: Q1.involution_map() # optional - sage.rings.padics Type I point centered at (2 + O(3^20) : 1 + O(3^20)) :: - sage: Q2 = B(0, 1/3) - sage: Q2.involution_map() + sage: Q2 = B(0, 1/3) # optional - sage.rings.padics + sage: Q2.involution_map() # optional - sage.rings.padics Type II point centered at (0 : 1 + O(3^20)) of radius 3^1 :: - sage: Q3 = B(1/3, 1/3) - sage: Q3.involution_map() + sage: Q3 = B(1/3, 1/3) # optional - sage.rings.padics + sage: Q3.involution_map() # optional - sage.rings.padics Type II point centered at (3 + O(3^21) : 1 + O(3^20)) of radius 3^-3 TESTS:: - sage: B = Berkovich_Cp_Projective(3) - sage: B((1,0)).involution_map() + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: B((1,0)).involution_map() # optional - sage.rings.padics Type I point centered at (0 : 1 + O(3^20)) :: - sage: B(0).involution_map() + sage: B(0).involution_map() # optional - sage.rings.padics Type I point centered at (1 + O(3^20) : 0) :: - sage: B(1/81, 1.5).involution_map() + sage: B(1/81, 1.5).involution_map() # optional - sage.rings.padics Type III point centered at (3^4 + O(3^24) : 1 + O(3^20)) of radius 0.000228623685413809 :: - sage: B([1, 2], [3, 1]).involution_map() + sage: B([1, 2], [3, 1]).involution_map() # optional - sage.rings.padics Traceback (most recent call last): ... ValueError: precision of type IV is not high enough to define image :: - sage: B([1/81, 10/81], [10, 9]).involution_map() + sage: B([1/81, 10/81], [10, 9]).involution_map() # optional - sage.rings.padics Type IV point of precision 2, approximated by disks centered at [(3^4 + O(3^24) : 1 + O(3^20)), (3^4 + 2*3^6 + 2*3^7 + 2*3^10 + 2*3^11 + 2*3^14 + 2*3^15 + 2*3^18 + 2*3^19 + 2*3^22 + 2*3^23 + O(3^24) : 1 + O(3^20))] @@ -2514,48 +2514,48 @@ def contained_in_interval(self, start, end): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) - sage: Q1 = B(2, 1) - sage: Q2 = B(2, 4) - sage: Q3 = B(1/3) - sage: Q2.contained_in_interval(Q1, Q3.join(Q1)) + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: Q1 = B(2, 1) # optional - sage.rings.padics + sage: Q2 = B(2, 4) # optional - sage.rings.padics + sage: Q3 = B(1/3) # optional - sage.rings.padics + sage: Q2.contained_in_interval(Q1, Q3.join(Q1)) # optional - sage.rings.padics False :: - sage: Q4 = B(1/81, 1) - sage: Q2.contained_in_interval(Q1, Q4.join(Q1)) + sage: Q4 = B(1/81, 1) # optional - sage.rings.padics + sage: Q2.contained_in_interval(Q1, Q4.join(Q1)) # optional - sage.rings.padics True TESTS:: - sage: B = Berkovich_Cp_Projective(3) - sage: infty = B((1, 0)) - sage: zero = B(0) - sage: gauss = B(0, 1) - sage: infty.contained_in_interval(zero, gauss) + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: infty = B((1, 0)) # optional - sage.rings.padics + sage: zero = B(0) # optional - sage.rings.padics + sage: gauss = B(0, 1) # optional - sage.rings.padics + sage: infty.contained_in_interval(zero, gauss) # optional - sage.rings.padics False :: - sage: Q1 = B(1,3) - sage: infty.contained_in_interval(gauss, Q1) + sage: Q1 = B(1, 3) # optional - sage.rings.padics + sage: infty.contained_in_interval(gauss, Q1) # optional - sage.rings.padics False :: - sage: zero.contained_in_interval(infty, gauss) + sage: zero.contained_in_interval(infty, gauss) # optional - sage.rings.padics False :: - sage: gauss.contained_in_interval(zero, infty) + sage: gauss.contained_in_interval(zero, infty) # optional - sage.rings.padics True :: - sage: Q2 = B(81, 1/3) - sage: gauss.contained_in_interval(infty, Q2) + sage: Q2 = B(81, 1/3) # optional - sage.rings.padics + sage: gauss.contained_in_interval(infty, Q2) # optional - sage.rings.padics True """ if not isinstance(start, Berkovich_Element_Cp_Projective): diff --git a/src/sage/schemes/berkovich/berkovich_space.py b/src/sage/schemes/berkovich/berkovich_space.py index 17eee57dd0a..002cb5c6589 100644 --- a/src/sage/schemes/berkovich/berkovich_space.py +++ b/src/sage/schemes/berkovich/berkovich_space.py @@ -40,7 +40,6 @@ from sage.categories.number_fields import NumberFields import sage.rings.abc from sage.rings.integer_ring import ZZ -from sage.rings.padics.factory import Qp from sage.rings.rational_field import QQ from sage.rings.number_field.number_field_ideal import NumberFieldFractionalIdeal from sage.categories.topological_spaces import TopologicalSpaces @@ -56,9 +55,9 @@ def is_Berkovich(space): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics sage: from sage.schemes.berkovich.berkovich_space import is_Berkovich - sage: is_Berkovich(B) + sage: is_Berkovich(B) # optional - sage.rings.padics True """ return isinstance(space, Berkovich) @@ -74,9 +73,9 @@ def is_Berkovich_Cp(space): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics sage: from sage.schemes.berkovich.berkovich_space import is_Berkovich - sage: is_Berkovich(B) + sage: is_Berkovich(B) # optional - sage.rings.padics True """ return isinstance(space, Berkovich_Cp) @@ -98,17 +97,17 @@ def residue_characteristic(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) - sage: B.prime() + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: B.prime() # optional - sage.rings.padics 3 :: sage: R. = QQ[] - sage: A. = NumberField(x^3 + 20) - sage: ideal = A.ideal(-1/2*a^2 + a - 3) - sage: B = Berkovich_Cp_Affine(A, ideal) - sage: B.residue_characteristic() + sage: A. = NumberField(x^3 + 20) # optional - sage.rings.number_field + sage: ideal = A.ideal(-1/2*a^2 + a - 3) # optional - sage.rings.number_field + sage: B = Berkovich_Cp_Affine(A, ideal) # optional - sage.rings.number_field + sage: B.residue_characteristic() # optional - sage.rings.number_field 7 """ return self._p @@ -126,8 +125,8 @@ def is_padic_base(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(Qp(3)) - sage: B.is_padic_base() + sage: B = Berkovich_Cp_Affine(Qp(3)) # optional - sage.rings.padics + sage: B.is_padic_base() # optional - sage.rings.padics True :: @@ -140,7 +139,7 @@ def is_padic_base(self): def is_number_field_base(self): """ - Return ``True`` if this Berkovich space is backed by a p-adic field. + Return ``True`` if this Berkovich space is backed by a number field. OUTPUT: @@ -149,8 +148,8 @@ def is_number_field_base(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(Qp(3)) - sage: B.is_number_field_base() + sage: B = Berkovich_Cp_Affine(Qp(3)) # optional - sage.rings.padics + sage: B.is_number_field_base() # optional - sage.rings.padics False :: @@ -179,10 +178,10 @@ def ideal(self): EXAMPLES:: sage: R. = QQ[] - sage: A. = NumberField(z^2 + 1) - sage: ideal = A.prime_above(5) - sage: B = Berkovich_Cp_Projective(A, ideal) - sage: B.ideal() + sage: A. = NumberField(z^2 + 1) # optional - sage.rings.number_field + sage: ideal = A.prime_above(5) # optional - sage.rings.number_field + sage: B = Berkovich_Cp_Projective(A, ideal) # optional - sage.rings.number_field + sage: B.ideal() # optional - sage.rings.number_field Fractional ideal (-a - 2) :: @@ -193,8 +192,8 @@ def ideal(self): :: - sage: B = Berkovich_Cp_Projective(Qp(3)) - sage: B.ideal() is None + sage: B = Berkovich_Cp_Projective(Qp(3)) # optional - sage.rings.padics + sage: B.ideal() is None # optional - sage.rings.padics True """ return self._ideal @@ -205,35 +204,35 @@ def __eq__(self,right): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) - sage: A. = Qq(27) - sage: C = Berkovich_Cp_Affine(A) - sage: B == C + sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: A. = Qq(27) # optional - sage.rings.padics + sage: C = Berkovich_Cp_Affine(A) # optional - sage.rings.padics + sage: B == C # optional - sage.rings.padics True :: sage: R. = QQ[] - sage: A. = NumberField(x^2 + 1) - sage: A_ideal = A.prime_above(2) - sage: B. = NumberField(x^4 + 1) - sage: B_ideal = B.prime_above(2) - sage: C = Berkovich_Cp_Projective(A, A_ideal) - sage: D = Berkovich_Cp_Projective(B, B_ideal) - sage: C == D + sage: A. = NumberField(x^2 + 1) # optional - sage.rings.number_field + sage: A_ideal = A.prime_above(2) # optional - sage.rings.number_field + sage: B. = NumberField(x^4 + 1) # optional - sage.rings.number_field + sage: B_ideal = B.prime_above(2) # optional - sage.rings.number_field + sage: C = Berkovich_Cp_Projective(A, A_ideal) # optional - sage.rings.number_field + sage: D = Berkovich_Cp_Projective(B, B_ideal) # optional - sage.rings.number_field + sage: C == D # optional - sage.rings.number_field False :: - sage: C = Berkovich_Cp_Affine(A, A_ideal) - sage: D = Berkovich_Cp_Affine(B, B_ideal) - sage: C == D + sage: C = Berkovich_Cp_Affine(A, A_ideal) # optional - sage.rings.number_field + sage: D = Berkovich_Cp_Affine(B, B_ideal) # optional - sage.rings.number_field + sage: C == D # optional - sage.rings.number_field False :: - sage: A_ideal_2 = A.prime_above(5) - sage: E = Berkovich_Cp_Affine(A, A_ideal_2) + sage: A_ideal_2 = A.prime_above(5) # optional - sage.rings.number_field + sage: E = Berkovich_Cp_Affine(A, A_ideal_2) # optional - sage.rings.number_field sage: C == E False """ @@ -252,10 +251,10 @@ def __ne__(self,right): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(5) - sage: A. = Qq(25) - sage: C = Berkovich_Cp_Affine(A) - sage: B != C + sage: B = Berkovich_Cp_Affine(5) # optional - sage.rings.padics + sage: A. = Qq(25) # optional - sage.rings.padics + sage: C = Berkovich_Cp_Affine(A) # optional - sage.rings.padics + sage: B != C # optional - sage.rings.padics False """ return not (self == right) @@ -266,16 +265,16 @@ def __hash__(self): EXAMPLES:: - sage: hash(Berkovich_Cp_Projective(3)) + sage: hash(Berkovich_Cp_Projective(3)) # optional - sage.rings.padics 3 :: sage: R. = QQ[] - sage: A. = NumberField(z^2 + 1) - sage: B = Berkovich_Cp_Projective(A, A.primes_above(5)[0]) - sage: C = Berkovich_Cp_Projective(A, A.primes_above(5)[1]) - sage: hash(B) != hash(C) + sage: A. = NumberField(z^2 + 1) # optional - sage.rings.number_field + sage: B = Berkovich_Cp_Projective(A, A.primes_above(5)[0]) # optional - sage.rings.number_field + sage: C = Berkovich_Cp_Projective(A, A.primes_above(5)[1]) # optional - sage.rings.number_field + sage: hash(B) != hash(C) # optional - sage.rings.number_field True """ if self._base_type == 'padic field': @@ -315,57 +314,57 @@ class Berkovich_Cp_Affine(Berkovich_Cp): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3); B + sage: B = Berkovich_Cp_Affine(3); B # optional - sage.rings.padics Affine Berkovich line over Cp(3) of precision 20 We can create elements:: - sage: B(-2) + sage: B(-2) # optional - sage.rings.padics Type I point centered at 1 + 2*3 + 2*3^2 + 2*3^3 + 2*3^4 + 2*3^5 + 2*3^6 + 2*3^7 + 2*3^8 + 2*3^9 + 2*3^10 + 2*3^11 + 2*3^12 + 2*3^13 + 2*3^14 + 2*3^15 + 2*3^16 + 2*3^17 + 2*3^18 + 2*3^19 + O(3^20) :: - sage: B(1, 2) + sage: B(1, 2) # optional - sage.rings.padics Type III point centered at 1 + O(3^20) of radius 2.00000000000000 For details on element creation, see the documentation of :class:`Berkovich_Element_Cp_Affine`. Initializing by passing in `\QQ_p` looks the same:: - sage: B = Berkovich_Cp_Affine(Qp(3)); B + sage: B = Berkovich_Cp_Affine(Qp(3)); B # optional - sage.rings.padics Affine Berkovich line over Cp(3) of precision 20 However, this method allows for more control over behind-the-scenes conversion:: - sage: B = Berkovich_Cp_Affine(Qp(3, 1)); B + sage: B = Berkovich_Cp_Affine(Qp(3, 1)); B # optional - sage.rings.padics Affine Berkovich line over Cp(3) of precision 1 - sage: B(1/2) + sage: B(1/2) # optional - sage.rings.padics Type I point centered at 2 + O(3) Note that this point has very low precision, as ``B`` was initialized with a p-adic field of capped-relative precision one. For high precision, pass in a high precision p-adic field:: - sage: B = Berkovich_Cp_Affine(Qp(3, 1000)); B + sage: B = Berkovich_Cp_Affine(Qp(3, 1000)); B # optional - sage.rings.padics Affine Berkovich line over Cp(3) of precision 1000 Points of Berkovich space can be created from points of extensions of `\QQ_p`:: - sage: B = Berkovich_Cp_Affine(3) - sage: A. = Qp(3).extension(x^3 - 3) - sage: B(a) + sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: A. = Qp(3).extension(x^3 - 3) # optional - sage.rings.number_field + sage: B(a) # optional - sage.rings.number_field sage.rings.padics Type I point centered at a + O(a^61) For exact computation, a number field can be used:: sage: R. = QQ[] - sage: A. = NumberField(x^3 + 20) - sage: ideal = A.prime_above(3) - sage: B = Berkovich_Cp_Affine(A, ideal); B + sage: A. = NumberField(x^3 + 20) # optional - sage.rings.number_field + sage: ideal = A.prime_above(3) # optional - sage.rings.number_field + sage: B = Berkovich_Cp_Affine(A, ideal); B # optional - sage.rings.number_field Affine Berkovich line over Cp(3), with base Number Field in a with defining polynomial x^3 + 20 @@ -383,11 +382,11 @@ class Berkovich_Cp_Affine(Berkovich_Cp): must be centered at a point of that number field:: sage: R. = QQ[] - sage: A. = NumberField(x^3 + 20) - sage: ideal = A.prime_above(3) - sage: B = Berkovich_Cp_Affine(A, ideal) - sage: C. = NumberField(x^2 + 1) - sage: B(c) + sage: A. = NumberField(x^3 + 20) # optional - sage.rings.number_field + sage: ideal = A.prime_above(3) # optional - sage.rings.number_field + sage: B = Berkovich_Cp_Affine(A, ideal) # optional - sage.rings.number_field + sage: C. = NumberField(x^2 + 1) # optional - sage.rings.number_field + sage: B(c) # optional - sage.rings.number_field Traceback (most recent call last): ... ValueError: could not convert c to Number Field in a @@ -395,14 +394,14 @@ class Berkovich_Cp_Affine(Berkovich_Cp): TESTS:: - sage: A. = AffineSpace(Qp(3), 1) - sage: Berkovich_Cp_Affine(A) + sage: A. = AffineSpace(Qp(3), 1) # optional - sage.rings.padics + sage: Berkovich_Cp_Affine(A) # optional - sage.rings.padics Affine Berkovich line over Cp(3) of precision 20 :: - sage: B = Berkovich_Cp_Projective(3) - sage: TestSuite(B).run() + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: TestSuite(B).run() # optional - sage.rings.padics """ Element = Berkovich_Element_Cp_Affine @@ -413,11 +412,13 @@ def __init__(self, base, ideal=None): EXAMPLES:: - sage: Berkovich_Cp_Affine(3) + sage: Berkovich_Cp_Affine(3) # optional - sage.rings.padics Affine Berkovich line over Cp(3) of precision 20 """ if base in ZZ: if base.is_prime(): + from sage.rings.padics.factory import Qp + base = Qp(base) # change to Qpbar else: raise ValueError("non-prime passed into Berkovich space") @@ -457,16 +458,16 @@ def _repr_(self): EXAMPLES:: - sage: B = Berkovich_Cp_Affine(3) - sage: B + sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: B # optional - sage.rings.padics Affine Berkovich line over Cp(3) of precision 20 :: sage: R. = QQ[] - sage: A. = NumberField(z^2 + 1) - sage: ideal = A.prime_above(3) - sage: Berkovich_Cp_Affine(A, ideal) + sage: A. = NumberField(z^2 + 1) # optional - sage.rings.number_field + sage: ideal = A.prime_above(3) # optional - sage.rings.number_field + sage: Berkovich_Cp_Affine(A, ideal) # optional - sage.rings.number_field Affine Berkovich line over Cp(3), with base Number Field in a with defining polynomial z^2 + 1 """ @@ -483,8 +484,8 @@ def _latex_(self): EXAMPLES: - sage: B = Berkovich_Cp_Affine(3) - sage: latex(B) + sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics + sage: latex(B) # optional - sage.rings.padics \text{Affine Berkovich line over } \Bold{C}_{3} """ return r"\text{Affine Berkovich line over } \Bold{C}_{%s}" % (self.prime()) @@ -523,36 +524,36 @@ class Berkovich_Cp_Projective(Berkovich_Cp): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3); B + sage: B = Berkovich_Cp_Projective(3); B # optional - sage.rings.padics Projective Berkovich line over Cp(3) of precision 20 Elements can be constructed:: - sage: B(1/2) + sage: B(1/2) # optional - sage.rings.padics Type I point centered at (2 + 3 + 3^2 + 3^3 + 3^4 + 3^5 + 3^6 + 3^7 + 3^8 + 3^9 + 3^10 + 3^11 + 3^12 + 3^13 + 3^14 + 3^15 + 3^16 + 3^17 + 3^18 + 3^19 + O(3^20) : 1 + O(3^20)) :: - sage: B(2, 1) + sage: B(2, 1) # optional - sage.rings.padics Type II point centered at (2 + O(3^20) : 1 + O(3^20)) of radius 3^0 For details about element construction, see the documentation of :class:`Berkovich_Element_Cp_Projective`. Initializing a Berkovich projective line by passing in a p-adic space looks the same:: - sage: B = Berkovich_Cp_Projective(Qp(3)); B + sage: B = Berkovich_Cp_Projective(Qp(3)); B # optional - sage.rings.padics Projective Berkovich line over Cp(3) of precision 20 However, this method allows for more control over behind-the-scenes conversion:: - sage: S = Qp(3, 1) - sage: B = Berkovich_Cp_Projective(S); B + sage: S = Qp(3, 1) # optional - sage.rings.padics + sage: B = Berkovich_Cp_Projective(S); B # optional - sage.rings.padics Projective Berkovich line over Cp(3) of precision 1 - sage: Q1 = B(1/2); Q1 + sage: Q1 = B(1/2); Q1 # optional - sage.rings.padics Type I point centered at (2 + O(3) : 1 + O(3)) Note that this point has very low precision, as S has low @@ -560,9 +561,9 @@ class Berkovich_Cp_Projective(Berkovich_Cp): a number field, as long as an ideal is specified:: sage: R. = QQ[] - sage: A. = NumberField(x^2 + 1) - sage: ideal = A.prime_above(2) - sage: B = Berkovich_Cp_Projective(A, ideal); B + sage: A. = NumberField(x^2 + 1) # optional - sage.rings.number_field + sage: ideal = A.prime_above(2) # optional - sage.rings.number_field + sage: B = Berkovich_Cp_Projective(A, ideal); B # optional - sage.rings.number_field Projective Berkovich line over Cp(2), with base Number Field in a with defining polynomial x^2 + 1 @@ -582,11 +583,11 @@ class Berkovich_Cp_Projective(Berkovich_Cp): must be centered at a point of that number field:: sage: R. = QQ[] - sage: A. = NumberField(x^3 + 20) - sage: ideal = A.prime_above(3) - sage: B = Berkovich_Cp_Projective(A, ideal) - sage: C. = NumberField(x^2 + 1) - sage: B(c) + sage: A. = NumberField(x^3 + 20) # optional - sage.rings.number_field + sage: ideal = A.prime_above(3) # optional - sage.rings.number_field + sage: B = Berkovich_Cp_Projective(A, ideal) # optional - sage.rings.number_field + sage: C. = NumberField(x^2 + 1) # optional - sage.rings.number_field + sage: B(c) # optional - sage.rings.number_field Traceback (most recent call last): ... TypeError: could not convert c to Projective Space @@ -594,8 +595,8 @@ class Berkovich_Cp_Projective(Berkovich_Cp): TESTS:: - sage: B = Berkovich_Cp_Projective(3) - sage: TestSuite(B).run() + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: TestSuite(B).run() # optional - sage.rings.padics """ Element = Berkovich_Element_Cp_Projective @@ -606,11 +607,13 @@ def __init__(self, base, ideal=None): EXAMPLES:: - sage: Berkovich_Cp_Projective(3) + sage: Berkovich_Cp_Projective(3) # optional - sage.rings.padics Projective Berkovich line over Cp(3) of precision 20 """ if base in ZZ: if base.is_prime(): + from sage.rings.padics.factory import Qp + base = ProjectiveSpace(Qp(base), 1) else: raise ValueError("non-prime passed into Berkovich space") @@ -661,23 +664,23 @@ def base_ring(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) - sage: B.base_ring() + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: B.base_ring() # optional - sage.rings.padics 3-adic Field with capped relative precision 20 :: - sage: C = Berkovich_Cp_Projective(ProjectiveSpace(Qp(3, 1), 1)) - sage: C.base_ring() + sage: C = Berkovich_Cp_Projective(ProjectiveSpace(Qp(3, 1), 1)) # optional - sage.rings.padics + sage: C.base_ring() # optional - sage.rings.padics 3-adic Field with capped relative precision 1 :: sage: R. = QQ[] - sage: A. = NumberField(x^3 + 20) - sage: ideal = A.prime_above(3) - sage: D = Berkovich_Cp_Projective(A, ideal) - sage: D.base_ring() + sage: A. = NumberField(x^3 + 20) # optional - sage.rings.number_field + sage: ideal = A.prime_above(3) # optional - sage.rings.number_field + sage: D = Berkovich_Cp_Projective(A, ideal) # optional - sage.rings.number_field + sage: D.base_ring() # optional - sage.rings.number_field Number Field in a with defining polynomial x^3 + 20 """ return self.base().base_ring() @@ -688,16 +691,16 @@ def _repr_(self): EXAMPLES:: - sage: B = Berkovich_Cp_Projective(3) - sage: B + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: B # optional - sage.rings.padics Projective Berkovich line over Cp(3) of precision 20 :: sage: R. = QQ[] - sage: A. = NumberField(x^2 + 1) - sage: v = A.ideal(a + 1) - sage: Berkovich_Cp_Projective(A, v) + sage: A. = NumberField(x^2 + 1) # optional - sage.rings.number_field + sage: v = A.ideal(a + 1) # optional - sage.rings.number_field + sage: Berkovich_Cp_Projective(A, v) # optional - sage.rings.number_field Projective Berkovich line over Cp(2), with base Number Field in a with defining polynomial x^2 + 1 """ if self._base_type == 'padic field': @@ -713,8 +716,8 @@ def _latex_(self): EXAMPLES: - sage: B = Berkovich_Cp_Projective(3) - sage: latex(B) + sage: B = Berkovich_Cp_Projective(3) # optional - sage.rings.padics + sage: latex(B) # optional - sage.rings.padics \text{Projective Berkovich line over } \Bold{C}_{3} """ return r"\text{Projective Berkovich line over } \Bold{C}_{%s}" %(self.prime()) diff --git a/src/sage/schemes/jacobians/abstract_jacobian.py b/src/sage/schemes/jacobians/abstract_jacobian.py index e2007663c81..6cb414667e2 100644 --- a/src/sage/schemes/jacobians/abstract_jacobian.py +++ b/src/sage/schemes/jacobians/abstract_jacobian.py @@ -221,7 +221,7 @@ def change_ring(self, R): EXAMPLES:: sage: R. = QQ['x'] - sage: H = HyperellipticCurve(x^3-10*x+9) + sage: H = HyperellipticCurve(x^3 - 10*x + 9) sage: Jac = H.jacobian(); Jac Jacobian of Hyperelliptic Curve over Rational Field defined by y^2 = x^3 - 10*x + 9 @@ -246,11 +246,12 @@ def base_extend(self, R): EXAMPLES:: sage: R. = QQ['x'] - sage: H = HyperellipticCurve(x^3-10*x+9) + sage: H = HyperellipticCurve(x^3 - 10*x + 9) sage: Jac = H.jacobian(); Jac - Jacobian of Hyperelliptic Curve over Rational Field defined by y^2 = x^3 - 10*x + 9 - sage: F. = QQ.extension(x^2+1) - sage: Jac.base_extend(F) + Jacobian of Hyperelliptic Curve over Rational Field + defined by y^2 = x^3 - 10*x + 9 + sage: F. = QQ.extension(x^2 + 1) # optional - sage.rings.number_field + sage: Jac.base_extend(F) # optional - sage.rings.number_field Jacobian of Hyperelliptic Curve over Number Field in a with defining polynomial x^2 + 1 defined by y^2 = x^3 - 10*x + 9 """ diff --git a/src/sage/schemes/overview.py b/src/sage/schemes/overview.py index d57b74d8f32..e210d76f76b 100644 --- a/src/sage/schemes/overview.py +++ b/src/sage/schemes/overview.py @@ -117,9 +117,9 @@ :: sage: R. = ZZ[] - sage: S. = R.quo(x^2+5) - sage: P. = ProjectiveSpace(2, S) - sage: P(S) + sage: S. = R.quo(x^2 + 5) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(2, S) # optional - sage.rings.number_field + sage: P(S) # optional - sage.rings.number_field Set of rational points of Projective Space of dimension 2 over Univariate Quotient Polynomial Ring in t over Integer Ring with modulus x^2 + 5 @@ -132,7 +132,7 @@ :: - sage: P([2, 1 + t]) + sage: P([2, 1 + t]) # optional - sage.rings.number_field (2 : t + 1 : 1) In fact, we need a test ``R.ideal([2, 1 + t]) == R.ideal([1])`` in order to make diff --git a/src/sage/schemes/product_projective/homset.py b/src/sage/schemes/product_projective/homset.py index b56eccb968e..67387a936aa 100644 --- a/src/sage/schemes/product_projective/homset.py +++ b/src/sage/schemes/product_projective/homset.py @@ -114,17 +114,18 @@ def points(self, **kwds): :: sage: u = QQ['u'].0 - sage: P. = ProductProjectiveSpaces([1,1], NumberField(u^2 - 2, 'v')) - sage: X = P.subscheme([x^2 - y^2, z^2 - 2*w^2]) - sage: sorted(X(P.base_ring()).points()) + sage: K = NumberField(u^2 - 2, 'v') # optional - sage.rings.number_field + sage: P. = ProductProjectiveSpaces([1, 1], K) # optional - sage.rings.number_field + sage: X = P.subscheme([x^2 - y^2, z^2 - 2*w^2]) # optional - sage.rings.number_field + sage: sorted(X(P.base_ring()).points()) # optional - sage.rings.number_field [(-1 : 1 , -v : 1), (-1 : 1 , v : 1), (1 : 1 , -v : 1), (1 : 1 , v : 1)] :: sage: u = QQ['u'].0 - sage: K = NumberField(u^2 + 1, 'v') - sage: P. = ProductProjectiveSpaces([1, 1], K) - sage: P(K).points(bound=1) + sage: K = NumberField(u^2 + 1, 'v') # optional - sage.rings.number_field + sage: P. = ProductProjectiveSpaces([1, 1], K) # optional - sage.rings.number_field + sage: P(K).points(bound=1) # optional - sage.rings.number_field [(-1 : 1 , -1 : 1), (-1 : 1 , -v : 1), (-1 : 1 , 0 : 1), (-1 : 1 , v : 1), (-1 : 1 , 1 : 0), (-1 : 1 , 1 : 1), (-v : 1 , -1 : 1), (-v : 1 , -v : 1), (-v : 1 , 0 : 1), (-v : 1 , v : 1), (-v : 1 , 1 : 0), (-v : 1 , 1 : 1), @@ -137,8 +138,8 @@ def points(self, **kwds): :: - sage: P. = ProductProjectiveSpaces([2, 1], GF(3)) - sage: P(P.base_ring()).points() + sage: P. = ProductProjectiveSpaces([2, 1], GF(3)) # optional - sage.rings.finite_rings + sage: P(P.base_ring()).points() # optional - sage.rings.finite_rings [(0 : 0 : 1 , 0 : 1), (0 : 0 : 1 , 1 : 0), (0 : 0 : 1 , 1 : 1), (0 : 0 : 1 , 2 : 1), (0 : 1 : 0 , 0 : 1), (0 : 1 : 0 , 1 : 0), (0 : 1 : 0 , 1 : 1), (0 : 1 : 0 , 2 : 1), (0 : 1 : 1 , 0 : 1), (0 : 1 : 1 , 1 : 0), (0 : 1 : 1 , 1 : 1), (0 : 1 : 1 , 2 : 1), @@ -155,8 +156,8 @@ def points(self, **kwds): :: - sage: PP. = ProductProjectiveSpaces([2,1], QQ) - sage: X = PP.subscheme([x + y, u*u-v*u]) + sage: PP. = ProductProjectiveSpaces([2, 1], QQ) + sage: X = PP.subscheme([x + y, u*u - v*u]) sage: X.rational_points(bound=2) [(-2 : 2 : 1 , 0 : 1), (-2 : 2 : 1 , 1 : 1), @@ -177,8 +178,8 @@ def points(self, **kwds): better to enumerate with low codimension:: - sage: PP. = ProductProjectiveSpaces([2,1,2], QQ) - sage: X = PP.subscheme([x*u^2*a, b*z*u*v,z*v^2*c ]) + sage: PP. = ProductProjectiveSpaces([2, 1, 2], QQ) + sage: X = PP.subscheme([x*u^2*a, b*z*u*v, z*v^2*c]) sage: len(X.rational_points(bound=1, algorithm='enumerate')) 232 """ diff --git a/src/sage/schemes/product_projective/morphism.py b/src/sage/schemes/product_projective/morphism.py index b558d88b304..82fa13405c1 100644 --- a/src/sage/schemes/product_projective/morphism.py +++ b/src/sage/schemes/product_projective/morphism.py @@ -83,7 +83,7 @@ def __init__(self, parent, polys, check=True): sage: Z. = ProductProjectiveSpaces([1, 2], QQ) sage: P. = ProductProjectiveSpaces([3, 1], QQ) sage: H = Hom(Z,P) - sage: f = H([a^2,b^2,a^2,a*b,a*x,b*z]); f + sage: f = H([a^2, b^2, a^2, a*b, a*x, b*z]); f Scheme morphism: From: Product of projective spaces P^1 x P^2 over Rational Field To: Product of projective spaces P^3 x P^1 over Rational Field @@ -95,7 +95,7 @@ def __init__(self, parent, polys, check=True): sage: Z. = ProductProjectiveSpaces([1, 3], QQ) sage: P. = ProductProjectiveSpaces([2, 2], QQ) sage: H = Hom(Z,P) - sage: f = H([a^2,b^2,c^2,x^2,y^2,z^2]) + sage: f = H([a^2, b^2, c^2, x^2, y^2, z^2]) Traceback (most recent call last): ... TypeError: polys (=[a^2, b^2, c^2, x^2, y^2, z^2]) must be @@ -199,11 +199,11 @@ def __call__(self, P, check=True): :: - sage: PP. = ProductProjectiveSpaces([2,1], ZZ) + sage: PP. = ProductProjectiveSpaces([2, 1], ZZ) sage: Q = PP([1,1,1,2,1]) - sage: Z. = ProductProjectiveSpaces([1,2], ZZ) + sage: Z. = ProductProjectiveSpaces([1, 2], ZZ) sage: H = End(Z) - sage: f = H([a^3, b^3+a*b^2, x^2, y^2-z^2, z*y]) + sage: f = H([a^3, b^3 + a*b^2, x^2, y^2 - z^2, z*y]) sage: f(Q) Traceback (most recent call last): ... @@ -218,7 +218,7 @@ def __call__(self, P, check=True): sage: PP. = ProductProjectiveSpaces(ZZ, [1, 1]) sage: HP = End(PP) sage: g = HP([x^2, y^2, u^2, v^2]) - sage: g([0, 0, 0, 0],check=False) + sage: g([0, 0, 0, 0], check=False) (0 : 0 , 0 : 0) """ from sage.schemes.product_projective.point import ProductProjectiveSpaces_point_ring @@ -315,7 +315,7 @@ def __ne__(self, right): EXAMPLES:: - sage: PP. = ProductProjectiveSpaces([1,2], ZZ) + sage: PP. = ProductProjectiveSpaces([1, 2], ZZ) sage: E = End(PP) sage: f = E([a^3, a*b^2, x*y, y*z, z*x]) sage: g = E([a*b, a^2, x^2, y^2, z^2]) @@ -360,13 +360,13 @@ def is_morphism(self): sage: Z. = ProductProjectiveSpaces([1, 2], ZZ) sage: H = End(Z) - sage: f = H([a^2, b^2, x*z-y*z, x^2-y^2, z^2]) + sage: f = H([a^2, b^2, x*z - y*z, x^2 - y^2, z^2]) sage: f.is_morphism() False :: - sage: P.=ProductProjectiveSpaces([2, 2], QQ) + sage: P. = ProductProjectiveSpaces([2, 2], QQ) sage: H = End(P) sage: f = H([u, v, w, u^2, v^2, w^2]) sage: f.is_morphism() @@ -410,7 +410,7 @@ def as_dynamical_system(self): EXAMPLES:: - sage: Z. = ProductProjectiveSpaces([1 , 2], ZZ) + sage: Z. = ProductProjectiveSpaces([1, 2], ZZ) sage: H = End(Z) sage: f = H([a^3, b^3, x^2, y^2, z^2]) sage: type(f.as_dynamical_system()) @@ -451,12 +451,12 @@ def global_height(self, prec=None): :: sage: u = QQ['u'].0 - sage: R = NumberField(u^2 - 2, 'v') - sage: PP. = ProductProjectiveSpaces([1, 1], R) - sage: H = End(PP) - sage: O = R.maximal_order() - sage: g = H([3*O(u)*x^2, 13*x*y, 7*a*y, 5*b*x + O(u)*a*y]) - sage: g.global_height() + sage: R = NumberField(u^2 - 2, 'v') # optional - sage.rings.number_field + sage: PP. = ProductProjectiveSpaces([1, 1], R) # optional - sage.rings.number_field + sage: H = End(PP) # optional - sage.rings.number_field + sage: O = R.maximal_order() # optional - sage.rings.number_field + sage: g = H([3*O(u)*x^2, 13*x*y, 7*a*y, 5*b*x + O(u)*a*y]) # optional - sage.rings.number_field + sage: g.global_height() # optional - sage.rings.number_field 2.56494935746154 """ K = self.domain().base_ring() @@ -492,18 +492,18 @@ def local_height(self, v, prec=None): sage: T. = ProductProjectiveSpaces([2, 1], QQ) sage: H = T.Hom(T) - sage: f = H([4*x^2+3/100*y^2, 8/210*x*y, 1/10000*z^2, 20*w^2, 1/384*u*w]) + sage: f = H([4*x^2 + 3/100*y^2, 8/210*x*y, 1/10000*z^2, 20*w^2, 1/384*u*w]) sage: f.local_height(2) 4.85203026391962 :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(z^2-5) - sage: P. = ProductProjectiveSpaces([1, 1], K) - sage: H = Hom(P,P) - sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2, a^2, 6*b^2 + 1/9*a*b]) - sage: f.local_height(K.ideal(3)) + sage: K. = NumberField(z^2 - 5) # optional - sage.rings.number_field + sage: P. = ProductProjectiveSpaces([1, 1], K) # optional - sage.rings.number_field + sage: H = Hom(P, P) # optional - sage.rings.number_field + sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2, a^2, 6*b^2 + 1/9*a*b]) # optional - sage.rings.number_field + sage: f.local_height(K.ideal(3)) # optional - sage.rings.number_field 2.19722457733622 """ K = FractionField(self.domain().base_ring()) diff --git a/src/sage/schemes/product_projective/point.py b/src/sage/schemes/product_projective/point.py index e884deb2809..f0486ac801c 100644 --- a/src/sage/schemes/product_projective/point.py +++ b/src/sage/schemes/product_projective/point.py @@ -41,7 +41,7 @@ class ProductProjectiveSpaces_point_ring(SchemeMorphism_point): EXAMPLES:: sage: T. = ProductProjectiveSpaces([2, 1], QQ) - sage: T.point([1, 2, 3, 4, 5]); + sage: T.point([1, 2, 3, 4, 5]) (1/3 : 2/3 : 1 , 4/5 : 1) """ def __init__(self, parent, polys, check=True): @@ -69,15 +69,15 @@ def __init__(self, parent, polys, check=True): :: - sage: T = ProductProjectiveSpaces([2, 2, 2], GF(5), 'x') - sage: T.point([1, 2, 3, 4, 5, 6, 7, 8, 9]) + sage: T = ProductProjectiveSpaces([2, 2, 2], GF(5), 'x') # optional - sage.rings.finite_rings + sage: T.point([1, 2, 3, 4, 5, 6, 7, 8, 9]) # optional - sage.rings.finite_rings (2 : 4 : 1 , 4 : 0 : 1 , 3 : 2 : 1) :: - sage: T. = ProductProjectiveSpaces([1, 1], GF(5)) - sage: X = T.subscheme([x-y, z-2*w]) - sage: X([1, 1, 2, 1]) + sage: T. = ProductProjectiveSpaces([1, 1], GF(5)) # optional - sage.rings.finite_rings + sage: X = T.subscheme([x - y, z - 2*w]) # optional - sage.rings.finite_rings + sage: X([1, 1, 2, 1]) # optional - sage.rings.finite_rings (1 : 1 , 2 : 1) """ polys = copy(polys) @@ -116,13 +116,13 @@ def __getitem__(self, i): EXAMPLES:: - sage: T = ProductProjectiveSpaces([2, 2, 2], GF(5), 'x') - sage: P = T([1, 0, 1, 1, 0, 0, 0, 0, 1]) - sage: P[1] + sage: T = ProductProjectiveSpaces([2, 2, 2], GF(5), 'x') # optional - sage.rings.finite_rings + sage: P = T([1, 0, 1, 1, 0, 0, 0, 0, 1]) # optional - sage.rings.finite_rings + sage: P[1] # optional - sage.rings.finite_rings (1 : 0 : 0) - sage: P[1].codomain() + sage: P[1].codomain() # optional - sage.rings.finite_rings Projective Space of dimension 2 over Finite Field of size 5 - sage: P[1][0] + sage: P[1][0] # optional - sage.rings.finite_rings 1 """ return self._points[i] @@ -173,26 +173,26 @@ def _richcmp_(self, right, op): EXAMPLES:: - sage: T = ProductProjectiveSpaces([1, 1, 1], GF(5), 'x') - sage: P = T([3, 2, 3, 4, 1, 0]) - sage: Q = T([1, 2, 3, 4, 3, 1]) - sage: P > Q + sage: T = ProductProjectiveSpaces([1, 1, 1], GF(5), 'x') # optional - sage.rings.finite_rings + sage: P = T([3, 2, 3, 4, 1, 0]) # optional - sage.rings.finite_rings + sage: Q = T([1, 2, 3, 4, 3, 1]) # optional - sage.rings.finite_rings + sage: P > Q # optional - sage.rings.finite_rings True :: - sage: T = ProductProjectiveSpaces([1, 1, 1], GF(5), 'x') - sage: P = T([1, 2, 3, 4, 1, 0]) - sage: Q = T([1, 2, 3, 4, 3, 0]) - sage: P == Q + sage: T = ProductProjectiveSpaces([1, 1, 1], GF(5), 'x') # optional - sage.rings.finite_rings + sage: P = T([1, 2, 3, 4, 1, 0]) # optional - sage.rings.finite_rings + sage: Q = T([1, 2, 3, 4, 3, 0]) # optional - sage.rings.finite_rings + sage: P == Q # optional - sage.rings.finite_rings True :: - sage: T = ProductProjectiveSpaces([1, 1, 1], GF(5), 'x') - sage: P = T([1, 2, 3, 4, 1, 0]) - sage: Q = T([1, 2, 3, 4, 3, 1]) - sage: P < Q + sage: T = ProductProjectiveSpaces([1, 1, 1], GF(5), 'x') # optional - sage.rings.finite_rings + sage: P = T([1, 2, 3, 4, 1, 0]) # optional - sage.rings.finite_rings + sage: Q = T([1, 2, 3, 4, 3, 1]) # optional - sage.rings.finite_rings + sage: P < Q # optional - sage.rings.finite_rings True """ #needed for Digraph @@ -281,10 +281,10 @@ def __hash__(self): :: - sage: PP = ProductProjectiveSpaces(GF(7), [1, 1, 1]) - sage: hash(PP([4, 1, 5, 4, 6, 1])) == hash((4, 1, 5, 4, 6, 1)) + sage: PP = ProductProjectiveSpaces(GF(7), [1, 1, 1]) # optional - sage.rings.finite_rings + sage: hash(PP([4, 1, 5, 4, 6, 1])) == hash((4, 1, 5, 4, 6, 1)) # optional - sage.rings.finite_rings False - sage: hash(PP([4, 1, 5, 4, 6, 1])) == hash((4, 1, 3, 1, 6, 1)) + sage: hash(PP([4, 1, 5, 4, 6, 1])) == hash((4, 1, 3, 1, 6, 1)) # optional - sage.rings.finite_rings True """ R = self.codomain().base_ring() @@ -411,8 +411,8 @@ def change_ring(self, R, **kwds): EXAMPLES:: sage: T. = ProductProjectiveSpaces([1, 1, 1], ZZ) - sage: P = T.point([5, 3, 15, 4, 2, 6]); - sage: P.change_ring(GF(3)) + sage: P = T.point([5, 3, 15, 4, 2, 6]) + sage: P.change_ring(GF(3)) # optional - sage.rings.finite_rings (1 : 0 , 0 : 1 , 1 : 0) """ check = kwds.get('check', True) @@ -439,14 +439,14 @@ def global_height(self, prec=None): EXAMPLES:: - sage: PP = ProductProjectiveSpaces(QQ, [2,2], 'x') + sage: PP = ProductProjectiveSpaces(QQ, [2, 2], 'x') sage: Q = PP([1, 7, 5, 18, 2, 3]) sage: Q.global_height() 2.89037175789616 :: - sage: PP = ProductProjectiveSpaces(ZZ, [1,1], 'x') + sage: PP = ProductProjectiveSpaces(ZZ, [1, 1], 'x') sage: A = PP([-30, 2, 1, 6]) sage: A.global_height() 2.70805020110221 @@ -454,17 +454,17 @@ def global_height(self, prec=None): :: sage: R. = PolynomialRing(QQ) - sage: k. = NumberField(x^2 + 5) - sage: PP = ProductProjectiveSpaces(k, [1, 2], 'y') - sage: Q = PP([3, 5*w+1, 1, 7*w, 10]) - sage: Q.global_height() + sage: k. = NumberField(x^2 + 5) # optional - sage.rings.number_field + sage: PP = ProductProjectiveSpaces(k, [1, 2], 'y') # optional - sage.rings.number_field + sage: Q = PP([3, 5*w + 1, 1, 7*w, 10]) # optional - sage.rings.number_field + sage: Q.global_height() # optional - sage.rings.number_field 2.75062910527236 :: - sage: PP = ProductProjectiveSpaces(QQbar, [1, 1], 'x') - sage: Q = PP([1, QQbar(sqrt(2)), QQbar(5^(1/3)), QQbar(3^(1/3))]) - sage: Q.global_height() + sage: PP = ProductProjectiveSpaces(QQbar, [1, 1], 'x') # optional - sage.rings.number_field + sage: Q = PP([1, QQbar(sqrt(2)), QQbar(5^(1/3)), QQbar(3^(1/3))]) # optional - sage.rings.number_field sage.symbolic + sage: Q.global_height() # optional - sage.rings.number_field sage.symbolic 0.536479304144700 """ K = self.codomain().base_ring() @@ -502,7 +502,7 @@ def local_height(self, v, prec=None): :: - sage: P = ProductProjectiveSpaces(QQ, [1,2], 'x') + sage: P = ProductProjectiveSpaces(QQ, [1, 2], 'x') sage: Q = P([1, 4, 1/2, 2, 32]) sage: Q.local_height(2) 4.15888308335967 @@ -532,7 +532,7 @@ def intersection_multiplicity(self, X): EXAMPLES:: - sage: PP. = ProductProjectiveSpaces(QQ, [2,1]) + sage: PP. = ProductProjectiveSpaces(QQ, [2, 1]) sage: X = PP.subscheme([y^2*z^3*u - x^5*v]) sage: Y = PP.subscheme([u^3 - v^3, x - y]) sage: Q = X([0,0,1,1,1]) @@ -555,7 +555,7 @@ def multiplicity(self): EXAMPLES:: - sage: PP. = ProductProjectiveSpaces(QQ, [3,2]) + sage: PP. = ProductProjectiveSpaces(QQ, [3, 2]) sage: X = PP.subscheme([x^8*t - y^8*t + z^5*w^3*v]) sage: Q1 = X([1,1,0,0,-1,-1,1]) sage: Q1.multiplicity() diff --git a/src/sage/schemes/product_projective/rational_point.py b/src/sage/schemes/product_projective/rational_point.py index 53e08bcc171..1aec4b791b8 100644 --- a/src/sage/schemes/product_projective/rational_point.py +++ b/src/sage/schemes/product_projective/rational_point.py @@ -17,7 +17,7 @@ sage: PP. = ProductProjectiveSpaces([1,0], QQ) sage: from sage.schemes.product_projective.rational_point import \ enum_product_projective_rational_field - sage: enum_product_projective_rational_field(PP,3) + sage: enum_product_projective_rational_field(PP, 3) [(-3 : 1 , 1), (-2 : 1 , 1), (-3/2 : 1 , 1), (-1 : 1 , 1), (-2/3 : 1 , 1), (-1/2 : 1 , 1), (-1/3 : 1 , 1), (0 : 1 , 1), (1/3 : 1 , 1), @@ -27,11 +27,11 @@ Product projective over finite field:: - sage: P1. = ProductProjectiveSpaces([1,1], GF(7)) - sage: X = P1.subscheme([2*x+3*y]) + sage: P1. = ProductProjectiveSpaces([1, 1], GF(7)) # optional - sage.rings.finite_rings + sage: X = P1.subscheme([2*x + 3*y]) # optional - sage.rings.finite_rings sage: from sage.schemes.product_projective.rational_point import \ enum_product_projective_finite_field - sage: enum_product_projective_finite_field(X) + sage: enum_product_projective_finite_field(X) # optional - sage.rings.finite_rings [(2 : 1 , 0 : 1), (2 : 1 , 1 : 0), (2 : 1 , 1 : 1), (2 : 1 , 2 : 1), (2 : 1 , 3 : 1), (2 : 1 , 4 : 1), (2 : 1 , 5 : 1), (2 : 1 , 6 : 1)] @@ -89,7 +89,7 @@ def enum_product_projective_rational_field(X, B): sage: PP. = ProductProjectiveSpaces([1, 2], QQ) sage: from sage.schemes.product_projective.rational_point import \ enum_product_projective_rational_field - sage: enum_product_projective_rational_field(PP,1) + sage: enum_product_projective_rational_field(PP, 1) [(-1 : 1 , -1 : -1 : 1), (-1 : 1 , -1 : 0 : 1), (-1 : 1 , -1 : 1 : 0), (-1 : 1 , -1 : 1 : 1), (-1 : 1 , 0 : -1 : 1), (-1 : 1 , 0 : 0 : 1), (-1 : 1 , 0 : 1 : 0), (-1 : 1 , 0 : 1 : 1), (-1 : 1 , 1 : -1 : 1), @@ -111,11 +111,11 @@ def enum_product_projective_rational_field(X, B): :: - sage: PP. = ProductProjectiveSpaces([2,1], QQ) - sage: X = PP.subscheme([x^2 + x*y + y*z, u*u-v*u]) + sage: PP. = ProductProjectiveSpaces([2, 1], QQ) + sage: X = PP.subscheme([x^2 + x*y + y*z, u*u - v*u]) sage: from sage.schemes.product_projective.rational_point import \ enum_product_projective_rational_field - sage: enum_product_projective_rational_field(X,4) + sage: enum_product_projective_rational_field(X, 4) [(-2 : 4 : 1 , 0 : 1), (-2 : 4 : 1 , 1 : 1), (-1 : 1 : 0 , 0 : 1), (-1 : 1 : 0 , 1 : 1), (-2/3 : -4/3 : 1 , 0 : 1), (-2/3 : -4/3 : 1 , 1 : 1), (-1/2 : -1/2 : 1 , 0 : 1), (-1/2 : -1/2 : 1 , 1 : 1), @@ -208,12 +208,12 @@ def enum_product_projective_number_field(X, **kwds): EXAMPLES:: sage: u = QQ['u'].0 - sage: K = NumberField(u^2 + 2, 'v') - sage: PP. = ProductProjectiveSpaces([1, 1], K) - sage: X = PP.subscheme([x^2 + 2*y^2]) + sage: K = NumberField(u^2 + 2, 'v') # optional - sage.rings.number_field + sage: PP. = ProductProjectiveSpaces([1, 1], K) # optional - sage.rings.number_field + sage: X = PP.subscheme([x^2 + 2*y^2]) # optional - sage.rings.number_field sage: from sage.schemes.product_projective.rational_point import \ enum_product_projective_number_field - sage: enum_product_projective_number_field(X, bound=1.5) + sage: enum_product_projective_number_field(X, bound=1.5) # optional - sage.rings.number_field [(-v : 1 , -1 : 1), (-v : 1 , -v : 1), (-v : 1 , -1/2*v : 1), (-v : 1 , 0 : 1), (-v : 1 , 1/2*v : 1), (-v : 1 , v : 1), (-v : 1 , 1 : 0), (-v : 1 , 1 : 1), (v : 1 , -1 : 1), @@ -261,10 +261,10 @@ def enum_product_projective_finite_field(X): EXAMPLES:: - sage: PP. = ProductProjectiveSpaces([1, 1], GF(3)) + sage: PP. = ProductProjectiveSpaces([1, 1], GF(3)) # optional - sage.rings.finite_rings sage: from sage.schemes.product_projective.rational_point import \ enum_product_projective_finite_field - sage: enum_product_projective_finite_field(PP) + sage: enum_product_projective_finite_field(PP) # optional - sage.rings.finite_rings [(0 : 1 , 0 : 1), (0 : 1 , 1 : 0), (0 : 1 , 1 : 1), (0 : 1 , 2 : 1), (1 : 0 , 0 : 1), (1 : 0 , 1 : 0), (1 : 0 , 1 : 1), (1 : 0 , 2 : 1), (1 : 1 , 0 : 1), @@ -274,11 +274,11 @@ def enum_product_projective_finite_field(X): :: - sage: PP. = ProductProjectiveSpaces([1, 1], GF(17)) - sage: X = PP.subscheme([x0^2 + 2*x1^2]) + sage: PP. = ProductProjectiveSpaces([1, 1], GF(17)) # optional - sage.rings.finite_rings + sage: X = PP.subscheme([x0^2 + 2*x1^2]) # optional - sage.rings.finite_rings sage: from sage.schemes.product_projective.rational_point import \ enum_product_projective_finite_field - sage: len(enum_product_projective_finite_field(X)) + sage: len(enum_product_projective_finite_field(X)) # optional - sage.rings.finite_rings 36 """ if is_Scheme(X): @@ -334,8 +334,8 @@ def sieve(X, bound): EXAMPLES:: sage: from sage.schemes.product_projective.rational_point import sieve - sage: PP. = ProductProjectiveSpaces([2,1], QQ) - sage: X = PP.subscheme([x^2 + y^2 - x*z, u*u-v*u]) + sage: PP. = ProductProjectiveSpaces([2, 1], QQ) + sage: X = PP.subscheme([x^2 + y^2 - x*z, u*u - v*u]) sage: sieve(X, 2) [(0 : 0 : 1 , 0 : 1), (0 : 0 : 1 , 1 : 1), (1/2 : -1/2 : 1 , 0 : 1), (1/2 : -1/2 : 1 , 1 : 1), (1/2 : 1/2 : 1 , 0 : 1), (1/2 : 1/2 : 1 , 1 : 1), diff --git a/src/sage/schemes/product_projective/space.py b/src/sage/schemes/product_projective/space.py index 4597d1c3798..2e53ada413a 100644 --- a/src/sage/schemes/product_projective/space.py +++ b/src/sage/schemes/product_projective/space.py @@ -105,7 +105,7 @@ def ProductProjectiveSpaces(n, R=None, names='x'): :: - sage: ProductProjectiveSpaces([2, 2],GF(7), 'y') + sage: ProductProjectiveSpaces([2, 2], GF(7), 'y') # optional - sage.rings.finite_rings Product of projective spaces P^2 x P^2 over Finite Field of size 7 :: @@ -396,7 +396,7 @@ def __pow__(self, m): EXAMPLES:: - sage: P1 = ProductProjectiveSpaces([2,1], QQ, 'x') + sage: P1 = ProductProjectiveSpaces([2, 1], QQ, 'x') sage: P1^3 Product of projective spaces P^2 x P^1 x P^2 x P^1 x P^2 x P^1 over Rational Field @@ -435,8 +435,8 @@ def __mul__(self, right): :: - sage: S = ProductProjectiveSpaces([1,2,1], ZZ, 't') - sage: T = ProductProjectiveSpaces([2,2], ZZ, 'x') + sage: S = ProductProjectiveSpaces([1, 2, 1], ZZ, 't') + sage: T = ProductProjectiveSpaces([2, 2], ZZ, 'x') sage: T.inject_variables() Defining x0, x1, x2, x3, x4, x5 sage: X = T.subscheme([x0*x4 - x1*x3]) @@ -479,7 +479,7 @@ def components(self): EXAMPLES:: - sage: P. = ProductProjectiveSpaces(QQ,[2,1]) + sage: P. = ProductProjectiveSpaces(QQ, [2, 1]) sage: P.components() [Projective Space of dimension 2 over Rational Field, Projective Space of dimension 1 over Rational Field] @@ -494,7 +494,7 @@ def dimension_relative(self): EXAMPLES:: - sage: T. = ProductProjectiveSpaces([3,2],QQ) + sage: T. = ProductProjectiveSpaces([3, 2], QQ) sage: T.dimension_relative() 5 """ @@ -508,10 +508,10 @@ def dimension_absolute(self): EXAMPLES:: - sage: T. = ProductProjectiveSpaces([2, 2], GF(17)) - sage: T.dimension_absolute() + sage: T. = ProductProjectiveSpaces([2, 2], GF(17)) # optional - sage.rings.finite_rings + sage: T.dimension_absolute() # optional - sage.rings.finite_rings 4 - sage: T.dimension() + sage: T.dimension() # optional - sage.rings.finite_rings 4 """ base = self.base_scheme() @@ -543,10 +543,10 @@ def dimension_absolute_components(self): EXAMPLES:: - sage: T. = ProductProjectiveSpaces([2, 2], GF(17)) - sage: T.dimension_absolute_components() + sage: T. = ProductProjectiveSpaces([2, 2], GF(17)) # optional - sage.rings.finite_rings + sage: T.dimension_absolute_components() # optional - sage.rings.finite_rings [2, 2] - sage: T.dimension_components() + sage: T.dimension_components() # optional - sage.rings.finite_rings [2, 2] """ base = self.base_scheme() @@ -564,8 +564,8 @@ def num_components(self): EXAMPLES:: - sage: T = ProductProjectiveSpaces([1, 1, 1], GF(5), 'x') - sage: T.num_components() + sage: T = ProductProjectiveSpaces([1, 1, 1], GF(5), 'x') # optional - sage.rings.finite_rings + sage: T.num_components() # optional - sage.rings.finite_rings 3 """ return len(self._components) @@ -581,8 +581,8 @@ def ngens(self): EXAMPLES:: - sage: T = ProductProjectiveSpaces([1, 1, 1], GF(5), 'x') - sage: T.ngens() + sage: T = ProductProjectiveSpaces([1, 1, 1], GF(5), 'x') # optional - sage.rings.finite_rings + sage: T.ngens() # optional - sage.rings.finite_rings 6 """ return sum([P.ngens() for P in self._components]) @@ -722,9 +722,9 @@ def _validate(self, polynomials): :: - sage: R. = PolynomialRing(GF(5)) - sage: T. = ProductProjectiveSpaces([2, 1], QQ) - sage: T._validate([t, t, t, w^2, u^2]) + sage: R. = PolynomialRing(GF(5)) # optional - sage.rings.finite_rings + sage: T. = ProductProjectiveSpaces([2, 1], QQ) # optional - sage.rings.finite_rings + sage: T._validate([t, t, t, w^2, u^2]) # optional - sage.rings.finite_rings Traceback (most recent call last): ... TypeError: polynomials (=[t, t, t, w^2, u^2]) must be elements of Multivariate @@ -755,9 +755,9 @@ def _check_satisfies_equations(self, v): :: - sage: R. = PolynomialRing(GF(7)) - sage: T. = ProductProjectiveSpaces([2, 1], R) - sage: T._check_satisfies_equations([1 + t, 1, 0, 0, 1]) + sage: R. = PolynomialRing(GF(7)) # optional - sage.rings.finite_rings + sage: T. = ProductProjectiveSpaces([2, 1], R) # optional - sage.rings.finite_rings + sage: T._check_satisfies_equations([1 + t, 1, 0, 0, 1]) # optional - sage.rings.finite_rings True :: @@ -837,25 +837,27 @@ def subscheme(self, X): EXAMPLES:: - sage: P. = ProductProjectiveSpaces([1, 1],GF(5)) - sage: X = P.subscheme([x-y, z-w]);X - Closed subscheme of Product of projective spaces P^1 x P^1 over Finite Field of size 5 defined by: + sage: P. = ProductProjectiveSpaces([1, 1], GF(5)) # optional - sage.rings.finite_rings + sage: X = P.subscheme([x - y, z - w]); X # optional - sage.rings.finite_rings + Closed subscheme of Product of projective spaces P^1 x P^1 + over Finite Field of size 5 defined by: x - y, z - w - sage: X.defining_polynomials () + sage: X.defining_polynomials() # optional - sage.rings.finite_rings [x - y, z - w] - sage: I = X.defining_ideal(); I + sage: I = X.defining_ideal(); I # optional - sage.rings.finite_rings Ideal (x - y, z - w) of Multivariate Polynomial Ring in x, y, z, w over Finite Field of size 5 - sage: X.dimension() + sage: X.dimension() # optional - sage.rings.finite_rings 0 - sage: X.base_ring() + sage: X.base_ring() # optional - sage.rings.finite_rings Finite Field of size 5 - sage: X.base_scheme() + sage: X.base_scheme() # optional - sage.rings.finite_rings Spectrum of Finite Field of size 5 - sage: X.structure_morphism() + sage: X.structure_morphism() # optional - sage.rings.finite_rings Scheme morphism: - From: Closed subscheme of Product of projective spaces P^1 x P^1 over Finite Field of size 5 defined by: + From: Closed subscheme of Product of projective spaces P^1 x P^1 + over Finite Field of size 5 defined by: x - y, z - w To: Spectrum of Finite Field of size 5 @@ -884,7 +886,7 @@ def change_ring(self, R): EXAMPLES:: sage: T. = ProductProjectiveSpaces([2, 2], QQ) - sage: T.change_ring(GF(17)) + sage: T.change_ring(GF(17)) # optional - sage.rings.finite_rings Product of projective spaces P^2 x P^2 over Finite Field of size 17 """ new_components = [P.change_ring(R) for P in self._components] @@ -1109,8 +1111,9 @@ def _point(self, *args, **kwds): EXAMPLES:: sage: u = QQ['u'].0 - sage: P = ProductProjectiveSpaces([1, 2], NumberField(u^2 - 2, 'v'), 'x') - sage: P([1, 3, u, 1, 1]) + sage: K = NumberField(u^2 - 2, 'v') # optional - sage.rings.number_field + sage: P = ProductProjectiveSpaces([1, 2], K, 'x') # optional - sage.rings.number_field + sage: P([1, 3, u, 1, 1]) # optional - sage.rings.number_field (1/3 : 1 , v : 1 : 1) """ return ProductProjectiveSpaces_point_field(*args, **kwds) @@ -1123,8 +1126,8 @@ def _point_homset(self, *args, **kwds): EXAMPLES:: - sage: P. = ProductProjectiveSpaces([1, 1], GF(5)) - sage: P._point_homset(Spec(GF(5)), P) + sage: P. = ProductProjectiveSpaces([1, 1], GF(5)) # optional - sage.rings.finite_rings + sage: P._point_homset(Spec(GF(5)), P) # optional - sage.rings.finite_rings Set of rational points of Product of projective spaces P^1 x P^1 over Finite Field of size 5 """ @@ -1178,8 +1181,8 @@ def points_of_bounded_height(self, **kwds): :: sage: u = QQ['u'].0 - sage: P = ProductProjectiveSpaces([1, 1], NumberField(u^2 - 2, 'v')) - sage: sorted(list(P.points_of_bounded_height(bound=1.5))) + sage: P = ProductProjectiveSpaces([1, 1], NumberField(u^2 - 2, 'v')) # optional - sage.rings.number_field + sage: sorted(list(P.points_of_bounded_height(bound=1.5))) # optional - sage.rings.number_field [(-v : 1 , -v : 1), (-v : 1 , -1 : 1), (-v : 1 , -1/2*v : 1), (-v : 1 , 0 : 1), (-v : 1 , 1/2*v : 1), (-v : 1 , 1 : 0), (-v : 1 , 1 : 1), (-v : 1 , v : 1), (-1 : 1 , -v : 1), (-1 : 1 , -1 : 1), (-1 : 1 , -1/2*v : 1), (-1 : 1 , 0 : 1), (-1 : 1 , 1/2*v : 1), (-1 : 1 , 1 : 0), (-1 : 1 , 1 : 1), @@ -1236,8 +1239,8 @@ def _point(self, *args, **kwds): EXAMPLES:: - sage: P = ProductProjectiveSpaces([1, 2], GF(11)) - sage: P([3, 7, 4, 5, 9]) + sage: P = ProductProjectiveSpaces([1, 2], GF(11)) # optional - sage.rings.finite_rings + sage: P([3, 7, 4, 5, 9]) # optional - sage.rings.finite_rings (2 : 1 , 9 : 3 : 1) """ return ProductProjectiveSpaces_point_finite_field(*args, **kwds) @@ -1248,8 +1251,8 @@ def __iter__(self): EXAMPLES:: - sage: P = ProductProjectiveSpaces([2, 1], GF(3)) - sage: [x for x in P] + sage: P = ProductProjectiveSpaces([2, 1], GF(3)) # optional - sage.rings.finite_rings + sage: [x for x in P] # optional - sage.rings.finite_rings [(0 : 0 : 1 , 0 : 1), (0 : 1 : 1 , 0 : 1), (0 : 2 : 1 , 0 : 1), @@ -1281,8 +1284,8 @@ def rational_points(self, F=None): EXAMPLES:: - sage: P = ProductProjectiveSpaces([1, 1], GF(5)) - sage: P.rational_points() + sage: P = ProductProjectiveSpaces([1, 1], GF(5)) # optional - sage.rings.finite_rings + sage: P.rational_points() # optional - sage.rings.finite_rings [(0 : 1 , 0 : 1), (1 : 1 , 0 : 1), (2 : 1 , 0 : 1), (3 : 1 , 0 : 1), (4 : 1 , 0 : 1), (1 : 0 , 0 : 1), (0 : 1 , 1 : 1), (1 : 1 , 1 : 1), (2 : 1 , 1 : 1), (3 : 1 , 1 : 1), (4 : 1 , 1 : 1), (1 : 0 , 1 : 1), (0 : 1 , 2 : 1), (1 : 1 , 2 : 1), (2 : 1 , 2 : 1), (3 : 1 , 2 : 1), (4 : 1 , 2 : 1), (1 : 0 , 2 : 1), @@ -1292,8 +1295,8 @@ def rational_points(self, F=None): :: - sage: P = ProductProjectiveSpaces([1, 1], GF(2)) - sage: P.rational_points(GF(2^2,'a')) + sage: P = ProductProjectiveSpaces([1, 1], GF(2)) # optional - sage.rings.finite_rings + sage: P.rational_points(GF(2^2, 'a')) # optional - sage.rings.finite_rings [(0 : 1 , 0 : 1), (a : 1 , 0 : 1), (a + 1 : 1 , 0 : 1), (1 : 1 , 0 : 1), (1 : 0 , 0 : 1), (0 : 1 , a : 1), (a : 1 , a : 1), (a + 1 : 1 , a : 1), (1 : 1 , a : 1), (1 : 0 , a : 1), (0 : 1 , a + 1 : 1), (a : 1 , a + 1 : 1), (a + 1 : 1 , a + 1 : 1), (1 : 1 , a + 1 : 1), (1 : 0 , a + 1 : 1), (0 : 1 , 1 : 1), (a : 1 , 1 : 1), diff --git a/src/sage/schemes/product_projective/subscheme.py b/src/sage/schemes/product_projective/subscheme.py index 963feea3d09..5c8dc6efbc6 100644 --- a/src/sage/schemes/product_projective/subscheme.py +++ b/src/sage/schemes/product_projective/subscheme.py @@ -45,8 +45,8 @@ class AlgebraicScheme_subscheme_product_projective(AlgebraicScheme_subscheme_pro EXAMPLES:: - sage: P. = ProductProjectiveSpaces([1,1], QQ) - sage: P.subscheme([u*x^2-v*y*x]) + sage: P. = ProductProjectiveSpaces([1, 1], QQ) + sage: P.subscheme([u*x^2 - v*y*x]) Closed subscheme of Product of projective spaces P^1 x P^1 over Rational Field defined by: x^2*u - x*y*v @@ -55,7 +55,7 @@ class AlgebraicScheme_subscheme_product_projective(AlgebraicScheme_subscheme_pro sage: from sage.schemes.product_projective.subscheme \ import AlgebraicScheme_subscheme_product_projective - sage: AlgebraicScheme_subscheme_product_projective(P, [u*x^2-v*y*x]) + sage: AlgebraicScheme_subscheme_product_projective(P, [u*x^2 - v*y*x]) Closed subscheme of Product of projective spaces P^1 x P^1 over Rational Field defined by: x^2*u - x*y*v @@ -78,8 +78,8 @@ def segre_embedding(self, PP=None): EXAMPLES:: - sage: X. = ProductProjectiveSpaces([2,2], QQ) - sage: P = ProjectiveSpace(QQ,8,'t') + sage: X. = ProductProjectiveSpaces([2, 2], QQ) + sage: P = ProjectiveSpace(QQ, 8, 't') sage: L = (-w - v)*x + (-w*y - u*z) sage: Q = (-u*w - v^2)*x^2 + ((-w^2 - u*w + (-u*v - u^2))*y + (-w^2 - u*v)*z)*x + \ ((-w^2 - u*w - u^2)*y^2 + (-u*w - v^2)*z*y + (-w^2 + (-v - u)*w)*z^2) @@ -90,7 +90,7 @@ def segre_embedding(self, PP=None): :: - sage: PP. = ProductProjectiveSpaces([1,1,1], CC) + sage: PP. = ProductProjectiveSpaces([1, 1, 1], CC) sage: PP.subscheme([]).segre_embedding() Scheme morphism: From: Closed subscheme of Product of projective spaces P^1 x P^1 x P^1 @@ -112,8 +112,8 @@ def segre_embedding(self, PP=None): :: - sage: PP. = ProductProjectiveSpaces([2,1,1], ZZ) - sage: PP.subscheme([x^3, u-v, s^2-t^2]).segre_embedding() + sage: PP. = ProductProjectiveSpaces([2, 1, 1], ZZ) + sage: PP.subscheme([x^3, u - v, s^2 - t^2]).segre_embedding() Scheme morphism: From: Closed subscheme of Product of projective spaces P^2 x P^1 x P^1 over Integer Ring defined by: @@ -211,37 +211,37 @@ def dimension(self): EXAMPLES:: - sage: X. = ProductProjectiveSpaces([2,2],QQ) + sage: X. = ProductProjectiveSpaces([2, 2], QQ) sage: L = (-w - v)*x + (-w*y - u*z) sage: Q = (-u*w - v^2)*x^2 + ((-w^2 - u*w + (-u*v - u^2))*y + (-w^2 - u*v)*z)*x + \ ((-w^2 - u*w - u^2)*y^2 + (-u*w - v^2)*z*y + (-w^2 + (-v - u)*w)*z^2) - sage: W = X.subscheme([L,Q]) + sage: W = X.subscheme([L, Q]) sage: W.dimension() 2 :: - sage: PP. = ProductProjectiveSpaces([2,1,1], QQ) - sage: X = PP.subscheme([x^3, x^5+y^5, z^6, x*u-v*y, s^2-t^2]) + sage: PP. = ProductProjectiveSpaces([2, 1, 1], QQ) + sage: X = PP.subscheme([x^3, x^5 + y^5, z^6, x*u - v*y, s^2 - t^2]) sage: X.dimension() -1 :: - sage: PP = ProductProjectiveSpaces([2,1,3], CC, 't') + sage: PP = ProductProjectiveSpaces([2, 1, 3], CC, 't') sage: PP.subscheme([]).dimension() 6 :: - sage: PP = ProductProjectiveSpaces([1,3,1], ZZ, 't') + sage: PP = ProductProjectiveSpaces([1, 3, 1], ZZ, 't') sage: PP.subscheme([]).dimension() 5 :: sage: PP. = ProductProjectiveSpaces([1,1,1], CC) - sage: X = PP.subscheme([x^2-y^2, u-v, s^2-t^2]) + sage: X = PP.subscheme([x^2 - y^2, u - v, s^2 - t^2]) sage: X.dimension() 0 """ @@ -270,11 +270,11 @@ def is_smooth(self, point=None): EXAMPLES:: - sage: X. = ProductProjectiveSpaces([2,2],QQ) + sage: X. = ProductProjectiveSpaces([2, 2],QQ) sage: L = (-w - v)*x + (-w*y - u*z) sage: Q = (-u*w - v^2)*x^2 + ((-w^2 - u*w + (-u*v - u^2))*y + (-w^2 - u*v)*z)*x + \ ((-w^2 - u*w - u^2)*y^2 + (-u*w - v^2)*z*y + (-w^2 + (-v - u)*w)*z^2) - sage: W = X.subscheme([L,Q]) + sage: W = X.subscheme([L, Q]) sage: W.is_smooth() Traceback (most recent call last): ... @@ -301,9 +301,9 @@ def affine_patch(self, I, return_embedding=False): EXAMPLES:: - sage: PP. = ProductProjectiveSpaces([3,1],QQ) - sage: W = PP.subscheme([y^2*z-x^3,z^2-w^2,u^3-v^3]) - sage: W.affine_patch([0,1],True) + sage: PP. = ProductProjectiveSpaces([3, 1],QQ) + sage: W = PP.subscheme([y^2*z - x^3, z^2 - w^2, u^3 - v^3]) + sage: W.affine_patch([0, 1], True) (Closed subscheme of Affine Space of dimension 4 over Rational Field defined by: x0^2*x1 - 1, x1^2 - x2^2, @@ -377,7 +377,7 @@ def intersection_multiplicity(self, X, P): Multiplicity of a fixed point of the map `z^2 + \frac{1}{4}`:: - sage: PP. = ProductProjectiveSpaces(QQ, [1,1]) + sage: PP. = ProductProjectiveSpaces(QQ, [1, 1]) sage: G = PP.subscheme([(x^2 + 1/4*y^2)*v - y^2*u]) sage: D = PP.subscheme([x*v - y*u]) sage: sorted(G.intersection(D).rational_points()) @@ -388,17 +388,17 @@ def intersection_multiplicity(self, X, P): :: - sage: F. = GF(4) - sage: PP. = ProductProjectiveSpaces(F, [2,2]) - sage: X = PP.subscheme([z^5 + 3*x*y^4 + 8*y^5, u^2 - v^2]) - sage: Y = PP.subscheme([x^6 + z^6, w*z - v*y]) - sage: Q = PP([a,a+1,1,a,a,1]) - sage: X.intersection_multiplicity(Y, Q) + sage: F. = GF(4) # optional - sage.rings.finite_rings + sage: PP. = ProductProjectiveSpaces(F, [2, 2]) # optional - sage.rings.finite_rings + sage: X = PP.subscheme([z^5 + 3*x*y^4 + 8*y^5, u^2 - v^2]) # optional - sage.rings.finite_rings + sage: Y = PP.subscheme([x^6 + z^6, w*z - v*y]) # optional - sage.rings.finite_rings + sage: Q = PP([a,a+1,1,a,a,1]) # optional - sage.rings.finite_rings + sage: X.intersection_multiplicity(Y, Q) # optional - sage.rings.finite_rings 16 :: - sage: PP. = ProductProjectiveSpaces(QQ, [2,2]) + sage: PP. = ProductProjectiveSpaces(QQ, [2, 2]) sage: X = PP.subscheme([x^2*u^3 + y*z*u*v^2, x - y]) sage: Y = PP.subscheme([u^3 - w^3, x*v - y*w, z^3*w^2 - y^3*u*v]) sage: Q = PP([0,0,1,0,1,0]) @@ -445,7 +445,7 @@ def multiplicity(self, P): EXAMPLES:: - sage: PP. = ProductProjectiveSpaces(QQ, [1,1]) + sage: PP. = ProductProjectiveSpaces(QQ, [1, 1]) sage: X = PP.subscheme([x^4*z^3 - y^4*w^3]) sage: Q1 = PP([1,1,1,1]) sage: X.multiplicity(Q1) @@ -456,13 +456,13 @@ def multiplicity(self, P): :: - sage: PP. = ProductProjectiveSpaces(GF(11), [1,2]) - sage: X = PP.subscheme([x^7*u - y^7*z, u^6*x^2 - w^3*z^3*x*y - w^6*y^2]) - sage: Q1 = PP([1,0,10,1,0]) - sage: X.multiplicity(Q1) + sage: PP. = ProductProjectiveSpaces(GF(11), [1,2]) # optional - sage.rings.finite_rings + sage: X = PP.subscheme([x^7*u - y^7*z, u^6*x^2 - w^3*z^3*x*y - w^6*y^2]) # optional - sage.rings.finite_rings + sage: Q1 = PP([1,0,10,1,0]) # optional - sage.rings.finite_rings + sage: X.multiplicity(Q1) # optional - sage.rings.finite_rings 1 - sage: Q2 = PP([1,0,1,0,0]) - sage: X.multiplicity(Q2) + sage: Q2 = PP([1,0,1,0,0]) # optional - sage.rings.finite_rings + sage: X.multiplicity(Q2) # optional - sage.rings.finite_rings 4 """ PP = self.ambient_space() diff --git a/src/sage/schemes/toric/chow_group.py b/src/sage/schemes/toric/chow_group.py index 2384d342656..3ca2843a2ae 100644 --- a/src/sage/schemes/toric/chow_group.py +++ b/src/sage/schemes/toric/chow_group.py @@ -787,9 +787,9 @@ def _repr_(self) -> str: sage: P2 = toric_varieties.P2() sage: from sage.schemes.toric.chow_group import ChowGroup - sage: ChowGroup(P2,ZZ)._repr_() + sage: ChowGroup(P2, ZZ)._repr_() 'Chow group of 2-d CPR-Fano toric variety covered by 3 affine patches' - sage: ChowGroup(P2,QQ)._repr_() + sage: ChowGroup(P2, QQ)._repr_() 'QQ-Chow group of 2-d CPR-Fano toric variety covered by 3 affine patches' """ if self.base_ring() == QQ: @@ -855,15 +855,15 @@ def degree(self, k=None): Four exercises from page 65 of [Ful1993]_. First, an example with `A_1(X)=\ZZ\oplus\ZZ/3\ZZ`:: - sage: X = ToricVariety(Fan(cones=[[0,1],[1,2],[2,0]], - ....: rays=[[2,-1],[-1,2],[-1,-1]])) + sage: X = ToricVariety(Fan(cones=[[0,1], [1,2], [2,0]], + ....: rays=[[2,-1], [-1,2], [-1,-1]])) sage: A = X.Chow_group() sage: A.degree(1) C3 x Z Second, an example with `A_2(X)=\ZZ^2`:: - sage: points = [[1,0,0],[0,1,0],[0,0,1],[1,-1,1],[-1,0,-1]] + sage: points = [[1,0,0], [0,1,0], [0,0,1], [1,-1,1], [-1,0,-1]] sage: l = LatticePolytope(points) sage: l.show3d() sage: X = ToricVariety(FaceFan(l)) diff --git a/src/sage/schemes/toric/divisor.py b/src/sage/schemes/toric/divisor.py index 8647225c77b..823c64968af 100644 --- a/src/sage/schemes/toric/divisor.py +++ b/src/sage/schemes/toric/divisor.py @@ -93,7 +93,7 @@ Divisor class [1, 0, 0, 0] sage: Dx.divisor_class() in Cl True - sage: (-Dw+Dv+Dy).divisor_class() + sage: (-Dw + Dv + Dy).divisor_class() Divisor class [1, 0, 0, 0] sage: c0 Divisor class [1, 0, 0, 0] @@ -271,7 +271,7 @@ def ToricDivisor(toric_variety, arg=None, ring=None, check=True, reduce=True): V(u) + V(y) sage: dP6.inject_variables() Defining x, u, y, v, z, w - sage: ToricDivisor(dP6, u+y) + sage: ToricDivisor(dP6, u + y) Traceback (most recent call last): ... ValueError: u + y is not a monomial @@ -575,7 +575,7 @@ def m(self, cone): EXAMPLES:: sage: F = Fan(cones=[(0,1,2,3), (0,1,4)], - ....: rays=[(1,1,1), (1,-1,1), (1,-1,-1), (1,1,-1), (0,0,1)]) + ....: rays=[(1,1,1), (1,-1,1), (1,-1,-1), (1,1,-1), (0,0,1)]) sage: X = ToricVariety(F) sage: square_cone = X.fan().cone_containing(0,1,2,3) sage: triangle_cone = X.fan().cone_containing(0,1,4) @@ -781,7 +781,7 @@ def move_away_from(self, cone): EXAMPLES:: sage: F = Fan(cones=[(0,1,2,3), (0,1,4)], - ....: rays=[(1,1,1), (1,-1,1), (1,-1,-1), (1,1,-1), (0,0,1)]) + ....: rays=[(1,1,1), (1,-1,1), (1,-1,-1), (1,1,-1), (0,0,1)]) sage: X = ToricVariety(F) sage: square_cone = X.fan().cone_containing(0,1,2,3) sage: triangle_cone = X.fan().cone_containing(0,1,4) @@ -820,7 +820,7 @@ def cohomology_class(self): EXAMPLES:: sage: dP6 = toric_varieties.dP6() - sage: D = dP6.divisor(dP6.fan().ray(0) ) + sage: D = dP6.divisor(dP6.fan().ray(0)) sage: D.cohomology_class() [y + v - w] """ @@ -1160,7 +1160,7 @@ def sections(self): sage: rays = [(1,0,0),(0,1,0),(0,0,1),(-2,0,-1),(-2,-1,0),(-3,-1,-1),(1,1,1),(-1,0,0)] sage: cones = [[0,1,3],[0,1,6],[0,2,4],[0,2,6],[0,3,5],[0,4,5],[1,3,7],[1,6,7],[2,4,7],[2,6,7],[3,5,7],[4,5,7]] - sage: X = ToricVariety(Fan(rays=rays,cones=cones)) + sage: X = ToricVariety(Fan(rays=rays, cones=cones)) sage: D = X.divisor(2); D V(z2) sage: D.is_nef() @@ -1206,10 +1206,10 @@ def sections_monomials(self): From [Cox]_ page 38:: - sage: lp = LatticePolytope([(1,0),(1,1),(0,1),(-1,0),(0,-1)]) + sage: lp = LatticePolytope([(1,0), (1,1), (0,1), (-1,0), (0,-1)]) sage: lp 2-d reflexive polytope #5 in 2-d lattice M - sage: dP7 = ToricVariety( FaceFan(lp), 'x1, x2, x3, x4, x5') + sage: dP7 = ToricVariety(FaceFan(lp), 'x1, x2, x3, x4, x5') sage: AK = -dP7.K() sage: AK.sections() (N(-1, 0), N(-1, 1), N(0, -1), N(0, 0), @@ -1704,7 +1704,7 @@ def __init__(self, toric_variety, base_ring): parent classes even if the schemes are the same:: sage: from sage.schemes.generic.divisor_group import DivisorGroup - sage: DivisorGroup(P2,ZZ) is ToricDivisorGroup(P2,ZZ) + sage: DivisorGroup(P2, ZZ) is ToricDivisorGroup(P2, ZZ) False """ assert is_ToricVariety(toric_variety), str(toric_variety) + ' is not a toric variety!' diff --git a/src/sage/schemes/toric/fano_variety.py b/src/sage/schemes/toric/fano_variety.py index 1bf2b79ad36..1b319b75476 100644 --- a/src/sage/schemes/toric/fano_variety.py +++ b/src/sage/schemes/toric/fano_variety.py @@ -1380,9 +1380,9 @@ def __init__(self, P_Delta, monomial_points=None, coefficient_names=None, Check that finite fields are handled correctly :trac:`14899`:: - sage: F = GF(5^2, "a") - sage: X = P1xP1.change_ring(F) - sage: X.anticanonical_hypersurface(monomial_points="all", + sage: F = GF(5^2, "a") # optional - sage.rings.finite_rings + sage: X = P1xP1.change_ring(F) # optional - sage.rings.finite_rings + sage: X.anticanonical_hypersurface(monomial_points="all", # optional - sage.rings.finite_rings ....: coefficients=[1]*X.Delta().npoints()) Closed subscheme of 2-d CPR-Fano toric variety covered by 4 affine patches defined by: diff --git a/src/sage/schemes/toric/homset.py b/src/sage/schemes/toric/homset.py index a057ecdf1ab..6ecc4990d15 100644 --- a/src/sage/schemes/toric/homset.py +++ b/src/sage/schemes/toric/homset.py @@ -57,7 +57,7 @@ sage: P1xP1.inject_variables() Defining s, t, x, y - sage: S = P1xP1.subscheme([s*x-t*y]) + sage: S = P1xP1.subscheme([s*x - t*y]) sage: type(S.Hom(S)) @@ -355,11 +355,11 @@ def _naive_enumerator(self, ring=None): EXAMPLES:: - sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) - sage: point_set = P123.point_set() - sage: next(iter(point_set._naive_enumerator())) + sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) # optional - sage.rings.finite_rings + sage: point_set = P123.point_set() # optional - sage.rings.finite_rings + sage: next(iter(point_set._naive_enumerator())) # optional - sage.rings.finite_rings (0, 0, 1) - sage: next(iter(point_set)) + sage: next(iter(point_set)) # optional - sage.rings.finite_rings [0 : 0 : 1] """ from sage.schemes.toric.points import NaiveFinitePointEnumerator @@ -386,11 +386,11 @@ def _finite_field_enumerator(self, finite_field=None): EXAMPLES:: - sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) - sage: point_set = P123.point_set() - sage: next(iter(point_set._finite_field_enumerator())) + sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) # optional - sage.rings.finite_rings + sage: point_set = P123.point_set() # optional - sage.rings.finite_rings + sage: next(iter(point_set._finite_field_enumerator())) # optional - sage.rings.finite_rings (0, 0, 1) - sage: next(iter(point_set)) + sage: next(iter(point_set)) # optional - sage.rings.finite_rings [0 : 0 : 1] """ from sage.schemes.toric.points import FiniteFieldPointEnumerator @@ -412,9 +412,9 @@ def _enumerator(self): EXAMPLES:: - sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) - sage: point_set = P123.point_set() - sage: point_set._enumerator() + sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) # optional - sage.rings.finite_rings + sage: point_set = P123.point_set() # optional - sage.rings.finite_rings + sage: point_set._enumerator() # optional - sage.rings.finite_rings """ ring = self.domain().base_ring() @@ -459,11 +459,11 @@ class SchemeHomset_points_toric_field(SchemeHomset_points_toric_base): unity:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_field=GF(7)) - sage: point_set = X.point_set() - sage: point_set.cardinality() + sage: X = ToricVariety(fan, base_field=GF(7)) # optional - sage.rings.finite_rings + sage: point_set = X.point_set() # optional - sage.rings.finite_rings + sage: point_set.cardinality() # optional - sage.rings.finite_rings 21 - sage: sorted(X.point_set().list()) + sage: sorted(X.point_set().list()) # optional - sage.rings.finite_rings [[0 : 0 : 1], [0 : 1 : 0], [0 : 1 : 1], [0 : 1 : 3], [1 : 0 : 0], [1 : 0 : 1], [1 : 0 : 3], [1 : 1 : 0], [1 : 1 : 1], [1 : 1 : 2], [1 : 1 : 3], [1 : 1 : 4], @@ -477,9 +477,9 @@ class SchemeHomset_points_toric_field(SchemeHomset_points_toric_base): on the fiber:: sage: fan = Fan([Cone([(1,0), (1,1)]), Cone([(1,1), (0,1)])]) - sage: blowup_plane = ToricVariety(fan, base_ring=GF(3)) - sage: point_set = blowup_plane.point_set() - sage: sorted(point_set.list()) + sage: blowup_plane = ToricVariety(fan, base_ring=GF(3)) # optional - sage.rings.finite_rings + sage: point_set = blowup_plane.point_set() # optional - sage.rings.finite_rings + sage: sorted(point_set.list()) # optional - sage.rings.finite_rings [[0 : 1 : 0], [0 : 1 : 1], [0 : 1 : 2], [1 : 0 : 0], [1 : 0 : 1], [1 : 0 : 2], [1 : 1 : 0], [1 : 1 : 1], [1 : 1 : 2], @@ -488,8 +488,8 @@ class SchemeHomset_points_toric_field(SchemeHomset_points_toric_base): Toric varieties with torus factors (that is, where the fan is not full-dimensional) also work:: - sage: F_times_Fstar = ToricVariety(Fan([Cone([(1,0)])]), base_field=GF(3)) - sage: sorted(F_times_Fstar.point_set().list()) + sage: F_times_Fstar = ToricVariety(Fan([Cone([(1,0)])]), base_field=GF(3)) # optional - sage.rings.finite_rings + sage: sorted(F_times_Fstar.point_set().list()) # optional - sage.rings.finite_rings [[0 : 1], [0 : 2], [1 : 1], [1 : 2], [2 : 1], [2 : 2]] TESTS:: @@ -522,18 +522,18 @@ def cardinality(self): rescalings are solved. This is somewhat slower:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_field=GF(7)) - sage: X.point_set().cardinality() + sage: X = ToricVariety(fan, base_field=GF(7)) # optional - sage.rings.finite_rings + sage: X.point_set().cardinality() # optional - sage.rings.finite_rings 21 Fulton's formula does not apply since the variety is not smooth. And, indeed, naive application gives a different result:: - sage: q = X.base_ring().order() - sage: n = X.dimension() - sage: d = map(len, fan().cones()) - sage: sum(dk * (q-1)**(n-k) for k, dk in enumerate(d)) + sage: q = X.base_ring().order() # optional - sage.rings.finite_rings + sage: n = X.dimension() # optional - sage.rings.finite_rings + sage: d = map(len, fan().cones()) # optional - sage.rings.finite_rings + sage: sum(dk * (q-1)**(n-k) for k, dk in enumerate(d)) # optional - sage.rings.finite_rings 57 Over infinite fields the number of points is not very tricky:: @@ -584,11 +584,11 @@ def __iter__(self): EXAMPLES:: - sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) - sage: point_set = P123.point_set() - sage: next(iter(point_set.__iter__())) + sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) # optional - sage.rings.finite_rings + sage: point_set = P123.point_set() # optional - sage.rings.finite_rings + sage: next(iter(point_set.__iter__())) # optional - sage.rings.finite_rings [0 : 0 : 1] - sage: next(iter(point_set)) # syntactic sugar + sage: next(iter(point_set)) # syntactic sugar # optional - sage.rings.finite_rings [0 : 0 : 1] """ for pt in self._enumerator(): @@ -608,9 +608,9 @@ def _enumerator(self): EXAMPLES:: - sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) - sage: point_set = P123.point_set() - sage: point_set._enumerator() + sage: P123 = toric_varieties.P2_123(base_ring=GF(3)) # optional - sage.rings.finite_rings + sage: point_set = P123.point_set() # optional - sage.rings.finite_rings + sage: point_set._enumerator() # optional - sage.rings.finite_rings """ ambient = super()._enumerator() @@ -633,11 +633,11 @@ def __iter__(self): EXAMPLES:: - sage: P2. = toric_varieties.P2(base_ring=GF(5)) - sage: cubic = P2.subscheme([x^3 + y^3 + z^3]) - sage: list(cubic.point_set()) + sage: P2. = toric_varieties.P2(base_ring=GF(5)) # optional - sage.rings.finite_rings + sage: cubic = P2.subscheme([x^3 + y^3 + z^3]) # optional - sage.rings.finite_rings + sage: list(cubic.point_set()) # optional - sage.rings.finite_rings [[0 : 1 : 4], [1 : 0 : 4], [1 : 4 : 0], [1 : 1 : 2], [1 : 2 : 1], [1 : 3 : 3]] - sage: cubic.point_set().cardinality() + sage: cubic.point_set().cardinality() # optional - sage.rings.finite_rings 6 """ for p in self._enumerator(): @@ -653,11 +653,11 @@ def cardinality(self): EXAMPLES:: - sage: P2. = toric_varieties.P2(base_ring=GF(5)) - sage: cubic = P2.subscheme([x^3 + y^3 + z^3]) - sage: list(cubic.point_set()) + sage: P2. = toric_varieties.P2(base_ring=GF(5)) # optional - sage.rings.finite_rings + sage: cubic = P2.subscheme([x^3 + y^3 + z^3]) # optional - sage.rings.finite_rings + sage: list(cubic.point_set()) # optional - sage.rings.finite_rings [[0 : 1 : 4], [1 : 0 : 4], [1 : 4 : 0], [1 : 1 : 2], [1 : 2 : 1], [1 : 3 : 3]] - sage: cubic.point_set().cardinality() + sage: cubic.point_set().cardinality() # optional - sage.rings.finite_rings 6 """ try: diff --git a/src/sage/schemes/toric/ideal.py b/src/sage/schemes/toric/ideal.py index e5902d83ffd..ba40a461047 100644 --- a/src/sage/schemes/toric/ideal.py +++ b/src/sage/schemes/toric/ideal.py @@ -19,7 +19,7 @@ EXAMPLES:: - sage: A = matrix([[1,1,1],[0,1,2]]) + sage: A = matrix([[1,1,1], [0,1,2]]) sage: IA = ToricIdeal(A) sage: IA.ker() Free module of degree 3 and rank 1 over Integer Ring @@ -34,7 +34,7 @@ this toric ideal ([Stu1997]_, Example 1.2) is the twisted cubic and cannot be generated by `2=\dim \ker(A)` polynomials:: - sage: A = matrix([[3,2,1,0],[0,1,2,3]]) + sage: A = matrix([[3,2,1,0], [0,1,2,3]]) sage: IA = ToricIdeal(A) sage: IA.ker() Free module of degree 4 and rank 2 over Integer Ring @@ -49,7 +49,8 @@ [Stu1997]_. One can show that `I_d` is generated by one quadric and `d` binomials of degree `d`:: - sage: I = lambda d: ToricIdeal(matrix([[1,1,1,1,1],[0,1,1,0,0],[0,0,1,1,d]])) + sage: def I(d): + ....: return ToricIdeal(matrix([[1,1,1,1,1],[0,1,1,0,0],[0,0,1,1,d]])) sage: I(2) Ideal (-z3^2 + z0*z4, z0*z2 - z1*z3, @@ -168,7 +169,7 @@ class ToricIdeal(MPolynomialIdeal): EXAMPLES:: - sage: A = matrix([[1,1,1],[0,1,2]]) + sage: A = matrix([[1,1,1], [0,1,2]]) sage: ToricIdeal(A) Ideal (-z1^2 + z0*z2) of Multivariate Polynomial Ring in z0, z1, z2 over Rational Field @@ -212,16 +213,17 @@ def __init__(self, A, EXAMPLES:: - sage: A = matrix([[1,1,1],[0,1,2]]) + sage: A = matrix([[1,1,1], [0,1,2]]) sage: ToricIdeal(A) Ideal (-z1^2 + z0*z2) of Multivariate Polynomial Ring in z0, z1, z2 over Rational Field - sage: ToricIdeal(A, names='x', base_ring=GF(101)) + sage: ToricIdeal(A, names='x', base_ring=GF(101)) # optional - sage.rings.finite_rings Ideal (-x1^2 + x0*x2) of Multivariate Polynomial Ring in x0, x1, x2 over Finite Field of size 101 sage: ToricIdeal(A, names='x', base_ring=FractionField(QQ['t'])) - Ideal (-x1^2 + x0*x2) of Multivariate Polynomial Ring - in x0, x1, x2 over Fraction Field of Univariate Polynomial Ring in t over Rational Field + Ideal (-x1^2 + x0*x2) of + Multivariate Polynomial Ring in x0, x1, x2 over + Fraction Field of Univariate Polynomial Ring in t over Rational Field """ self._A = matrix(ZZ, A) if polynomial_ring: @@ -253,7 +255,7 @@ def A(self): EXAMPLES:: - sage: A = matrix([[1,1,1],[0,1,2]]) + sage: A = matrix([[1,1,1], [0,1,2]]) sage: IA = ToricIdeal(A) sage: IA.A() [1 1 1] @@ -271,7 +273,7 @@ def ker(self): EXAMPLES:: - sage: A = matrix([[1,1,1],[0,1,2]]) + sage: A = matrix([[1,1,1], [0,1,2]]) sage: IA = ToricIdeal(A) sage: IA.ker() Free module of degree 3 and rank 1 over Integer Ring @@ -295,7 +297,7 @@ def nvariables(self): EXAMPLES:: - sage: A = matrix([[1,1,1],[0,1,2]]) + sage: A = matrix([[1,1,1], [0,1,2]]) sage: IA = ToricIdeal(A) sage: IA.nvariables() 3 @@ -324,7 +326,7 @@ def _init_ring(self, term_order): EXAMPLES:: - sage: A = matrix([[1,1,1],[0,1,2]]) + sage: A = matrix([[1,1,1], [0,1,2]]) sage: IA = ToricIdeal(A) sage: R = IA._init_ring('neglex'); R Multivariate Polynomial Ring in z0, z1, z2 over Rational Field @@ -352,7 +354,7 @@ def _naive_ideal(self, ring): EXAMPLES:: - sage: A = matrix([[1,1,1],[0,1,2]]) + sage: A = matrix([[1,1,1], [0,1,2]]) sage: IA = ToricIdeal(A) sage: IA.ker() Free module of degree 3 and rank 1 over Integer Ring @@ -439,7 +441,7 @@ def _ideal_HostenSturmfels(self): EXAMPLES:: - sage: A = matrix([[3,2,1,0],[0,1,2,3]]) + sage: A = matrix([[3,2,1,0], [0,1,2,3]]) sage: IA = ToricIdeal(A); IA Ideal (-z1*z2 + z0*z3, -z1^2 + z0*z2, z2^2 - z1*z3) of Multivariate Polynomial Ring in z0, z1, z2, z3 over Rational Field @@ -449,7 +451,7 @@ def _ideal_HostenSturmfels(self): TESTS:: - sage: I_2x2 = identity_matrix(ZZ,2) + sage: I_2x2 = identity_matrix(ZZ, 2) sage: ToricIdeal(I_2x2) Ideal (0) of Multivariate Polynomial Ring in z0, z1 over Rational Field """ diff --git a/src/sage/schemes/toric/library.py b/src/sage/schemes/toric/library.py index 6f3617f22b6..42d670b5311 100644 --- a/src/sage/schemes/toric/library.py +++ b/src/sage/schemes/toric/library.py @@ -1387,7 +1387,7 @@ def WP(self, *q, **kw): sage: X = toric_varieties.WP([1,3,1], names='x y z') sage: X.inject_variables() Defining x, y, z - sage: g = y^2-(x^6-z^6) + sage: g = y^2 - (x^6-z^6) sage: C = X.subscheme([g]); C Closed subscheme of 2-d toric variety covered by 3 affine patches defined by: -x^6 + z^6 + y^2 diff --git a/src/sage/schemes/toric/morphism.py b/src/sage/schemes/toric/morphism.py index d41c35c5a7b..5bfd8f55821 100644 --- a/src/sage/schemes/toric/morphism.py +++ b/src/sage/schemes/toric/morphism.py @@ -48,7 +48,7 @@ sage: P2. = toric_varieties.P2() sage: P1. = toric_varieties.P1() - sage: P1.hom([0,u^2+v^2,u*v], P2) + sage: P1.hom([0, u^2 + v^2, u*v], P2) Scheme morphism: From: 1-d CPR-Fano toric variety covered by 2 affine patches To: 2-d CPR-Fano toric variety covered by 3 affine patches @@ -93,7 +93,7 @@ Consider instead the following morphism of fans:: - sage: fm = FanMorphism( matrix(ZZ,[[1,0]]), P1.fan(), P2.fan() ); fm + sage: fm = FanMorphism(matrix(ZZ, [[1,0]]), P1.fan(), P2.fan()); fm Fan morphism defined by the matrix [1 0] Domain fan: Rational polyhedral fan in 1-d lattice N @@ -217,7 +217,8 @@ 2-dimensional cone, which represents the exceptional set of the blow-up in this single coordinate chart. Lets investigate further:: - sage: exceptional_cones = single_chart.fan_morphism().primitive_preimage_cones(A2_Z2.fan(2)[0]) + sage: fm = single_chart.fan_morphism() + sage: exceptional_cones = fm.primitive_preimage_cones(A2_Z2.fan(2)[0]) sage: exceptional_set = single_chart.fiber_component(exceptional_cones[0]) sage: exceptional_set 1-d affine toric variety @@ -237,7 +238,7 @@ sage: A3 = toric_varieties.A(3) sage: P3 = toric_varieties.P(3) - sage: m = matrix([(2,0,0), (1,1,0), (3, 1, 0)]) + sage: m = matrix([(2,0,0), (1,1,0), (3,1,0)]) sage: phi = A3.hom(m, P3) sage: phi.as_polynomial_map() Scheme morphism: @@ -479,7 +480,7 @@ class SchemeMorphism_polynomial_toric_variety(SchemeMorphism_polynomial, Morphis sage: P1xP1 = toric_varieties.P1xP1() sage: P1xP1.inject_variables() Defining s, t, x, y - sage: P1 = P1xP1.subscheme(s-t) + sage: P1 = P1xP1.subscheme(s - t) sage: H = P1xP1.Hom(P1) sage: import sage.schemes.toric.morphism as MOR sage: MOR.SchemeMorphism_polynomial_toric_variety(H, [s, s, x, y]) @@ -501,7 +502,7 @@ def __init__(self, parent, polynomials, check=True): sage: P1xP1 = toric_varieties.P1xP1() sage: P1xP1.inject_variables() Defining s, t, x, y - sage: P1 = P1xP1.subscheme(s-t) + sage: P1 = P1xP1.subscheme(s - t) sage: H = P1xP1.Hom(P1) sage: import sage.schemes.toric.morphism as MOR sage: MOR.SchemeMorphism_polynomial_toric_variety(H, [s, s, x, y]) @@ -833,7 +834,7 @@ class SchemeMorphism_fan_toric_variety(SchemeMorphism, Morphism): sage: P1xP1 = toric_varieties.P1xP1() sage: P1 = toric_varieties.P1() sage: hom_set = P1xP1.Hom(P1) - sage: fm = FanMorphism( matrix(ZZ,[[1],[0]]), P1xP1.fan(), P1.fan() ) + sage: fm = FanMorphism(matrix(ZZ, [[1],[0]]), P1xP1.fan(), P1.fan()) sage: hom_set(fm) Scheme morphism: From: 2-d CPR-Fano toric variety covered by 4 affine patches @@ -858,7 +859,7 @@ def __init__(self, parent, fan_morphism, check=True): sage: P1xP1 = toric_varieties.P1xP1() sage: P1 = toric_varieties.P1() sage: hom_set = P1xP1.Hom(P1) - sage: fan_morphism = FanMorphism( matrix(ZZ,[[1],[0]]), P1xP1.fan(), P1.fan() ) + sage: fan_morphism = FanMorphism(matrix(ZZ, [[1],[0]]), P1xP1.fan(), P1.fan()) sage: from sage.schemes.toric.morphism import SchemeMorphism_fan_toric_variety sage: SchemeMorphism_fan_toric_variety(hom_set, fan_morphism) Scheme morphism: @@ -1311,7 +1312,7 @@ def pullback_divisor(self, divisor): sage: A2_Z2 = toric_varieties.A2_Z2() sage: A2 = toric_varieties.A2() - sage: f = A2.hom( matrix([[1,0],[1,2]]), A2_Z2) + sage: f = A2.hom(matrix([[1,0], [1,2]]), A2_Z2) sage: f.pullback_divisor(A2_Z2.divisor(0)) V(x) @@ -1423,7 +1424,7 @@ def fiber_generic(self): [1 : 1 : z0 : z1] sage: A1 = toric_varieties.A1() - sage: fan = Fan([(0,1,2)], [(1,1,0),(1,0,1),(1,-1,-1)]) + sage: fan = Fan([(0,1,2)], [(1,1,0), (1,0,1), (1,-1,-1)]) sage: fan = fan.subdivide(new_rays=[(1,0,0)]) sage: f = ToricVariety(fan).hom(matrix([[1],[0],[0]]), A1) sage: f.fiber_generic() @@ -1478,10 +1479,11 @@ def fiber_component(self, domain_cone, multiplicity=False): ....: (0,1,0,0),(0,2,-1,-1),(1,0,0,0),(2,0,-1,-1)]) sage: coarse_fan = FaceFan(polytope) sage: P2 = toric_varieties.P2() - sage: proj24 = matrix([[0,0],[1,0],[0,0],[0,1]]) + sage: proj24 = matrix([[0,0], [1,0], [0,0], [0,1]]) sage: fm = FanMorphism(proj24, coarse_fan, P2.fan(), subdivide=True) sage: fibration = ToricVariety(fm.domain_fan()).hom(fm, P2) - sage: primitive_cones = fibration.fan_morphism().primitive_preimage_cones(P2.fan(1)[0]) + sage: ffm = fibration.fan_morphism() + sage: primitive_cones = ffm.primitive_preimage_cones(P2.fan(1)[0]) sage: primitive_cone = primitive_cones[0] sage: fibration.fiber_component(primitive_cone) 2-d toric variety covered by 4 affine patches @@ -1597,11 +1599,12 @@ def fiber_graph(self, codomain_cone): sage: coarse_fan = FaceFan(polytope, lattice=ToricLattice(4)) sage: P2 = toric_varieties.P2() - sage: proj34 = block_matrix(2,1,[zero_matrix(2,2), identity_matrix(2)]) + sage: proj34 = block_matrix(2, 1, [zero_matrix(2,2), + ....: identity_matrix(2)]) sage: fm = FanMorphism(proj34, coarse_fan, P2.fan(), subdivide=True) sage: fibration = ToricVariety(fm.domain_fan()).hom(fm, P2) - sage: fibration.fiber_graph( P2.fan(0)[0] ) + sage: fibration.fiber_graph(P2.fan(0)[0]) Graph on 1 vertex sage: for c1 in P2.fan(1): ....: fibration.fiber_graph(c1) @@ -1674,7 +1677,8 @@ class SchemeMorphism_fan_fiber_component_toric_variety(SchemeMorphism): sage: proj24 = matrix([[0,0],[1,0],[0,0],[0,1]]) sage: fm = FanMorphism(proj24, coarse_fan, P2.fan(), subdivide=True) sage: fibration = ToricVariety(fm.domain_fan()).hom(fm, P2) - sage: primitive_cones = fibration.fan_morphism().primitive_preimage_cones(P2.fan(1)[0]) + sage: ffm = fibration.fan_morphism() + sage: primitive_cones = ffm.primitive_preimage_cones(P2.fan(1)[0]) sage: primitive_cone = primitive_cones[0] sage: fiber_component = fibration.fiber_component(primitive_cone) sage: fiber_component @@ -1706,7 +1710,7 @@ def __init__(self, toric_morphism, defining_cone): ....: (0,1,0,0),(0,2,-1,-1),(1,0,0,0),(2,0,-1,-1)]) sage: coarse_fan = FaceFan(polytope, lattice=ToricLattice(4)) sage: P2 = toric_varieties.P2() - sage: proj24 = matrix([[0,0],[1,0],[0,0],[0,1]]) + sage: proj24 = matrix([[0,0], [1,0], [0,0], [0,1]]) sage: fm = FanMorphism(proj24, coarse_fan, P2.fan(), subdivide=True) sage: fibration = ToricVariety(fm.domain_fan()).hom(fm, P2) sage: primitive_cone = Cone([(-1, 2, -1, 0)]) @@ -1762,7 +1766,7 @@ def as_polynomial_map(self): ....: (0,1,0,0),(0,2,-1,-1),(1,0,0,0),(2,0,-1,-1)]) sage: coarse_fan = FaceFan(polytope, lattice=ToricLattice(4)) sage: P2 = toric_varieties.P2() - sage: proj24 = matrix([[0,0],[1,0],[0,0],[0,1]]) + sage: proj24 = matrix([[0,0], [1,0], [0,0], [0,1]]) sage: fm = FanMorphism(proj24, coarse_fan, P2.fan(), subdivide=True) sage: fibration = ToricVariety(fm.domain_fan()).hom(fm, P2) @@ -1939,7 +1943,7 @@ def _image_ray_multiplicity(self, fiber_ray): ....: (0,1,0,0),(0,2,-1,-1),(1,0,0,0),(2,0,-1,-1)]) sage: coarse_fan = FaceFan(polytope, lattice=ToricLattice(4)) sage: P2 = toric_varieties.P2() - sage: proj24 = matrix([[0,0],[1,0],[0,0],[0,1]]) + sage: proj24 = matrix([[0,0], [1,0], [0,0], [0,1]]) sage: fm = FanMorphism(proj24, coarse_fan, P2.fan(), subdivide=True) sage: fibration = ToricVariety(fm.domain_fan()).hom(fm, P2) sage: primitive_cone = Cone([(-1, 2, -1, 0)]) diff --git a/src/sage/schemes/toric/points.py b/src/sage/schemes/toric/points.py index a0e0d586563..a7224407150 100644 --- a/src/sage/schemes/toric/points.py +++ b/src/sage/schemes/toric/points.py @@ -14,13 +14,13 @@ EXAMPLES:: - sage: P2 = toric_varieties.P2(base_ring=GF(3)) - sage: point_set = P2.point_set() - sage: point_set.cardinality() + sage: P2 = toric_varieties.P2(base_ring=GF(3)) # optional - sage.rings.finite_rings + sage: point_set = P2.point_set() # optional - sage.rings.finite_rings + sage: point_set.cardinality() # optional - sage.rings.finite_rings 13 - sage: next(iter(point_set)) + sage: next(iter(point_set)) # optional - sage.rings.finite_rings [0 : 0 : 1] - sage: list(point_set)[0:5] + sage: list(point_set)[0:5] # optional - sage.rings.finite_rings [[0 : 0 : 1], [1 : 0 : 0], [0 : 1 : 0], [0 : 1 : 1], [0 : 1 : 2]] """ @@ -125,8 +125,8 @@ def __init__(self, fan, ring): sage: from sage.schemes.toric.points import NaiveFinitePointEnumerator sage: fan = toric_varieties.P2().fan() - sage: n = NaiveFinitePointEnumerator(fan, GF(3)) - sage: next(iter(n)) + sage: n = NaiveFinitePointEnumerator(fan, GF(3)) # optional - sage.rings.finite_rings + sage: next(iter(n)) # optional - sage.rings.finite_rings (0, 0, 1) """ assert ring.is_finite() @@ -149,8 +149,8 @@ def rays(self): sage: fan.rays() Empty collection in 2-d lattice N - sage: n = NaiveFinitePointEnumerator(fan, GF(3)) - sage: n.rays() + sage: n = NaiveFinitePointEnumerator(fan, GF(3)) # optional - sage.rings.finite_rings + sage: n.rays() # optional - sage.rings.finite_rings N(1, 0), N(0, 1) in 2-d lattice N @@ -164,8 +164,9 @@ def units(self): EXAMPLES:: - sage: ne = toric_varieties.P2(base_ring=GF(5)).point_set()._naive_enumerator() - sage: ne.units() + sage: P2 = toric_varieties.P2(base_ring=GF(5)) # optional - sage.rings.finite_rings + sage: ne = P2.point_set()._naive_enumerator() # optional - sage.rings.finite_rings + sage: ne.units() # optional - sage.rings.finite_rings (1, 2, 3, 4) """ return tuple(x for x in self.ring if x != 0) @@ -186,12 +187,13 @@ def roots(self, n): EXAMPLES:: - sage: ne = toric_varieties.P2(base_ring=GF(5)).point_set()._naive_enumerator() - sage: ne.roots(2) + sage: P2 = toric_varieties.P2(base_ring=GF(5)) # optional - sage.rings.finite_rings + sage: ne = P2.point_set()._naive_enumerator() # optional - sage.rings.finite_rings + sage: ne.roots(2) # optional - sage.rings.finite_rings (1, 4) - sage: ne.roots(3) + sage: ne.roots(3) # optional - sage.rings.finite_rings (1,) - sage: ne.roots(4) + sage: ne.roots(4) # optional - sage.rings.finite_rings (1, 2, 3, 4) """ return tuple(x for x in self.ring if x**n == self.ring.one()) @@ -208,11 +210,11 @@ def _Chow_group_free(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_ring=GF(7)) - sage: X.Chow_group().degree(1) + sage: X = ToricVariety(fan, base_ring=GF(7)) # optional - sage.rings.finite_rings + sage: X.Chow_group().degree(1) # optional - sage.rings.finite_rings C3 x Z - sage: enum = X.point_set()._naive_enumerator() - sage: enum._Chow_group_free() + sage: enum = X.point_set()._naive_enumerator() # optional - sage.rings.finite_rings + sage: enum._Chow_group_free() # optional - sage.rings.finite_rings ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5), (6, 6, 6)) """ units = self.units() @@ -236,11 +238,11 @@ def _Chow_group_torsion(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_ring=GF(7)) - sage: X.Chow_group().degree(1) + sage: X = ToricVariety(fan, base_ring=GF(7)) # optional - sage.rings.finite_rings + sage: X.Chow_group().degree(1) # optional - sage.rings.finite_rings C3 x Z - sage: enum = X.point_set()._naive_enumerator() - sage: enum._Chow_group_torsion() + sage: enum = X.point_set()._naive_enumerator() # optional - sage.rings.finite_rings + sage: enum._Chow_group_torsion() # optional - sage.rings.finite_rings ((1, 2, 4), (1, 4, 2)) """ if self.fan.is_smooth(): @@ -269,16 +271,19 @@ def rescalings(self): EXAMPLES:: - sage: ni = toric_varieties.P2_123(base_ring=GF(5)).point_set()._naive_enumerator() - sage: ni.rescalings() + sage: P2_123 = toric_varieties.P2_123(base_ring=GF(5)) # optional - sage.rings.finite_rings + sage: ni = P2_123.point_set()._naive_enumerator() # optional - sage.rings.finite_rings + sage: ni.rescalings() # optional - sage.rings.finite_rings ((1, 1, 1), (1, 4, 4), (4, 2, 3), (4, 3, 2)) - sage: ni = toric_varieties.dP8(base_ring=GF(3)).point_set()._naive_enumerator() - sage: ni.rescalings() + sage: dP8 = toric_varieties.dP8(base_ring=GF(3)) # optional - sage.rings.finite_rings + sage: ni = dP8.point_set()._naive_enumerator() # optional - sage.rings.finite_rings + sage: ni.rescalings() # optional - sage.rings.finite_rings ((1, 1, 1, 1), (1, 2, 2, 2), (2, 1, 2, 1), (2, 2, 1, 2)) - sage: ni = toric_varieties.P1xP1(base_ring=GF(3)).point_set()._naive_enumerator() - sage: ni.rescalings() + sage: P1xP1 = toric_varieties.P1xP1(base_ring=GF(3)) # optional - sage.rings.finite_rings + sage: ni = P1xP1.point_set()._naive_enumerator() # optional - sage.rings.finite_rings + sage: ni.rescalings() # optional - sage.rings.finite_rings ((1, 1, 1, 1), (1, 1, 2, 2), (2, 2, 1, 1), (2, 2, 2, 2)) """ free = self._Chow_group_free() @@ -302,14 +307,15 @@ def orbit(self, point): EXAMPLES:: - sage: ne = toric_varieties.P2_123(base_ring=GF(7)).point_set()._naive_enumerator() - sage: sorted(ne.orbit([1, 0, 0])) + sage: P2_123 = toric_varieties.P2_123(base_ring=GF(7)) # optional - sage.rings.finite_rings + sage: ne = P2_123.point_set()._naive_enumerator() # optional - sage.rings.finite_rings + sage: sorted(ne.orbit([1, 0, 0])) # optional - sage.rings.finite_rings [(1, 0, 0), (2, 0, 0), (4, 0, 0)] - sage: sorted(ne.orbit([0, 1, 0])) + sage: sorted(ne.orbit([0, 1, 0])) # optional - sage.rings.finite_rings [(0, 1, 0), (0, 6, 0)] - sage: sorted(ne.orbit([0, 0, 1])) + sage: sorted(ne.orbit([0, 0, 1])) # optional - sage.rings.finite_rings [(0, 0, 1), (0, 0, 2), (0, 0, 3), (0, 0, 4), (0, 0, 5), (0, 0, 6)] - sage: sorted(ne.orbit([1, 1, 0])) + sage: sorted(ne.orbit([1, 1, 0])) # optional - sage.rings.finite_rings [(1, 1, 0), (1, 6, 0), (2, 1, 0), (2, 6, 0), (4, 1, 0), (4, 6, 0)] """ result = set() @@ -329,8 +335,9 @@ def cone_iter(self): EXAMPLES:: - sage: ne = toric_varieties.dP6(base_ring=GF(11)).point_set()._naive_enumerator() - sage: for cone in ne.cone_iter(): + sage: dP6 = toric_varieties.dP6(base_ring=GF(11)) # optional - sage.rings.finite_rings + sage: ne = dP6.point_set()._naive_enumerator() # optional - sage.rings.finite_rings + sage: for cone in ne.cone_iter(): # optional - sage.rings.finite_rings ....: print(cone.ambient_ray_indices()) (0, 1) (1, 2) @@ -364,22 +371,24 @@ def coordinate_iter(self): EXAMPLES:: - sage: F2 = GF(2) - sage: ni = toric_varieties.P2(base_ring=F2).point_set()._naive_enumerator() - sage: list(ni.coordinate_iter()) - [(0, 0, 1), (1, 0, 0), (0, 1, 0), (0, 1, 1), (1, 0, 1), (1, 1, 0), (1, 1, 1)] + sage: P2 = toric_varieties.P2(base_ring=GF(2)) # optional - sage.rings.finite_rings + sage: ni = P2.point_set()._naive_enumerator() # optional - sage.rings.finite_rings + sage: list(ni.coordinate_iter()) # optional - sage.rings.finite_rings + [(0, 0, 1), (1, 0, 0), (0, 1, 0), (0, 1, 1), + (1, 0, 1), (1, 1, 0), (1, 1, 1)] - sage: ni = toric_varieties.P1xP1(base_ring=F2).point_set()._naive_enumerator() - sage: list(ni.coordinate_iter()) + sage: P1xP1 = toric_varieties.P1xP1(base_ring=GF(2)) # optional - sage.rings.finite_rings + sage: ni = P1xP1.point_set()._naive_enumerator() # optional - sage.rings.finite_rings + sage: list(ni.coordinate_iter()) # optional - sage.rings.finite_rings [(0, 1, 0, 1), (1, 0, 0, 1), (1, 0, 1, 0), (0, 1, 1, 0), (0, 1, 1, 1), (1, 0, 1, 1), (1, 1, 0, 1), (1, 1, 1, 0), (1, 1, 1, 1)] TESTS:: - sage: V = ToricVariety(Fan([Cone([(1,1)])]), base_ring=GF(3)) - sage: ni = V.point_set()._naive_enumerator() - sage: list(ni.coordinate_iter()) + sage: V = ToricVariety(Fan([Cone([(1,1)])]), base_ring=GF(3)) # optional - sage.rings.finite_rings + sage: ni = V.point_set()._naive_enumerator() # optional - sage.rings.finite_rings + sage: list(ni.coordinate_iter()) # optional - sage.rings.finite_rings [(0, 1), (0, 2), (1, 1), (1, 2), (2, 1), (2, 2)] """ units = [x for x in self.ring if x != 0] @@ -406,12 +415,15 @@ def __iter__(self): EXAMPLES:: - sage: ni = toric_varieties.P2(base_ring=GF(2)).point_set()._naive_enumerator() - sage: list(ni) - [(0, 0, 1), (1, 0, 0), (0, 1, 0), (0, 1, 1), (1, 0, 1), (1, 1, 0), (1, 1, 1)] + sage: P2 = toric_varieties.P2(base_ring=GF(2)) # optional - sage.rings.finite_rings + sage: ni = P2.point_set()._naive_enumerator() # optional - sage.rings.finite_rings + sage: list(ni) # optional - sage.rings.finite_rings + [(0, 0, 1), (1, 0, 0), (0, 1, 0), (0, 1, 1), + (1, 0, 1), (1, 1, 0), (1, 1, 1)] - sage: ni = toric_varieties.P1xP1(base_ring=GF(3)).point_set()._naive_enumerator() - sage: list(ni) + sage: P1xP1 = toric_varieties.P1xP1(base_ring=GF(3)) # optional - sage.rings.finite_rings + sage: ni = P1xP1.point_set()._naive_enumerator() # optional - sage.rings.finite_rings + sage: list(ni) # optional - sage.rings.finite_rings [(0, 1, 0, 1), (1, 0, 0, 1), (1, 0, 1, 0), (0, 1, 1, 0), (0, 1, 1, 1), (0, 1, 1, 2), (1, 0, 1, 1), (1, 0, 1, 2), (1, 1, 0, 1), (1, 2, 0, 1), (1, 1, 1, 0), (1, 2, 1, 0), @@ -438,9 +450,9 @@ def multiplicative_generator(self): EXAMPLES:: - sage: point_set = toric_varieties.P2(base_ring=GF(5^2, 'a')).point_set() - sage: ffe = point_set._finite_field_enumerator() - sage: ffe.multiplicative_generator() + sage: point_set = toric_varieties.P2(base_ring=GF(5^2, 'a')).point_set() # optional - sage.rings.finite_rings + sage: ffe = point_set._finite_field_enumerator() # optional - sage.rings.finite_rings + sage: ffe.multiplicative_generator() # optional - sage.rings.finite_rings a """ return self.ring.multiplicative_generator() @@ -464,19 +476,19 @@ def root_generator(self, n): EXAMPLES:: - sage: point_set = toric_varieties.P2(base_ring=GF(5)).point_set() - sage: ffe = point_set._finite_field_enumerator() - sage: ffe.root_generator(2) + sage: point_set = toric_varieties.P2(base_ring=GF(5)).point_set() # optional - sage.rings.finite_rings + sage: ffe = point_set._finite_field_enumerator() # optional - sage.rings.finite_rings + sage: ffe.root_generator(2) # optional - sage.rings.finite_rings 4 - sage: ffe.root_generator(3) + sage: ffe.root_generator(3) # optional - sage.rings.finite_rings 1 - sage: ffe.root_generator(4) + sage: ffe.root_generator(4) # optional - sage.rings.finite_rings 2 TESTS:: - sage: for p in primes(10): - ....: for k in range(1,5): + sage: for p in primes(10): # optional - sage.rings.finite_rings + ....: for k in range(1, 5): ....: F = GF(p^k, 'a') ....: N = F.cardinality() - 1 ....: ffe = point_set._finite_field_enumerator(F) @@ -501,13 +513,13 @@ def _Chow_group_free_generators(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_ring=GF(7)) - sage: X.Chow_group().degree(1) + sage: X = ToricVariety(fan, base_ring=GF(7)) # optional - sage.rings.finite_rings + sage: X.Chow_group().degree(1) # optional - sage.rings.finite_rings C3 x Z - sage: enum = X.point_set()._finite_field_enumerator() - sage: enum._Chow_group_free() + sage: enum = X.point_set()._finite_field_enumerator() # optional - sage.rings.finite_rings + sage: enum._Chow_group_free() # optional - sage.rings.finite_rings ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5), (6, 6, 6)) - sage: enum._Chow_group_free_generators() + sage: enum._Chow_group_free_generators() # optional - sage.rings.finite_rings ((3, 3, 3),) """ result = [] @@ -530,13 +542,13 @@ def _Chow_group_torsion_generators(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_ring=GF(7)) - sage: X.Chow_group().degree(1) + sage: X = ToricVariety(fan, base_ring=GF(7)) # optional - sage.rings.finite_rings + sage: X.Chow_group().degree(1) # optional - sage.rings.finite_rings C3 x Z - sage: enum = X.point_set()._finite_field_enumerator() - sage: enum._Chow_group_torsion() + sage: enum = X.point_set()._finite_field_enumerator() # optional - sage.rings.finite_rings + sage: enum._Chow_group_torsion() # optional - sage.rings.finite_rings ((1, 2, 4), (1, 4, 2)) - sage: enum._Chow_group_torsion_generators() + sage: enum._Chow_group_torsion_generators() # optional - sage.rings.finite_rings ((1, 2, 4),) """ if self.fan.is_smooth(): @@ -570,19 +582,19 @@ def log(self, z): EXAMPLES:: - sage: F. = GF(5^2) - sage: point_set = toric_varieties.P2_123(base_ring=F).point_set() - sage: ffe = point_set._finite_field_enumerator() - sage: z = tuple(a^i for i in range(25)); z + sage: F. = GF(5^2) # optional - sage.rings.finite_rings + sage: point_set = toric_varieties.P2_123(base_ring=F).point_set() # optional - sage.rings.finite_rings + sage: ffe = point_set._finite_field_enumerator() # optional - sage.rings.finite_rings + sage: z = tuple(a^i for i in range(25)); z # optional - sage.rings.finite_rings (1, a, a + 3, 4*a + 3, 2*a + 2, 4*a + 1, 2, 2*a, 2*a + 1, 3*a + 1, 4*a + 4, 3*a + 2, 4, 4*a, 4*a + 2, a + 2, 3*a + 3, a + 4, 3, 3*a, 3*a + 4, 2*a + 4, a + 1, 2*a + 3, 1) - sage: ffe.log(z) + sage: ffe.log(z) # optional - sage.rings.finite_rings (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0) - sage: ffe.exp(ffe.log(z)) == z + sage: ffe.exp(ffe.log(z)) == z # optional - sage.rings.finite_rings True - sage: ffe.log(ffe.exp(range(24))) == tuple(range(24)) + sage: ffe.log(ffe.exp(range(24))) == tuple(range(24)) # optional - sage.rings.finite_rings True """ base = self.multiplicative_generator() @@ -603,15 +615,15 @@ def exp(self, powers): EXAMPLES:: - sage: F. = GF(5^2) - sage: point_set = toric_varieties.P2_123(base_ring=F).point_set() - sage: ffe = point_set._finite_field_enumerator() - sage: powers = list(range(24)) - sage: ffe.exp(powers) + sage: F. = GF(5^2) # optional - sage.rings.finite_rings + sage: point_set = toric_varieties.P2_123(base_ring=F).point_set() # optional - sage.rings.finite_rings + sage: ffe = point_set._finite_field_enumerator() # optional - sage.rings.finite_rings + sage: powers = list(range(24)) # optional - sage.rings.finite_rings + sage: ffe.exp(powers) # optional - sage.rings.finite_rings (1, a, a + 3, 4*a + 3, 2*a + 2, 4*a + 1, 2, 2*a, 2*a + 1, 3*a + 1, 4*a + 4, 3*a + 2, 4, 4*a, 4*a + 2, a + 2, 3*a + 3, a + 4, 3, 3*a, 3*a + 4, 2*a + 4, a + 1, 2*a + 3) - sage: ffe.log(ffe.exp(powers)) == tuple(powers) + sage: ffe.log(ffe.exp(powers)) == tuple(powers) # optional - sage.rings.finite_rings True """ base = self.multiplicative_generator() @@ -629,13 +641,13 @@ def rescaling_log_generators(self): EXAMPLES:: - sage: point_set = toric_varieties.P2_123(base_ring=GF(5)).point_set() - sage: ffe = point_set._finite_field_enumerator() - sage: ffe.rescalings() + sage: point_set = toric_varieties.P2_123(base_ring=GF(5)).point_set() # optional - sage.rings.finite_rings + sage: ffe = point_set._finite_field_enumerator() # optional - sage.rings.finite_rings + sage: ffe.rescalings() # optional - sage.rings.finite_rings ((1, 1, 1), (1, 4, 4), (4, 2, 3), (4, 3, 2)) - sage: list(map(ffe.log, ffe.rescalings())) + sage: list(map(ffe.log, ffe.rescalings())) # optional - sage.rings.finite_rings [(0, 0, 0), (0, 2, 2), (2, 1, 3), (2, 3, 1)] - sage: ffe.rescaling_log_generators() + sage: ffe.rescaling_log_generators() # optional - sage.rings.finite_rings ((2, 3, 1),) """ free = self._Chow_group_free_generators() @@ -657,22 +669,22 @@ def cone_points_iter(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_ring=GF(7)) - sage: point_set = X.point_set() - sage: ffe = point_set._finite_field_enumerator() - sage: cpi = ffe.cone_points_iter() - sage: cone, nonzero_points, cokernel = list(cpi)[5] - sage: cone + sage: X = ToricVariety(fan, base_ring=GF(7)) # optional - sage.rings.finite_rings + sage: point_set = X.point_set() # optional - sage.rings.finite_rings + sage: ffe = point_set._finite_field_enumerator() # optional - sage.rings.finite_rings + sage: cpi = ffe.cone_points_iter() # optional - sage.rings.finite_rings + sage: cone, nonzero_points, cokernel = list(cpi)[5] # optional - sage.rings.finite_rings + sage: cone # optional - sage.rings.finite_rings 1-d cone of Rational polyhedral fan in 2-d lattice N - sage: cone.ambient_ray_indices() + sage: cone.ambient_ray_indices() # optional - sage.rings.finite_rings (2,) - sage: nonzero_points + sage: nonzero_points # optional - sage.rings.finite_rings [0, 1] - sage: cokernel + sage: cokernel # optional - sage.rings.finite_rings Finitely generated module V/W over Integer Ring with invariants (2) - sage: list(cokernel) + sage: list(cokernel) # optional - sage.rings.finite_rings [(0), (1)] - sage: [p.lift() for p in cokernel] + sage: [p.lift() for p in cokernel] # optional - sage.rings.finite_rings [(0, 0), (0, 1)] """ from sage.matrix.constructor import matrix, block_matrix, identity_matrix @@ -708,21 +720,22 @@ def __iter__(self): EXAMPLES:: - sage: point_set = toric_varieties.P2(base_ring=GF(2)).point_set() - sage: ffe = point_set._finite_field_enumerator() - sage: list(ffe) - [(0, 0, 1), (1, 0, 0), (0, 1, 0), (0, 1, 1), (1, 0, 1), (1, 1, 0), (1, 1, 1)] + sage: point_set = toric_varieties.P2(base_ring=GF(2)).point_set() # optional - sage.rings.finite_rings + sage: ffe = point_set._finite_field_enumerator() # optional - sage.rings.finite_rings + sage: list(ffe) # optional - sage.rings.finite_rings + [(0, 0, 1), (1, 0, 0), (0, 1, 0), (0, 1, 1), + (1, 0, 1), (1, 1, 0), (1, 1, 1)] sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_ring=GF(7)) - sage: point_set = X.point_set() - sage: ffe = point_set._finite_field_enumerator() - sage: list(ffe) + sage: X = ToricVariety(fan, base_ring=GF(7)) # optional - sage.rings.finite_rings + sage: point_set = X.point_set() # optional - sage.rings.finite_rings + sage: ffe = point_set._finite_field_enumerator() # optional - sage.rings.finite_rings + sage: list(ffe) # optional - sage.rings.finite_rings [(1, 0, 0), (0, 1, 0), (0, 0, 1), (0, 1, 1), (0, 1, 3), (1, 0, 1), (1, 0, 3), (1, 1, 0), (1, 3, 0), (1, 1, 1), (1, 1, 3), (1, 1, 2), (1, 1, 6), (1, 1, 4), (1, 1, 5), (1, 3, 2), (1, 3, 6), (1, 3, 4), (1, 3, 5), (1, 3, 1), (1, 3, 3)] - sage: set(point_set._naive_enumerator()) == set(ffe) + sage: set(point_set._naive_enumerator()) == set(ffe) # optional - sage.rings.finite_rings True """ nrays = len(self.rays()) @@ -746,10 +759,10 @@ def cardinality(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X = ToricVariety(fan, base_ring=GF(7)) - sage: point_set = X.point_set() - sage: ffe = point_set._finite_field_enumerator() - sage: ffe.cardinality() + sage: X = ToricVariety(fan, base_ring=GF(7)) # optional - sage.rings.finite_rings + sage: point_set = X.point_set() # optional - sage.rings.finite_rings + sage: ffe = point_set._finite_field_enumerator() # optional - sage.rings.finite_rings + sage: ffe.cardinality() # optional - sage.rings.finite_rings 21 """ n = 0 @@ -776,7 +789,7 @@ def __init__(self, polynomials, ambient): sage: P2. = toric_varieties.P2() sage: from sage.schemes.toric.points import NaiveSubschemePointEnumerator sage: ne = NaiveSubschemePointEnumerator( - ....: [x^2+y^2-2*z^2], P2.point_set()._enumerator()) + ....: [x^2 + y^2 - 2*z^2], P2.point_set()._enumerator()) sage: next(iter(ne)) (1, 1, 1) """ @@ -801,7 +814,7 @@ def __iter__(self): sage: P2. = toric_varieties.P2() sage: from sage.schemes.toric.points import NaiveSubschemePointEnumerator sage: ne = NaiveSubschemePointEnumerator( - ....: [x^2+y^2-2*z^2], P2.point_set()._enumerator()) + ....: [x^2 + y^2 - 2*z^2], P2.point_set()._enumerator()) sage: next(iter(ne)) (1, 1, 1) """ @@ -831,14 +844,14 @@ def inhomogeneous_equations(self, ring, nonzero_coordinates, cokernel): EXAMPLES:: sage: R. = QQ[] - sage: P2. = toric_varieties.P2(base_ring=GF(7)) - sage: X = P2.subscheme([x^3 + 2*y^3 + 3*z^3, x*y*z + x*y^2]) - sage: point_set = X.point_set() - sage: ffe = point_set._enumerator() - sage: cone, nonzero_coordinates, cokernel = list(ffe.ambient.cone_points_iter())[5] - sage: cone.ambient_ray_indices(), nonzero_coordinates + sage: P2. = toric_varieties.P2(base_ring=GF(7)) # optional - sage.rings.finite_rings + sage: X = P2.subscheme([x^3 + 2*y^3 + 3*z^3, x*y*z + x*y^2]) # optional - sage.rings.finite_rings + sage: point_set = X.point_set() # optional - sage.rings.finite_rings + sage: ffe = point_set._enumerator() # optional - sage.rings.finite_rings + sage: cone, nonzero_coordinates, cokernel = list(ffe.ambient.cone_points_iter())[5] # optional - sage.rings.finite_rings + sage: cone.ambient_ray_indices(), nonzero_coordinates # optional - sage.rings.finite_rings ((2,), [0, 1]) - sage: ffe.inhomogeneous_equations(R, nonzero_coordinates, cokernel) + sage: ffe.inhomogeneous_equations(R, nonzero_coordinates, cokernel) # optional - sage.rings.finite_rings [2*s^3 + 1, s^2] """ nrays = len(self.ambient.rays()) @@ -872,14 +885,14 @@ def solutions_serial(self, inhomogeneous_equations, log_range): EXAMPLES:: - sage: R. = GF(7)[] - sage: P2. = toric_varieties.P2(base_ring=GF(7)) - sage: X = P2.subscheme(1) - sage: point_set = X.point_set() - sage: ffe = point_set._enumerator() - sage: ffe.solutions_serial([s^2-1, s^6-s^2], [range(6)]) + sage: R. = GF(7)[] # optional - sage.rings.finite_rings + sage: P2. = toric_varieties.P2(base_ring=GF(7)) # optional - sage.rings.finite_rings + sage: X = P2.subscheme(1) # optional - sage.rings.finite_rings + sage: point_set = X.point_set() # optional - sage.rings.finite_rings + sage: ffe = point_set._enumerator() # optional - sage.rings.finite_rings + sage: ffe.solutions_serial([s^2 - 1, s^6 - s^2], [range(6)]) # optional - sage.rings.finite_rings - sage: list(_) + sage: list(_) # optional - sage.rings.finite_rings [(0,), (3,)] """ from itertools import product @@ -900,14 +913,14 @@ def solutions(self, inhomogeneous_equations, log_range): EXAMPLES:: - sage: R. = GF(7)[] - sage: P2. = toric_varieties.P2(base_ring=GF(7)) - sage: X = P2.subscheme(1) - sage: point_set = X.point_set() - sage: ffe = point_set._enumerator() - sage: ffe.solutions([s^2-1, s^6-s^2], [range(6)]) + sage: R. = GF(7)[] # optional - sage.rings.finite_rings + sage: P2. = toric_varieties.P2(base_ring=GF(7)) # optional - sage.rings.finite_rings + sage: X = P2.subscheme(1) # optional - sage.rings.finite_rings + sage: point_set = X.point_set() # optional - sage.rings.finite_rings + sage: ffe = point_set._enumerator() # optional - sage.rings.finite_rings + sage: ffe.solutions([s^2 - 1, s^6 - s^2], [range(6)]) # optional - sage.rings.finite_rings - sage: sorted(_) + sage: sorted(_) # optional - sage.rings.finite_rings [(0,), (3,)] """ # Do simple cases in one process (this includes most doctests) @@ -946,18 +959,18 @@ def homogeneous_coordinates(self, log_t, nonzero_coordinates, cokernel): EXAMPLES:: - sage: P2. = toric_varieties.P2(base_ring=GF(7)) - sage: X = P2.subscheme([x^3 + 2*y^3 + 3*z^3, x*y*z + x*y^2]) - sage: point_set = X.point_set() - sage: ffe = point_set._enumerator() - sage: cone, nonzero_coordinates, cokernel = list(ffe.ambient.cone_points_iter())[5] - sage: cone.ambient_ray_indices(), nonzero_coordinates + sage: P2. = toric_varieties.P2(base_ring=GF(7)) # optional - sage.rings.finite_rings + sage: X = P2.subscheme([x^3 + 2*y^3 + 3*z^3, x*y*z + x*y^2]) # optional - sage.rings.finite_rings + sage: point_set = X.point_set() # optional - sage.rings.finite_rings + sage: ffe = point_set._enumerator() # optional - sage.rings.finite_rings + sage: cone, nonzero_coordinates, cokernel = list(ffe.ambient.cone_points_iter())[5] # optional - sage.rings.finite_rings + sage: cone.ambient_ray_indices(), nonzero_coordinates # optional - sage.rings.finite_rings ((2,), [0, 1]) - sage: ffe.homogeneous_coordinates([0], nonzero_coordinates, cokernel) + sage: ffe.homogeneous_coordinates([0], nonzero_coordinates, cokernel) # optional - sage.rings.finite_rings (1, 1, 0) - sage: ffe.homogeneous_coordinates([1], nonzero_coordinates, cokernel) + sage: ffe.homogeneous_coordinates([1], nonzero_coordinates, cokernel) # optional - sage.rings.finite_rings (1, 3, 0) - sage: ffe.homogeneous_coordinates([2], nonzero_coordinates, cokernel) + sage: ffe.homogeneous_coordinates([2], nonzero_coordinates, cokernel) # optional - sage.rings.finite_rings (1, 2, 0) """ z = [self.ambient.ring.zero()] * len(self.ambient.rays()) @@ -982,11 +995,11 @@ def __iter__(self): EXAMPLES:: - sage: P2. = toric_varieties.P2(base_ring=GF(7)) - sage: X = P2.subscheme([x^3 + 2*y^3 + 3*z^3, x*y*z + x*y^2]) - sage: point_set = X.point_set() - sage: ffe = point_set._enumerator() - sage: list(ffe) # indirect doctest + sage: P2. = toric_varieties.P2(base_ring=GF(7)) # optional - sage.rings.finite_rings + sage: X = P2.subscheme([x^3 + 2*y^3 + 3*z^3, x*y*z + x*y^2]) # optional - sage.rings.finite_rings + sage: point_set = X.point_set() # optional - sage.rings.finite_rings + sage: ffe = point_set._enumerator() # optional - sage.rings.finite_rings + sage: list(ffe) # indirect doctest # optional - sage.rings.finite_rings [(1, 1, 6), (1, 2, 5), (1, 4, 3)] """ for cone, nonzero_coordinates, cokernel in self.ambient.cone_points_iter(): @@ -1008,10 +1021,10 @@ def cardinality(self): EXAMPLES:: sage: fan = NormalFan(ReflexivePolytope(2, 0)) - sage: X. = ToricVariety(fan, base_ring=GF(7)) - sage: Y = X.subscheme(u^3 + v^3 + w^3 + u*v*w) - sage: point_set = Y.point_set() - sage: list(point_set) + sage: X. = ToricVariety(fan, base_ring=GF(7)) # optional - sage.rings.finite_rings + sage: Y = X.subscheme(u^3 + v^3 + w^3 + u*v*w) # optional - sage.rings.finite_rings + sage: point_set = Y.point_set() # optional - sage.rings.finite_rings + sage: list(point_set) # optional - sage.rings.finite_rings [[0 : 1 : 3], [1 : 0 : 3], [1 : 3 : 0], @@ -1019,8 +1032,8 @@ def cardinality(self): [1 : 1 : 4], [1 : 3 : 2], [1 : 3 : 5]] - sage: ffe = point_set._enumerator() - sage: ffe.cardinality() + sage: ffe = point_set._enumerator() # optional - sage.rings.finite_rings + sage: ffe.cardinality() # optional - sage.rings.finite_rings 7 """ n = 0 diff --git a/src/sage/schemes/toric/sheaf/constructor.py b/src/sage/schemes/toric/sheaf/constructor.py index 74aa578d422..11a189adbf3 100644 --- a/src/sage/schemes/toric/sheaf/constructor.py +++ b/src/sage/schemes/toric/sheaf/constructor.py @@ -272,9 +272,9 @@ def Klyachko(self, multi_filtration): EXAMPLES:: sage: P1 = toric_varieties.P1() - sage: v1, v2, v3 = [(1,0,0),(0,1,0),(0,0,1)] - sage: F1 = FilteredVectorSpace({1:[v1, v2, v3], 3:[v1]}) - sage: F2 = FilteredVectorSpace({0:[v1, v2, v3], 2:[v2, v3]}) + sage: v1, v2, v3 = [(1,0,0), (0,1,0), (0,0,1)] + sage: F1 = FilteredVectorSpace({1: [v1, v2, v3], 3: [v1]}) + sage: F2 = FilteredVectorSpace({0: [v1, v2, v3], 2: [v2, v3]}) sage: P1 = toric_varieties.P1() sage: r1, r2 = P1.fan().rays() sage: F = MultiFilteredVectorSpace({r1:F1, r2:F2}); F diff --git a/src/sage/schemes/toric/sheaf/klyachko.py b/src/sage/schemes/toric/sheaf/klyachko.py index 77fae4b7545..bf15fc4c29f 100644 --- a/src/sage/schemes/toric/sheaf/klyachko.py +++ b/src/sage/schemes/toric/sheaf/klyachko.py @@ -93,12 +93,12 @@ def Bundle(toric_variety, multi_filtration, check=True): EXAMPLES:: sage: P1 = toric_varieties.P1() - sage: v1, v2, v3 = [(1,0,0),(0,1,0),(0,0,1)] - sage: F1 = FilteredVectorSpace({1:[v1, v2, v3], 3:[v1]}) - sage: F2 = FilteredVectorSpace({0:[v1, v2, v3], 2:[v2, v3]}) + sage: v1, v2, v3 = [(1,0,0), (0,1,0), (0,0,1)] + sage: F1 = FilteredVectorSpace({1: [v1, v2, v3], 3: [v1]}) + sage: F2 = FilteredVectorSpace({0: [v1, v2, v3], 2: [v2, v3]}) sage: P1 = toric_varieties.P1() sage: r1, r2 = P1.fan().rays() - sage: F = MultiFilteredVectorSpace({r1:F1, r2:F2}); F + sage: F = MultiFilteredVectorSpace({r1: F1, r2: F2}); F Filtrations N(-1): QQ^3 >= QQ^2 >= QQ^2 >= 0 >= 0 N(1): QQ^3 >= QQ^3 >= QQ^1 >= QQ^1 >= 0 @@ -110,7 +110,7 @@ def Bundle(toric_variety, multi_filtration, check=True): sage: P1.sheaves.Klyachko(F) Rank 3 bundle on 1-d CPR-Fano toric variety covered by 2 affine patches. - sage: P1.sheaves.Klyachko({r1:F1, r2:F2}) # alternative + sage: P1.sheaves.Klyachko({r1: F1, r2: F2}) # alternative Rank 3 bundle on 1-d CPR-Fano toric variety covered by 2 affine patches. The above is just a shorthand for:: @@ -157,8 +157,8 @@ def __init__(self, toric_variety, multi_filtration, check=True): sage: P1 = toric_varieties.P1() sage: r1, r2 = P1.fan().rays() sage: F = MultiFilteredVectorSpace({ - ....: r1:FilteredVectorSpace(3,1), - ....: r2:FilteredVectorSpace(3,0)}); F + ....: r1: FilteredVectorSpace(3,1), + ....: r2: FilteredVectorSpace(3,0)}); F Filtrations N(-1): QQ^3 >= 0 >= 0 N(1): QQ^3 >= QQ^3 >= 0 @@ -545,10 +545,10 @@ def E_quotient_projection(self, sigma, tau, m): sage: P3 = toric_varieties.P(3) sage: rays = [(1,0,0), (0,1,0), (0,0,1)] - sage: F1 = FilteredVectorSpace(rays, {0:[0], 1:[2], 2:[1]}) + sage: F1 = FilteredVectorSpace(rays, {0: [0], 1: [2], 2: [1]}) sage: F2 = FilteredVectorSpace(3, 0) sage: r = P3.fan().rays() - sage: V = P3.sheaves.Klyachko({r[0]:F1, r[1]:F2, r[2]:F2, r[3]:F2}) + sage: V = P3.sheaves.Klyachko({r[0]: F1, r[1]: F2, r[2]: F2, r[3]: F2}) sage: tau = Cone([(1,0,0), (0,1,0)]) sage: sigma = Cone([(1,0,0)]) sage: M = P3.fan().dual_lattice() @@ -608,10 +608,10 @@ def cohomology_complex(self, m): sage: P3 = toric_varieties.P(3) sage: rays = [(1,0,0), (0,1,0), (0,0,1)] - sage: F1 = FilteredVectorSpace(rays, {0:[0], 1:[2], 2:[1]}) - sage: F2 = FilteredVectorSpace(rays, {0:[1,2], 1:[0]}) + sage: F1 = FilteredVectorSpace(rays, {0: [0], 1: [2], 2: [1]}) + sage: F2 = FilteredVectorSpace(rays, {0: [1,2], 1: [0]}) sage: r = P3.fan().rays() - sage: V = P3.sheaves.Klyachko({r[0]:F1, r[1]:F2, r[2]:F2, r[3]:F2}) + sage: V = P3.sheaves.Klyachko({r[0]: F1, r[1]: F2, r[2]: F2, r[3]: F2}) sage: tau = Cone([(1,0,0), (0,1,0)]) sage: sigma = Cone([(1, 0, 0)]) sage: M = P3.fan().dual_lattice() @@ -621,7 +621,7 @@ def cohomology_complex(self, m): sage: F = CyclotomicField(3) sage: P3 = toric_varieties.P(3).change_ring(F) - sage: V = P3.sheaves.Klyachko({r[0]:F1, r[1]:F2, r[2]:F2, r[3]:F2}) + sage: V = P3.sheaves.Klyachko({r[0]: F1, r[1]: F2, r[2]: F2, r[3]: F2}) sage: V.cohomology_complex(m) Chain complex with at most 2 nonzero terms over Cyclotomic Field of order 3 and degree 2 @@ -748,7 +748,7 @@ def __richcmp__(self, other, op): sage: V2 = X.sheaves.trivial_bundle(2) sage: V2 == V1 False - sage: V2 == V1+V1 + sage: V2 == V1 + V1 True sage: T_X = X.sheaves.tangent_bundle() @@ -897,9 +897,9 @@ def symmetric_power(self, n): sage: P1 = toric_varieties.P1() sage: H = P1.divisor(0) sage: L = P1.sheaves.line_bundle(H) - sage: (L+L).symmetric_power(2) + sage: (L + L).symmetric_power(2) Rank 3 bundle on 1-d CPR-Fano toric variety covered by 2 affine patches. - sage: (L+L).symmetric_power(2) == L*L+L*L+L*L + sage: (L + L).symmetric_power(2) == L*L + L*L + L*L True """ filt = self._filt.symmetric_power(n) diff --git a/src/sage/schemes/toric/toric_subscheme.py b/src/sage/schemes/toric/toric_subscheme.py index 76c0b300813..99d9f5c975c 100644 --- a/src/sage/schemes/toric/toric_subscheme.py +++ b/src/sage/schemes/toric/toric_subscheme.py @@ -56,7 +56,7 @@ class AlgebraicScheme_subscheme_toric(AlgebraicScheme_subscheme): Defining s, t, x, y sage: import sage.schemes.toric.toric_subscheme as SCM sage: X = SCM.AlgebraicScheme_subscheme_toric( - ....: P1xP1, [x*s + y*t, x^3+y^3]) + ....: P1xP1, [x*s + y*t, x^3 + y^3]) sage: X Closed subscheme of 2-d CPR-Fano toric variety covered by 4 affine patches defined by: @@ -65,7 +65,7 @@ class AlgebraicScheme_subscheme_toric(AlgebraicScheme_subscheme): A better way to construct the same scheme as above:: - sage: P1xP1.subscheme([x*s + y*t, x^3+y^3]) + sage: P1xP1.subscheme([x*s + y*t, x^3 + y^3]) Closed subscheme of 2-d CPR-Fano toric variety covered by 4 affine patches defined by: s*x + t*y, @@ -87,7 +87,7 @@ def __init__(self, toric_variety, polynomials): Defining s, t, x, y sage: import sage.schemes.toric.toric_subscheme as SCM sage: X = SCM.AlgebraicScheme_subscheme_toric( - ....: P1xP1, [x*s + y*t, x^3+y^3]) + ....: P1xP1, [x*s + y*t, x^3 + y^3]) sage: X Closed subscheme of 2-d CPR-Fano toric variety covered by 4 affine patches defined by: @@ -177,7 +177,7 @@ def fan(self): EXAMPLES:: sage: P2. = toric_varieties.P(2) - sage: E = P2.subscheme([x^2+y^2+z^2]) + sage: E = P2.subscheme([x^2 + y^2 + z^2]) sage: E.fan() Rational polyhedral fan in 2-d lattice N """ @@ -218,7 +218,7 @@ def affine_patch(self, i): [1 : t : x : 1] sage: P1xP1.inject_variables() Defining s, t, x, y - sage: P1 = P1xP1.subscheme(x-y) + sage: P1 = P1xP1.subscheme(x - y) sage: subpatch = P1.affine_patch(1) sage: subpatch Closed subscheme of 2-d affine toric variety defined by: @@ -273,17 +273,17 @@ def affine_algebraic_patch(self, cone=None, names=None): sage: P2. = toric_varieties.P2() sage: cone = P2.fan().generating_cone(0) - sage: V = P2.subscheme(x^3+y^3+z^3) + sage: V = P2.subscheme(x^3 + y^3 + z^3) sage: V.affine_algebraic_patch(cone) Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: z0^3 + z1^3 + 1 - sage: cone = Cone([(0,1),(2,1)]) + sage: cone = Cone([(0,1), (2,1)]) sage: A2Z2. = AffineToricVariety(cone) sage: A2Z2.affine_algebraic_patch() Closed subscheme of Affine Space of dimension 3 over Rational Field defined by: -z0*z1 + z2^2 - sage: V = A2Z2.subscheme(x^2+y^2-1) + sage: V = A2Z2.subscheme(x^2 + y^2 - 1) sage: patch = V.affine_algebraic_patch(); patch Closed subscheme of Affine Space of dimension 3 over Rational Field defined by: -z0*z1 + z2^2, @@ -299,11 +299,11 @@ def affine_algebraic_patch(self, cone=None, names=None): the singularity of the ambient space and the second is the pull-back of `x^2+y^2-1` :: - sage: lp = LatticePolytope([(1,0,0),(1,1,0),(1,1,1),(1,0,1),(-2,-1,-1)], + sage: lp = LatticePolytope([(1,0,0), (1,1,0), (1,1,1), (1,0,1), (-2,-1,-1)], ....: lattice=ToricLattice(3)) sage: X. = CPRFanoToricVariety(Delta_polar=lp) - sage: Y = X.subscheme(x*v+y*u+t) - sage: cone = Cone([(1,0,0),(1,1,0),(1,1,1),(1,0,1)]) + sage: Y = X.subscheme(x*v + y*u + t) + sage: cone = Cone([(1,0,0), (1,1,0), (1,1,1), (1,0,1)]) sage: Y.affine_algebraic_patch(cone) Closed subscheme of Affine Space of dimension 4 over Rational Field defined by: z0*z2 - z1*z3, @@ -398,8 +398,8 @@ def _best_affine_patch(self, point): EXAMPLES:: - sage: P.= toric_varieties.P2() - sage: S = P.subscheme(x+2*y+3*z) + sage: P. = toric_varieties.P2() + sage: S = P.subscheme(x + 2*y + 3*z) sage: S._best_affine_patch(P.point([2,-3,0])) 1 sage: S._best_affine_patch([2,-3,0]) @@ -433,8 +433,8 @@ def neighborhood(self, point): EXAMPLES:: - sage: P.= toric_varieties.P2() - sage: S = P.subscheme(x+2*y+3*z) + sage: P. = toric_varieties.P2() + sage: S = P.subscheme(x + 2*y + 3*z) sage: s = S.point([0,-3,2]); s [0 : -3 : 2] sage: patch = S.neighborhood(s); patch @@ -513,10 +513,10 @@ def dimension(self): sage: P1xP1 = toric_varieties.P1xP1() sage: P1xP1.inject_variables() Defining s, t, x, y - sage: P1 = P1xP1.subscheme(s-t) + sage: P1 = P1xP1.subscheme(s - t) sage: P1.dimension() 1 - sage: P1xP1.subscheme([s-t, (s-t)^2]).dimension() + sage: P1xP1.subscheme([s - t, (s-t)^2]).dimension() 1 sage: P1xP1.subscheme([s, t]).dimension() -1 @@ -546,7 +546,7 @@ def is_smooth(self, point=None): EXAMPLES:: sage: P2. = toric_varieties.P2() - sage: cuspidal_curve = P2.subscheme([y^2*z-x^3]) + sage: cuspidal_curve = P2.subscheme([y^2*z - x^3]) sage: cuspidal_curve Closed subscheme of 2-d CPR-Fano toric variety covered by 3 affine patches defined by: -x^3 + y^2*z @@ -574,11 +574,11 @@ def is_smooth(self, point=None): A smooth hypersurface in a compact singular toric variety:: - sage: lp = LatticePolytope([(1,0,0),(1,1,0),(1,1,1),(1,0,1),(-2,-1,-1)], + sage: lp = LatticePolytope([(1,0,0), (1,1,0), (1,1,1), (1,0,1), (-2,-1,-1)], ....: lattice=ToricLattice(3)) sage: X. = CPRFanoToricVariety(Delta_polar=lp) - sage: Y = X.subscheme(x*v+y*u+t) - sage: cone = Cone([(1,0,0),(1,1,0),(1,1,1),(1,0,1)]) + sage: Y = X.subscheme(x*v + y*u + t) + sage: cone = Cone([(1,0,0), (1,1,0), (1,1,1), (1,0,1)]) sage: Y.is_smooth() True """ @@ -621,7 +621,7 @@ def is_nondegenerate(self): sage: fan = FaceFan(diamond) sage: P1xP1xP1 = ToricVariety(fan) sage: z0, z1, z2, z3, z4, z5 = P1xP1xP1.gens() - sage: t = 5; + sage: t = 5 sage: F = z0^2*z1^2*z2^2 + z1^2*z2^2*z3^2 + z0^2*z2^2*z4^2\ ....: + z2^2*z3^2*z4^2 + t*z0*z1*z2*z3*z4*z5 + z0^2*z1^2*z5^2\ ....: + z1^2*z3^2*z5^2 + z0^2*z4^2*z5^2 + z3^2*z4^2*z5^2 @@ -634,9 +634,9 @@ def is_nondegenerate(self): Taking a random change of variables breaks the symmetry, but makes the surface nondegenerate:: - sage: F1 = F.subs(z0 = 1*z0 + 1*z3, z3 = 1*z0 + 2*z3,\ - ....: z1 = -2*z1 + -1*z4, z4 = 1*z1 + 2*z4,\ - ....: z2 = -3*z2 + -1*z5, z5 = -3*z2 + 2*z5 ) + sage: F1 = F.subs(z0=1*z0 + 1*z3, z3=1*z0 + 2*z3, + ....: z1=-2*z1 + -1*z4, z4=1*z1 + 2*z4, + ....: z2=-3*z2 + -1*z5, z5=-3*z2 + 2*z5) sage: Y = P1xP1xP1.subscheme([F1]) sage: Y.is_smooth() True @@ -649,8 +649,8 @@ def is_nondegenerate(self): sage: X = toric_varieties.WP([1,4,2,3], names='z0 z1 z2 z3') sage: X.inject_variables() Defining z0, z1, z2, z3 - sage: g0 = z1^3 + z2^6 +z3^4 - sage: g = g0-2*z3^2*z0^6+z2*z0^10+z0^12 + sage: g0 = z1^3 + z2^6 + z3^4 + sage: g = g0 - 2*z3^2*z0^6 + z2*z0^10 + z0^12 sage: Y = X.subscheme([g]) sage: Y.is_nondegenerate() False @@ -659,9 +659,9 @@ def is_nondegenerate(self): sage: P2. = toric_varieties.P2() sage: f = x^5 + 2*x*y^4 + y^5 - 2*y^3*z^2 + x*z^4 - 2*z^5 - sage: P2.change_ring(GF(5)).subscheme([f]).is_nondegenerate() + sage: P2.change_ring(GF(5)).subscheme([f]).is_nondegenerate() # optional - sage.rings.finite_rings True - sage: P2.change_ring(GF(7)).subscheme([f]).is_nondegenerate() + sage: P2.change_ring(GF(7)).subscheme([f]).is_nondegenerate() # optional - sage.rings.finite_rings False TESTS: @@ -759,7 +759,7 @@ class AlgebraicScheme_subscheme_affine_toric(AlgebraicScheme_subscheme_toric): Defining s, t, x, y sage: import sage.schemes.toric.toric_subscheme as SCM sage: X = SCM.AlgebraicScheme_subscheme_toric( - ....: P1xP1, [x*s + y*t, x^3+y^3]) + ....: P1xP1, [x*s + y*t, x^3 + y^3]) sage: X Closed subscheme of 2-d CPR-Fano toric variety covered by 4 affine patches defined by: @@ -768,7 +768,7 @@ class AlgebraicScheme_subscheme_affine_toric(AlgebraicScheme_subscheme_toric): A better way to construct the same scheme as above:: - sage: P1xP1.subscheme([x*s + y*t, x^3+y^3]) + sage: P1xP1.subscheme([x*s + y*t, x^3 + y^3]) Closed subscheme of 2-d CPR-Fano toric variety covered by 4 affine patches defined by: s*x + t*y, @@ -786,7 +786,7 @@ def __init__(self, toric_variety, polynomials): Defining s, t, x, y sage: import sage.schemes.toric.toric_subscheme as SCM sage: X = SCM.AlgebraicScheme_subscheme_toric( - ....: P1xP1, [x*s + y*t, x^3+y^3]) + ....: P1xP1, [x*s + y*t, x^3 + y^3]) sage: X Closed subscheme of 2-d CPR-Fano toric variety covered by 4 affine patches defined by: @@ -808,7 +808,7 @@ def dimension(self): EXAMPLES:: sage: P1xP1. = toric_varieties.P1xP1() - sage: P1 = P1xP1.subscheme(s0-s1) + sage: P1 = P1xP1.subscheme(s0 - s1) sage: P1.dimension() 1 @@ -853,7 +853,7 @@ def is_smooth(self, point=None): EXAMPLES:: sage: A2. = toric_varieties.A2() - sage: cuspidal_curve = A2.subscheme([y^2-x^3]) + sage: cuspidal_curve = A2.subscheme([y^2 - x^3]) sage: cuspidal_curve Closed subscheme of 2-d affine toric variety defined by: -x^3 + y^2 @@ -863,7 +863,7 @@ def is_smooth(self, point=None): False sage: cuspidal_curve.is_smooth() False - sage: circle = A2.subscheme(x^2+y^2-1) + sage: circle = A2.subscheme(x^2 + y^2 - 1) sage: circle.is_smooth([1,0]) True sage: circle.is_smooth() diff --git a/src/sage/schemes/toric/variety.py b/src/sage/schemes/toric/variety.py index 9b543e71cdd..1fc08dff5e5 100644 --- a/src/sage/schemes/toric/variety.py +++ b/src/sage/schemes/toric/variety.py @@ -129,7 +129,7 @@ ... ValueError: x^2 + s^2 is not homogeneous on 2-d toric variety covered by 4 affine patches - sage: P1xP1.subscheme([x^2*s^2 + x*y*t^2 +y^2*t^2, s^3 + t^3]) + sage: P1xP1.subscheme([x^2*s^2 + x*y*t^2 + y^2*t^2, s^3 + t^3]) Closed subscheme of 2-d toric variety covered by 4 affine patches defined by: x^2*s^2 + x*y*t^2 + y^2*t^2, @@ -267,9 +267,9 @@ sage: D = P4_11133.divisor(0) sage: HH(D) [3*z4] - sage: P4_11133.integrate( HH(D)^4 ) + sage: P4_11133.integrate(HH(D)^4) 9 - sage: P4_11133.integrate( HH(D) * HH(cone) ) + sage: P4_11133.integrate(HH(D) * HH(cone)) 1 Although computationally less efficient, we can do the same @@ -455,7 +455,7 @@ def ToricVariety(fan, sage: P1xP1.inject_variables() Defining x, s, y, t - sage: P1xP1.subscheme(x*s-y*t) + sage: P1xP1.subscheme(x*s - y*t) Closed subscheme of 2-d toric variety covered by 4 affine patches defined by: x*s - y*t @@ -872,7 +872,7 @@ def _homset(self, *args, **kwds): sage: P1xP1.inject_variables() Defining s, t, x, y - sage: P1 = P1xP1.subscheme(s-t) + sage: P1 = P1xP1.subscheme(s - t) sage: hom_set = P1xP1.Hom(P1) sage: hom_set([s,s,x,y]) Scheme morphism: @@ -1311,7 +1311,7 @@ def is_homogeneous(self, polynomial): no homogeneous rescalings, for example:: sage: A1. = toric_varieties.A1() - sage: A1.is_homogeneous(z^3+z^7) + sage: A1.is_homogeneous(z^3 + z^7) True Finally, the degree group is really the Chow group @@ -1321,11 +1321,11 @@ def is_homogeneous(self, polynomial): from odd-degree homogeneous polynomials:: sage: A2_Z2. = toric_varieties.A2_Z2() - sage: A2_Z2.is_homogeneous(x+y+x^3+y^5+x^3*y^4) + sage: A2_Z2.is_homogeneous(x + y + x^3 + y^5 + x^3*y^4) True - sage: A2_Z2.is_homogeneous(x^2+x*y+y^4+(x*y)^5+x^4*y^4) + sage: A2_Z2.is_homogeneous(x^2 + x*y + y^4 + (x*y)^5 + x^4*y^4) True - sage: A2_Z2.is_homogeneous(x+y^2) + sage: A2_Z2.is_homogeneous(x + y^2) False """ if '_homogeneous_degrees_group' not in self.__dict__: @@ -1874,7 +1874,7 @@ def subscheme(self, polynomials): with coordinates `(x, y)` for one and `(s, t)` for the other:: sage: P1xP1. = toric_varieties.P1xP1() - sage: X = P1xP1.subscheme([x*s + y*t, x^3+y^3]) + sage: X = P1xP1.subscheme([x*s + y*t, x^3 + y^3]) sage: X Closed subscheme of 2-d CPR-Fano toric variety covered by 4 affine patches defined by: @@ -1917,10 +1917,12 @@ def Stanley_Reisner_ideal(self): EXAMPLES:: - sage: fan = Fan([[0,1,3],[3,4],[2,0],[1,2,4]], [(-3, -2, 1), (0, 0, 1), (3, -2, 1), (-1, -1, 1), (1, -1, 1)]) - sage: X = ToricVariety(fan, coordinate_names='A B C D E', base_field=GF(5)) - sage: SR = X.Stanley_Reisner_ideal(); SR - Ideal (A*E, C*D, A*B*C, B*D*E) of Multivariate Polynomial Ring in A, B, C, D, E over Rational Field + sage: fan = Fan([[0,1,3], [3,4], [2,0], [1,2,4]], + ....: [(-3, -2, 1), (0, 0, 1), (3, -2, 1), (-1, -1, 1), (1, -1, 1)]) + sage: X = ToricVariety(fan, coordinate_names='A B C D E', base_field=GF(5)) # optional - sage.rings.finite_rings + sage: SR = X.Stanley_Reisner_ideal(); SR # optional - sage.rings.finite_rings + Ideal (A*E, C*D, A*B*C, B*D*E) of + Multivariate Polynomial Ring in A, B, C, D, E over Rational Field """ if "_SR" not in self.__dict__: R = PolynomialRing(QQ, self.variable_names()) @@ -1939,10 +1941,12 @@ def linear_equivalence_ideal(self): EXAMPLES:: - sage: fan = Fan([[0,1,3],[3,4],[2,0],[1,2,4]], [(-3, -2, 1), (0, 0, 1), (3, -2, 1), (-1, -1, 1), (1, -1, 1)]) - sage: X = ToricVariety(fan, coordinate_names='A B C D E', base_field=GF(5)) - sage: lin = X.linear_equivalence_ideal(); lin - Ideal (-3*A + 3*C - D + E, -2*A - 2*C - D - E, A + B + C + D + E) of Multivariate Polynomial Ring in A, B, C, D, E over Rational Field + sage: fan = Fan([[0,1,3], [3,4], [2,0], [1,2,4]], + ....: [(-3, -2, 1), (0, 0, 1), (3, -2, 1), (-1, -1, 1), (1, -1, 1)]) + sage: X = ToricVariety(fan, coordinate_names='A B C D E', base_field=GF(5)) # optional - sage.rings.finite_rings + sage: lin = X.linear_equivalence_ideal(); lin # optional - sage.rings.finite_rings + Ideal (-3*A + 3*C - D + E, -2*A - 2*C - D - E, A + B + C + D + E) of + Multivariate Polynomial Ring in A, B, C, D, E over Rational Field """ if "_linear_equivalence_ideal" not in self.__dict__: R = PolynomialRing(QQ, self.variable_names()) @@ -1980,7 +1984,8 @@ def cohomology_ring(self): sage: X.cohomology_ring() Rational cohomology ring of a 2-d CPR-Fano toric variety covered by 6 affine patches sage: X.cohomology_ring().defining_ideal() - Ideal (-u - y + z + w, x - y - v + w, x*y, x*v, x*z, u*v, u*z, u*w, y*z, y*w, v*w) of Multivariate Polynomial Ring in x, u, y, v, z, w over Rational Field + Ideal (-u - y + z + w, x - y - v + w, x*y, x*v, x*z, u*v, u*z, u*w, y*z, y*w, v*w) of + Multivariate Polynomial Ring in x, u, y, v, z, w over Rational Field sage: X.cohomology_ring().defining_ideal().ring() Multivariate Polynomial Ring in x, u, y, v, z, w over Rational Field sage: X.variable_names() @@ -2542,7 +2547,7 @@ def _semigroup_ring(self, cone=None, names=None): EXAMPLES:: - sage: A2Z2 = Cone([(0,1),(2,1)]) + sage: A2Z2 = Cone([(0,1), (2,1)]) sage: AffineToricVariety(A2Z2)._semigroup_ring() (Multivariate Polynomial Ring in z0, z1, z2 over Rational Field, Ideal (-z0*z1 + z2^2) of Multivariate Polynomial Ring in z0, z1, z2 over Rational Field, @@ -2554,7 +2559,7 @@ def _semigroup_ring(self, cone=None, names=None): (Multivariate Polynomial Ring in z0, z1 over Rational Field, Ideal (0) of Multivariate Polynomial Ring in z0, z1 over Rational Field, 2-d cone in 2-d lattice M) - sage: P2.change_ring(GF(101))._semigroup_ring(cone) + sage: P2.change_ring(GF(101))._semigroup_ring(cone) # optional - sage.rings.finite_rings (Multivariate Polynomial Ring in z0, z1 over Finite Field of size 101, Ideal (0) of Multivariate Polynomial Ring in z0, z1 over Finite Field of size 101, 2-d cone in 2-d lattice M) @@ -2617,13 +2622,13 @@ def Spec(self, cone=None, names=None): EXAMPLES:: - sage: quadrant = Cone([(1,0),(0,1)]) + sage: quadrant = Cone([(1,0), (0,1)]) sage: AffineToricVariety(quadrant).Spec() Spectrum of Multivariate Polynomial Ring in z0, z1 over Rational Field A more interesting example:: - sage: A2Z2 = Cone([(0,1),(2,1)]) + sage: A2Z2 = Cone([(0,1), (2,1)]) sage: AffineToricVariety(A2Z2).Spec(names='u,v,t') Spectrum of Quotient of Multivariate Polynomial Ring in u, v, t over Rational Field by the ideal (-u*v + t^2) @@ -2656,7 +2661,7 @@ def affine_algebraic_patch(self, cone=None, names=None): EXAMPLES:: - sage: cone = Cone([(0,1),(2,1)]) + sage: cone = Cone([(0,1), (2,1)]) sage: A2Z2 = AffineToricVariety(cone) sage: A2Z2.affine_algebraic_patch() Closed subscheme of Affine Space of dimension 3 over Rational Field defined by: @@ -2807,10 +2812,10 @@ def count_points(self): sage: o = lattice_polytope.cross_polytope(3) sage: V = ToricVariety(FaceFan(o)) - sage: V2 = V.change_ring(GF(2)) - sage: V2.point_set().cardinality() + sage: V2 = V.change_ring(GF(2)) # optional - sage.rings.finite_rings + sage: V2.point_set().cardinality() # optional - sage.rings.finite_rings 27 - sage: V2.count_points() + sage: V2.count_points() # optional - sage.rings.finite_rings 27 """ return self.point_set().cardinality() @@ -2838,18 +2843,18 @@ def Demazure_roots(self): Here are the remaining three examples listed in [Baz2011]_, Example 2.1 and 2.3:: sage: s = 3 - sage: cones = [(0,1),(1,2),(2,3),(3,0)] - sage: Hs = ToricVariety(Fan(rays=[(1,0),(0,-1),(-1,s),(0,1)], cones=cones)) + sage: cones = [(0,1), (1,2), (2,3), (3,0)] + sage: Hs = ToricVariety(Fan(rays=[(1,0), (0,-1), (-1,s), (0,1)], cones=cones)) sage: Hs.Demazure_roots() (M(-1, 0), M(1, 0), M(0, 1), M(1, 1), M(2, 1), M(3, 1)) - sage: P11s = ToricVariety(Fan(rays=[(1,0),(0,-1),(-1,s)], cones=[(0,1),(1,2),(2,0)])) + sage: P11s = ToricVariety(Fan(rays=[(1,0), (0,-1), (-1,s)], cones=[(0,1), (1,2), (2,0)])) sage: P11s.Demazure_roots() (M(-1, 0), M(1, 0), M(0, 1), M(1, 1), M(2, 1), M(3, 1)) sage: P11s.Demazure_roots() == Hs.Demazure_roots() True - sage: Bs = ToricVariety(Fan(rays=[(s,1),(s,-1),(-s,-1),(-s,1)], cones=cones)) + sage: Bs = ToricVariety(Fan(rays=[(s,1), (s,-1), (-s,-1), (-s,1)], cones=cones)) sage: Bs.Demazure_roots() () @@ -3491,9 +3496,9 @@ def part_of_degree(self, d): sage: P1xP1 = toric_varieties.P1xP1() sage: t = P1xP1.cohomology_ring().gen(0) sage: y = P1xP1.cohomology_ring().gen(2) - sage: 3*t+4*t^2*y+y+t*y+t+1 + sage: 3*t + 4*t^2*y + y + t*y + t + 1 [t*y + 4*t + y + 1] - sage: (3*t+4*t^2*y+y+t*y+t+1).part_of_degree(1) + sage: (3*t + 4*t^2*y + y + t*y + t + 1).part_of_degree(1) [4*t + y] """ Q = self.parent() diff --git a/src/sage/schemes/toric/weierstrass.py b/src/sage/schemes/toric/weierstrass.py index 552a91093d6..7db602ef333 100644 --- a/src/sage/schemes/toric/weierstrass.py +++ b/src/sage/schemes/toric/weierstrass.py @@ -168,12 +168,12 @@ def Discriminant(polynomial, variables=None): sage: from sage.schemes.toric.weierstrass import Discriminant sage: R. = QQ[] - sage: Discriminant(x^3+y^3+z^3) + sage: Discriminant(x^3 + y^3 + z^3) 19683/16 sage: Discriminant(x*y*z) 0 sage: R. = QQ[] - sage: quadratic1 = w^2+x^2+y^2 + sage: quadratic1 = w^2 + x^2 + y^2 sage: quadratic2 = z^2 + w*x sage: Discriminant([quadratic1, quadratic2]) -1/16 @@ -207,7 +207,7 @@ def j_invariant(polynomial, variables=None): sage: from sage.schemes.toric.weierstrass import j_invariant sage: R. = QQ[] - sage: j_invariant(x^3+y^3+z^3) + sage: j_invariant(x^3 + y^3 + z^3) 0 sage: j_invariant(-y^2 + x^2 + x^3) +Infinity @@ -538,7 +538,7 @@ def _check_homogeneity(polynomial, variables, weights, total_weight=None): ....: a11*x*y*z + a02*y^2*z + a10*x*z^2 + a01*y*z^2 + a00*z^3) sage: _check_homogeneity(p, [x,y,z], (1,1,1), 3) - sage: _check_homogeneity(p+x^4, [x,y,z], (1,1,1), 3) + sage: _check_homogeneity(p + x^4, [x,y,z], (1,1,1), 3) Traceback (most recent call last): ... ValueError: the polynomial is not homogeneous with weights (1, 1, 1) @@ -632,7 +632,7 @@ def _check_polynomial_P2(cubic, variables): sage: from sage.schemes.toric.weierstrass import _check_polynomial_P2 sage: R. = QQ[] - sage: cubic = x^3+y^3+z^3 + sage: cubic = x^3 + y^3 + z^3 sage: _check_polynomial_P2(cubic, [x,y,z]) (x, y, z) sage: _check_polynomial_P2(cubic, None) @@ -640,7 +640,7 @@ def _check_polynomial_P2(cubic, variables): sage: _check_polynomial_P2(cubic.subs(z=1), None) (x, y, None) sage: R. = QQ[] - sage: cubic = x^3+y^3+z^3 + t*x*y*z + sage: cubic = x^3 + y^3 + z^3 + t*x*y*z sage: _check_polynomial_P2(cubic, [x,y,z]) (x, y, z) sage: _check_polynomial_P2(cubic, [x,y,t]) @@ -684,11 +684,11 @@ def WeierstrassForm_P2(polynomial, variables=None): sage: from sage.schemes.toric.weierstrass import WeierstrassForm_P2 sage: R. = QQ[] - sage: WeierstrassForm_P2( x^3+y^3+z^3 ) + sage: WeierstrassForm_P2(x^3 + y^3 + z^3) (0, -27/4) sage: R. = QQ[] - sage: WeierstrassForm_P2( -y^2*z+x^3+a*x*z^2+b*z^3, [x,y,z] ) + sage: WeierstrassForm_P2(-y^2*z + x^3 + a*x*z^2 + b*z^3, [x,y,z]) (a, b) TESTS:: @@ -789,9 +789,9 @@ def _check_polynomial_P1xP1(biquadric, variables): sage: from sage.schemes.toric.weierstrass import _check_polynomial_P1xP1 sage: R. = QQ[] - sage: biquadric = ( x0^2*y0^2 + x0*x1*y0^2*2 + x1^2*y0^2*3 - ....: + x0^2*y0*y1*4 + x0*x1*y0*y1*5 + x1^2*y0*y1*6 - ....: + x0^2*y1^2*7 + x0*x1*y1^2*8 ) + sage: biquadric = (x0^2*y0^2 + x0*x1*y0^2*2 + x1^2*y0^2*3 + ....: + x0^2*y0*y1*4 + x0*x1*y0*y1*5 + x1^2*y0*y1*6 + ....: + x0^2*y1^2*7 + x0*x1*y1^2*8) sage: _check_polynomial_P1xP1(biquadric, [x0,x1,y0,y1]) [x0, x1, y0, y1] sage: _check_polynomial_P1xP1(biquadric, None) @@ -834,9 +834,9 @@ def _partial_discriminant(quadric, y0, y1=None): EXAMPLES:: sage: R. = QQ[] - sage: biquadric = ( x0^2*y0^2*a00 + x0*x1*y0^2*a10 + x1^2*y0^2*a20 - ....: + x0^2*y0*y1*a01 + x0*x1*y0*y1*a11 + x1^2*y0*y1*a21 - ....: + x0^2*y1^2*a02 + x0*x1*y1^2*a12 + x1^2*y1^2*a22 ) + sage: biquadric = (x0^2*y0^2*a00 + x0*x1*y0^2*a10 + x1^2*y0^2*a20 + ....: + x0^2*y0*y1*a01 + x0*x1*y0*y1*a11 + x1^2*y0*y1*a21 + ....: + x0^2*y1^2*a02 + x0*x1*y1^2*a12 + x1^2*y1^2*a22) sage: from sage.schemes.toric.weierstrass import _partial_discriminant sage: _partial_discriminant(biquadric, y0, y1) x0^4*a01^2 + 2*x0^3*x1*a01*a11 + x0^2*x1^2*a11^2 @@ -888,10 +888,10 @@ def WeierstrassForm_P1xP1(biquadric, variables=None): EXAMPLES:: sage: from sage.schemes.toric.weierstrass import WeierstrassForm_P1xP1 - sage: R.= QQ[] - sage: biquadric = ( x0^2*y0^2 + x0*x1*y0^2*2 + x1^2*y0^2*3 - ....: + x0^2*y0*y1*4 + x0*x1*y0*y1*5 + x1^2*y0*y1*6 - ....: + x0^2*y1^2*7 + x0*x1*y1^2*8 ) + sage: R. = QQ[] + sage: biquadric = (x0^2*y0^2 + x0*x1*y0^2*2 + x1^2*y0^2*3 + ....: + x0^2*y0*y1*4 + x0*x1*y0*y1*5 + x1^2*y0*y1*6 + ....: + x0^2*y1^2*7 + x0*x1*y1^2*8) sage: WeierstrassForm_P1xP1(biquadric, [x0, x1, y0, y1]) (1581/16, -3529/32) @@ -905,9 +905,9 @@ def WeierstrassForm_P1xP1(biquadric, variables=None): TESTS:: sage: R. = QQ[] - sage: biquadric = ( x0^2*y0^2*a00 + x0*x1*y0^2*a10 + x1^2*y0^2*a20 - ....: + x0^2*y0*y1*a01 + x0*x1*y0*y1*a11 + x1^2*y0*y1*a21 - ....: + x0^2*y1^2*a02 + x0*x1*y1^2*a12 ) + sage: biquadric = (x0^2*y0^2*a00 + x0*x1*y0^2*a10 + x1^2*y0^2*a20 + ....: + x0^2*y0*y1*a01 + x0*x1*y0*y1*a11 + x1^2*y0*y1*a21 + ....: + x0^2*y1^2*a02 + x0*x1*y1^2*a12) sage: WeierstrassForm_P1xP1(biquadric, [x0, x1, y0, y1]) (-1/48*a11^4 + 1/6*a01*a11^2*a21 - 1/3*a01^2*a21^2 + 1/6*a20*a11^2*a02 + 1/3*a20*a01*a21*a02 - 1/2*a10*a11*a21*a02 @@ -935,7 +935,7 @@ def WeierstrassForm_P1xP1(biquadric, variables=None): + 1/9*a10^2*a20*a02*a12^2 - 2/3*a00*a20^2*a02*a12^2 - 2/27*a10^3*a12^3 + 1/3*a00*a10*a20*a12^3) - sage: _ == WeierstrassForm_P1xP1(biquadric.subs(x1=1,y1=1), [x0, y0]) + sage: _ == WeierstrassForm_P1xP1(biquadric.subs(x1=1, y1=1), [x0, y0]) True """ x, y, s, t = _check_polynomial_P1xP1(biquadric, variables) @@ -1027,7 +1027,8 @@ def WeierstrassForm_P2_112(polynomial, variables=None): EXAMPLES:: sage: from sage.schemes.toric.weierstrass import WeierstrassForm_P2_112 - sage: fan = Fan(rays=[(1,0),(0,1),(-1,-2),(0,-1)],cones=[[0,1],[1,2],[2,3],[3,0]]) + sage: fan = Fan(rays=[(1,0),(0,1),(-1,-2),(0,-1)], + ....: cones=[[0,1],[1,2],[2,3],[3,0]]) sage: P112. = ToricVariety(fan) sage: (-P112.K()).sections_monomials() (z^4*t^2, x*z^3*t^2, x^2*z^2*t^2, x^3*z*t^2, @@ -1038,8 +1039,8 @@ def WeierstrassForm_P2_112(polynomial, variables=None): TESTS:: sage: R. = QQ[] - sage: p = ( a40*x^4*t^2 + a30*x^3*z*t^2 + a20*x^2*z^2*t^2 + a10*x*z^3*t^2 + - ....: a00*z^4*t^2 + a21*x^2*y*t + a11*x*y*z*t + a01*y*z^2*t + a02*y^2 ) + sage: p = (a40*x^4*t^2 + a30*x^3*z*t^2 + a20*x^2*z^2*t^2 + a10*x*z^3*t^2 + + ....: a00*z^4*t^2 + a21*x^2*y*t + a11*x*y*z*t + a01*y*z^2*t + a02*y^2) sage: WeierstrassForm_P2_112(p, [x,y,z,t]) (-1/48*a11^4 + 1/6*a21*a11^2*a01 - 1/3*a21^2*a01^2 + a00*a21^2*a02 - 1/2*a10*a21*a11*a02 + 1/6*a20*a11^2*a02 + 1/3*a20*a21*a01*a02 @@ -1061,15 +1062,15 @@ def WeierstrassForm_P2_112(polynomial, variables=None): + 1/3*a30*a20*a10*a02^3 - a40*a10^2*a02^3 - a30^2*a00*a02^3 + 8/3*a40*a20*a00*a02^3) - sage: _ == WeierstrassForm_P2_112(p.subs(z=1,t=1), [x,y]) + sage: _ == WeierstrassForm_P2_112(p.subs(z=1, t=1), [x,y]) True sage: cubic = p.subs(a40=0) sage: a,b = WeierstrassForm_P2_112(cubic, [x,y,z,t]) - sage: a = a.subs(t=1,z=1) - sage: b = b.subs(t=1,z=1) + sage: a = a.subs(t=1, z=1) + sage: b = b.subs(t=1, z=1) sage: from sage.schemes.toric.weierstrass import WeierstrassForm_P2 - sage: (a,b) == WeierstrassForm_P2(cubic.subs(t=1,z=1), [x,y]) + sage: (a,b) == WeierstrassForm_P2(cubic.subs(t=1, z=1), [x,y]) True """ x, y, z, t = _check_polynomial_P2_112(polynomial, variables) diff --git a/src/sage/schemes/toric/weierstrass_covering.py b/src/sage/schemes/toric/weierstrass_covering.py index fe3c45ed722..7a625fac211 100644 --- a/src/sage/schemes/toric/weierstrass_covering.py +++ b/src/sage/schemes/toric/weierstrass_covering.py @@ -161,10 +161,10 @@ def WeierstrassMap(polynomial, variables=None): 1/2*x^6*y^3 - 1/2*x^3*y^6 - 1/2*x^6*z^3 + 1/2*y^6*z^3 + 1/2*x^3*z^6 - 1/2*y^3*z^6, x*y*z) - sage: f, g = WeierstrassForm(cubic); (f,g) - (0, -27/4) - sage: cubic.divides(-Y^2 + X^3 + f*X*Z^4 + g*Z^6) - True + sage: f, g = WeierstrassForm(cubic); (f,g) + (0, -27/4) + sage: cubic.divides(-Y^2 + X^3 + f*X*Z^4 + g*Z^6) + True Only the affine span of the Newton polytope of the polynomial matters. For example:: @@ -301,7 +301,7 @@ def WeierstrassMap_P2(polynomial, variables=None): sage: from sage.schemes.toric.weierstrass import WeierstrassForm_P2 sage: from sage.schemes.toric.weierstrass_covering import WeierstrassMap_P2 sage: R. = QQ[] - sage: equation = x^3+y^3+z^3+x*y*z + sage: equation = x^3 + y^3 + z^3 + x*y*z sage: f, g = WeierstrassForm_P2(equation) sage: X,Y,Z = WeierstrassMap_P2(equation) sage: equation.divides(-Y^2 + X^3 + f*X*Z^4 + g*Z^6) @@ -310,7 +310,7 @@ def WeierstrassMap_P2(polynomial, variables=None): sage: from sage.schemes.toric.weierstrass import WeierstrassForm_P2 sage: from sage.schemes.toric.weierstrass_covering import WeierstrassMap_P2 sage: R. = QQ[] - sage: equation = x^3+y^3+1 + sage: equation = x^3 + y^3 + 1 sage: f, g = WeierstrassForm_P2(equation) sage: X,Y,Z = WeierstrassMap_P2(equation) sage: equation.divides(-Y^2 + X^3 + f*X*Z^4 + g*Z^6) @@ -344,9 +344,9 @@ def WeierstrassMap_P1xP1(polynomial, variables=None): sage: from sage.schemes.toric.weierstrass_covering import WeierstrassMap_P1xP1 sage: from sage.schemes.toric.weierstrass import WeierstrassForm_P1xP1 - sage: R.= QQ[] - sage: biquadric = ( x0^2*y0^2 + x1^2*y0^2 + x0^2*y1^2 + x1^2*y1^2 + - ....: a * x0*x1*y0*y1*5 ) + sage: R. = QQ[] + sage: biquadric = (x0^2*y0^2 + x1^2*y0^2 + x0^2*y1^2 + x1^2*y1^2 + + ....: a * x0*x1*y0*y1*5) sage: f, g = WeierstrassForm_P1xP1(biquadric, [x0, x1, y0, y1]); (f,g) (-625/48*a^4 + 25/3*a^2 - 16/3, 15625/864*a^6 - 625/36*a^4 - 100/9*a^2 + 128/27) sage: X, Y, Z = WeierstrassMap_P1xP1(biquadric, [x0, x1, y0, y1]) @@ -356,8 +356,8 @@ def WeierstrassMap_P1xP1(polynomial, variables=None): sage: R = PolynomialRing(QQ, 'x,y,s,t', order='lex') sage: R.inject_variables() Defining x, y, s, t - sage: equation = ( s^2*(x^2+2*x*y+3*y^2) + s*t*(4*x^2+5*x*y+6*y^2) - ....: + t^2*(7*x^2+8*x*y+9*y^2) ) + sage: equation = (s^2*(x^2+2*x*y+3*y^2) + s*t*(4*x^2+5*x*y+6*y^2) + ....: + t^2*(7*x^2+8*x*y+9*y^2)) sage: X, Y, Z = WeierstrassMap_P1xP1(equation, [x,y,s,t]) sage: f, g = WeierstrassForm_P1xP1(equation, variables=[x,y,s,t]) sage: (-Y^2 + X^3 + f*X*Z^4 + g*Z^6).reduce(R.ideal(equation)) @@ -429,7 +429,8 @@ def WeierstrassMap_P2_112(polynomial, variables=None): Another example, this time in homogeneous coordinates:: - sage: fan = Fan(rays=[(1,0),(0,1),(-1,-2),(0,-1)],cones=[[0,1],[1,2],[2,3],[3,0]]) + sage: fan = Fan(rays=[(1,0),(0,1),(-1,-2),(0,-1)], + ....: cones=[[0,1],[1,2],[2,3],[3,0]]) sage: P112. = ToricVariety(fan) sage: (-P112.K()).sections_monomials() (z^4*t^2, x*z^3*t^2, x^2*z^2*t^2, x^3*z*t^2, diff --git a/src/sage/schemes/toric/weierstrass_higher.py b/src/sage/schemes/toric/weierstrass_higher.py index 034d3ead9e4..64ae772ab27 100644 --- a/src/sage/schemes/toric/weierstrass_higher.py +++ b/src/sage/schemes/toric/weierstrass_higher.py @@ -11,7 +11,7 @@ quadratic equations in `\mathbb{P}^3` :: sage: R. = QQ[] - sage: quadratic1 = w^2+x^2+y^2 + sage: quadratic1 = w^2 + x^2 + y^2 sage: quadratic2 = z^2 + w*x sage: WeierstrassForm([quadratic1, quadratic2]) (-1/4, 0) @@ -50,7 +50,7 @@ def WeierstrassForm2(polynomial, variables=None, transformation=False): sage: from sage.schemes.toric.weierstrass_higher import WeierstrassForm2 sage: R. = QQ[] - sage: quadratic1 = w^2+x^2+y^2 + sage: quadratic1 = w^2 + x^2 + y^2 sage: quadratic2 = z^2 + w*x sage: WeierstrassForm2([quadratic1, quadratic2]) (-1/4, 0) @@ -87,7 +87,7 @@ def _check_polynomials_P3(quadratic1, quadratic2, variables): sage: from sage.schemes.toric.weierstrass_higher import _check_polynomials_P3 sage: R. = QQ[] - sage: quadratic = w^2+x^2+y^2+z^2 + sage: quadratic = w^2 + x^2 + y^2 + z^2 sage: _check_polynomials_P3(w^2, quadratic, [w,x,y,z]) (w, x, y, z) sage: _check_polynomials_P3(w^2, quadratic, None) @@ -95,7 +95,7 @@ def _check_polynomials_P3(quadratic1, quadratic2, variables): sage: _check_polynomials_P3(z^2, quadratic.subs(w=0), None) (x, y, z, None) sage: R. = QQ[] - sage: quadratic = w^2+x^2+y^2+z^2 + t*(x*y+y*z+z*w+w*x) + sage: quadratic = w^2 + x^2 + y^2 + z^2 + t*(x*y+y*z+z*w+w*x) sage: _check_polynomials_P3(w^2, quadratic, [w,x,y,z]) (w, x, y, z) sage: _check_polynomials_P3(w^2, quadratic, [w,x,y,t]) @@ -157,7 +157,7 @@ def _biquadratic_syzygy_quartic(quadratic1, quadratic2, variables=None): sage: from sage.schemes.toric.weierstrass_higher import _biquadratic_syzygy_quartic sage: R. = QQ[] - sage: _biquadratic_syzygy_quartic(w^2+x^2+y^2, z^2) + sage: _biquadratic_syzygy_quartic(w^2 + x^2 + y^2, z^2) (Joint quaternary quadratic with coefficients (1, 1, 1, 0, 0, 0, 0, 0, 0, 0) and quaternary quadratic with coefficients (0, 0, 0, 1, 0, 0, 0, 0, 0, 0), Binary quartic with coefficients (0, 0, 0, -1, 0), {aux...}) @@ -203,7 +203,7 @@ def WeierstrassForm_P3(quadratic1, quadratic2, variables=None): sage: from sage.schemes.toric.weierstrass_higher import WeierstrassForm_P3 sage: R. = QQ[] - sage: quadratic1 = w^2+x^2+y^2 + sage: quadratic1 = w^2 + x^2 + y^2 sage: quadratic2 = z^2 + w*x sage: WeierstrassForm_P3(quadratic1, quadratic2) (-1/4, 0) @@ -242,7 +242,7 @@ def WeierstrassMap_P3(quadratic1, quadratic2, variables=None): sage: from sage.schemes.toric.weierstrass_higher import \ ....: WeierstrassMap_P3, WeierstrassForm_P3 sage: R. = QQ[] - sage: quadratic1 = w^2+x^2+y^2 + sage: quadratic1 = w^2 + x^2 + y^2 sage: quadratic2 = z^2 + w*x sage: X, Y, Z = WeierstrassMap_P3(quadratic1, quadratic2) sage: X @@ -262,17 +262,17 @@ def WeierstrassMap_P3(quadratic1, quadratic2, variables=None): TESTS:: - sage: R. = GF(101)[] - sage: p1 = w^2 + x^2 + y^2 + z^2 - sage: p2 = a0*w^2 + a1*x^2 + a2*y^2 + a3*z^2 - sage: X, Y, Z = WeierstrassMap_P3(p1, p2, [w,x,y,z]) - sage: X.total_degree(), len(X.coefficients()) + sage: R. = GF(101)[] # optional - sage.rings.finite_rings + sage: p1 = w^2 + x^2 + y^2 + z^2 # optional - sage.rings.finite_rings + sage: p2 = a0*w^2 + a1*x^2 + a2*y^2 + a3*z^2 # optional - sage.rings.finite_rings + sage: X, Y, Z = WeierstrassMap_P3(p1, p2, [w,x,y,z]) # optional - sage.rings.finite_rings + sage: X.total_degree(), len(X.coefficients()) # optional - sage.rings.finite_rings (22, 4164) - sage: Y.total_degree(), len(Y.coefficients()) + sage: Y.total_degree(), len(Y.coefficients()) # optional - sage.rings.finite_rings (33, 26912) - sage: Z.total_degree(), len(Z.coefficients()) + sage: Z.total_degree(), len(Z.coefficients()) # optional - sage.rings.finite_rings (10, 24) - sage: Z + sage: Z # optional - sage.rings.finite_rings w*x*y*z*a0^3*a1^2*a2 - w*x*y*z*a0^2*a1^3*a2 - w*x*y*z*a0^3*a1*a2^2 + w*x*y*z*a0*a1^3*a2^2 + w*x*y*z*a0^2*a1*a2^3 - w*x*y*z*a0*a1^2*a2^3 - w*x*y*z*a0^3*a1^2*a3 + w*x*y*z*a0^2*a1^3*a3 + w*x*y*z*a0^3*a2^2*a3 From 4f53f6eb22b82e70ba2d1e98e2cd4afbf50ed7c8 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 21 Mar 2023 20:00:12 -0700 Subject: [PATCH 080/135] sage.schemes.curves: Add # optional --- src/sage/schemes/curves/affine_curve.py | 826 +++++++++-------- src/sage/schemes/curves/closed_point.py | 200 ++-- src/sage/schemes/curves/constructor.py | 32 +- src/sage/schemes/curves/curve.py | 136 +-- src/sage/schemes/curves/point.py | 150 +-- src/sage/schemes/curves/projective_curve.py | 917 ++++++++++--------- src/sage/schemes/curves/zariski_vankampen.py | 2 +- 7 files changed, 1185 insertions(+), 1078 deletions(-) diff --git a/src/sage/schemes/curves/affine_curve.py b/src/sage/schemes/curves/affine_curve.py index a329e927d51..811d49dba8f 100644 --- a/src/sage/schemes/curves/affine_curve.py +++ b/src/sage/schemes/curves/affine_curve.py @@ -27,49 +27,49 @@ EXAMPLES:: - sage: k. = GF(2) - sage: A. = AffineSpace(k, 3) - sage: C = Curve([x^2 + x - y^3, y^4 - y - z^3], A) - sage: C.genus() + sage: k. = GF(2) # optional - sage.rings.finite_rings + sage: A. = AffineSpace(k, 3) # optional - sage.rings.finite_rings + sage: C = Curve([x^2 + x - y^3, y^4 - y - z^3], A) # optional - sage.rings.finite_rings + sage: C.genus() # optional - sage.rings.finite_rings 10 - sage: C.function_field() + sage: C.function_field() # optional - sage.rings.finite_rings Function field in z defined by z^9 + x^8 + x^6 + x^5 + x^4 + x^3 + x Closed points of arbitrary degree can be computed:: - sage: C.closed_points() + sage: C.closed_points() # optional - sage.rings.finite_rings [Point (x, y, z), Point (x + 1, y, z)] - sage: C.closed_points(2) + sage: C.closed_points(2) # optional - sage.rings.finite_rings [Point (x^2 + x + 1, y + 1, z), Point (y^2 + y + 1, x + y, z), Point (y^2 + y + 1, x + y + 1, z)] - sage: p = _[0] - sage: p.places() + sage: p = _[0] # optional - sage.rings.finite_rings + sage: p.places() # optional - sage.rings.finite_rings [Place (x^2 + x + 1, (1/(x^4 + x^2 + 1))*z^7 + (1/(x^4 + x^2 + 1))*z^6 + 1)] The places at infinity correspond to the extra closed points of the curve's projective closure:: - sage: C.places_at_infinity() + sage: C.places_at_infinity() # optional - sage.rings.finite_rings [Place (1/x, 1/x*z)] It is easy to transit to and from the function field of the curve:: - sage: fx = C(x) - sage: fy = C(y) - sage: fx^2 + fx - fy^3 + sage: fx = C(x) # optional - sage.rings.finite_rings + sage: fy = C(y) # optional - sage.rings.finite_rings + sage: fx^2 + fx - fy^3 # optional - sage.rings.finite_rings 0 - sage: fx.divisor() + sage: fx.divisor() # optional - sage.rings.finite_rings -9*Place (1/x, 1/x*z) + 9*Place (x, z) - sage: p, = fx.zeros() - sage: C.place_to_closed_point(p) + sage: p, = fx.zeros() # optional - sage.rings.finite_rings + sage: C.place_to_closed_point(p) # optional - sage.rings.finite_rings Point (x, y, z) - sage: _.rational_point() + sage: _.rational_point() # optional - sage.rings.finite_rings (0, 0, 0) - sage: _.closed_point() + sage: _.closed_point() # optional - sage.rings.finite_rings Point (x, y, z) - sage: _.place() + sage: _.place() # optional - sage.rings.finite_rings Place (x, z) Integral affine curves over `\QQ` @@ -95,10 +95,10 @@ s sage: sy = sy.polynomial(10); sy -7/256*s^10 - 5/128*s^8 - 1/16*s^6 - 1/8*s^4 - 1/2*s^2 + 1 - sage: s = var('s') - sage: P1 = parametric_plot([sx, sy], (s, -1, 1), color='red') - sage: P2 = C.plot((x, -1, 1), (y, 0, 2)) # half circle - sage: P1 + P2 + sage: s = var('s') # optional - sage.symbolic + sage: P1 = parametric_plot([sx, sy], (s, -1, 1), color='red') # optional - sage.plot sage.symbolic + sage: P2 = C.plot((x, -1, 1), (y, 0, 2)) # half circle # optional - sage.plot sage.symbolic + sage: P1 + P2 # optional - sage.plot sage.symbolic Graphics object consisting of 2 graphics primitives AUTHORS: @@ -168,16 +168,16 @@ class AffineCurve(Curve_generic, AlgebraicScheme_subscheme_affine): EXAMPLES:: sage: R. = QQ[] - sage: K. = NumberField(v^2 + 3) - sage: A. = AffineSpace(K, 3) - sage: C = Curve([z - u*x^2, y^2], A); C + sage: K. = NumberField(v^2 + 3) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 3) # optional - sage.rings.number_field + sage: C = Curve([z - u*x^2, y^2], A); C # optional - sage.rings.number_field Affine Curve over Number Field in u with defining polynomial v^2 + 3 defined by (-u)*x^2 + z, y^2 :: - sage: A. = AffineSpace(GF(7), 3) - sage: C = Curve([x^2 - z, z - 8*x], A); C + sage: A. = AffineSpace(GF(7), 3) # optional - sage.rings.finite_rings + sage: C = Curve([x^2 - z, z - 8*x], A); C # optional - sage.rings.finite_rings Affine Curve over Finite Field of size 7 defined by x^2 - z, -x + z """ def __init__(self, A, X): @@ -187,16 +187,16 @@ def __init__(self, A, X): EXAMPLES:: sage: R. = QQ[] - sage: K. = NumberField(v^2 + 3) - sage: A. = AffineSpace(K, 3) - sage: C = Curve([z - u*x^2, y^2], A); C + sage: K. = NumberField(v^2 + 3) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 3) # optional - sage.rings.number_field + sage: C = Curve([z - u*x^2, y^2], A); C # optional - sage.rings.number_field Affine Curve over Number Field in u with defining polynomial v^2 + 3 defined by (-u)*x^2 + z, y^2 :: - sage: A. = AffineSpace(GF(7), 3) - sage: C = Curve([x^2 - z, z - 8*x], A); C + sage: A. = AffineSpace(GF(7), 3) # optional - sage.rings.finite_rings + sage: C = Curve([x^2 - z, z - 8*x], A); C # optional - sage.rings.finite_rings Affine Curve over Finite Field of size 7 defined by x^2 - z, -x + z """ if not is_AffineSpace(A): @@ -324,18 +324,18 @@ def divisor_of_function(self, r): EXAMPLES:: - sage: F = GF(5) - sage: P2 = AffineSpace(2, F, names = 'xy') - sage: R = P2.coordinate_ring() - sage: x, y = R.gens() - sage: f = y^2 - x^9 - x - sage: C = Curve(f) - sage: K = FractionField(R) - sage: r = 1/x - sage: C.divisor_of_function(r) # todo: not implemented (broken) + sage: F = GF(5) # optional - sage.rings.finite_rings + sage: P2 = AffineSpace(2, F, names='xy') # optional - sage.rings.finite_rings + sage: R = P2.coordinate_ring() # optional - sage.rings.finite_rings + sage: x, y = R.gens() # optional - sage.rings.finite_rings + sage: f = y^2 - x^9 - x # optional - sage.rings.finite_rings + sage: C = Curve(f) # optional - sage.rings.finite_rings + sage: K = FractionField(R) # optional - sage.rings.finite_rings + sage: r = 1/x # optional - sage.rings.finite_rings + sage: C.divisor_of_function(r) # todo: not implemented (broken) # optional - sage.rings.finite_rings [[-1, (0, 0, 1)]] - sage: r = 1/x^3 - sage: C.divisor_of_function(r) # todo: not implemented (broken) + sage: r = 1/x^3 # optional - sage.rings.finite_rings + sage: C.divisor_of_function(r) # todo: not implemented (broken) # optional - sage.rings.finite_rings [[-3, (0, 0, 1)]] """ F = self.base_ring() @@ -378,13 +378,13 @@ def local_coordinates(self, pt, n): EXAMPLES:: - sage: F = GF(5) - sage: pt = (2,3) - sage: R = PolynomialRing(F,2, names = ['x','y']) - sage: x,y = R.gens() - sage: f = y^2-x^9-x - sage: C = Curve(f) - sage: C.local_coordinates(pt, 9) + sage: F = GF(5) # optional - sage.rings.finite_rings + sage: pt = (2,3) # optional - sage.rings.finite_rings + sage: R = PolynomialRing(F, 2, names = ['x','y']) # optional - sage.rings.finite_rings + sage: x,y = R.gens() # optional - sage.rings.finite_rings + sage: f = y^2 - x^9 - x # optional - sage.rings.finite_rings + sage: C = Curve(f) # optional - sage.rings.finite_rings + sage: C.local_coordinates(pt, 9) # optional - sage.rings.finite_rings [t + 2, -2*t^12 - 2*t^11 + 2*t^9 + t^8 - 2*t^7 - 2*t^6 - 2*t^4 + t^3 - 2*t^2 - 2] """ f = self.defining_polynomial() @@ -497,12 +497,12 @@ def is_transverse(self, C, P): :: sage: R. = QQ[] - sage: K. = NumberField(a^3 + 2) - sage: A. = AffineSpace(K, 2) - sage: C = A.curve([x*y]) - sage: D = A.curve([y - b*x]) - sage: Q = A([0,0]) - sage: C.is_transverse(D, Q) + sage: K. = NumberField(a^3 + 2) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 2) # optional - sage.rings.number_field + sage: C = A.curve([x*y]) # optional - sage.rings.number_field + sage: D = A.curve([y - b*x]) # optional - sage.rings.number_field + sage: Q = A([0,0]) # optional - sage.rings.number_field + sage: C.is_transverse(D, Q) # optional - sage.rings.number_field False :: @@ -555,11 +555,12 @@ def multiplicity(self, P): :: - sage: A. = AffineSpace(QQbar,2) - sage: C = Curve([-x^7 + (-7)*x^6 + y^6 + (-21)*x^5 + 12*y^5 + (-35)*x^4 + 60*y^4 +\ - (-35)*x^3 + 160*y^3 + (-21)*x^2 + 240*y^2 + (-7)*x + 192*y + 63], A) - sage: Q = A([-1,-2]) - sage: C.multiplicity(Q) + sage: A. = AffineSpace(QQbar,2) # optional - sage.rings.number_field + sage: C = Curve([-x^7 + (-7)*x^6 + y^6 + (-21)*x^5 + 12*y^5 # optional - sage.rings.number_field + ....: + (-35)*x^4 + 60*y^4 + (-35)*x^3 + 160*y^3 + ....: + (-21)*x^2 + 240*y^2 + (-7)*x + 192*y + 63], A) + sage: Q = A([-1,-2]) # optional - sage.rings.number_field + sage: C.multiplicity(Q) # optional - sage.rings.number_field 6 :: @@ -610,26 +611,29 @@ def tangents(self, P, factor=True): EXAMPLES:: sage: set_verbose(-1) - sage: A. = AffineSpace(QQbar, 2) - sage: C = Curve([x^5*y^3 + 2*x^4*y^4 + x^3*y^5 + 3*x^4*y^3 + 6*x^3*y^4 + 3*x^2*y^5\ - + 3*x^3*y^3 + 6*x^2*y^4 + 3*x*y^5 + x^5 + 10*x^4*y + 40*x^3*y^2 + 81*x^2*y^3 + 82*x*y^4\ - + 33*y^5], A) - sage: Q = A([0,0]) - sage: C.tangents(Q) - [x + 3.425299577684700?*y, x + (1.949159013086856? + 1.179307909383728?*I)*y, - x + (1.949159013086856? - 1.179307909383728?*I)*y, x + (1.338191198070795? + 0.2560234251008043?*I)*y, - x + (1.338191198070795? - 0.2560234251008043?*I)*y] - sage: C.tangents(Q, factor=False) + sage: A. = AffineSpace(QQbar, 2) # optional - sage.rings.number_field + sage: C = Curve([x^5*y^3 + 2*x^4*y^4 + x^3*y^5 + 3*x^4*y^3 # optional - sage.rings.number_field + ....: + 6*x^3*y^4 + 3*x^2*y^5 + 3*x^3*y^3 + ....: + 6*x^2*y^4 + 3*x*y^5 + x^5 + 10*x^4*y + ....: + 40*x^3*y^2 + 81*x^2*y^3 + 82*x*y^4 + 33*y^5], A) + sage: Q = A([0,0]) # optional - sage.rings.number_field + sage: C.tangents(Q) # optional - sage.rings.number_field + [x + 3.425299577684700?*y, + x + (1.949159013086856? + 1.179307909383728?*I)*y, + x + (1.949159013086856? - 1.179307909383728?*I)*y, + x + (1.338191198070795? + 0.2560234251008043?*I)*y, + x + (1.338191198070795? - 0.2560234251008043?*I)*y] + sage: C.tangents(Q, factor=False) # optional - sage.rings.number_field [120*x^5 + 1200*x^4*y + 4800*x^3*y^2 + 9720*x^2*y^3 + 9840*x*y^4 + 3960*y^5] :: sage: R. = QQ[] - sage: K. = NumberField(a^2 - 3) - sage: A. = AffineSpace(K, 2) - sage: C = Curve([(x^2 + y^2 - 2*x)^2 - x^2 - y^2], A) - sage: Q = A([0,0]) - sage: C.tangents(Q) + sage: K. = NumberField(a^2 - 3) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 2) # optional - sage.rings.number_field + sage: C = Curve([(x^2 + y^2 - 2*x)^2 - x^2 - y^2], A) # optional - sage.rings.number_field + sage: Q = A([0,0]) # optional - sage.rings.number_field + sage: C.tangents(Q) # optional - sage.rings.number_field [x + (-1/3*b)*y, x + (1/3*b)*y] :: @@ -721,11 +725,11 @@ def is_ordinary_singularity(self, P): :: sage: R. = QQ[] - sage: K. = NumberField(a^2 - 3) - sage: A. = AffineSpace(K, 2) - sage: C = Curve([(x^2 + y^2 - 2*x)^2 - x^2 - y^2], A) - sage: Q = A([0,0]) - sage: C.is_ordinary_singularity(Q) + sage: K. = NumberField(a^2 - 3) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 2) # optional - sage.rings.number_field + sage: C = Curve([(x^2 + y^2 - 2*x)^2 - x^2 - y^2], A) # optional - sage.rings.number_field + sage: Q = A([0,0]) # optional - sage.rings.number_field + sage: C.is_ordinary_singularity(Q) # optional - sage.rings.number_field True :: @@ -829,16 +833,16 @@ def __init__(self, A, X): EXAMPLES:: sage: R. = QQ[] - sage: K. = NumberField(v^2 + 3) - sage: A. = AffineSpace(K, 3) - sage: C = Curve([z - u*x^2, y^2], A); C + sage: K. = NumberField(v^2 + 3) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 3) # optional - sage.rings.number_field + sage: C = Curve([z - u*x^2, y^2], A); C # optional - sage.rings.number_field Affine Curve over Number Field in u with defining polynomial v^2 + 3 defined by (-u)*x^2 + z, y^2 :: - sage: A. = AffineSpace(GF(7), 3) - sage: C = Curve([x^2 - z, z - 8*x], A); C + sage: A. = AffineSpace(GF(7), 3) # optional - sage.rings.number_field + sage: C = Curve([x^2 - z, z - 8*x], A); C # optional - sage.rings.number_field Affine Curve over Finite Field of size 7 defined by x^2 - z, -x + z """ super().__init__(A, X) @@ -884,8 +888,8 @@ def projection(self, indices, AS=None): sage: C = Curve([y^7 - x^2 + x^3 - 2*z, z^2 - x^7 - y^2], A) sage: C.projection([0,1]) (Scheme morphism: - From: Affine Curve over Rational Field defined by y^7 + x^3 - x^2 - - 2*z, -x^7 - y^2 + z^2 + From: Affine Curve over Rational Field + defined by y^7 + x^3 - x^2 - 2*z, -x^7 - y^2 + z^2 To: Affine Space of dimension 2 over Rational Field Defn: Defined on coordinates by sending (x, y, z) to (x, y), @@ -912,14 +916,15 @@ def projection(self, indices, AS=None): :: - sage: A. = AffineSpace(GF(11), 5) - sage: C = Curve([x^3 - 5*y*z + u^2, x - y^2 + 3*z^2, w^2 + 2*u^3*y, y - u^2 + z*x], A) - sage: B. = AffineSpace(GF(11), 3) - sage: proj1 = C.projection([1,2,4], AS=B) - sage: proj1 + sage: A. = AffineSpace(GF(11), 5) # optional - sage.rings.finite_rings + sage: C = Curve([x^3 - 5*y*z + u^2, x - y^2 + 3*z^2, # optional - sage.rings.finite_rings + ....: w^2 + 2*u^3*y, y - u^2 + z*x], A) + sage: B. = AffineSpace(GF(11), 3) # optional - sage.rings.finite_rings + sage: proj1 = C.projection([1,2,4], AS=B) # optional - sage.rings.finite_rings + sage: proj1 # optional - sage.rings.finite_rings (Scheme morphism: From: Affine Curve over Finite Field of size 11 defined by x^3 - - 5*y*z + u^2, -y^2 + 3*z^2 + x, 2*y*u^3 + w^2, x*z - u^2 + y + 5*y*z + u^2, -y^2 + 3*z^2 + x, 2*y*u^3 + w^2, x*z - u^2 + y To: Affine Space of dimension 3 over Finite Field of size 11 Defn: Defined on coordinates by sending (x, y, z, w, u) to (y, z, u), @@ -929,12 +934,12 @@ def projection(self, indices, AS=None): 3*b*c^2 + 3*a*b, a^4*c^2 + 2*b^4*c^2 - a^5 - 2*a*b^4 + 5*b*c^4 + a*b*c^2 - 5*a*b^2 + 4*b^3 + b*c^2 + 5*c^2 - 5*a, a^6 - 5*b^6 - 5*b^3*c^2 + 5*a*b^3 + 2*c^4 - 4*a*c^2 + 2*a^2 - 5*a*b + c^2) - sage: proj1[1].ambient_space() is B + sage: proj1[1].ambient_space() is B # optional - sage.rings.finite_rings True - sage: proj2 = C.projection([1,2,4]) - sage: proj2[1].ambient_space() is B + sage: proj2 = C.projection([1,2,4]) # optional - sage.rings.finite_rings + sage: proj2[1].ambient_space() is B # optional - sage.rings.finite_rings False - sage: C.projection([1,2,3,5], AS=B) + sage: C.projection([1,2,3,5], AS=B) # optional - sage.rings.finite_rings Traceback (most recent call last): ... TypeError: (=Affine Space of dimension 3 over Finite Field of size 11) @@ -946,22 +951,21 @@ def projection(self, indices, AS=None): sage: C = A.curve([x*y - z^3, x*z - w^3, w^2 - x^3]) sage: C.projection([y,z]) (Scheme morphism: - From: Affine Curve over Rational Field defined by -z^3 + x*y, -w^3 + - x*z, -x^3 + w^2 + From: Affine Curve over Rational Field defined by + -z^3 + x*y, -w^3 + x*z, -x^3 + w^2 To: Affine Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x, y, z, w) to - (y, z), + Defn: Defined on coordinates by sending (x, y, z, w) to (y, z), Affine Plane Curve over Rational Field defined by x1^23 - x0^7*x1^4) sage: B. = AffineSpace(QQ, 3) sage: C.projection([x,y,z], AS=B) (Scheme morphism: - From: Affine Curve over Rational Field defined by -z^3 + x*y, -w^3 + - x*z, -x^3 + w^2 + From: Affine Curve over Rational Field defined by + -z^3 + x*y, -w^3 + x*z, -x^3 + w^2 To: Affine Space of dimension 3 over Rational Field Defn: Defined on coordinates by sending (x, y, z, w) to (x, y, z), - Affine Curve over Rational Field defined by z^3 - x*y, x^8 - x*z^2, - x^7*z^2 - x*y*z) + Affine Curve over Rational Field defined by + z^3 - x*y, x^8 - x*z^2, x^7*z^2 - x*y*z) sage: C.projection([y,z,z]) Traceback (most recent call last): ... @@ -1043,35 +1047,35 @@ def plane_projection(self, AP=None): sage: C = Curve([x^2 - y*z*w, z^3 - w, w + x*y - 3*z^3], A) sage: C.plane_projection() (Scheme morphism: - From: Affine Curve over Rational Field defined by -y*z*w + x^2, z^3 - - w, -3*z^3 + x*y + w + From: Affine Curve over Rational Field defined by + -y*z*w + x^2, z^3 - w, -3*z^3 + x*y + w To: Affine Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x, y, z, w) to - (x, y), Affine Plane Curve over Rational Field defined by - x0^2*x1^7 - 16*x0^4) + Defn: Defined on coordinates by sending (x, y, z, w) to (x, y), + Affine Plane Curve over Rational Field defined by + x0^2*x1^7 - 16*x0^4) :: sage: R. = QQ[] - sage: K. = NumberField(a^2 + 2) - sage: A. = AffineSpace(K, 3) - sage: C = A.curve([x - b, y - 2]) - sage: B. = AffineSpace(K, 2) - sage: proj1 = C.plane_projection(AP=B) - sage: proj1 + sage: K. = NumberField(a^2 + 2) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 3) # optional - sage.rings.number_field + sage: C = A.curve([x - b, y - 2]) # optional - sage.rings.number_field + sage: B. = AffineSpace(K, 2) # optional - sage.rings.number_field + sage: proj1 = C.plane_projection(AP=B) # optional - sage.rings.number_field + sage: proj1 # optional - sage.rings.number_field (Scheme morphism: - From: Affine Curve over Number Field in b with defining polynomial - a^2 + 2 defined by x + (-b), y - 2 - To: Affine Space of dimension 2 over Number Field in b with - defining polynomial a^2 + 2 + From: Affine Curve over Number Field in b + with defining polynomial a^2 + 2 defined by x + (-b), y - 2 + To: Affine Space of dimension 2 over Number Field in b + with defining polynomial a^2 + 2 Defn: Defined on coordinates by sending (x, y, z) to (x, z), - Affine Plane Curve over Number Field in b with defining polynomial a^2 - + 2 defined by a + (-b)) - sage: proj1[1].ambient_space() is B + Affine Plane Curve over Number Field in b + with defining polynomial a^2 + 2 defined by a + (-b)) + sage: proj1[1].ambient_space() is B # optional - sage.rings.number_field True - sage: proj2 = C.plane_projection() - sage: proj2[1].ambient_space() is B + sage: proj2 = C.plane_projection() # optional - sage.rings.number_field + sage: proj2[1].ambient_space() is B # optional - sage.rings.number_field False """ n = self.ambient_space().dimension_relative() @@ -1114,65 +1118,89 @@ def blowup(self, P=None): sage: C = Curve([y^2 - x^3], A) sage: C.blowup() ((Affine Plane Curve over Rational Field defined by s1^2 - x, - Affine Plane Curve over Rational Field defined by y*s0^3 - 1), - ([Scheme endomorphism of Affine Plane Curve over Rational Field defined by s1^2 - x - Defn: Defined on coordinates by sending (x, s1) to - (x, s1), Scheme morphism: + Affine Plane Curve over Rational Field defined by y*s0^3 - 1), + ([Scheme endomorphism of Affine Plane Curve over Rational Field + defined by s1^2 - x + Defn: Defined on coordinates by sending (x, s1) to (x, s1), + Scheme morphism: From: Affine Plane Curve over Rational Field defined by s1^2 - x To: Affine Plane Curve over Rational Field defined by y*s0^3 - 1 - Defn: Defined on coordinates by sending (x, s1) to - (x*s1, 1/s1)], [Scheme morphism: + Defn: Defined on coordinates by sending (x, s1) to (x*s1, 1/s1)], + [Scheme morphism: From: Affine Plane Curve over Rational Field defined by y*s0^3 - 1 To: Affine Plane Curve over Rational Field defined by s1^2 - x - Defn: Defined on coordinates by sending (y, s0) to - (y*s0, 1/s0), - Scheme endomorphism of Affine Plane Curve over Rational Field defined by y*s0^3 - 1 - Defn: Defined on coordinates by sending (y, s0) to - (y, s0)]), + Defn: Defined on coordinates by sending (y, s0) to (y*s0, 1/s0), + Scheme endomorphism of Affine Plane Curve over Rational Field + defined by y*s0^3 - 1 + Defn: Defined on coordinates by sending (y, s0) to (y, s0)]), (Scheme morphism: From: Affine Plane Curve over Rational Field defined by s1^2 - x To: Affine Plane Curve over Rational Field defined by -x^3 + y^2 - Defn: Defined on coordinates by sending (x, s1) to - (x, x*s1), Scheme morphism: + Defn: Defined on coordinates by sending (x, s1) to (x, x*s1), + Scheme morphism: From: Affine Plane Curve over Rational Field defined by y*s0^3 - 1 To: Affine Plane Curve over Rational Field defined by -x^3 + y^2 - Defn: Defined on coordinates by sending (y, s0) to - (y*s0, y))) + Defn: Defined on coordinates by sending (y, s0) to (y*s0, y))) :: - sage: K. = QuadraticField(2) - sage: A. = AffineSpace(K, 3) - sage: C = Curve([y^2 - a*x^5, x - z], A) - sage: B = C.blowup() - sage: B[0] - (Affine Curve over Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? defined by s2 - 1, 2*x^3 + (-a)*s1^2, - Affine Curve over Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? defined by s0 - s2, 2*y^3*s2^5 + (-a), - Affine Curve over Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? defined by s0 - 1, 2*z^3 + (-a)*s1^2) - sage: B[1][0][2] + sage: K. = QuadraticField(2) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 3) # optional - sage.rings.number_field + sage: C = Curve([y^2 - a*x^5, x - z], A) # optional - sage.rings.number_field + sage: B = C.blowup() # optional - sage.rings.number_field + sage: B[0] # optional - sage.rings.number_field + (Affine Curve over Number Field in a with defining polynomial x^2 - 2 + with a = 1.414213562373095? defined by s2 - 1, 2*x^3 + (-a)*s1^2, + Affine Curve over Number Field in a with defining polynomial x^2 - 2 + with a = 1.414213562373095? defined by s0 - s2, 2*y^3*s2^5 + (-a), + Affine Curve over Number Field in a with defining polynomial x^2 - 2 + with a = 1.414213562373095? defined by s0 - 1, 2*z^3 + (-a)*s1^2) + sage: B[1][0][2] # optional - sage.rings.number_field Scheme morphism: - From: Affine Curve over Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? defined by s2 - 1, 2*x^3 + (-a)*s1^2 - To: Affine Curve over Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? defined by s0 - 1, 2*z^3 + (-a)*s1^2 + From: Affine Curve over Number Field in a + with defining polynomial x^2 - 2 with a = 1.414213562373095? + defined by s2 - 1, 2*x^3 + (-a)*s1^2 + To: Affine Curve over Number Field in a + with defining polynomial x^2 - 2 with a = 1.414213562373095? + defined by s0 - 1, 2*z^3 + (-a)*s1^2 Defn: Defined on coordinates by sending (x, s1, s2) to (x*s2, 1/s2, s1/s2) - sage: B[1][2][0] + sage: B[1][2][0] # optional - sage.rings.number_field Scheme morphism: - From: Affine Curve over Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? defined by s0 - 1, 2*z^3 + (-a)*s1^2 - To: Affine Curve over Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? defined by s2 - 1, 2*x^3 + (-a)*s1^2 + From: Affine Curve over Number Field in a + with defining polynomial x^2 - 2 with a = 1.414213562373095? + defined by s0 - 1, 2*z^3 + (-a)*s1^2 + To: Affine Curve over Number Field in a + with defining polynomial x^2 - 2 with a = 1.414213562373095? + defined by s2 - 1, 2*x^3 + (-a)*s1^2 Defn: Defined on coordinates by sending (z, s0, s1) to (z*s0, s1/s0, 1/s0) - sage: B[2] + sage: B[2] # optional - sage.rings.number_field (Scheme morphism: - From: Affine Curve over Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? defined by s2 - 1, 2*x^3 + (-a)*s1^2 - To: Affine Curve over Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? defined by (-a)*x^5 + y^2, x - z + From: Affine Curve over Number Field in a + with defining polynomial x^2 - 2 with a = 1.414213562373095? + defined by s2 - 1, 2*x^3 + (-a)*s1^2 + To: Affine Curve over Number Field in a + with defining polynomial x^2 - 2 with a = 1.414213562373095? + defined by (-a)*x^5 + y^2, x - z Defn: Defined on coordinates by sending (x, s1, s2) to - (x, x*s1, x*s2), Scheme morphism: - From: Affine Curve over Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? defined by s0 - s2, 2*y^3*s2^5 + (-a) - To: Affine Curve over Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? defined by (-a)*x^5 + y^2, x - z + (x, x*s1, x*s2), + Scheme morphism: + From: Affine Curve over Number Field in a + with defining polynomial x^2 - 2 with a = 1.414213562373095? + defined by s0 - s2, 2*y^3*s2^5 + (-a) + To: Affine Curve over Number Field in a + with defining polynomial x^2 - 2 with a = 1.414213562373095? + defined by (-a)*x^5 + y^2, x - z Defn: Defined on coordinates by sending (y, s0, s2) to - (y*s0, y, y*s2), Scheme morphism: - From: Affine Curve over Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? defined by s0 - 1, 2*z^3 + (-a)*s1^2 - To: Affine Curve over Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? defined by (-a)*x^5 + y^2, x - z + (y*s0, y, y*s2), + Scheme morphism: + From: Affine Curve over Number Field in a + with defining polynomial x^2 - 2 with a = 1.414213562373095? + defined by s0 - 1, 2*z^3 + (-a)*s1^2 + To: Affine Curve over Number Field in a + with defining polynomial x^2 - 2 with a = 1.414213562373095? + defined by (-a)*x^5 + y^2, x - z Defn: Defined on coordinates by sending (z, s0, s1) to (z*s0, z*s1, z)) @@ -1182,37 +1210,49 @@ def blowup(self, P=None): sage: C = A.curve((y - 3/2)^3 - (x + 2)^5 - (x + 2)^6) sage: Q = A([-2,3/2]) sage: C.blowup(Q) - ((Affine Plane Curve over Rational Field defined by x^3 - s1^3 + 7*x^2 + 16*x + 12, - Affine Plane Curve over Rational Field defined by 8*y^3*s0^6 - 36*y^2*s0^6 + 8*y^2*s0^5 + - 54*y*s0^6 - 24*y*s0^5 - 27*s0^6 + 18*s0^5 - 8), - ([Scheme endomorphism of Affine Plane Curve over Rational Field defined by x^3 - s1^3 + 7*x^2 + - 16*x + 12 + ((Affine Plane Curve over Rational Field + defined by x^3 - s1^3 + 7*x^2 + 16*x + 12, + Affine Plane Curve over Rational Field + defined by 8*y^3*s0^6 - 36*y^2*s0^6 + 8*y^2*s0^5 + + 54*y*s0^6 - 24*y*s0^5 - 27*s0^6 + 18*s0^5 - 8), + ([Scheme endomorphism of Affine Plane Curve over Rational Field + defined by x^3 - s1^3 + 7*x^2 + 16*x + 12 + Defn: Defined on coordinates by sending (x, s1) to (x, s1), + Scheme morphism: + From: Affine Plane Curve over Rational Field + defined by x^3 - s1^3 + 7*x^2 + 16*x + 12 + To: Affine Plane Curve over Rational Field + defined by 8*y^3*s0^6 - 36*y^2*s0^6 + 8*y^2*s0^5 + + 54*y*s0^6 - 24*y*s0^5 - 27*s0^6 + 18*s0^5 - 8 Defn: Defined on coordinates by sending (x, s1) to - (x, s1), Scheme morphism: - From: Affine Plane Curve over Rational Field defined by x^3 - s1^3 + 7*x^2 + 16*x + 12 - To: Affine Plane Curve over Rational Field defined by 8*y^3*s0^6 - 36*y^2*s0^6 + 8*y^2*s0^5 + - 54*y*s0^6 - 24*y*s0^5 - 27*s0^6 + 18*s0^5 - 8 - Defn: Defined on coordinates by sending (x, s1) to - (x*s1 + 2*s1 + 3/2, 1/s1)], [Scheme morphism: - From: Affine Plane Curve over Rational Field defined by 8*y^3*s0^6 - 36*y^2*s0^6 + 8*y^2*s0^5 + - 54*y*s0^6 - 24*y*s0^5 - 27*s0^6 + 18*s0^5 - 8 - To: Affine Plane Curve over Rational Field defined by x^3 - s1^3 + 7*x^2 + 16*x + 12 + (x*s1 + 2*s1 + 3/2, 1/s1)], + [Scheme morphism: + From: Affine Plane Curve over Rational Field + defined by 8*y^3*s0^6 - 36*y^2*s0^6 + 8*y^2*s0^5 + + 54*y*s0^6 - 24*y*s0^5 - 27*s0^6 + 18*s0^5 - 8 + To: Affine Plane Curve over Rational Field + defined by x^3 - s1^3 + 7*x^2 + 16*x + 12 Defn: Defined on coordinates by sending (y, s0) to (y*s0 - 3/2*s0 - 2, 1/s0), - Scheme endomorphism of Affine Plane Curve over Rational Field defined by 8*y^3*s0^6 - 36*y^2*s0^6 + - 8*y^2*s0^5 + 54*y*s0^6 - 24*y*s0^5 - 27*s0^6 + 18*s0^5 - 8 - Defn: Defined on coordinates by sending (y, s0) to - (y, s0)]), + Scheme endomorphism of Affine Plane Curve over Rational Field + defined by 8*y^3*s0^6 - 36*y^2*s0^6 + 8*y^2*s0^5 + 54*y*s0^6 + - 24*y*s0^5 - 27*s0^6 + 18*s0^5 - 8 + Defn: Defined on coordinates by sending (y, s0) to (y, s0)]), (Scheme morphism: - From: Affine Plane Curve over Rational Field defined by x^3 - s1^3 + 7*x^2 + 16*x + 12 - To: Affine Plane Curve over Rational Field defined by -x^6 - 13*x^5 - 70*x^4 - 200*x^3 + y^3 - - 320*x^2 - 9/2*y^2 - 272*x + 27/4*y - 795/8 + From: Affine Plane Curve over Rational Field + defined by x^3 - s1^3 + 7*x^2 + 16*x + 12 + To: Affine Plane Curve over Rational Field + defined by -x^6 - 13*x^5 - 70*x^4 - 200*x^3 + y^3 + - 320*x^2 - 9/2*y^2 - 272*x + 27/4*y - 795/8 Defn: Defined on coordinates by sending (x, s1) to - (x, x*s1 + 2*s1 + 3/2), Scheme morphism: - From: Affine Plane Curve over Rational Field defined by 8*y^3*s0^6 - 36*y^2*s0^6 + 8*y^2*s0^5 + - 54*y*s0^6 - 24*y*s0^5 - 27*s0^6 + 18*s0^5 - 8 - To: Affine Plane Curve over Rational Field defined by -x^6 - 13*x^5 - 70*x^4 - 200*x^3 + y^3 - - 320*x^2 - 9/2*y^2 - 272*x + 27/4*y - 795/8 + (x, x*s1 + 2*s1 + 3/2), + Scheme morphism: + From: Affine Plane Curve over Rational Field + defined by 8*y^3*s0^6 - 36*y^2*s0^6 + 8*y^2*s0^5 + + 54*y*s0^6 - 24*y*s0^5 - 27*s0^6 + 18*s0^5 - 8 + To: Affine Plane Curve over Rational Field + defined by -x^6 - 13*x^5 - 70*x^4 - 200*x^3 + y^3 + - 320*x^2 - 9/2*y^2 - 272*x + 27/4*y - 795/8 Defn: Defined on coordinates by sending (y, s0) to (y*s0 - 3/2*s0 - 2, y))) @@ -1223,16 +1263,15 @@ def blowup(self, P=None): sage: Q = C([-1,0,0,4]) sage: B = C.blowup(Q) sage: B[0] - (Affine Curve over Rational Field defined by s3, s1 - s2, x^2*s2^6 + - 2*x*s2^6 + 3*x^2*s2^4 + s2^6 + 6*x*s2^4 + 3*x^2*s2^2 + 3*s2^4 + 6*x*s2^2 - + x^2 - s2^2 + 2*x + 1, - Affine Curve over Rational Field defined by s3, s2 - 1, y^2*s0^6 + - 3*y^2*s0^4 + 3*y^2*s0^2 + y^2 - 4*s0^2, - Affine Curve over Rational Field defined by s3, s1 - 1, z^2*s0^6 + - 3*z^2*s0^4 + 3*z^2*s0^2 + z^2 - 4*s0^2, + (Affine Curve over Rational Field defined by s3, s1 - s2, + x^2*s2^6 + 2*x*s2^6 + 3*x^2*s2^4 + s2^6 + 6*x*s2^4 + + 3*x^2*s2^2 + 3*s2^4 + 6*x*s2^2 + x^2 - s2^2 + 2*x + 1, + Affine Curve over Rational Field defined by s3, s2 - 1, + y^2*s0^6 + 3*y^2*s0^4 + 3*y^2*s0^2 + y^2 - 4*s0^2, + Affine Curve over Rational Field defined by s3, s1 - 1, + z^2*s0^6 + 3*z^2*s0^4 + 3*z^2*s0^2 + z^2 - 4*s0^2, Closed subscheme of Affine Space of dimension 4 over Rational Field - defined by: - 1) + defined by: 1) sage: Q = A([6,2,3,1]) sage: B = C.blowup(Q) Traceback (most recent call last): @@ -1241,9 +1280,9 @@ def blowup(self, P=None): :: - sage: A. = AffineSpace(QuadraticField(-1), 2) - sage: C = A.curve([y^2 + x^2]) - sage: C.blowup() + sage: A. = AffineSpace(QuadraticField(-1), 2) # optional - sage.rings.number_field + sage: C = A.curve([y^2 + x^2]) # optional - sage.rings.number_field + sage: C.blowup() # optional - sage.rings.number_field Traceback (most recent call last): ... TypeError: this curve must be irreducible @@ -1390,71 +1429,78 @@ def resolution_of_singularities(self, extend=False): sage: C.resolution_of_singularities() ((Affine Plane Curve over Rational Field defined by s1^2 - x, Affine Plane Curve over Rational Field defined by y*s0^3 - 1), - ((Scheme endomorphism of Affine Plane Curve over Rational Field defined by s1^2 - x - Defn: Defined on coordinates by sending (x, s1) to - (x, s1), Scheme morphism: + ((Scheme endomorphism of Affine Plane Curve over Rational Field + defined by s1^2 - x + Defn: Defined on coordinates by sending (x, s1) to (x, s1), + Scheme morphism: From: Affine Plane Curve over Rational Field defined by s1^2 - x To: Affine Plane Curve over Rational Field defined by y*s0^3 - 1 - Defn: Defined on coordinates by sending (x, s1) to - (x*s1, 1/s1)), (Scheme morphism: + Defn: Defined on coordinates by sending (x, s1) to (x*s1, 1/s1)), + (Scheme morphism: From: Affine Plane Curve over Rational Field defined by y*s0^3 - 1 To: Affine Plane Curve over Rational Field defined by s1^2 - x - Defn: Defined on coordinates by sending (y, s0) to - (y*s0, 1/s0), - Scheme endomorphism of Affine Plane Curve over Rational Field defined by y*s0^3 - 1 - Defn: Defined on coordinates by sending (y, s0) to - (y, s0))), + Defn: Defined on coordinates by sending (y, s0) to (y*s0, 1/s0), + Scheme endomorphism of Affine Plane Curve over Rational Field + defined by y*s0^3 - 1 + Defn: Defined on coordinates by sending (y, s0) to (y, s0))), (Scheme morphism: From: Affine Plane Curve over Rational Field defined by s1^2 - x To: Affine Plane Curve over Rational Field defined by -x^3 + y^2 - Defn: Defined on coordinates by sending (x, s1) to - (x, x*s1), Scheme morphism: + Defn: Defined on coordinates by sending (x, s1) to (x, x*s1), + Scheme morphism: From: Affine Plane Curve over Rational Field defined by y*s0^3 - 1 To: Affine Plane Curve over Rational Field defined by -x^3 + y^2 - Defn: Defined on coordinates by sending (y, s0) to - (y*s0, y))) + Defn: Defined on coordinates by sending (y, s0) to (y*s0, y))) :: sage: set_verbose(-1) - sage: K. = QuadraticField(3) - sage: A. = AffineSpace(K, 2) - sage: C = A.curve(x^4 + 2*x^2 + a*y^3 + 1) - sage: C.resolution_of_singularities(extend=True)[0] # long time (2 seconds) - (Affine Plane Curve over Number Field in a0 with defining polynomial y^4 - 4*y^2 + 16 defined by - 24*x^2*ss1^3 + 24*ss1^3 + (a0^3 - 8*a0), - Affine Plane Curve over Number Field in a0 with defining polynomial y^4 - 4*y^2 + 16 defined by - 24*s1^2*ss0 + (a0^3 - 8*a0)*ss0^2 + (-6*a0^3)*s1, - Affine Plane Curve over Number Field in a0 with defining polynomial y^4 - 4*y^2 + 16 defined by - 8*y^2*s0^4 + (4*a0^3)*y*s0^3 - 32*s0^2 + (a0^3 - 8*a0)*y) + sage: K. = QuadraticField(3) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 2) # optional - sage.rings.number_field + sage: C = A.curve(x^4 + 2*x^2 + a*y^3 + 1) # optional - sage.rings.number_field + sage: C.resolution_of_singularities(extend=True)[0] # long time (2 s) # optional - sage.rings.number_field + (Affine Plane Curve over Number Field in a0 + with defining polynomial y^4 - 4*y^2 + 16 + defined by 24*x^2*ss1^3 + 24*ss1^3 + (a0^3 - 8*a0), + Affine Plane Curve over Number Field in a0 + with defining polynomial y^4 - 4*y^2 + 16 + defined by 24*s1^2*ss0 + (a0^3 - 8*a0)*ss0^2 + (-6*a0^3)*s1, + Affine Plane Curve over Number Field in a0 + with defining polynomial y^4 - 4*y^2 + 16 + defined by 8*y^2*s0^4 + (4*a0^3)*y*s0^3 - 32*s0^2 + (a0^3 - 8*a0)*y) :: - sage: A. = AffineSpace(GF(5), 3) - sage: C = Curve([y - x^3, (z - 2)^2 - y^3 - x^3], A) - sage: R = C.resolution_of_singularities() - sage: R[0] - (Affine Curve over Finite Field of size 5 defined by x^2 - s1, s1^4 - x*s2^2 + s1, x*s1^3 - s2^2 + x, - Affine Curve over Finite Field of size 5 defined by y*s2^2 - y^2 - 1, s2^4 - s0^3 - y^2 - 2, y*s0^3 - - s2^2 + y, Affine Curve over Finite Field of size 5 defined by s0^3*s1 + z*s1^3 + s1^4 - 2*s1^3 - 1, - z*s0^3 + z*s1^3 - 2*s0^3 - 2*s1^3 - 1, z^2*s1^3 + z*s1^3 - s1^3 - z + s1 + 2) + sage: A. = AffineSpace(GF(5), 3) # optional - sage.rings.finite_rings + sage: C = Curve([y - x^3, (z - 2)^2 - y^3 - x^3], A) # optional - sage.rings.finite_rings + sage: R = C.resolution_of_singularities() # optional - sage.rings.finite_rings + sage: R[0] # optional - sage.rings.finite_rings + (Affine Curve over Finite Field of size 5 + defined by x^2 - s1, s1^4 - x*s2^2 + s1, x*s1^3 - s2^2 + x, + Affine Curve over Finite Field of size 5 + defined by y*s2^2 - y^2 - 1, s2^4 - s0^3 - y^2 - 2, y*s0^3 - s2^2 + y, + Affine Curve over Finite Field of size 5 + defined by s0^3*s1 + z*s1^3 + s1^4 - 2*s1^3 - 1, + z*s0^3 + z*s1^3 - 2*s0^3 - 2*s1^3 - 1, + z^2*s1^3 + z*s1^3 - s1^3 - z + s1 + 2) :: sage: A. = AffineSpace(QQ, 4) - sage: C = A.curve([((x - 2)^2 + y^2)^2 - (x - 2)^2 - y^2 + (x - 2)^3, z - y - 7, w - 4]) + sage: C = A.curve([((x - 2)^2 + y^2)^2 - (x - 2)^2 - y^2 + (x - 2)^3, + ....: z - y - 7, w - 4]) sage: B = C.resolution_of_singularities() sage: B[0] - (Affine Curve over Rational Field defined by s3, s1 - s2, x^2*s2^4 - - 4*x*s2^4 + 2*x^2*s2^2 + 4*s2^4 - 8*x*s2^2 + x^2 + 7*s2^2 - 3*x + 1, - Affine Curve over Rational Field defined by s3, s2 - 1, y^2*s0^4 + - 2*y^2*s0^2 + y*s0^3 + y^2 - s0^2 - 1, - Affine Curve over Rational Field defined by s3, s1 - 1, z^2*s0^4 - - 14*z*s0^4 + 2*z^2*s0^2 + z*s0^3 + 49*s0^4 - 28*z*s0^2 - 7*s0^3 + z^2 + - 97*s0^2 - 14*z + 48, + (Affine Curve over Rational Field defined by s3, s1 - s2, + x^2*s2^4 - 4*x*s2^4 + 2*x^2*s2^2 + 4*s2^4 - 8*x*s2^2 + + x^2 + 7*s2^2 - 3*x + 1, + Affine Curve over Rational Field defined by s3, s2 - 1, + y^2*s0^4 + 2*y^2*s0^2 + y*s0^3 + y^2 - s0^2 - 1, + Affine Curve over Rational Field defined by s3, s1 - 1, + z^2*s0^4 - 14*z*s0^4 + 2*z^2*s0^2 + z*s0^3 + 49*s0^4 + - 28*z*s0^2 - 7*s0^3 + z^2 + 97*s0^2 - 14*z + 48, Closed subscheme of Affine Space of dimension 4 over Rational Field - defined by: - 1) + defined by: 1) :: @@ -1653,15 +1699,13 @@ def tangent_line(self, p): sage: Tp = C.tangent_space(p) sage: Tp - Closed subscheme of Affine Space of dimension 3 over Rational Field defined by: - x + y + z, - 2*x + 3*z + Closed subscheme of Affine Space of dimension 3 over Rational Field + defined by: x + y + z, 2*x + 3*z sage: phi = A3.translation(A3.origin(), p) sage: T = phi * Tp.embedding_morphism() sage: T.image() - Closed subscheme of Affine Space of dimension 3 over Rational Field defined by: - -2*y + z + 1, - x + y + z + Closed subscheme of Affine Space of dimension 3 over Rational Field + defined by: -2*y + z + 1, x + y + z sage: _ == C.tangent_line(p) True @@ -1705,19 +1749,19 @@ def fundamental_group(self): sage: A. = AffineSpace(QQ, 2) sage: C = A.curve(y^2 - x^3 - x^2) - sage: C.fundamental_group() # optional - sirocco + sage: C.fundamental_group() # optional - sirocco Finitely presented group < x0 | > In the case of number fields, they need to have an embedding to the algebraic field:: - sage: a = QQ[x](x^2+5).roots(QQbar)[0][0] - sage: F = NumberField(a.minpoly(), 'a', embedding=a) - sage: F.inject_variables() + sage: a = QQ[x](x^2 + 5).roots(QQbar)[0][0] # optional - sage.rings.number_field + sage: F = NumberField(a.minpoly(), 'a', embedding=a) # optional - sage.rings.number_field + sage: F.inject_variables() # optional - sage.rings.number_field Defining a - sage: A. = AffineSpace(F, 2) - sage: C = A.curve(y^2 - a*x^3 - x^2) - sage: C.fundamental_group() # optional - sirocco + sage: A. = AffineSpace(F, 2) # optional - sage.rings.number_field + sage: C = A.curve(y^2 - a*x^3 - x^2) # optional - sage.rings.number_field + sage: C.fundamental_group() # optional - sirocco # optional - sage.rings.number_field Finitely presented group < x0 | > .. WARNING:: @@ -1752,7 +1796,7 @@ def braid_monodromy(self): sage: A. = AffineSpace(QQ, 2) sage: C = A.curve((x^2-y^3)*(x+3*y-5)) - sage: C.braid_monodromy() # optional - sirocco + sage: C.braid_monodromy() # optional - sirocco [s1*s0*(s1*s2)^2*s0*s2^2*s0^-1*(s2^-1*s1^-1)^2*s0^-1*s1^-1, s1*s0*(s1*s2)^2*(s0*s2^-1*s1*s2*s1*s2^-1)^2*(s2^-1*s1^-1)^2*s0^-1*s1^-1, s1*s0*(s1*s2)^2*s2*s1^-1*s2^-1*s1^-1*s0^-1*s1^-1, @@ -1779,10 +1823,11 @@ def riemann_surface(self, **kwargs): EXAMPLES:: - sage: R.=QQ[] - sage: C = Curve(x^3+3*y^3+5) + sage: R. = QQ[] + sage: C = Curve(x^3 + 3*y^3 + 5) sage: C.riemann_surface() - Riemann surface defined by polynomial f = x^3 + 3*y^3 + 5 = 0, with 53 bits of precision + Riemann surface defined by polynomial f = x^3 + 3*y^3 + 5 = 0, + with 53 bits of precision """ from sage.schemes.riemann_surfaces.riemann_surface import RiemannSurface S = RiemannSurface(self.defining_polynomial(),**kwargs) @@ -1819,12 +1864,12 @@ def riemann_roch_basis(self, D): EXAMPLES:: - sage: R = PolynomialRing(GF(5),2,names = ["x","y"]) - sage: x, y = R.gens() - sage: f = y^2 - x^9 - x - sage: C = Curve(f) - sage: D = [6,0,0,0,0,0] - sage: C.riemann_roch_basis(D) + sage: R = PolynomialRing(GF(5), 2, names=["x","y"]) # optional - sage.rings.finite_rings + sage: x, y = R.gens() # optional - sage.rings.finite_rings + sage: f = y^2 - x^9 - x # optional - sage.rings.finite_rings + sage: C = Curve(f) # optional - sage.rings.finite_rings + sage: D = [6,0,0,0,0,0] # optional - sage.rings.finite_rings + sage: C.riemann_roch_basis(D) # optional - sage.rings.finite_rings [1, (-x*z^5 + y^2*z^4)/x^6, (-x*z^6 + y^2*z^5)/x^7, (-x*z^7 + y^2*z^6)/x^8] """ F = self.base_ring() @@ -1870,33 +1915,35 @@ def rational_points(self, algorithm="enum"): EXAMPLES:: - sage: x, y = (GF(5)['x,y']).gens() - sage: f = y^2 - x^9 - x - sage: C = Curve(f); C + sage: x, y = (GF(5)['x,y']).gens() # optional - sage.rings.finite_rings + sage: f = y^2 - x^9 - x # optional - sage.rings.finite_rings + sage: C = Curve(f); C # optional - sage.rings.finite_rings Affine Plane Curve over Finite Field of size 5 defined by -x^9 + y^2 - x - sage: C.rational_points(algorithm='bn') + sage: C.rational_points(algorithm='bn') # optional - sage.rings.finite_rings [(0, 0), (2, 2), (2, 3), (3, 1), (3, 4)] - sage: C = Curve(x - y + 1) - sage: C.rational_points() + sage: C = Curve(x - y + 1) # optional - sage.rings.finite_rings + sage: C.rational_points() # optional - sage.rings.finite_rings [(0, 1), (1, 2), (2, 3), (3, 4), (4, 0)] We compare Brill-Noether and enumeration:: - sage: x, y = (GF(17)['x,y']).gens() - sage: C = Curve(x^2 + y^5 + x*y - 19) - sage: v = C.rational_points(algorithm='bn') - sage: w = C.rational_points(algorithm='enum') - sage: len(v) + sage: x, y = (GF(17)['x,y']).gens() # optional - sage.rings.finite_rings + sage: C = Curve(x^2 + y^5 + x*y - 19) # optional - sage.rings.finite_rings + sage: v = C.rational_points(algorithm='bn') # optional - sage.rings.finite_rings + sage: w = C.rational_points(algorithm='enum') # optional - sage.rings.finite_rings + sage: len(v) # optional - sage.rings.finite_rings 20 - sage: v == w + sage: v == w # optional - sage.rings.finite_rings True - sage: A. = AffineSpace(2,GF(9,'a')) - sage: C = Curve(x^2 + y^2 - 1) - sage: C - Affine Plane Curve over Finite Field in a of size 3^2 defined by x^2 + y^2 - 1 - sage: C.rational_points() - [(0, 1), (0, 2), (1, 0), (2, 0), (a + 1, a + 1), (a + 1, 2*a + 2), (2*a + 2, a + 1), (2*a + 2, 2*a + 2)] + sage: A. = AffineSpace(2, GF(9,'a')) # optional - sage.rings.finite_rings + sage: C = Curve(x^2 + y^2 - 1) # optional - sage.rings.finite_rings + sage: C # optional - sage.rings.finite_rings + Affine Plane Curve over Finite Field in a of size 3^2 + defined by x^2 + y^2 - 1 + sage: C.rational_points() # optional - sage.rings.finite_rings + [(0, 1), (0, 2), (1, 0), (2, 0), (a + 1, a + 1), + (a + 1, 2*a + 2), (2*a + 2, a + 1), (2*a + 2, 2*a + 2)] """ if algorithm == "enum": f = self.defining_polynomial() @@ -1961,9 +2008,9 @@ def function_field(self): :: - sage: A. = AffineSpace(GF(8), 2) - sage: C = Curve(x^5 + y^5 + x*y + 1) - sage: C.function_field() + sage: A. = AffineSpace(GF(8), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y + 1) # optional - sage.rings.finite_rings + sage: C.function_field() # optional - sage.rings.finite_rings Function field in y defined by y^5 + x*y + x^5 + 1 """ return self._function_field @@ -1975,9 +2022,9 @@ def _genus(self): EXAMPLES:: - sage: A. = AffineSpace(GF(2), 2) - sage: C = Curve(x^5 + y^5 + x*y + 1) - sage: C.genus() # indirect doctest + sage: A. = AffineSpace(GF(2), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y + 1) # optional - sage.rings.finite_rings + sage: C.genus() # indirect doctest # optional - sage.rings.finite_rings 1 """ k = self.base_ring() @@ -1997,25 +2044,25 @@ def __call__(self, *args): EXAMPLES:: - sage: A. = AffineSpace(GF(8), 2) - sage: C = Curve(x^5 + y^5 + x*y + 1) - sage: C(1,1) + sage: A. = AffineSpace(GF(8), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y + 1) # optional - sage.rings.finite_rings + sage: C(1,1) # optional - sage.rings.finite_rings (1, 1) - sage: C(x/y) + sage: C(x/y) # optional - sage.rings.finite_rings (x/(x^5 + 1))*y^4 + x^2/(x^5 + 1) - sage: C(GF(8^2)) + sage: C(GF(8^2)) # optional - sage.rings.finite_rings Set of rational points of Closed subscheme of Affine Space of dimension 2 over Finite Field in z6 of size 2^6 defined by: x^5 + y^5 + x*y + 1 :: - sage: A. = AffineSpace(GF(11), 3) - sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) - sage: C([0,0,0]) + sage: A. = AffineSpace(GF(11), 3) # optional - sage.rings.finite_rings + sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # optional - sage.rings.finite_rings + sage: C([0,0,0]) # optional - sage.rings.finite_rings (0, 0, 0) - sage: C(y) + sage: C(y) # optional - sage.rings.finite_rings z^2 - sage: C(A.coordinate_ring()(y)) + sage: C(A.coordinate_ring()(y)) # optional - sage.rings.finite_rings z^2 """ try: @@ -2037,14 +2084,14 @@ def function(self, f): EXAMPLES:: - sage: A. = AffineSpace(GF(8), 2) - sage: C = Curve(x^5 + y^5 + x*y + 1) - sage: f = C.function(x/y) - sage: f + sage: A. = AffineSpace(GF(8), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y + 1) # optional - sage.rings.finite_rings + sage: f = C.function(x/y) # optional - sage.rings.finite_rings + sage: f # optional - sage.rings.finite_rings (x/(x^5 + 1))*y^4 + x^2/(x^5 + 1) - sage: df = f.differential(); df + sage: df = f.differential(); df # optional - sage.rings.finite_rings ((1/(x^10 + 1))*y^4 + x^6/(x^10 + 1)) d(x) - sage: df.divisor() + sage: df.divisor() # optional - sage.rings.finite_rings 2*Place (1/x, 1/x^4*y^4 + 1/x^3*y^3 + 1/x^2*y^2 + 1/x*y + 1) + 2*Place (1/x, 1/x*y + 1) - 2*Place (x + 1, y) @@ -2065,10 +2112,10 @@ def coordinate_functions(self): EXAMPLES:: - sage: A. = AffineSpace(GF(8), 2) - sage: C = Curve(x^5 + y^5 + x*y + 1) - sage: x, y = C.coordinate_functions() - sage: x^5 + y^5 + x*y + 1 + sage: A. = AffineSpace(GF(8), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y + 1) # optional - sage.rings.finite_rings + sage: x, y = C.coordinate_functions() # optional - sage.rings.finite_rings + sage: x^5 + y^5 + x*y + 1 # optional - sage.rings.finite_rings 0 """ return self._coordinate_functions @@ -2085,11 +2132,13 @@ def _nonsingular_model(self): TESTS:: - sage: A. = AffineSpace(GF(11), 3) - sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) - sage: C._nonsingular_model - (Function field in z defined by z^3 + 10*x, Ring morphism: - From: Multivariate Polynomial Ring in x, y, z over Finite Field of size 11 + sage: A. = AffineSpace(GF(11), 3) # optional - sage.rings.finite_rings + sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # optional - sage.rings.finite_rings + sage: C._nonsingular_model # optional - sage.rings.finite_rings + (Function field in z defined by z^3 + 10*x, + Ring morphism: + From: Multivariate Polynomial Ring in x, y, z + over Finite Field of size 11 To: Function field in z defined by z^3 + 10*x Defn: x |--> x y |--> z^2 @@ -2190,9 +2239,9 @@ def _function_field(self): TESTS:: - sage: A. = AffineSpace(GF(11), 3) - sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) - sage: C._function_field + sage: A. = AffineSpace(GF(11), 3) # optional - sage.rings.finite_rings + sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # optional - sage.rings.finite_rings + sage: C._function_field # optional - sage.rings.finite_rings Function field in z defined by z^3 + 10*x """ return self._nonsingular_model[0] @@ -2204,11 +2253,12 @@ def _lift_to_function_field(self): TESTS:: - sage: A. = AffineSpace(GF(11), 3) - sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) - sage: C._lift_to_function_field + sage: A. = AffineSpace(GF(11), 3) # optional - sage.rings.finite_rings + sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # optional - sage.rings.finite_rings + sage: C._lift_to_function_field # optional - sage.rings.finite_rings Ring morphism: - From: Multivariate Polynomial Ring in x, y, z over Finite Field of size 11 + From: Multivariate Polynomial Ring in x, y, z + over Finite Field of size 11 To: Function field in z defined by z^3 + 10*x Defn: x |--> x y |--> z^2 @@ -2223,9 +2273,9 @@ def _coordinate_functions(self): TESTS:: - sage: A. = AffineSpace(GF(11), 3) - sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) - sage: C._coordinate_functions + sage: A. = AffineSpace(GF(11), 3) # optional - sage.rings.finite_rings + sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # optional - sage.rings.finite_rings + sage: C._coordinate_functions # optional - sage.rings.finite_rings [x, z^2, z] """ return self._nonsingular_model[1].im_gens() @@ -2237,9 +2287,9 @@ def _singularities(self): TESTS:: - sage: A. = AffineSpace(GF(7^2),2) - sage: C = Curve(x^2 - x^4 - y^4) - sage: C._singularities + sage: A. = AffineSpace(GF(7^2), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^2 - x^4 - y^4) # optional - sage.rings.finite_rings + sage: C._singularities # optional - sage.rings.finite_rings [(Point (x, y), [Place (x, 1/x*y^3 + 1/x*y^2 + 1), Place (x, 1/x*y^3 + 1/x*y^2 + 6)])] """ @@ -2279,16 +2329,16 @@ def singular_closed_points(self): EXAMPLES:: - sage: A. = AffineSpace(GF(7^2),2) - sage: C = Curve(x^2 - x^4 - y^4) - sage: C.singular_closed_points() + sage: A. = AffineSpace(GF(7^2), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^2 - x^4 - y^4) # optional - sage.rings.finite_rings + sage: C.singular_closed_points() # optional - sage.rings.finite_rings [Point (x, y)] :: - sage: A. = AffineSpace(GF(11), 3) - sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) - sage: C.singular_closed_points() + sage: A. = AffineSpace(GF(11), 3) # optional - sage.rings.finite_rings + sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # optional - sage.rings.finite_rings + sage: C.singular_closed_points() # optional - sage.rings.finite_rings [] """ return [p for p, _ in self._singularities] @@ -2304,13 +2354,13 @@ def place_to_closed_point(self, place): EXAMPLES:: - sage: A. = AffineSpace(GF(4), 2) - sage: C = Curve(x^5 + y^5 + x*y + 1) - sage: F = C.function_field() - sage: pls = F.places(1) - sage: C.place_to_closed_point(pls[-1]) + sage: A. = AffineSpace(GF(4), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y + 1) # optional - sage.rings.finite_rings + sage: F = C.function_field() # optional - sage.rings.finite_rings + sage: pls = F.places(1) # optional - sage.rings.finite_rings + sage: C.place_to_closed_point(pls[-1]) # optional - sage.rings.finite_rings Point (x + 1, y + 1) - sage: C.place_to_closed_point(pls[-2]) + sage: C.place_to_closed_point(pls[-2]) # optional - sage.rings.finite_rings Point (x + 1, y + 1) """ F = self.function_field() @@ -2388,17 +2438,17 @@ def places_at_infinity(self): :: - sage: F = GF(9) - sage: A2. = AffineSpace(F, 2) - sage: C = A2.curve(y^3 + y - x^4) - sage: C.places_at_infinity() + sage: F = GF(9) # optional - sage.rings.finite_rings + sage: A2. = AffineSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = A2.curve(y^3 + y - x^4) # optional - sage.rings.finite_rings + sage: C.places_at_infinity() # optional - sage.rings.finite_rings [Place (1/x, 1/x^3*y^2)] :: - sage: A. = AffineSpace(GF(11), 3) - sage: C = Curve([x*z-y^2,y-z^2,x-y*z], A) - sage: C.places_at_infinity() + sage: A. = AffineSpace(GF(11), 3) # optional - sage.rings.finite_rings + sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A) # optional - sage.rings.finite_rings + sage: C.places_at_infinity() # optional - sage.rings.finite_rings [Place (1/x, 1/x*z^2)] """ return list(set(p for f in self._coordinate_functions if f for p in f.poles())) @@ -2425,11 +2475,11 @@ def places_on(self, point): :: - sage: k. = GF(9) - sage: A. = AffineSpace(k,2) - sage: C = Curve(y^2 - x^5 - x^4 - 2*x^3 - 2*x - 2) - sage: pts = C.closed_points() - sage: pts + sage: k. = GF(9) # optional - sage.rings.finite_rings + sage: A. = AffineSpace(k, 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2 - x^5 - x^4 - 2*x^3 - 2*x - 2) # optional - sage.rings.finite_rings + sage: pts = C.closed_points() # optional - sage.rings.finite_rings + sage: pts # optional - sage.rings.finite_rings [Point (x, y + (a + 1)), Point (x, y + (-a - 1)), Point (x + (a + 1), y + (a - 1)), @@ -2440,20 +2490,20 @@ def places_on(self, point): Point (x + (-a - 1), y + (-a)), Point (x + 1, y + 1), Point (x + 1, y - 1)] - sage: p1, p2, p3 = pts[:3] - sage: C.places_on(p1) + sage: p1, p2, p3 = pts[:3] # optional - sage.rings.finite_rings + sage: C.places_on(p1) # optional - sage.rings.finite_rings [Place (x, y + a + 1)] - sage: C.places_on(p2) + sage: C.places_on(p2) # optional - sage.rings.finite_rings [Place (x, y + 2*a + 2)] - sage: C.places_on(p3) + sage: C.places_on(p3) # optional - sage.rings.finite_rings [Place (x + a + 1, y + a + 2)] :: - sage: F. = GF(8) - sage: P. = ProjectiveSpace(F, 2) - sage: Cp = Curve(x^3*y + y^3*z + x*z^3) - sage: C = Cp.affine_patch(0) + sage: F. = GF(8) # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(F, 2) # optional - sage.rings.finite_rings + sage: Cp = Curve(x^3*y + y^3*z + x*z^3) # optional - sage.rings.finite_rings + sage: C = Cp.affine_patch(0) # optional - sage.rings.finite_rings """ phi = self._lift_to_function_field gs = [phi(g) for g in point.prime_ideal().gens()] @@ -2487,17 +2537,17 @@ def parametric_representation(self, place, name=None): :: - sage: A. = AffineSpace(GF(7^2), 2) - sage: C = Curve(x^2 - x^4 - y^4) - sage: p, = C.singular_closed_points() - sage: b1, b2 = p.places() - sage: xs, ys = C.parametric_representation(b1) - sage: f = xs^2 - xs^4 - ys^4 - sage: [f.coefficient(i) for i in range(5)] + sage: A. = AffineSpace(GF(7^2), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^2 - x^4 - y^4) # optional - sage.rings.finite_rings + sage: p, = C.singular_closed_points() # optional - sage.rings.finite_rings + sage: b1, b2 = p.places() # optional - sage.rings.finite_rings + sage: xs, ys = C.parametric_representation(b1) # optional - sage.rings.finite_rings + sage: f = xs^2 - xs^4 - ys^4 # optional - sage.rings.finite_rings + sage: [f.coefficient(i) for i in range(5)] # optional - sage.rings.finite_rings [0, 0, 0, 0, 0] - sage: xs, ys = C.parametric_representation(b2) - sage: f = xs^2 - xs^4 - ys^4 - sage: [f.coefficient(i) for i in range(5)] + sage: xs, ys = C.parametric_representation(b2) # optional - sage.rings.finite_rings + sage: f = xs^2 - xs^4 - ys^4 # optional - sage.rings.finite_rings + sage: [f.coefficient(i) for i in range(5)] # optional - sage.rings.finite_rings [0, 0, 0, 0, 0] """ F = place.function_field() @@ -2518,10 +2568,11 @@ class IntegralAffineCurve_finite_field(IntegralAffineCurve): EXAMPLES:: - sage: A. = AffineSpace(GF(11), 3) - sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A); C - Affine Curve over Finite Field of size 11 defined by -y^2 + x*z, -z^2 + y, -y*z + x - sage: C.function_field() + sage: A. = AffineSpace(GF(11), 3) # optional - sage.rings.finite_rings + sage: C = Curve([x*z - y^2, y - z^2, x - y*z], A); C # optional - sage.rings.finite_rings + Affine Curve over Finite Field of size 11 + defined by -y^2 + x*z, -z^2 + y, -y*z + x + sage: C.function_field() # optional - sage.rings.finite_rings Function field in z defined by z^3 + 10*x """ _point = IntegralAffineCurvePoint_finite_field @@ -2536,10 +2587,10 @@ def places(self, degree=1): EXAMPLES:: - sage: F = GF(9) - sage: A2. = AffineSpace(F, 2) - sage: C = A2.curve(y^3 + y - x^4) - sage: C.places() + sage: F = GF(9) # optional - sage.rings.finite_rings + sage: A2. = AffineSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = A2.curve(y^3 + y - x^4) # optional - sage.rings.finite_rings + sage: C.places() # optional - sage.rings.finite_rings [Place (1/x, 1/x^3*y^2), Place (x, y), Place (x, y + z2 + 1), @@ -2583,9 +2634,9 @@ def closed_points(self, degree=1): EXAMPLES:: - sage: A. = AffineSpace(GF(7),2) - sage: C = Curve(x^2 - x^4 - y^4) - sage: C.closed_points() + sage: A. = AffineSpace(GF(7), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^2 - x^4 - y^4) # optional - sage.rings.finite_rings + sage: C.closed_points() # optional - sage.rings.finite_rings [Point (x, y), Point (x + 1, y), Point (x + 2, y + 2), @@ -2628,10 +2679,11 @@ class IntegralAffinePlaneCurve_finite_field(AffinePlaneCurve_finite_field, Integ EXAMPLES:: - sage: A. = AffineSpace(GF(8), 2) - sage: C = Curve(x^5 + y^5 + x*y + 1); C - Affine Plane Curve over Finite Field in z3 of size 2^3 defined by x^5 + y^5 + x*y + 1 - sage: C.function_field() + sage: A. = AffineSpace(GF(8), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y + 1); C # optional - sage.rings.finite_rings + Affine Plane Curve over Finite Field in z3 of size 2^3 + defined by x^5 + y^5 + x*y + 1 + sage: C.function_field() # optional - sage.rings.finite_rings Function field in y defined by y^5 + x*y + x^5 + 1 """ _point = IntegralAffinePlaneCurvePoint_finite_field diff --git a/src/sage/schemes/curves/closed_point.py b/src/sage/schemes/curves/closed_point.py index 9d881016bb7..3f11fb19b19 100644 --- a/src/sage/schemes/curves/closed_point.py +++ b/src/sage/schemes/curves/closed_point.py @@ -9,30 +9,30 @@ EXAMPLES:: - sage: F. = GF(2) - sage: P. = AffineSpace(F, 2); - sage: C = Curve(y^2 + y - x^3) - sage: C.closed_points() + sage: F. = GF(2) # optional - sage.rings.finite_rings + sage: P. = AffineSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2 + y - x^3) # optional - sage.rings.finite_rings + sage: C.closed_points() # optional - sage.rings.finite_rings [Point (x, y), Point (x, y + 1)] - sage: C.closed_points(2) + sage: C.closed_points(2) # optional - sage.rings.finite_rings [Point (y^2 + y + 1, x + 1), Point (y^2 + y + 1, x + y), Point (y^2 + y + 1, x + y + 1)] - sage: C.closed_points(3) + sage: C.closed_points(3) # optional - sage.rings.finite_rings [Point (x^2 + x + y, x*y + 1, y^2 + x + 1), Point (x^2 + x + y + 1, x*y + x + 1, y^2 + x)] Closed points of projective curves are represented by homogeneous maximal ideals:: - sage: F. = GF(2) - sage: P. = ProjectiveSpace(F, 2) - sage: C = Curve(x^3*y + y^3*z + x*z^3) - sage: C.closed_points() + sage: F. = GF(2) # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^3*y + y^3*z + x*z^3) # optional - sage.rings.finite_rings + sage: C.closed_points() # optional - sage.rings.finite_rings [Point (x, z), Point (x, y), Point (y, z)] - sage: C.closed_points(2) + sage: C.closed_points(2) # optional - sage.rings.finite_rings [Point (y^2 + y*z + z^2, x + y + z)] - sage: C.closed_points(3) + sage: C.closed_points(3) # optional - sage.rings.finite_rings [Point (y^3 + y^2*z + z^3, x + y), Point (y^3 + y*z^2 + z^3, x + z), Point (x^2 + x*z + y*z + z^2, x*y + x*z + z^2, y^2 + x*z), @@ -44,19 +44,19 @@ Rational points are easily converted to closed points and vice versa if the closed point is of degree one:: - sage: F. = GF(2) - sage: P. = ProjectiveSpace(F, 2) - sage: C = Curve(x^3*y + y^3*z + x*z^3) - sage: p1, p2, p3 = C.closed_points() - sage: p1.rational_point() + sage: F. = GF(2) # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^3*y + y^3*z + x*z^3) # optional - sage.rings.finite_rings + sage: p1, p2, p3 = C.closed_points() # optional - sage.rings.finite_rings + sage: p1.rational_point() # optional - sage.rings.finite_rings (0 : 1 : 0) - sage: p2.rational_point() + sage: p2.rational_point() # optional - sage.rings.finite_rings (0 : 0 : 1) - sage: p3.rational_point() + sage: p3.rational_point() # optional - sage.rings.finite_rings (1 : 0 : 0) - sage: _.closed_point() + sage: _.closed_point() # optional - sage.rings.finite_rings Point (y, z) - sage: _ == p3 + sage: _ == p3 # optional - sage.rings.finite_rings True AUTHORS: @@ -99,10 +99,10 @@ class IntegralCurveClosedPoint(CurveClosedPoint): EXAMPLES:: - sage: F. = GF(4) - sage: P. = AffineSpace(F, 2); - sage: C = Curve(y^2 + y - x^3) - sage: C.closed_points() + sage: F. = GF(4) # optional - sage.rings.finite_rings + sage: P. = AffineSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2 + y - x^3) # optional - sage.rings.finite_rings + sage: C.closed_points() # optional - sage.rings.finite_rings [Point (x, y), Point (x, y + 1), Point (x + a, y + a), @@ -118,12 +118,12 @@ def __init__(self, curve, prime_ideal, degree): TESTS:: - sage: F. = GF(4) - sage: P. = AffineSpace(F, 2); - sage: C = Curve(y^2 + y - x^3) - sage: p = C([0,0]); p + sage: F. = GF(4) # optional - sage.rings.finite_rings + sage: P. = AffineSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2 + y - x^3) # optional - sage.rings.finite_rings + sage: p = C([0,0]); p # optional - sage.rings.finite_rings (0, 0) - sage: loads(dumps(p)) == p + sage: loads(dumps(p)) == p # optional - sage.rings.finite_rings True """ super().__init__(curve.ambient_space(), prime_ideal) @@ -137,12 +137,12 @@ def __hash__(self): EXAMPLES:: - sage: F. = GF(4) - sage: P. = AffineSpace(F, 2); - sage: C = Curve(y^2 + y - x^3) - sage: pts = C.closed_points() - sage: p = pts[0] - sage: {p: 1} + sage: F. = GF(4) # optional - sage.rings.finite_rings + sage: P. = AffineSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2 + y - x^3) # optional - sage.rings.finite_rings + sage: pts = C.closed_points() # optional - sage.rings.finite_rings + sage: p = pts[0] # optional - sage.rings.finite_rings + sage: {p: 1} # optional - sage.rings.finite_rings {Point (x, y): 1} """ return hash((self.parent(),self.prime_ideal())) @@ -159,11 +159,11 @@ def _richcmp_(self, other, op): EXAMPLES:: - sage: F. = GF(4) - sage: P. = AffineSpace(F, 2); - sage: C = Curve(y^2 + y - x^3) - sage: pts = C.closed_points() - sage: pts[0] == pts[1] + sage: F. = GF(4) # optional - sage.rings.finite_rings + sage: P. = AffineSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2 + y - x^3) # optional - sage.rings.finite_rings + sage: pts = C.closed_points() # optional - sage.rings.finite_rings + sage: pts[0] == pts[1] # optional - sage.rings.finite_rings False """ return richcmp((self._curve, self.prime_ideal()), (other._curve, other.prime_ideal()), op) @@ -174,11 +174,11 @@ def _repr_(self): EXAMPLES:: - sage: F. = GF(4) - sage: P. = AffineSpace(F, 2); - sage: C = Curve(y^2 + y - x^3) - sage: pts = C.closed_points() - sage: pts[0] + sage: F. = GF(4) # optional - sage.rings.finite_rings + sage: P. = AffineSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2 + y - x^3) # optional - sage.rings.finite_rings + sage: pts = C.closed_points() # optional - sage.rings.finite_rings + sage: pts[0] # optional - sage.rings.finite_rings Point (x, y) """ return "Point ({})".format(', '.join(repr(g) for g in self.prime_ideal().gens())) @@ -189,12 +189,12 @@ def curve(self): EXAMPLES:: - sage: F. = GF(4) - sage: P. = AffineSpace(F, 2); - sage: C = Curve(y^2 + y - x^3) - sage: pts = C.closed_points() - sage: p = pts[0] - sage: p.curve() + sage: F. = GF(4) # optional - sage.rings.finite_rings + sage: P. = AffineSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2 + y - x^3) # optional - sage.rings.finite_rings + sage: pts = C.closed_points() # optional - sage.rings.finite_rings + sage: p = pts[0] # optional - sage.rings.finite_rings + sage: p.curve() # optional - sage.rings.finite_rings Affine Plane Curve over Finite Field in a of size 2^2 defined by x^3 + y^2 + y """ return self._curve @@ -205,12 +205,12 @@ def degree(self): EXAMPLES:: - sage: F. = GF(4) - sage: P. = AffineSpace(F, 2); - sage: C = Curve(y^2 + y - x^3) - sage: pts = C.closed_points() - sage: p = pts[0] - sage: p.degree() + sage: F. = GF(4) # optional - sage.rings.finite_rings + sage: P. = AffineSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2 + y - x^3) # optional - sage.rings.finite_rings + sage: pts = C.closed_points() # optional - sage.rings.finite_rings + sage: p = pts[0] # optional - sage.rings.finite_rings + sage: p.degree() # optional - sage.rings.finite_rings 1 """ return self._degree @@ -221,12 +221,12 @@ def places(self): EXAMPLES:: - sage: F. = GF(4) - sage: P. = AffineSpace(F, 2); - sage: C = Curve(y^2 + y - x^3) - sage: pts = C.closed_points() - sage: p = pts[0] - sage: p.places() + sage: F. = GF(4) # optional - sage.rings.finite_rings + sage: P. = AffineSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2 + y - x^3) # optional - sage.rings.finite_rings + sage: pts = C.closed_points() # optional - sage.rings.finite_rings + sage: p = pts[0] # optional - sage.rings.finite_rings + sage: p.places() # optional - sage.rings.finite_rings [Place (x, y)] """ return self._curve.places_on(self) @@ -239,12 +239,12 @@ def place(self): EXAMPLES:: - sage: F. = GF(4) - sage: P. = AffineSpace(F, 2); - sage: C = Curve(y^2 + y - x^3) - sage: pts = C.closed_points() - sage: p = pts[0] - sage: p.place() + sage: F. = GF(4) # optional - sage.rings.finite_rings + sage: P. = AffineSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2 + y - x^3) # optional - sage.rings.finite_rings + sage: pts = C.closed_points() # optional - sage.rings.finite_rings + sage: p = pts[0] # optional - sage.rings.finite_rings + sage: p.place() # optional - sage.rings.finite_rings Place (x, y) """ return self._curve.places_on(self)[0] @@ -260,9 +260,9 @@ def rational_point(self): EXAMPLES:: - sage: A. = AffineSpace(GF(3^2),2) - sage: C = Curve(y^2 - x^5 - x^4 - 2*x^3 - 2*x-2) - sage: C.closed_points() + sage: A. = AffineSpace(GF(3^2), 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2 - x^5 - x^4 - 2*x^3 - 2*x - 2) # optional - sage.rings.finite_rings + sage: C.closed_points() # optional - sage.rings.finite_rings [Point (x, y + (z2 + 1)), Point (x, y + (-z2 - 1)), Point (x + (z2 + 1), y + (z2 - 1)), @@ -273,7 +273,7 @@ def rational_point(self): Point (x + (-z2 - 1), y + (-z2)), Point (x + 1, y + 1), Point (x + 1, y - 1)] - sage: [p.rational_point() for p in _] + sage: [p.rational_point() for p in _] # optional - sage.rings.finite_rings [(0, 2*z2 + 2), (0, z2 + 1), (2*z2 + 2, 2*z2 + 1), @@ -284,7 +284,7 @@ def rational_point(self): (z2 + 1, z2), (2, 2), (2, 1)] - sage: set(_) == set(C.rational_points()) + sage: set(_) == set(C.rational_points()) # optional - sage.rings.finite_rings True """ if self.degree() != 1: @@ -305,21 +305,21 @@ def projective(self, i=0): EXAMPLES:: - sage: F. = GF(2) - sage: A. = AffineSpace(F, 2) - sage: C = Curve(y^2 + y - x^3, A) - sage: p1, p2 = C.closed_points() - sage: p1 + sage: F. = GF(2) # optional - sage.rings.finite_rings + sage: A. = AffineSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2 + y - x^3, A) # optional - sage.rings.finite_rings + sage: p1, p2 = C.closed_points() # optional - sage.rings.finite_rings + sage: p1 # optional - sage.rings.finite_rings Point (x, y) - sage: p2 + sage: p2 # optional - sage.rings.finite_rings Point (x, y + 1) - sage: p1.projective() + sage: p1.projective() # optional - sage.rings.finite_rings Point (x1, x2) - sage: p2.projective(0) + sage: p2.projective(0) # optional - sage.rings.finite_rings Point (x1, x0 + x2) - sage: p2.projective(1) + sage: p2.projective(1) # optional - sage.rings.finite_rings Point (x0, x1 + x2) - sage: p2.projective(2) + sage: p2.projective(2) # optional - sage.rings.finite_rings Point (x0, x1 + x2) """ C = self.curve() @@ -349,18 +349,18 @@ def rational_point(self): EXAMPLES:: - sage: F. = GF(4) - sage: P. = ProjectiveSpace(F, 2) - sage: C = Curve(x^3*y + y^3*z + x*z^3) - sage: C.closed_points() + sage: F. = GF(4) # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^3*y + y^3*z + x*z^3) # optional - sage.rings.finite_rings + sage: C.closed_points() # optional - sage.rings.finite_rings [Point (x, z), Point (x, y), Point (y, z), Point (x + a*z, y + (a + 1)*z), Point (x + (a + 1)*z, y + a*z)] - sage: [p.rational_point() for p in _] + sage: [p.rational_point() for p in _] # optional - sage.rings.finite_rings [(0 : 1 : 0), (0 : 0 : 1), (1 : 0 : 0), (a : a + 1 : 1), (a + 1 : a : 1)] - sage: set(_) == set(C.rational_points()) + sage: set(_) == set(C.rational_points()) # optional - sage.rings.finite_rings True """ if self.degree() != 1: @@ -385,19 +385,19 @@ def affine(self, i=None): EXAMPLES:: - sage: F. = GF(2) - sage: P. = ProjectiveSpace(F, 2) - sage: C = Curve(x^3*y + y^3*z + x*z^3) - sage: p1, p2, p3 = C.closed_points() - sage: p1.affine() + sage: F. = GF(2) # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^3*y + y^3*z + x*z^3) # optional - sage.rings.finite_rings + sage: p1, p2, p3 = C.closed_points() # optional - sage.rings.finite_rings + sage: p1.affine() # optional - sage.rings.finite_rings Point (x, z) - sage: p2.affine() + sage: p2.affine() # optional - sage.rings.finite_rings Point (x, y) - sage: p3.affine() + sage: p3.affine() # optional - sage.rings.finite_rings Point (y, z) - sage: p3.affine(0) + sage: p3.affine(0) # optional - sage.rings.finite_rings Point (y, z) - sage: p3.affine(1) + sage: p3.affine(1) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: not in the affine patch diff --git a/src/sage/schemes/curves/constructor.py b/src/sage/schemes/curves/constructor.py index 88f9b95701f..08f6dfe4ecf 100644 --- a/src/sage/schemes/curves/constructor.py +++ b/src/sage/schemes/curves/constructor.py @@ -12,9 +12,10 @@ :: - sage: P. = ProjectiveSpace(GF(5), 2) + sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings sage: Curve(y^2*z^7 - x^9 - x*z^8) - Projective Plane Curve over Finite Field of size 5 defined by -x^9 + y^2*z^7 - x*z^8 + Projective Plane Curve over Finite Field of size 5 + defined by -x^9 + y^2*z^7 - x*z^8 AUTHORS: @@ -123,10 +124,10 @@ def Curve(F, A=None): Affine plane curves. :: - sage: x,y = GF(7)['x,y'].gens() - sage: C = Curve(y^2 + x^3 + x^10); C + sage: x,y = GF(7)['x,y'].gens() # optional - sage.rings.finite_rings + sage: C = Curve(y^2 + x^3 + x^10); C # optional - sage.rings.finite_rings Affine Plane Curve over Finite Field of size 7 defined by x^10 + x^3 + y^2 - sage: C.genus() + sage: C.genus() # optional - sage.rings.finite_rings 0 sage: x, y = QQ['x,y'].gens() sage: Curve(x^3 + y^3 + 1) @@ -168,24 +169,25 @@ def Curve(F, A=None): The intersection is not a curve, though it is a scheme. :: sage: X = C.intersection(D); X - Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - x^3 + y^3 + z^3, - x^4 + y^4 + z^4 + Closed subscheme of Projective Space of dimension 2 over Rational Field + defined by: x^3 + y^3 + z^3, + x^4 + y^4 + z^4 Note that the intersection has dimension 0. :: sage: X.dimension() 0 sage: I = X.defining_ideal(); I - Ideal (x^3 + y^3 + z^3, x^4 + y^4 + z^4) of Multivariate Polynomial Ring in x, y, z over Rational Field + Ideal (x^3 + y^3 + z^3, x^4 + y^4 + z^4) of + Multivariate Polynomial Ring in x, y, z over Rational Field If only a polynomial in three variables is given, then it must be homogeneous such that a projective curve is constructed. :: sage: x,y,z = QQ['x,y,z'].gens() - sage: Curve(x^2+y^2) + sage: Curve(x^2 + y^2) Projective Conic Curve over Rational Field defined by x^2 + y^2 - sage: Curve(x^2+y^2+z) + sage: Curve(x^2 + y^2 + z) Traceback (most recent call last): ... TypeError: x^2 + y^2 + z is not a homogeneous polynomial @@ -203,11 +205,11 @@ def Curve(F, A=None): The defining polynomial must be nonzero unless the ambient space itself is of dimension 1. :: - sage: P1. = ProjectiveSpace(1,GF(5)) - sage: S = P1.coordinate_ring() - sage: Curve(S(0), P1) + sage: P1. = ProjectiveSpace(1, GF(5)) # optional - sage.rings.finite_rings + sage: S = P1.coordinate_ring() # optional - sage.rings.finite_rings + sage: Curve(S(0), P1) # optional - sage.rings.finite_rings Projective Line over Finite Field of size 5 - sage: Curve(P1) + sage: Curve(P1) # optional - sage.rings.finite_rings Projective Line over Finite Field of size 5 :: diff --git a/src/sage/schemes/curves/curve.py b/src/sage/schemes/curves/curve.py index e5576459629..3954aea62ce 100644 --- a/src/sage/schemes/curves/curve.py +++ b/src/sage/schemes/curves/curve.py @@ -46,8 +46,8 @@ class Curve_generic(AlgebraicScheme_subscheme): EXAMPLES:: - sage: A. = AffineSpace(QQ,3) - sage: C = Curve([x-y,z-2]) + sage: A. = AffineSpace(QQ, 3) + sage: C = Curve([x - y, z - 2]) sage: loads(C.dumps()) == C True """ @@ -57,13 +57,13 @@ def _repr_(self): EXAMPLES:: - sage: A. = AffineSpace(QQ,3) - sage: C = Curve([x-y,z-2]) + sage: A. = AffineSpace(QQ, 3) + sage: C = Curve([x - y, z - 2]) sage: C Affine Curve over Rational Field defined by x - y, z - 2 - sage: P. = ProjectiveSpace(QQ,2) - sage: C = Curve(x-y) + sage: P. = ProjectiveSpace(QQ, 2) + sage: C = Curve(x - y) sage: C Projective Plane Curve over Rational Field defined by x - y """ @@ -215,29 +215,29 @@ def geometric_genus(self): Examples of projective curves. :: - sage: P2 = ProjectiveSpace(2, GF(5), names=['x','y','z']) - sage: x, y, z = P2.coordinate_ring().gens() - sage: C = Curve(y^2*z - x^3 - 17*x*z^2 + y*z^2) - sage: C.geometric_genus() - 1 - sage: C = Curve(y^2*z - x^3) - sage: C.geometric_genus() - 0 - sage: C = Curve(x^10 + y^7*z^3 + z^10) - sage: C.geometric_genus() - 3 + sage: P2 = ProjectiveSpace(2, GF(5), names=['x','y','z']) # optional - sage.rings.finite_rings + sage: x, y, z = P2.coordinate_ring().gens() # optional - sage.rings.finite_rings + sage: C = Curve(y^2*z - x^3 - 17*x*z^2 + y*z^2) # optional - sage.rings.finite_rings + sage: C.geometric_genus() # optional - sage.rings.finite_rings + 1 + sage: C = Curve(y^2*z - x^3) # optional - sage.rings.finite_rings + sage: C.geometric_genus() # optional - sage.rings.finite_rings + 0 + sage: C = Curve(x^10 + y^7*z^3 + z^10) # optional - sage.rings.finite_rings + sage: C.geometric_genus() # optional - sage.rings.finite_rings + 3 Examples of affine curves. :: - sage: x, y = PolynomialRing(GF(5), 2, 'xy').gens() - sage: C = Curve(y^2 - x^3 - 17*x + y) - sage: C.geometric_genus() + sage: x, y = PolynomialRing(GF(5), 2, 'xy').gens() # optional - sage.rings.finite_rings + sage: C = Curve(y^2 - x^3 - 17*x + y) # optional - sage.rings.finite_rings + sage: C.geometric_genus() # optional - sage.rings.finite_rings 1 - sage: C = Curve(y^2 - x^3) - sage: C.geometric_genus() + sage: C = Curve(y^2 - x^3) # optional - sage.rings.finite_rings + sage: C.geometric_genus() # optional - sage.rings.finite_rings 0 - sage: C = Curve(x^10 + y^7 + 1) - sage: C.geometric_genus() + sage: C = Curve(x^10 + y^7 + 1) # optional - sage.rings.finite_rings + sage: C.geometric_genus() # optional - sage.rings.finite_rings 3 """ @@ -288,16 +288,16 @@ def singular_subscheme(self): sage: P. = ProjectiveSpace(QQ, 3) sage: C = Curve([y^8 - x^2*z*w^5, w^2 - 2*y^2 - x*z], P) sage: C.singular_subscheme() - Closed subscheme of Projective Space of dimension 3 over Rational - Field defined by: + Closed subscheme of Projective Space of dimension 3 + over Rational Field defined by: y^8 - x^2*z*w^5, -2*y^2 - x*z + w^2, -x^3*y*z^4 + 3*x^2*y*z^3*w^2 - 3*x*y*z^2*w^4 + 8*x*y*z*w^5 + y*z*w^6, x^2*z*w^5, -5*x^2*z^2*w^4 - 4*x*z*w^6, x^4*y*z^3 - 3*x^3*y*z^2*w^2 + 3*x^2*y*z*w^4 - 4*x^2*y*w^5 - x*y*w^6, - -2*x^3*y*z^3*w + 6*x^2*y*z^2*w^3 - 20*x^2*y*z*w^4 - 6*x*y*z*w^5 + - 2*y*w^7, + -2*x^3*y*z^3*w + 6*x^2*y*z^2*w^3 - 20*x^2*y*z*w^4 + - 6*x*y*z*w^5 + 2*y*w^7, -5*x^3*z*w^4 - 2*x^2*w^6 """ return self.ambient_space().subscheme(self.Jacobian()) @@ -323,12 +323,12 @@ def singular_points(self, F=None): :: sage: R. = QQ[] - sage: K. = NumberField(a^8 - a^4 + 1) - sage: P. = ProjectiveSpace(QQ, 2) - sage: C = Curve([359/12*x*y^2*z^2 + 2*y*z^4 + 187/12*y^3*z^2 + x*z^4\ - + 67/3*x^2*y*z^2 + 117/4*y^5 + 9*x^5 + 6*x^3*z^2 + 393/4*x*y^4\ - + 145*x^2*y^3 + 115*x^3*y^2 + 49*x^4*y], P) - sage: sorted(C.singular_points(K), key=str) + sage: K. = NumberField(a^8 - a^4 + 1) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(QQ, 2) # optional - sage.rings.number_field + sage: C = Curve([359/12*x*y^2*z^2 + 2*y*z^4 + 187/12*y^3*z^2 + x*z^4 # optional - sage.rings.number_field + ....: + 67/3*x^2*y*z^2 + 117/4*y^5 + 9*x^5 + 6*x^3*z^2 + ....: + 393/4*x*y^4 + 145*x^2*y^3 + 115*x^3*y^2 + 49*x^4*y], P) + sage: sorted(C.singular_points(K), key=str) # optional - sage.rings.number_field [(-1/2*b^5 - 1/2*b^3 + 1/2*b - 1 : 1 : 0), (-2/3*b^4 + 1/3 : 0 : 1), (-b^6 : b^6 : 1), @@ -372,10 +372,10 @@ def is_singular(self, P=None): :: - sage: A. = AffineSpace(GF(11), 3) - sage: C = A.curve([y^3 - z^5, x^5 - y + 1]) - sage: Q = A([7,0,0]) - sage: C.is_singular(Q) + sage: A. = AffineSpace(GF(11), 3) # optional - sage.rings.finite_rings + sage: C = A.curve([y^3 - z^5, x^5 - y + 1]) # optional - sage.rings.finite_rings + sage: Q = A([7,0,0]) # optional - sage.rings.finite_rings + sage: C.is_singular(Q) # optional - sage.rings.finite_rings True """ return not self.is_smooth(P) @@ -405,14 +405,14 @@ def intersects_at(self, C, P): :: - sage: A. = AffineSpace(GF(13), 2) - sage: C = Curve([y + 12*x^5 + 3*x^3 + 7], A) - sage: D = Curve([y^2 + 7*x^2 + 8], A) - sage: Q1 = A([9,6]) - sage: C.intersects_at(D, Q1) + sage: A. = AffineSpace(GF(13), 2) # optional - sage.rings.finite_rings + sage: C = Curve([y + 12*x^5 + 3*x^3 + 7], A) # optional - sage.rings.finite_rings + sage: D = Curve([y^2 + 7*x^2 + 8], A) # optional - sage.rings.finite_rings + sage: Q1 = A([9,6]) # optional - sage.rings.finite_rings + sage: C.intersects_at(D, Q1) # optional - sage.rings.finite_rings True - sage: Q2 = A([3,7]) - sage: C.intersects_at(D, Q2) + sage: Q2 = A([3,7]) # optional - sage.rings.finite_rings + sage: C.intersects_at(D, Q2) # optional - sage.rings.finite_rings False """ if C.ambient_space() != self.ambient_space(): @@ -451,22 +451,21 @@ def intersection_points(self, C, F=None): EXAMPLES:: sage: R. = QQ[] - sage: K. = NumberField(a^2 + a + 1) - sage: P. = ProjectiveSpace(QQ, 3) - sage: C = Curve([y^2 - w*z, w^3 - y^3], P) - sage: D = Curve([x*y - w*z, z^3 - y^3], P) - sage: C.intersection_points(D, F=K) - [(-b - 1 : -b - 1 : b : 1), (b : b : -b - 1 : 1), (1 : 0 : 0 : 0), - (1 : 1 : 1 : 1)] + sage: K. = NumberField(a^2 + a + 1) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(QQ, 3) # optional - sage.rings.number_field + sage: C = Curve([y^2 - w*z, w^3 - y^3], P) # optional - sage.rings.number_field + sage: D = Curve([x*y - w*z, z^3 - y^3], P) # optional - sage.rings.number_field + sage: C.intersection_points(D, F=K) # optional - sage.rings.number_field + [(-b - 1 : -b - 1 : b : 1), (b : b : -b - 1 : 1), + (1 : 0 : 0 : 0), (1 : 1 : 1 : 1)] :: - sage: A. = AffineSpace(GF(7), 2) - sage: C = Curve([y^3 - x^3], A) - sage: D = Curve([-x*y^3 + y^4 - 2*x^3 + 2*x^2*y], A) - sage: C.intersection_points(D) - [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 3), (5, 5), (5, 6), - (6, 6)] + sage: A. = AffineSpace(GF(7), 2) # optional - sage.rings.finite_rings + sage: C = Curve([y^3 - x^3], A) # optional - sage.rings.finite_rings + sage: D = Curve([-x*y^3 + y^4 - 2*x^3 + 2*x^2*y], A) # optional - sage.rings.finite_rings + sage: C.intersection_points(D) # optional - sage.rings.finite_rings + [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 3), (5, 5), (5, 6), (6, 6)] :: @@ -506,26 +505,27 @@ def change_ring(self, R): sage: P. = ProjectiveSpace(QQ, 3) sage: C = Curve([x^2 - y^2, z*y - 4/5*w^2], P) - sage: C.change_ring(QuadraticField(-1)) - Projective Curve over Number Field in a with defining polynomial x^2 + 1 with a = 1*I defined by x^2 - y^2, y*z - 4/5*w^2 + sage: C.change_ring(QuadraticField(-1)) # optional - sage.rings.number_field + Projective Curve over Number Field in a with defining polynomial x^2 + 1 + with a = 1*I defined by x^2 - y^2, y*z - 4/5*w^2 :: sage: R. = QQ[] - sage: K. = NumberField(a^3 + a^2 - 1) - sage: A. = AffineSpace(K, 2) - sage: C = Curve([K.0*x^2 - x + y^3 - 11], A) - sage: L = K.embeddings(QQbar) + sage: K. = NumberField(a^3 + a^2 - 1) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 2) # optional - sage.rings.number_field + sage: C = Curve([K.0*x^2 - x + y^3 - 11], A) # optional - sage.rings.number_field + sage: L = K.embeddings(QQbar) # optional - sage.rings.number_field sage: set_verbose(-1) # suppress warnings for slow computation - sage: C.change_ring(L[0]) - Affine Plane Curve over Algebraic Field defined by y^3 + - (-0.8774388331233464? - 0.744861766619745?*I)*x^2 - x - 11 + sage: C.change_ring(L[0]) # optional - sage.rings.number_field + Affine Plane Curve over Algebraic Field + defined by y^3 + (-0.8774388331233464? - 0.744861766619745?*I)*x^2 - x - 11 :: sage: P. = ProjectiveSpace(QQ, 2) sage: C = P.curve([y*x - 18*x^2 + 17*z^2]) - sage: C.change_ring(GF(17)) + sage: C.change_ring(GF(17)) # optional - sage.rings.finite_rings Projective Plane Curve over Finite Field of size 17 defined by -x^2 + x*y """ new_AS = self.ambient_space().change_ring(R) diff --git a/src/sage/schemes/curves/point.py b/src/sage/schemes/curves/point.py index 0ae3ab7e820..5fbe6303b2e 100644 --- a/src/sage/schemes/curves/point.py +++ b/src/sage/schemes/curves/point.py @@ -7,17 +7,17 @@ sage: C = Curve([x^3 - 2*x*z^2 - y^3, z^3 - w^3 - x*y*z], P) sage: Q = C([1,1,0,0]) sage: Q.parent() - Set of rational points of Projective Curve over Rational Field defined - by x^3 - y^3 - 2*x*z^2, -x*y*z + z^3 - w^3 + Set of rational points of Projective Curve over Rational Field + defined by x^3 - y^3 - 2*x*z^2, -x*y*z + z^3 - w^3 or on affine curves:: - sage: A. = AffineSpace(GF(23), 2) - sage: C = Curve([y - y^4 + 17*x^2 - 2*x + 22], A) - sage: Q = C([22,21]) - sage: Q.parent() - Set of rational points of Affine Plane Curve over Finite Field of size - 23 defined by -y^4 - 6*x^2 - 2*x + y - 1 + sage: A. = AffineSpace(GF(23), 2) # optional - sage.rings.finite_rings + sage: C = Curve([y - y^4 + 17*x^2 - 2*x + 22], A) # optional - sage.rings.finite_rings + sage: Q = C([22,21]) # optional - sage.rings.finite_rings + sage: Q.parent() # optional - sage.rings.finite_rings + Set of rational points of Affine Plane Curve over Finite Field of size 23 + defined by -y^4 - 6*x^2 - 2*x + y - 1 AUTHORS: @@ -70,10 +70,10 @@ def multiplicity(self): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(17), 2) - sage: C = Curve([y^3*z - 16*x^4], P) - sage: Q = C([0,0,1]) - sage: Q.multiplicity() + sage: P. = ProjectiveSpace(GF(17), 2) # optional - sage.rings.finite_rings + sage: C = Curve([y^3*z - 16*x^4], P) # optional - sage.rings.finite_rings + sage: Q = C([0,0,1]) # optional - sage.rings.finite_rings + sage: Q.multiplicity() # optional - sage.rings.finite_rings 3 """ return self.codomain().multiplicity(self) @@ -113,14 +113,14 @@ def is_ordinary_singularity(self): :: sage: R. = QQ[] - sage: K. = NumberField(a^2 - 3) - sage: P. = ProjectiveSpace(K, 2) - sage: C = P.curve([x^2*y^3*z^4 - y^6*z^3 - 4*x^2*y^4*z^3 - + sage: K. = NumberField(a^2 - 3) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field + sage: C = P.curve([x^2*y^3*z^4 - y^6*z^3 - 4*x^2*y^4*z^3 - # optional - sage.rings.number_field ....: 4*x^4*y^2*z^3 + 3*y^7*z^2 + 10*x^2*y^5*z^2 + 9*x^4*y^3*z^2 + ....: 5*x^6*y*z^2 - 3*y^8*z - 9*x^2*y^6*z - 11*x^4*y^4*z - 7*x^6*y^2*z - ....: 2*x^8*z + y^9 + 2*x^2*y^7 + 3*x^4*y^5 + 4*x^6*y^3 + 2*x^8*y]) - sage: Q = C([-1/2, 1/2, 1]) - sage: Q.is_ordinary_singularity() + sage: Q = C([-1/2, 1/2, 1]) # optional - sage.rings.number_field + sage: Q.is_ordinary_singularity() # optional - sage.rings.number_field True """ return self.codomain().is_ordinary_singularity(self) @@ -145,11 +145,11 @@ def is_transverse(self, D): :: - sage: P. = ProjectiveSpace(GF(17), 2) - sage: C = Curve([x^4 - 16*y^3*z], P) - sage: D = Curve([y^2 - z*x], P) - sage: Q = C([0,0,1]) - sage: Q.is_transverse(D) + sage: P. = ProjectiveSpace(GF(17), 2) # optional - sage.rings.finite_rings + sage: C = Curve([x^4 - 16*y^3*z], P) # optional - sage.rings.finite_rings + sage: D = Curve([y^2 - z*x], P) # optional - sage.rings.finite_rings + sage: Q = C([0,0,1]) # optional - sage.rings.finite_rings + sage: Q.is_transverse(D) # optional - sage.rings.finite_rings False """ return self.codomain().is_transverse(D, self) @@ -170,12 +170,12 @@ def closed_point(self): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(17), 2) - sage: C = Curve([x^4 - 16*y^3*z], P) - sage: C.singular_points() + sage: P. = ProjectiveSpace(GF(17), 2) # optional - sage.rings.finite_rings + sage: C = Curve([x^4 - 16*y^3*z], P) # optional - sage.rings.finite_rings + sage: C.singular_points() # optional - sage.rings.finite_rings [(0 : 0 : 1)] - sage: p = _[0] - sage: p.closed_point() + sage: p = _[0] # optional - sage.rings.finite_rings + sage: p.closed_point() # optional - sage.rings.finite_rings Point (x, y) """ curve = self.codomain() @@ -197,12 +197,12 @@ def places(self): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(17), 2) - sage: C = Curve([x^4 - 16*y^3*z], P) - sage: C.singular_points() + sage: P. = ProjectiveSpace(GF(17), 2) # optional - sage.rings.finite_rings + sage: C = Curve([x^4 - 16*y^3*z], P) # optional - sage.rings.finite_rings + sage: C.singular_points() # optional - sage.rings.finite_rings [(0 : 0 : 1)] - sage: p = _[0] - sage: p.places() + sage: p = _[0] # optional - sage.rings.finite_rings + sage: p.places() # optional - sage.rings.finite_rings [Place (y)] """ return self.closed_point().places() @@ -213,12 +213,12 @@ def place(self): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(17), 2) - sage: C = Curve([x^4 - 16*y^3*z], P) - sage: C.singular_points() + sage: P. = ProjectiveSpace(GF(17), 2) # optional - sage.rings.finite_rings + sage: C = Curve([x^4 - 16*y^3*z], P) # optional - sage.rings.finite_rings + sage: C.singular_points() # optional - sage.rings.finite_rings [(0 : 0 : 1)] - sage: p = _[0] - sage: p.place() + sage: p = _[0] # optional - sage.rings.finite_rings + sage: p.place() # optional - sage.rings.finite_rings Place (y) """ return self.closed_point().place() @@ -253,14 +253,14 @@ def is_singular(self): EXAMPLES:: - sage: K = QuadraticField(-1) - sage: A. = AffineSpace(K, 3) - sage: C = Curve([(x^4 + 2*z + 2)*y, z - y + 1]) - sage: Q1 = C([0,0,-1]) - sage: Q1.is_singular() + sage: K = QuadraticField(-1) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 3) # optional - sage.rings.number_field + sage: C = Curve([(x^4 + 2*z + 2)*y, z - y + 1]) # optional - sage.rings.number_field + sage: Q1 = C([0,0,-1]) # optional - sage.rings.number_field + sage: Q1.is_singular() # optional - sage.rings.number_field True - sage: Q2 = C([-K.gen(),0,-1]) - sage: Q2.is_singular() + sage: Q2 = C([-K.gen(),0,-1]) # optional - sage.rings.number_field + sage: Q2.is_singular() # optional - sage.rings.number_field False """ return self.codomain().is_singular(self) @@ -324,10 +324,10 @@ def is_ordinary_singularity(self): :: - sage: A. = AffineSpace(GF(7), 2) - sage: C = A.curve([y^2 - x^7 - 6*x^3]) - sage: Q = C([0,0]) - sage: Q.is_ordinary_singularity() + sage: A. = AffineSpace(GF(7), 2) # optional - sage.rings.finite_rings + sage: C = A.curve([y^2 - x^7 - 6*x^3]) # optional - sage.rings.finite_rings + sage: Q = C([0,0]) # optional - sage.rings.finite_rings + sage: Q.is_ordinary_singularity() # optional - sage.rings.finite_rings False """ return self.codomain().is_ordinary_singularity(self) @@ -353,12 +353,12 @@ def is_transverse(self, D): :: sage: R. = QQ[] - sage: K. = NumberField(a^2 - 2) - sage: A. = AffineSpace(K, 2) - sage: C = Curve([y^2 + x^2 - 1], A) - sage: D = Curve([y - x], A) - sage: Q = C([-1/2*b,-1/2*b]) - sage: Q.is_transverse(D) + sage: K. = NumberField(a^2 - 2) # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 2) # optional - sage.rings.number_field + sage: C = Curve([y^2 + x^2 - 1], A) # optional - sage.rings.number_field + sage: D = Curve([y - x], A) # optional - sage.rings.number_field + sage: Q = C([-1/2*b, -1/2*b]) # optional - sage.rings.number_field + sage: Q.is_transverse(D) # optional - sage.rings.number_field True """ return self.codomain().is_transverse(D, self) @@ -381,10 +381,10 @@ def closed_point(self): EXAMPLES:: - sage: A. = AffineSpace(GF(8), 2) - sage: C = Curve(x^5 + y^5 + x*y + 1) - sage: p = C([1,1]) - sage: p.closed_point() + sage: A. = AffineSpace(GF(8), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y + 1) # optional - sage.rings.finite_rings + sage: p = C([1,1]) # optional - sage.rings.finite_rings + sage: p.closed_point() # optional - sage.rings.finite_rings Point (x + 1, y + 1) """ curve = self.codomain() @@ -400,18 +400,18 @@ def places(self): EXAMPLES:: - sage: A. = AffineSpace(GF(2), 2) - sage: C = Curve(x^5 + y^5 + x*y + 1) - sage: p = C(-1,-1) - sage: p + sage: A. = AffineSpace(GF(2), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y + 1) # optional - sage.rings.finite_rings + sage: p = C(-1,-1) # optional - sage.rings.finite_rings + sage: p # optional - sage.rings.finite_rings (1, 1) - sage: p.closed_point() + sage: p.closed_point() # optional - sage.rings.finite_rings Point (x + 1, y + 1) - sage: _.places() + sage: _.places() # optional - sage.rings.finite_rings [Place (x + 1, (1/(x^5 + 1))*y^4 + ((x^5 + x^4 + 1)/(x^5 + 1))*y^3 - + ((x^5 + x^3 + 1)/(x^5 + 1))*y^2 + (x^2/(x^5 + 1))*y), Place (x + - 1, (1/(x^5 + 1))*y^4 + ((x^5 + x^4 + 1)/(x^5 + 1))*y^3 + (x^3/(x^5 - + 1))*y^2 + (x^2/(x^5 + 1))*y + x + 1)] + + ((x^5 + x^3 + 1)/(x^5 + 1))*y^2 + (x^2/(x^5 + 1))*y), + Place (x + 1, (1/(x^5 + 1))*y^4 + ((x^5 + x^4 + 1)/(x^5 + 1))*y^3 + + (x^3/(x^5 + 1))*y^2 + (x^2/(x^5 + 1))*y + x + 1)] """ return self.closed_point().places() @@ -421,16 +421,16 @@ def place(self): EXAMPLES:: - sage: A. = AffineSpace(GF(2), 2) - sage: C = Curve(x^5 + y^5 + x*y + 1) - sage: p = C(-1,-1) - sage: p + sage: A. = AffineSpace(GF(2), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y + 1) # optional - sage.rings.finite_rings + sage: p = C(-1,-1) # optional - sage.rings.finite_rings + sage: p # optional - sage.rings.finite_rings (1, 1) - sage: p.closed_point() + sage: p.closed_point() # optional - sage.rings.finite_rings Point (x + 1, y + 1) - sage: _.place() - Place (x + 1, (1/(x^5 + 1))*y^4 + ((x^5 + x^4 + 1)/(x^5 + 1))*y^3 + - ((x^5 + x^3 + 1)/(x^5 + 1))*y^2 + (x^2/(x^5 + 1))*y) + sage: _.place() # optional - sage.rings.finite_rings + Place (x + 1, (1/(x^5 + 1))*y^4 + ((x^5 + x^4 + 1)/(x^5 + 1))*y^3 + + ((x^5 + x^3 + 1)/(x^5 + 1))*y^2 + (x^2/(x^5 + 1))*y) """ return self.closed_point().place() diff --git a/src/sage/schemes/curves/projective_curve.py b/src/sage/schemes/curves/projective_curve.py index e5a6ba01be1..6cac33c1a50 100644 --- a/src/sage/schemes/curves/projective_curve.py +++ b/src/sage/schemes/curves/projective_curve.py @@ -27,54 +27,54 @@ EXAMPLES:: - sage: k = GF(2) - sage: P. = ProjectiveSpace(k, 2) - sage: C = Curve(x^2*z - y^3, P) - sage: C.genus() + sage: k = GF(2) # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(k, 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^2*z - y^3, P) # optional - sage.rings.finite_rings + sage: C.genus() # optional - sage.rings.finite_rings 0 - sage: C.function_field() + sage: C.function_field() # optional - sage.rings.finite_rings Function field in z defined by z + y^3 Closed points of arbitrary degree can be computed:: - sage: C.closed_points() + sage: C.closed_points() # optional - sage.rings.finite_rings [Point (x, y), Point (y, z), Point (x + z, y + z)] - sage: C.closed_points(2) + sage: C.closed_points(2) # optional - sage.rings.finite_rings [Point (y^2 + y*z + z^2, x + z)] - sage: C.closed_points(3) + sage: C.closed_points(3) # optional - sage.rings.finite_rings [Point (y^3 + y^2*z + z^3, x + y + z), Point (x^2 + y*z + z^2, x*y + x*z + y*z, y^2 + x*z + y*z + z^2)] All singular closed points can be found:: - sage: C.singular_closed_points() + sage: C.singular_closed_points() # optional - sage.rings.finite_rings [Point (x, y)] - sage: p = _[0] - sage: p.places() # a unibranch singularity, that is, a cusp + sage: p = _[0] # optional - sage.rings.finite_rings + sage: p.places() # a unibranch singularity, that is, a cusp # optional - sage.rings.finite_rings [Place (1/y)] - sage: pls = _[0] - sage: C.place_to_closed_point(pls) + sage: pls = _[0] # optional - sage.rings.finite_rings + sage: C.place_to_closed_point(pls) # optional - sage.rings.finite_rings Point (x, y) It is easy to transit to and from the function field of the curve:: - sage: fx = C(x/z) - sage: fy = C(y/z) - sage: fx^2 - fy^3 + sage: fx = C(x/z) # optional - sage.rings.finite_rings + sage: fy = C(y/z) # optional - sage.rings.finite_rings + sage: fx^2 - fy^3 # optional - sage.rings.finite_rings 0 - sage: fx.divisor() + sage: fx.divisor() # optional - sage.rings.finite_rings 3*Place (1/y) - 3*Place (y) - sage: p, = fx.poles() - sage: p + sage: p, = fx.poles() # optional - sage.rings.finite_rings + sage: p # optional - sage.rings.finite_rings Place (y) - sage: C.place_to_closed_point(p) + sage: C.place_to_closed_point(p) # optional - sage.rings.finite_rings Point (y, z) - sage: _.rational_point() + sage: _.rational_point() # optional - sage.rings.finite_rings (1 : 0 : 0) - sage: _.closed_point() + sage: _.closed_point() # optional - sage.rings.finite_rings Point (y, z) - sage: _.place() + sage: _.place() # optional - sage.rings.finite_rings Place (y) Integral projective curves over `\QQ` @@ -187,16 +187,16 @@ class ProjectiveCurve(Curve_generic, AlgebraicScheme_subscheme_projective): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(7), 4) - sage: C = Curve([y*u^2 - x^3, z*u^2 - x^3, w*u^2 - x^3, y^3 - x^3], P); C - Projective Curve over Finite Field of size 7 defined by -x^3 + y*u^2, - -x^3 + z*u^2, -x^3 + w*u^2, -x^3 + y^3 + sage: P. = ProjectiveSpace(GF(7), 4) # optional - sage.rings.finite_rings + sage: C = Curve([y*u^2 - x^3, z*u^2 - x^3, w*u^2 - x^3, y^3 - x^3], P); C # optional - sage.rings.finite_rings + Projective Curve over Finite Field of size 7 defined + by -x^3 + y*u^2, -x^3 + z*u^2, -x^3 + w*u^2, -x^3 + y^3 :: - sage: K. = CyclotomicField(11) - sage: P. = ProjectiveSpace(K, 3) - sage: C = Curve([y*w - u*z^2 - x^2, x*w - 3*u^2*z*w], P); C + sage: K. = CyclotomicField(11) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 3) # optional - sage.rings.number_field + sage: C = Curve([y*w - u*z^2 - x^2, x*w - 3*u^2*z*w], P); C # optional - sage.rings.number_field Projective Curve over Cyclotomic Field of order 11 and degree 10 defined by -x^2 + (-u)*z^2 + y*w, x*w + (-3*u^2)*z*w """ @@ -298,21 +298,21 @@ def projection(self, P=None, PS=None): EXAMPLES:: - sage: K. = CyclotomicField(3) - sage: P. = ProjectiveSpace(K, 3) - sage: C = Curve([y*w - x^2, z*w^2 - a*x^3], P) - sage: L. = ProjectiveSpace(K, 2) - sage: proj1 = C.projection(PS=L) - sage: proj1 + sage: K. = CyclotomicField(3) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 3) # optional - sage.rings.number_field + sage: C = Curve([y*w - x^2, z*w^2 - a*x^3], P) # optional - sage.rings.number_field + sage: L. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field + sage: proj1 = C.projection(PS=L) # optional - sage.rings.number_field + sage: proj1 # optional - sage.rings.number_field (Scheme morphism: From: Projective Curve over Cyclotomic Field of order 3 and degree 2 - defined by -x^2 + y*w, (-a)*x^3 + z*w^2 - To: Projective Space of dimension 2 over Cyclotomic Field of order - 3 and degree 2 + defined by -x^2 + y*w, (-a)*x^3 + z*w^2 + To: Projective Space of dimension 2 + over Cyclotomic Field of order 3 and degree 2 Defn: Defined on coordinates by sending (x : y : z : w) to (x : y : -z + w), Projective Plane Curve over Cyclotomic Field of order 3 and degree 2 - defined by a^6 + (-a)*a^3*b^3 - a^4*b*c) + defined by a^6 + (-a)*a^3*b^3 - a^4*b*c) sage: proj1[1].ambient_space() is L True sage: proj2 = C.projection() @@ -325,42 +325,42 @@ def projection(self, P=None, PS=None): sage: C = Curve([y - x, z - a - b, w^2 - c^2, z - x - a, x^2 - w*z], P) sage: C.projection() (Scheme morphism: - From: Projective Curve over Rational Field defined by -x + y, z - a - - b, w^2 - c^2, -x + z - a, x^2 - z*w + From: Projective Curve over Rational Field + defined by -x + y, z - a - b, w^2 - c^2, -x + z - a, x^2 - z*w To: Projective Space of dimension 5 over Rational Field Defn: Defined on coordinates by sending (x : y : z : w : a : b : c) - to - (x : y : -z + w : a : b : c), + to (x : y : -z + w : a : b : c), Projective Curve over Rational Field defined by x1 - x4, x0 - x4, x2*x3 - + x3^2 + x2*x4 + 2*x3*x4, x2^2 - x3^2 - 2*x3*x4 + x4^2 - x5^2, x2*x4^2 + - x3*x4^2 + x4^3 - x3*x5^2 - x4*x5^2, x4^4 - x3^2*x5^2 - 2*x3*x4*x5^2 - - x4^2*x5^2) + + x3^2 + x2*x4 + 2*x3*x4, x2^2 - x3^2 - 2*x3*x4 + x4^2 - x5^2, x2*x4^2 + + x3*x4^2 + x4^3 - x3*x5^2 - x4*x5^2, x4^4 - x3^2*x5^2 - 2*x3*x4*x5^2 - + x4^2*x5^2) :: - sage: P. = ProjectiveSpace(GF(2), 3) - sage: C = P.curve([(x - y)*(x - z)*(x - w)*(y - z)*(y - w), x*y*z*w*(x+y+z+w)]) - sage: C.projection() + sage: P. = ProjectiveSpace(GF(2), 3) # optional - sage.rings.finite_rings + sage: C = P.curve([(x - y)*(x - z)*(x - w)*(y - z)*(y - w), # optional - sage.rings.finite_rings + ....: x*y*z*w*(x + y + z + w)]) + sage: C.projection() # optional - sage.rings.finite_rings Traceback (most recent call last): ... NotImplementedError: this curve contains all points of its ambient space :: - sage: P. = ProjectiveSpace(GF(7), 4) - sage: C = P.curve([x^3 - y*z*u, w^2 - u^2 + 2*x*z, 3*x*w - y^2]) - sage: L. = ProjectiveSpace(GF(7), 3) - sage: C.projection(PS=L) + sage: P. = ProjectiveSpace(GF(7), 4) # optional - sage.rings.finite_rings + sage: C = P.curve([x^3 - y*z*u, w^2 - u^2 + 2*x*z, 3*x*w - y^2]) # optional - sage.rings.finite_rings + sage: L. = ProjectiveSpace(GF(7), 3) # optional - sage.rings.finite_rings + sage: C.projection(PS=L) # optional - sage.rings.finite_rings (Scheme morphism: - From: Projective Curve over Finite Field of size 7 defined by x^3 - - y*z*u, 2*x*z + w^2 - u^2, -y^2 + 3*x*w + From: Projective Curve over Finite Field of size 7 + defined by x^3 - y*z*u, 2*x*z + w^2 - u^2, -y^2 + 3*x*w To: Projective Space of dimension 3 over Finite Field of size 7 Defn: Defined on coordinates by sending (x : y : z : w : u) to (x : y : z : w), Projective Curve over Finite Field of size 7 defined by b^2 - 3*a*d, - a^5*b + a*b*c^3*d - 3*b*c^2*d^3, a^6 + a^2*c^3*d - 3*a*c^2*d^3) - sage: Q. = ProjectiveSpace(GF(7), 2) - sage: C.projection(PS=Q) + a^5*b + a*b*c^3*d - 3*b*c^2*d^3, a^6 + a^2*c^3*d - 3*a*c^2*d^3) + sage: Q. = ProjectiveSpace(GF(7), 2) # optional - sage.rings.finite_rings + sage: C.projection(PS=Q) # optional - sage.rings.finite_rings Traceback (most recent call last): ... TypeError: (=Projective Space of dimension 2 over Finite Field of size @@ -374,19 +374,20 @@ def projection(self, P=None, PS=None): sage: Q = PP([1,0,1,1]) sage: C.projection(P=Q) (Scheme morphism: - From: Projective Curve over Rational Field defined by x^3 - y*z^2, -x*z + w^2 + From: Projective Curve over Rational Field + defined by x^3 - y*z^2, -x*z + w^2 To: Projective Space of dimension 2 over Rational Field Defn: Defined on coordinates by sending (x : y : z : w) to (y : -x + z : -x + w), Projective Plane Curve over Rational Field defined by x0*x1^5 - - 6*x0*x1^4*x2 + 14*x0*x1^3*x2^2 - 16*x0*x1^2*x2^3 + 9*x0*x1*x2^4 - - 2*x0*x2^5 - x2^6) + 6*x0*x1^4*x2 + 14*x0*x1^3*x2^2 - 16*x0*x1^2*x2^3 + 9*x0*x1*x2^4 - + 2*x0*x2^5 - x2^6) sage: LL. = ProjectiveSpace(QQ, 2) sage: Q = PP([0,0,0,1]) sage: C.projection(PS=LL, P=Q) (Scheme morphism: - From: Projective Curve over Rational Field defined by x^3 - y*z^2, - -x*z + w^2 + From: Projective Curve over Rational Field + defined by x^3 - y*z^2, -x*z + w^2 To: Projective Space of dimension 2 over Rational Field Defn: Defined on coordinates by sending (x : y : z : w) to (x : y : z), @@ -516,13 +517,13 @@ def plane_projection(self, PP=None): sage: proj1 = C.plane_projection(PP=L) sage: proj1 (Scheme morphism: - From: Projective Curve over Rational Field defined by x*u - z*v, -y + - w, -x^2 + y*w, -w^5 + 2*y^3*z*u + From: Projective Curve over Rational Field + defined by x*u - z*v, -y + w, -x^2 + y*w, -w^5 + 2*y^3*z*u To: Projective Space of dimension 2 over Rational Field Defn: Defined on coordinates by sending (x : y : z : w : u : v) to (x : -z + u : -z + v), Projective Plane Curve over Rational Field defined by a^8 + 6*a^7*b + - 4*a^5*b^3 - 4*a^7*c - 2*a^6*b*c - 4*a^5*b^2*c + 2*a^6*c^2) + 4*a^5*b^3 - 4*a^7*c - 2*a^6*b*c - 4*a^5*b^2*c + 2*a^6*c^2) sage: proj1[1].ambient_space() is L True sage: proj2 = C.projection() @@ -531,21 +532,24 @@ def plane_projection(self, PP=None): :: - sage: P. = ProjectiveSpace(GF(7), 4) - sage: C = P.curve([x^2 - 6*y^2, w*z*u - y^3 + 4*y^2*z, u^2 - x^2]) - sage: C.plane_projection() + sage: P. = ProjectiveSpace(GF(7), 4) # optional - sage.rings.finite_rings + sage: C = P.curve([x^2 - 6*y^2, w*z*u - y^3 + 4*y^2*z, u^2 - x^2]) # optional - sage.rings.finite_rings + sage: C.plane_projection() # optional - sage.rings.finite_rings (Scheme morphism: - From: Projective Curve over Finite Field of size 7 defined by x^2 + y^2, -y^3 - 3*y^2*z + z*w*u, -x^2 + u^2 + From: Projective Curve over Finite Field of size 7 + defined by x^2 + y^2, -y^3 - 3*y^2*z + z*w*u, -x^2 + u^2 To: Projective Space of dimension 2 over Finite Field of size 7 Defn: Defined on coordinates by sending (x : y : z : w : u) to (x : z : -y + w), - Projective Plane Curve over Finite Field of size 7 defined by x0^10 + 2*x0^8*x1^2 + 2*x0^6*x1^4 - 3*x0^6*x1^3*x2 + 2*x0^6*x1^2*x2^2 - 2*x0^4*x1^4*x2^2 + x0^2*x1^4*x2^4) + Projective Plane Curve over Finite Field of size 7 + defined by x0^10 + 2*x0^8*x1^2 + 2*x0^6*x1^4 - 3*x0^6*x1^3*x2 + + 2*x0^6*x1^2*x2^2 - 2*x0^4*x1^4*x2^2 + x0^2*x1^4*x2^4) :: - sage: P. = ProjectiveSpace(GF(17), 2) - sage: C = P.curve(x^2 - y*z - z^2) - sage: C.plane_projection() + sage: P. = ProjectiveSpace(GF(17), 2) # optional - sage.rings.finite_rings + sage: C = P.curve(x^2 - y*z - z^2) # optional - sage.rings.finite_rings + sage: C.plane_projection() # optional - sage.rings.finite_rings Traceback (most recent call last): ... TypeError: this curve is already a plane curve @@ -585,17 +589,18 @@ class ProjectivePlaneCurve(ProjectiveCurve): A projective plane curve defined over an algebraic closure of `\QQ`:: - sage: P. = ProjectiveSpace(QQbar, 2) - sage: set_verbose(-1) # suppress warnings for slow computation - sage: C = Curve([y*z - x^2 - QQbar.gen()*z^2], P); C - Projective Plane Curve over Algebraic Field defined by - -x^2 + y*z + (-I)*z^2 + sage: P. = ProjectiveSpace(QQbar, 2) # optional - sage.rings.number_field + sage: set_verbose(-1) # suppress warnings for slow computation # optional - sage.rings.number_field + sage: C = Curve([y*z - x^2 - QQbar.gen()*z^2], P); C # optional - sage.rings.number_field + Projective Plane Curve over Algebraic Field + defined by -x^2 + y*z + (-I)*z^2 A projective plane curve defined over a finite field:: - sage: P. = ProjectiveSpace(GF(5^2, 'v'), 2) - sage: C = Curve([y^2*z - x*z^2 - z^3], P); C - Projective Plane Curve over Finite Field in v of size 5^2 defined by y^2*z - x*z^2 - z^3 + sage: P. = ProjectiveSpace(GF(5^2, 'v'), 2) # optional - sage.rings.finite_rings + sage: C = Curve([y^2*z - x*z^2 - z^3], P); C # optional - sage.rings.finite_rings + Projective Plane Curve over Finite Field in v of size 5^2 + defined by y^2*z - x*z^2 - z^3 """ def __init__(self, A, f): """ @@ -640,18 +645,18 @@ def divisor_of_function(self, r): EXAMPLES:: - sage: FF = FiniteField(5) - sage: P2 = ProjectiveSpace(2, FF, names = ['x','y','z']) - sage: R = P2.coordinate_ring() - sage: x, y, z = R.gens() - sage: f = y^2*z^7 - x^9 - x*z^8 - sage: C = Curve(f) - sage: K = FractionField(R) - sage: r = 1/x - sage: C.divisor_of_function(r) # todo: not implemented !!!! + sage: FF = FiniteField(5) # optional - sage.rings.finite_rings + sage: P2 = ProjectiveSpace(2, FF, names=['x','y','z']) # optional - sage.rings.finite_rings + sage: R = P2.coordinate_ring() # optional - sage.rings.finite_rings + sage: x, y, z = R.gens() # optional - sage.rings.finite_rings + sage: f = y^2*z^7 - x^9 - x*z^8 # optional - sage.rings.finite_rings + sage: C = Curve(f) # optional - sage.rings.finite_rings + sage: K = FractionField(R) # optional - sage.rings.finite_rings + sage: r = 1/x # optional - sage.rings.finite_rings + sage: C.divisor_of_function(r) # todo: not implemented !!!! # optional - sage.rings.finite_rings [[-1, (0, 0, 1)]] - sage: r = 1/x^3 - sage: C.divisor_of_function(r) # todo: not implemented !!!! + sage: r = 1/x^3 # optional - sage.rings.finite_rings + sage: C.divisor_of_function(r) # todo: not implemented !!!! # optional - sage.rings.finite_rings [[-3, (0, 0, 1)]] """ F = self.base_ring() @@ -686,13 +691,14 @@ def local_coordinates(self, pt, n): EXAMPLES:: - sage: FF = FiniteField(5) - sage: P2 = ProjectiveSpace(2, FF, names = ['x','y','z']) - sage: x, y, z = P2.coordinate_ring().gens() - sage: C = Curve(y^2*z^7-x^9-x*z^8) - sage: pt = C([2,3,1]) - sage: C.local_coordinates(pt,9) # todo: not implemented !!!! - [2 + t, 3 + 3*t^2 + t^3 + 3*t^4 + 3*t^6 + 3*t^7 + t^8 + 2*t^9 + 3*t^11 + 3*t^12] + sage: FF = FiniteField(5) # optional - sage.rings.finite_rings + sage: P2 = ProjectiveSpace(2, FF, names=['x','y','z']) # optional - sage.rings.finite_rings + sage: x, y, z = P2.coordinate_ring().gens() # optional - sage.rings.finite_rings + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # optional - sage.rings.finite_rings + sage: pt = C([2,3,1]) # optional - sage.rings.finite_rings + sage: C.local_coordinates(pt,9) # todo: not implemented !!!! # optional - sage.rings.finite_rings + [2 + t, + 3 + 3*t^2 + t^3 + 3*t^4 + 3*t^6 + 3*t^7 + t^8 + 2*t^9 + 3*t^11 + 3*t^12] """ f = self.defining_polynomial() @@ -764,25 +770,25 @@ def plot(self, *args, **kwds): sage: R. = QQ[] sage: C = Curve(x^3 - y^2*z) - sage: C.plot() + sage: C.plot() # optional - sage.plot Graphics object consisting of 1 graphics primitive The other affine patches of the same curve:: - sage: C.plot(patch=0) + sage: C.plot(patch=0) # optional - sage.plot Graphics object consisting of 1 graphics primitive - sage: C.plot(patch=1) + sage: C.plot(patch=1) # optional - sage.plot Graphics object consisting of 1 graphics primitive An elliptic curve:: sage: E = EllipticCurve('101a') sage: C = Curve(E) - sage: C.plot() + sage: C.plot() # optional - sage.plot Graphics object consisting of 1 graphics primitive - sage: C.plot(patch=0) + sage: C.plot(patch=0) # optional - sage.plot Graphics object consisting of 1 graphics primitive - sage: C.plot(patch=1) + sage: C.plot(patch=1) # optional - sage.plot Graphics object consisting of 1 graphics primitive A hyperelliptic curve:: @@ -790,11 +796,11 @@ def plot(self, *args, **kwds): sage: P. = QQ[] sage: f = 4*x^5 - 30*x^3 + 45*x - 22 sage: C = HyperellipticCurve(f) - sage: C.plot() + sage: C.plot() # optional - sage.plot Graphics object consisting of 1 graphics primitive - sage: C.plot(patch=0) + sage: C.plot(patch=0) # optional - sage.plot Graphics object consisting of 1 graphics primitive - sage: C.plot(patch=1) + sage: C.plot(patch=1) # optional - sage.plot Graphics object consisting of 1 graphics primitive """ # if user has not specified a favorite affine patch, take the @@ -826,47 +832,47 @@ def is_singular(self, P=None): Over `\QQ`:: sage: F = QQ - sage: P2. = ProjectiveSpace(F,2) - sage: C = Curve(X^3-Y^2*Z) + sage: P2. = ProjectiveSpace(F, 2) + sage: C = Curve(X^3 - Y^2*Z) sage: C.is_singular() True Over a finite field:: - sage: F = GF(19) - sage: P2. = ProjectiveSpace(F,2) - sage: C = Curve(X^3+Y^3+Z^3) - sage: C.is_singular() + sage: F = GF(19) # optional - sage.rings.finite_rings + sage: P2. = ProjectiveSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(X^3 + Y^3 + Z^3) # optional - sage.rings.finite_rings + sage: C.is_singular() # optional - sage.rings.finite_rings False - sage: D = Curve(X^4-X*Z^3) - sage: D.is_singular() + sage: D = Curve(X^4 - X*Z^3) # optional - sage.rings.finite_rings + sage: D.is_singular() # optional - sage.rings.finite_rings True - sage: E = Curve(X^5+19*Y^5+Z^5) - sage: E.is_singular() + sage: E = Curve(X^5 + 19*Y^5 + Z^5) # optional - sage.rings.finite_rings + sage: E.is_singular() # optional - sage.rings.finite_rings True - sage: E = Curve(X^5+9*Y^5+Z^5) - sage: E.is_singular() + sage: E = Curve(X^5 + 9*Y^5 + Z^5) # optional - sage.rings.finite_rings + sage: E.is_singular() # optional - sage.rings.finite_rings False Over `\CC`:: sage: F = CC - sage: P2. = ProjectiveSpace(F,2) + sage: P2. = ProjectiveSpace(F, 2) sage: C = Curve(X) sage: C.is_singular() False - sage: D = Curve(Y^2*Z-X^3) + sage: D = Curve(Y^2*Z - X^3) sage: D.is_singular() True - sage: E = Curve(Y^2*Z-X^3+Z^3) + sage: E = Curve(Y^2*Z - X^3 + Z^3) sage: E.is_singular() False Showing that :trac:`12187` is fixed:: - sage: F. = GF(2)[] - sage: G = Curve(X^2+Y*Z) - sage: G.is_singular() + sage: F. = GF(2)[] # optional - sage.rings.finite_rings + sage: G = Curve(X^2 + Y*Z) # optional - sage.rings.finite_rings + sage: G.is_singular() # optional - sage.rings.finite_rings False :: @@ -924,18 +930,20 @@ def tangents(self, P, factor=True): EXAMPLES:: sage: set_verbose(-1) - sage: P. = ProjectiveSpace(QQbar, 2) - sage: C = Curve([x^3*y + 2*x^2*y^2 + x*y^3 + x^3*z + 7*x^2*y*z + 14*x*y^2*z + 9*y^3*z], P) - sage: Q = P([0,0,1]) - sage: C.tangents(Q) - [x + 4.147899035704788?*y, x + (1.426050482147607? + 0.3689894074818041?*I)*y, - x + (1.426050482147607? - 0.3689894074818041?*I)*y] - sage: C.tangents(Q, factor=False) + sage: P. = ProjectiveSpace(QQbar, 2) # optional - sage.rings.number_field + sage: C = Curve([x^3*y + 2*x^2*y^2 + x*y^3 + x^3*z # optional - sage.rings.number_field + ....: + 7*x^2*y*z + 14*x*y^2*z + 9*y^3*z], P) + sage: Q = P([0,0,1]) # optional - sage.rings.number_field + sage: C.tangents(Q) # optional - sage.rings.number_field + [x + 4.147899035704788?*y, + x + (1.426050482147607? + 0.3689894074818041?*I)*y, + x + (1.426050482147607? - 0.3689894074818041?*I)*y] + sage: C.tangents(Q, factor=False) # optional - sage.rings.number_field [6*x^3 + 42*x^2*y + 84*x*y^2 + 54*y^3] :: - sage: P. = ProjectiveSpace(QQ,2) + sage: P. = ProjectiveSpace(QQ, 2) sage: C = P.curve([x^2*y^3*z^4 - y^6*z^3 - 4*x^2*y^4*z^3 - 4*x^4*y^2*z^3 + 3*y^7*z^2 +\ 10*x^2*y^5*z^2 + 9*x^4*y^3*z^2 + 5*x^6*y*z^2 - 3*y^8*z - 9*x^2*y^6*z - 11*x^4*y^4*z -\ 7*x^6*y^2*z - 2*x^8*z + y^9 + 2*x^2*y^7 + 3*x^4*y^5 + 4*x^6*y^3 + 2*x^8*y]) @@ -1001,13 +1009,15 @@ def is_ordinary_singularity(self, P): :: sage: R. = QQ[] - sage: K. = NumberField(a^2 - 3) - sage: P. = ProjectiveSpace(K, 2) - sage: C = P.curve([x^2*y^3*z^4 - y^6*z^3 - 4*x^2*y^4*z^3 - 4*x^4*y^2*z^3 + 3*y^7*z^2 + 10*x^2*y^5*z^2\ - + 9*x^4*y^3*z^2 + 5*x^6*y*z^2 - 3*y^8*z - 9*x^2*y^6*z - 11*x^4*y^4*z - 7*x^6*y^2*z - 2*x^8*z + y^9 +\ - 2*x^2*y^7 + 3*x^4*y^5 + 4*x^6*y^3 + 2*x^8*y]) - sage: Q = P([0,1,1]) - sage: C.is_ordinary_singularity(Q) + sage: K. = NumberField(a^2 - 3) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field + sage: C = P.curve([x^2*y^3*z^4 - y^6*z^3 - 4*x^2*y^4*z^3 - 4*x^4*y^2*z^3 # optional - sage.rings.number_field + ....: + 3*y^7*z^2 + 10*x^2*y^5*z^2 + 9*x^4*y^3*z^2 + ....: + 5*x^6*y*z^2 - 3*y^8*z - 9*x^2*y^6*z - 11*x^4*y^4*z + ....: - 7*x^6*y^2*z - 2*x^8*z + y^9 + 2*x^2*y^7 + 3*x^4*y^5 + ....: + 4*x^6*y^3 + 2*x^8*y]) + sage: Q = P([0,1,1]) # optional - sage.rings.number_field + sage: C.is_ordinary_singularity(Q) # optional - sage.rings.number_field True :: @@ -1051,23 +1061,23 @@ def quadratic_transform(self): sage: C = Curve(x^3*y - z^4 - z^2*x^2, P) sage: C.quadratic_transform() Scheme morphism: - From: Projective Plane Curve over Rational Field defined by x^3*y - - x^2*z^2 - z^4 - To: Projective Plane Curve over Rational Field defined by -x^3*y - - x*y*z^2 + z^4 + From: Projective Plane Curve over Rational Field + defined by x^3*y - x^2*z^2 - z^4 + To: Projective Plane Curve over Rational Field + defined by -x^3*y - x*y*z^2 + z^4 Defn: Defined on coordinates by sending (x : y : z) to (y*z : x*z : x*y) :: - sage: P. = ProjectiveSpace(GF(17), 2) + sage: P. = ProjectiveSpace(GF(17), 2) # optional - sage.rings.finite_rings sage: C = P.curve([y^7*z^2 - 16*x^9 + x*y*z^7 + 2*z^9]) sage: C.quadratic_transform() Scheme morphism: - From: Projective Plane Curve over Finite Field of size 17 defined by - x^9 + y^7*z^2 + x*y*z^7 + 2*z^9 - To: Projective Plane Curve over Finite Field of size 17 defined by - 2*x^9*y^7 + x^8*y^6*z^2 + x^9*z^7 + y^7*z^9 + From: Projective Plane Curve over Finite Field of size 17 + defined by x^9 + y^7*z^2 + x*y*z^7 + 2*z^9 + To: Projective Plane Curve over Finite Field of size 17 + defined by 2*x^9*y^7 + x^8*y^6*z^2 + x^9*z^7 + y^7*z^9 Defn: Defined on coordinates by sending (x : y : z) to (y*z : x*z : x*y) """ @@ -1119,55 +1129,66 @@ def excellent_position(self, Q): sage: C.excellent_position(Q) Scheme morphism: From: Projective Plane Curve over Rational Field defined by x*y - z^2 - To: Projective Plane Curve over Rational Field defined by -x^2 - - 3*x*y - 4*y^2 - x*z - 3*y*z + To: Projective Plane Curve over Rational Field + defined by -x^2 - 3*x*y - 4*y^2 - x*z - 3*y*z Defn: Defined on coordinates by sending (x : y : z) to (-x + 1/2*y + 1/2*z : -1/2*y + 1/2*z : x + 1/2*y - 1/2*z) :: sage: R. = QQ[] - sage: K. = NumberField(a^2 - 3) - sage: P. = ProjectiveSpace(K, 2) - sage: C = P.curve([z^2*y^3*x^4 - y^6*x^3 - 4*z^2*y^4*x^3 - 4*z^4*y^2*x^3 + 3*y^7*x^2 + 10*z^2*y^5*x^2\ - + 9*z^4*y^3*x^2 + 5*z^6*y*x^2 - 3*y^8*x - 9*z^2*y^6*x - 11*z^4*y^4*x - 7*z^6*y^2*x - 2*z^8*x + y^9 +\ - 2*z^2*y^7 + 3*z^4*y^5 + 4*z^6*y^3 + 2*z^8*y]) - sage: Q = P([1,0,0]) - sage: C.excellent_position(Q) + sage: K. = NumberField(a^2 - 3) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field + sage: C = P.curve([z^2*y^3*x^4 - y^6*x^3 - 4*z^2*y^4*x^3 - 4*z^4*y^2*x^3 # optional - sage.rings.number_field + ....: + 3*y^7*x^2 + 10*z^2*y^5*x^2 + 9*z^4*y^3*x^2 + ....: + 5*z^6*y*x^2 - 3*y^8*x - 9*z^2*y^6*x - 11*z^4*y^4*x + ....: - 7*z^6*y^2*x - 2*z^8*x + y^9 + 2*z^2*y^7 + 3*z^4*y^5 + ....: + 4*z^6*y^3 + 2*z^8*y]) + sage: Q = P([1,0,0]) # optional - sage.rings.number_field + sage: C.excellent_position(Q) # optional - sage.rings.number_field Scheme morphism: - From: Projective Plane Curve over Number Field in b with defining - polynomial a^2 - 3 defined by -x^3*y^6 + 3*x^2*y^7 - 3*x*y^8 + y^9 + - x^4*y^3*z^2 - 4*x^3*y^4*z^2 + 10*x^2*y^5*z^2 - 9*x*y^6*z^2 + 2*y^7*z^2 - - 4*x^3*y^2*z^4 + 9*x^2*y^3*z^4 - 11*x*y^4*z^4 + 3*y^5*z^4 + 5*x^2*y*z^6 - - 7*x*y^2*z^6 + 4*y^3*z^6 - 2*x*z^8 + 2*y*z^8 - To: Projective Plane Curve over Number Field in b with defining - polynomial a^2 - 3 defined by 900*x^9 - 7410*x^8*y + 29282*x^7*y^2 - - 69710*x^6*y^3 + 110818*x^5*y^4 - 123178*x^4*y^5 + 96550*x^3*y^6 - - 52570*x^2*y^7 + 18194*x*y^8 - 3388*y^9 - 1550*x^8*z + 9892*x^7*y*z - - 30756*x^6*y^2*z + 58692*x^5*y^3*z - 75600*x^4*y^4*z + 67916*x^3*y^5*z - - 42364*x^2*y^6*z + 16844*x*y^7*z - 3586*y^8*z + 786*x^7*z^2 - - 3958*x^6*y*z^2 + 9746*x^5*y^2*z^2 - 14694*x^4*y^3*z^2 + - 15174*x^3*y^4*z^2 - 10802*x^2*y^5*z^2 + 5014*x*y^6*z^2 - 1266*y^7*z^2 - - 144*x^6*z^3 + 512*x^5*y*z^3 - 912*x^4*y^2*z^3 + 1024*x^3*y^3*z^3 - - 816*x^2*y^4*z^3 + 512*x*y^5*z^3 - 176*y^6*z^3 + 8*x^5*z^4 - 8*x^4*y*z^4 - - 16*x^3*y^2*z^4 + 16*x^2*y^3*z^4 + 8*x*y^4*z^4 - 8*y^5*z^4 + From: Projective Plane Curve over Number Field in b + with defining polynomial a^2 - 3 + defined by -x^3*y^6 + 3*x^2*y^7 - 3*x*y^8 + y^9 + x^4*y^3*z^2 + - 4*x^3*y^4*z^2 + 10*x^2*y^5*z^2 - 9*x*y^6*z^2 + + 2*y^7*z^2 - 4*x^3*y^2*z^4 + 9*x^2*y^3*z^4 + - 11*x*y^4*z^4 + 3*y^5*z^4 + 5*x^2*y*z^6 + - 7*x*y^2*z^6 + 4*y^3*z^6 - 2*x*z^8 + 2*y*z^8 + To: Projective Plane Curve over Number Field in b + with defining polynomial a^2 - 3 + defined by 900*x^9 - 7410*x^8*y + 29282*x^7*y^2 - 69710*x^6*y^3 + + 110818*x^5*y^4 - 123178*x^4*y^5 + 96550*x^3*y^6 + - 52570*x^2*y^7 + 18194*x*y^8 - 3388*y^9 - 1550*x^8*z + + 9892*x^7*y*z - 30756*x^6*y^2*z + 58692*x^5*y^3*z + - 75600*x^4*y^4*z + 67916*x^3*y^5*z - 42364*x^2*y^6*z + + 16844*x*y^7*z - 3586*y^8*z + 786*x^7*z^2 + - 3958*x^6*y*z^2 + 9746*x^5*y^2*z^2 - 14694*x^4*y^3*z^2 + + 15174*x^3*y^4*z^2 - 10802*x^2*y^5*z^2 + + 5014*x*y^6*z^2 - 1266*y^7*z^2 - 144*x^6*z^3 + + 512*x^5*y*z^3 - 912*x^4*y^2*z^3 + 1024*x^3*y^3*z^3 + - 816*x^2*y^4*z^3 + 512*x*y^5*z^3 - 176*y^6*z^3 + + 8*x^5*z^4 - 8*x^4*y*z^4 - 16*x^3*y^2*z^4 + + 16*x^2*y^3*z^4 + 8*x*y^4*z^4 - 8*y^5*z^4 Defn: Defined on coordinates by sending (x : y : z) to (1/4*y + 1/2*z : -1/4*y + 1/2*z : x + 1/4*y - 1/2*z) :: sage: set_verbose(-1) - sage: a = QQbar(sqrt(2)) - sage: P. = ProjectiveSpace(QQbar, 2) - sage: C = Curve([(-1/4*a)*x^3 + (-3/4*a)*x^2*y + (-3/4*a)*x*y^2 + (-1/4*a)*y^3 - 2*x*y*z], P) - sage: Q = P([0,0,1]) - sage: C.excellent_position(Q) + sage: a = QQbar(sqrt(2)) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(QQbar, 2) # optional - sage.rings.number_field + sage: C = Curve([(-1/4*a)*x^3 + (-3/4*a)*x^2*y # optional - sage.rings.number_field + ....: + (-3/4*a)*x*y^2 + (-1/4*a)*y^3 - 2*x*y*z], P) + sage: Q = P([0,0,1]) # optional - sage.rings.number_field + sage: C.excellent_position(Q) # optional - sage.rings.number_field Scheme morphism: - From: Projective Plane Curve over Algebraic Field defined by - (-0.3535533905932738?)*x^3 + (-1.060660171779822?)*x^2*y + - (-1.060660171779822?)*x*y^2 + (-0.3535533905932738?)*y^3 + (-2)*x*y*z - To: Projective Plane Curve over Algebraic Field defined by - (-2.828427124746190?)*x^3 + (-2)*x^2*y + 2*y^3 + (-2)*x^2*z + 2*y^2*z + From: Projective Plane Curve over Algebraic Field defined + by (-0.3535533905932738?)*x^3 + (-1.060660171779822?)*x^2*y + + (-1.060660171779822?)*x*y^2 + (-0.3535533905932738?)*y^3 + + (-2)*x*y*z + To: Projective Plane Curve over Algebraic Field defined + by (-2.828427124746190?)*x^3 + (-2)*x^2*y + 2*y^3 + + (-2)*x^2*z + 2*y^2*z Defn: Defined on coordinates by sending (x : y : z) to (1/2*x + 1/2*y : (-1/2)*x + 1/2*y : 1/2*x + (-1/2)*y + z) """ @@ -1311,39 +1332,52 @@ def ordinary_model(self): EXAMPLES:: sage: set_verbose(-1) - sage: K = QuadraticField(3) - sage: P. = ProjectiveSpace(K, 2) - sage: C = Curve([x^5 - K.0*y*z^4], P) - sage: C.ordinary_model() + sage: K = QuadraticField(3) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field + sage: C = Curve([x^5 - K.0*y*z^4], P) # optional - sage.rings.number_field + sage: C.ordinary_model() # optional - sage.rings.number_field Scheme morphism: - From: Projective Plane Curve over Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? defined by x^5 + (-a)*y*z^4 - To: Projective Plane Curve over Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? defined by (-a)*x^5*y + (-4*a)*x^4*y^2 + (-6*a)*x^3*y^3 + (-4*a)*x^2*y^4 + (-a)*x*y^5 + (-a - 1)*x^5*z + (-4*a + 5)*x^4*y*z + (-6*a - 10)*x^3*y^2*z + (-4*a + 10)*x^2*y^3*z + (-a - 5)*x*y^4*z + y^5*z + From: Projective Plane Curve over Number Field in a + with defining polynomial x^2 - 3 with a = 1.732050807568878? + defined by x^5 + (-a)*y*z^4 + To: Projective Plane Curve over Number Field in a + with defining polynomial x^2 - 3 with a = 1.732050807568878? + defined by (-a)*x^5*y + (-4*a)*x^4*y^2 + (-6*a)*x^3*y^3 + + (-4*a)*x^2*y^4 + (-a)*x*y^5 + (-a - 1)*x^5*z + + (-4*a + 5)*x^4*y*z + (-6*a - 10)*x^3*y^2*z + + (-4*a + 10)*x^2*y^3*z + (-a - 5)*x*y^4*z + y^5*z Defn: Defined on coordinates by sending (x : y : z) to - (-1/4*x^2 - 1/2*x*y + 1/2*x*z + 1/2*y*z - 1/4*z^2 : 1/4*x^2 + 1/2*x*y + 1/2*y*z - 1/4*z^2 : -1/4*x^2 + 1/4*z^2) + (-1/4*x^2 - 1/2*x*y + 1/2*x*z + 1/2*y*z - 1/4*z^2 : + 1/4*x^2 + 1/2*x*y + 1/2*y*z - 1/4*z^2 : + -1/4*x^2 + 1/4*z^2) :: sage: set_verbose(-1) sage: P. = ProjectiveSpace(QQ, 2) sage: C = Curve([y^2*z^2 - x^4 - x^3*z], P) - sage: D = C.ordinary_model(); D # long time (2 seconds) + sage: D = C.ordinary_model(); D # long time (2 seconds) Scheme morphism: - From: Projective Plane Curve over Rational Field defined by -x^4 - - x^3*z + y^2*z^2 - To: Projective Plane Curve over Rational Field defined by 4*x^6*y^3 - - 24*x^5*y^4 + 36*x^4*y^5 + 8*x^6*y^2*z - 40*x^5*y^3*z + 24*x^4*y^4*z + - 72*x^3*y^5*z - 4*x^6*y*z^2 + 8*x^5*y^2*z^2 - 56*x^4*y^3*z^2 + - 104*x^3*y^4*z^2 + 44*x^2*y^5*z^2 + 8*x^6*z^3 - 16*x^5*y*z^3 - - 24*x^4*y^2*z^3 + 40*x^3*y^3*z^3 + 48*x^2*y^4*z^3 + 8*x*y^5*z^3 - - 8*x^5*z^4 + 36*x^4*y*z^4 - 56*x^3*y^2*z^4 + 20*x^2*y^3*z^4 + - 40*x*y^4*z^4 - 16*y^5*z^4 + From: Projective Plane Curve over Rational Field defined + by -x^4 - x^3*z + y^2*z^2 + To: Projective Plane Curve over Rational Field defined + by 4*x^6*y^3 - 24*x^5*y^4 + 36*x^4*y^5 + 8*x^6*y^2*z + - 40*x^5*y^3*z + 24*x^4*y^4*z + 72*x^3*y^5*z - 4*x^6*y*z^2 + + 8*x^5*y^2*z^2 - 56*x^4*y^3*z^2 + 104*x^3*y^4*z^2 + + 44*x^2*y^5*z^2 + 8*x^6*z^3 - 16*x^5*y*z^3 + - 24*x^4*y^2*z^3 + 40*x^3*y^3*z^3 + 48*x^2*y^4*z^3 + + 8*x*y^5*z^3 - 8*x^5*z^4 + 36*x^4*y*z^4 - 56*x^3*y^2*z^4 + + 20*x^2*y^3*z^4 + 40*x*y^4*z^4 - 16*y^5*z^4 Defn: Defined on coordinates by sending (x : y : z) to - (-3/64*x^4 + 9/64*x^2*y^2 - 3/32*x*y^3 - 1/16*x^3*z - - 1/8*x^2*y*z + 1/4*x*y^2*z - 1/16*y^3*z - 1/8*x*y*z^2 + 1/16*y^2*z^2 : - -1/64*x^4 + 3/64*x^2*y^2 - 1/32*x*y^3 + 1/16*x*y^2*z - 1/16*y^3*z + - 1/16*y^2*z^2 : 3/64*x^4 - 3/32*x^3*y + 3/64*x^2*y^2 + 1/16*x^3*z - - 3/16*x^2*y*z + 1/8*x*y^2*z - 1/8*x*y*z^2 + 1/16*y^2*z^2) - sage: all(D.codomain().is_ordinary_singularity(Q) for Q in D.codomain().singular_points()) # long time + (-3/64*x^4 + 9/64*x^2*y^2 - 3/32*x*y^3 - 1/16*x^3*z + - 1/8*x^2*y*z + 1/4*x*y^2*z - 1/16*y^3*z - 1/8*x*y*z^2 + + 1/16*y^2*z^2 : + -1/64*x^4 + 3/64*x^2*y^2 - 1/32*x*y^3 + 1/16*x*y^2*z + - 1/16*y^3*z + 1/16*y^2*z^2 : + 3/64*x^4 - 3/32*x^3*y + 3/64*x^2*y^2 + 1/16*x^3*z + - 3/16*x^2*y*z + 1/8*x*y^2*z - 1/8*x*y*z^2 + 1/16*y^2*z^2) + sage: all(D.codomain().is_ordinary_singularity(Q) # long time + ....: for Q in D.codomain().singular_points()) True :: @@ -1353,44 +1387,53 @@ def ordinary_model(self): sage: C = Curve([(x^2 + y^2 - y*z - 2*z^2)*(y*z - x^2 + 2*z^2)*z + y^5], P) sage: C.ordinary_model() # long time (5 seconds) Scheme morphism: - From: Projective Plane Curve over Number Field in a with defining - polynomial y^2 - 2 defined by y^5 - x^4*z - x^2*y^2*z + 2*x^2*y*z^2 + - y^3*z^2 + 4*x^2*z^3 + y^2*z^3 - 4*y*z^4 - 4*z^5 - To: Projective Plane Curve over Number Field in a with defining - polynomial y^2 - 2 defined by (-29*a + 1)*x^8*y^6 + (10*a + 158)*x^7*y^7 - + (-109*a - 31)*x^6*y^8 + (-80*a - 198)*x^8*y^5*z + (531*a + - 272)*x^7*y^6*z + (170*a - 718)*x^6*y^7*z + (19*a - 636)*x^5*y^8*z + - (-200*a - 628)*x^8*y^4*z^2 + (1557*a - 114)*x^7*y^5*z^2 + (2197*a - - 2449)*x^6*y^6*z^2 + (1223*a - 3800)*x^5*y^7*z^2 + (343*a - - 1329)*x^4*y^8*z^2 + (-323*a - 809)*x^8*y^3*z^3 + (1630*a - - 631)*x^7*y^4*z^3 + (4190*a - 3126)*x^6*y^5*z^3 + (3904*a - - 7110)*x^5*y^6*z^3 + (1789*a - 5161)*x^4*y^7*z^3 + (330*a - - 1083)*x^3*y^8*z^3 + (-259*a - 524)*x^8*y^2*z^4 + (720*a - - 605)*x^7*y^3*z^4 + (3082*a - 2011)*x^6*y^4*z^4 + (4548*a - - 5462)*x^5*y^5*z^4 + (2958*a - 6611)*x^4*y^6*z^4 + (994*a - - 2931)*x^3*y^7*z^4 + (117*a - 416)*x^2*y^8*z^4 + (-108*a - 184)*x^8*y*z^5 - + (169*a - 168)*x^7*y^2*z^5 + (831*a - 835)*x^6*y^3*z^5 + (2225*a - - 1725)*x^5*y^4*z^5 + (1970*a - 3316)*x^4*y^5*z^5 + (952*a - - 2442)*x^3*y^6*z^5 + (217*a - 725)*x^2*y^7*z^5 + (16*a - 77)*x*y^8*z^5 + - (-23*a - 35)*x^8*z^6 + (43*a + 24)*x^7*y*z^6 + (21*a - 198)*x^6*y^2*z^6 - + (377*a - 179)*x^5*y^3*z^6 + (458*a - 537)*x^4*y^4*z^6 + (288*a - - 624)*x^3*y^5*z^6 + (100*a - 299)*x^2*y^6*z^6 + (16*a - 67)*x*y^7*z^6 - - 5*y^8*z^6 + From: Projective Plane Curve over Number Field in a + with defining polynomial y^2 - 2 defined + by y^5 - x^4*z - x^2*y^2*z + 2*x^2*y*z^2 + y^3*z^2 + + 4*x^2*z^3 + y^2*z^3 - 4*y*z^4 - 4*z^5 + To: Projective Plane Curve over Number Field in a + with defining polynomial y^2 - 2 defined + by (-29*a + 1)*x^8*y^6 + (10*a + 158)*x^7*y^7 + + (-109*a - 31)*x^6*y^8 + (-80*a - 198)*x^8*y^5*z + + (531*a + 272)*x^7*y^6*z + (170*a - 718)*x^6*y^7*z + + (19*a - 636)*x^5*y^8*z + (-200*a - 628)*x^8*y^4*z^2 + + (1557*a - 114)*x^7*y^5*z^2 + (2197*a - 2449)*x^6*y^6*z^2 + + (1223*a - 3800)*x^5*y^7*z^2 + (343*a - 1329)*x^4*y^8*z^2 + + (-323*a - 809)*x^8*y^3*z^3 + (1630*a - 631)*x^7*y^4*z^3 + + (4190*a - 3126)*x^6*y^5*z^3 + (3904*a - 7110)*x^5*y^6*z^3 + + (1789*a - 5161)*x^4*y^7*z^3 + (330*a - 1083)*x^3*y^8*z^3 + + (-259*a - 524)*x^8*y^2*z^4 + (720*a - 605)*x^7*y^3*z^4 + + (3082*a - 2011)*x^6*y^4*z^4 + (4548*a - 5462)*x^5*y^5*z^4 + + (2958*a - 6611)*x^4*y^6*z^4 + (994*a - 2931)*x^3*y^7*z^4 + + (117*a - 416)*x^2*y^8*z^4 + (-108*a - 184)*x^8*y*z^5 + + (169*a - 168)*x^7*y^2*z^5 + (831*a - 835)*x^6*y^3*z^5 + + (2225*a - 1725)*x^5*y^4*z^5 + (1970*a - 3316)*x^4*y^5*z^5 + + (952*a - 2442)*x^3*y^6*z^5 + (217*a - 725)*x^2*y^7*z^5 + + (16*a - 77)*x*y^8*z^5 + (-23*a - 35)*x^8*z^6 + + (43*a + 24)*x^7*y*z^6 + (21*a - 198)*x^6*y^2*z^6 + + (377*a - 179)*x^5*y^3*z^6 + (458*a - 537)*x^4*y^4*z^6 + + (288*a - 624)*x^3*y^5*z^6 + (100*a - 299)*x^2*y^6*z^6 + + (16*a - 67)*x*y^7*z^6 - 5*y^8*z^6 Defn: Defined on coordinates by sending (x : y : z) to - ((-5/128*a - 5/128)*x^4 + (-5/32*a + 5/32)*x^3*y + (-1/16*a + - 3/32)*x^2*y^2 + (1/16*a - 1/16)*x*y^3 + (1/32*a - 1/32)*y^4 - 1/32*x^3*z - + (3/16*a - 5/8)*x^2*y*z + (1/8*a - 5/16)*x*y^2*z + (1/8*a + - 5/32)*x^2*z^2 + (-3/16*a + 5/16)*x*y*z^2 + (-3/16*a - 1/16)*y^2*z^2 + - 1/16*x*z^3 + (1/4*a + 1/4)*y*z^3 + (-3/32*a - 5/32)*z^4 : (-5/128*a - - 5/128)*x^4 + (5/32*a)*x^3*y + (3/32*a + 3/32)*x^2*y^2 + (-1/16*a)*x*y^3 - + (-1/32*a - 1/32)*y^4 - 1/32*x^3*z + (-11/32*a)*x^2*y*z + (1/8*a + - 5/16)*x*y^2*z + (3/16*a + 1/4)*y^3*z + (1/8*a + 5/32)*x^2*z^2 + (-1/16*a - - 3/8)*x*y*z^2 + (-3/8*a - 9/16)*y^2*z^2 + 1/16*x*z^3 + (5/16*a + - 1/2)*y*z^3 + (-3/32*a - 5/32)*z^4 : (1/64*a + 3/128)*x^4 + (-1/32*a - - 1/32)*x^3*y + (3/32*a - 9/32)*x^2*y^2 + (1/16*a - 3/16)*x*y^3 - 1/32*y^4 - + (3/32*a + 1/8)*x^2*y*z + (-1/8*a + 1/8)*x*y^2*z + (-1/16*a)*y^3*z + - (-1/16*a - 3/32)*x^2*z^2 + (1/16*a + 1/16)*x*y*z^2 + (3/16*a + - 3/16)*y^2*z^2 + (-3/16*a - 1/4)*y*z^3 + (1/16*a + 3/32)*z^4) + ((-5/128*a - 5/128)*x^4 + (-5/32*a + 5/32)*x^3*y + + (-1/16*a + 3/32)*x^2*y^2 + (1/16*a - 1/16)*x*y^3 + + (1/32*a - 1/32)*y^4 - 1/32*x^3*z + (3/16*a - 5/8)*x^2*y*z + + (1/8*a - 5/16)*x*y^2*z + (1/8*a + 5/32)*x^2*z^2 + + (-3/16*a + 5/16)*x*y*z^2 + (-3/16*a - 1/16)*y^2*z^2 + + 1/16*x*z^3 + (1/4*a + 1/4)*y*z^3 + (-3/32*a - 5/32)*z^4 : + (-5/128*a - 5/128)*x^4 + (5/32*a)*x^3*y + + (3/32*a + 3/32)*x^2*y^2 + (-1/16*a)*x*y^3 + + (-1/32*a - 1/32)*y^4 - 1/32*x^3*z + (-11/32*a)*x^2*y*z + + (1/8*a + 5/16)*x*y^2*z + (3/16*a + 1/4)*y^3*z + + (1/8*a + 5/32)*x^2*z^2 + (-1/16*a - 3/8)*x*y*z^2 + + (-3/8*a - 9/16)*y^2*z^2 + 1/16*x*z^3 + (5/16*a + 1/2)*y*z^3 + + (-3/32*a - 5/32)*z^4 : + (1/64*a + 3/128)*x^4 + (-1/32*a - 1/32)*x^3*y + + (3/32*a - 9/32)*x^2*y^2 + (1/16*a - 3/16)*x*y^3 - 1/32*y^4 + + (3/32*a + 1/8)*x^2*y*z + (-1/8*a + 1/8)*x*y^2*z + + (-1/16*a)*y^3*z + (-1/16*a - 3/32)*x^2*z^2 + + (1/16*a + 1/16)*x*y*z^2 + (3/16*a + 3/16)*y^2*z^2 + + (-3/16*a - 1/4)*y*z^3 + (1/16*a + 3/32)*z^4) """ # helper function for extending the base field def extension(self): @@ -1490,12 +1533,12 @@ def is_transverse(self, C, P): :: - sage: K = QuadraticField(-1) - sage: P. = ProjectiveSpace(K, 2) - sage: C = Curve([y^2*z - K.0*x^3], P) - sage: D = Curve([z*x + y^2], P) - sage: Q = P([0,0,1]) - sage: C.is_transverse(D, Q) + sage: K = QuadraticField(-1) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field + sage: C = Curve([y^2*z - K.0*x^3], P) # optional - sage.rings.number_field + sage: D = Curve([z*x + y^2], P) # optional - sage.rings.number_field + sage: Q = P([0,0,1]) # optional - sage.rings.number_field + sage: C.is_transverse(D, Q) # optional - sage.rings.number_field False :: @@ -1555,9 +1598,9 @@ def arithmetic_genus(self): :: - sage: P. = ProjectiveSpace(GF(7), 4) - sage: C = P.curve([t^3 - x*y*w, x^3 + y^3 + z^3, z - w]) - sage: C.arithmetic_genus() + sage: P. = ProjectiveSpace(GF(7), 4) # optional - sage.rings.finite_rings + sage: C = P.curve([t^3 - x*y*w, x^3 + y^3 + z^3, z - w]) # optional - sage.rings.finite_rings + sage: C.arithmetic_genus() # optional - sage.rings.finite_rings 10 """ if not self.is_irreducible(): @@ -1606,7 +1649,8 @@ def tangent_line(self, p): sage: C = Curve([x*y - z*w, x^2 - y*w, y^2*w - x*z*w], P) sage: p = C(1,1,1,1) sage: C.tangent_line(p) - Projective Curve over Rational Field defined by -2*x + y + w, -3*x + z + 2*w + Projective Curve over Rational Field + defined by -2*x + y + w, -3*x + z + 2*w """ for i in range(len(p)): @@ -1636,12 +1680,13 @@ def arithmetic_genus(self): EXAMPLES:: - sage: x,y,z = PolynomialRing(GF(5), 3, 'xyz').gens() - sage: C = Curve(y^2*z^7 - x^9 - x*z^8); C - Projective Plane Curve over Finite Field of size 5 defined by -x^9 + y^2*z^7 - x*z^8 - sage: C.arithmetic_genus() + sage: x,y,z = PolynomialRing(GF(5), 3, 'xyz').gens() # optional - sage.rings.finite_rings + sage: C = Curve(y^2*z^7 - x^9 - x*z^8); C # optional - sage.rings.finite_rings + Projective Plane Curve over Finite Field of size 5 + defined by -x^9 + y^2*z^7 - x*z^8 + sage: C.arithmetic_genus() # optional - sage.rings.finite_rings 28 - sage: C.genus() + sage: C.genus() # optional - sage.rings.finite_rings 4 :: @@ -1668,23 +1713,23 @@ def fundamental_group(self): EXAMPLES:: - sage: P. = ProjectiveSpace(QQ,2) - sage: C = P.curve(x^2*z-y^3) - sage: C.fundamental_group() # optional - sirocco + sage: P. = ProjectiveSpace(QQ, 2) + sage: C = P.curve(x^2*z - y^3) + sage: C.fundamental_group() # optional - sirocco Finitely presented group < x0 | x0^3 > In the case of number fields, they need to have an embedding into the algebraic field:: - sage: a = QQ[x](x^2+5).roots(QQbar)[0][0] - sage: a + sage: a = QQ[x](x^2 + 5).roots(QQbar)[0][0] # optional - sage.rings.number_field + sage: a # optional - sage.rings.number_field -2.236067977499790?*I - sage: F = NumberField(a.minpoly(), 'a', embedding=a) - sage: P. = ProjectiveSpace(F, 2) - sage: F.inject_variables() + sage: F = NumberField(a.minpoly(), 'a', embedding=a) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(F, 2) # optional - sage.rings.number_field + sage: F.inject_variables() # optional - sage.rings.number_field Defining a - sage: C = P.curve(x^2 + a * y^2) - sage: C.fundamental_group() # optional - sirocco + sage: C = P.curve(x^2 + a * y^2) # optional - sage.rings.number_field + sage: C.fundamental_group() # optional - sirocco # optional - sage.rings.number_field Finitely presented group < x0 | > .. WARNING:: @@ -1693,11 +1738,14 @@ def fundamental_group(self): TESTS:: - sage: P.=ProjectiveSpace(QQ,2) - sage: f=z^2*y^3-z*(33*x*z+2*x^2+8*z^2)*y^2+(21*z^2+21*x*z-x^2)*(z^2+11*x*z-x^2)*y+(x-18*z)*(z^2+11*x*z-x^2)^2 + sage: P. = ProjectiveSpace(QQ, 2) + sage: f = z^2*y^3 - z*(33*x*z+2*x^2+8*z^2)*y^2 + ....: + (21*z^2+21*x*z-x^2)*(z^2+11*x*z-x^2)*y + ....: + (x-18*z)*(z^2+11*x*z-x^2)^2 sage: C = P.curve(f) sage: C.fundamental_group() # optional - sirocco - Finitely presented group < x1, x3 | (x3^-1*x1^-1*x3*x1^-1)^2*x3^-1, x3*(x1^-1*x3^-1)^2*x1^-1*(x3*x1)^2 > + Finitely presented group < x1, x3 | (x3^-1*x1^-1*x3*x1^-1)^2*x3^-1, + x3*(x1^-1*x3^-1)^2*x1^-1*(x3*x1)^2 > """ from sage.schemes.curves.zariski_vankampen import fundamental_group @@ -1734,7 +1782,8 @@ def rational_parameterization(self): sage: C.rational_parameterization() Scheme morphism: From: Projective Space of dimension 1 over Rational Field - To: Projective Plane Curve over Rational Field defined by -x^3 + y^2*z + To: Projective Plane Curve over Rational Field + defined by -x^3 + y^2*z Defn: Defined on coordinates by sending (s : t) to (s^2*t : s^3 : t^3) @@ -1745,7 +1794,8 @@ def rational_parameterization(self): sage: C.rational_parameterization() Scheme morphism: From: Projective Space of dimension 1 over Rational Field - To: Projective Plane Curve over Rational Field defined by x^3 - x*y*z + x*z^2 - 4*y*z^2 + To: Projective Plane Curve over Rational Field + defined by x^3 - x*y*z + x*z^2 - 4*y*z^2 Defn: Defined on coordinates by sending (s : t) to (4*s^2*t + s*t^2 : s^2*t + t^3 : 4*s^3 + s^2*t) @@ -1753,11 +1803,12 @@ def rational_parameterization(self): sage: P. = ProjectiveSpace(QQ, 2) sage: C = Curve([x^2 + y^2 + z^2], P) - sage: C.rational_parameterization() + sage: C.rational_parameterization() # optional - sage.rings.number_field Scheme morphism: - From: Projective Space of dimension 1 over Number Field in a with defining polynomial a^2 + 1 - To: Projective Plane Curve over Number Field in a with defining - polynomial a^2 + 1 defined by x^2 + y^2 + z^2 + From: Projective Space of dimension 1 over Number Field in a + with defining polynomial a^2 + 1 + To: Projective Plane Curve over Number Field in a + with defining polynomial a^2 + 1 defined by x^2 + y^2 + z^2 Defn: Defined on coordinates by sending (s : t) to ((-a)*s^2 + (-a)*t^2 : s^2 - t^2 : 2*s*t) """ @@ -1784,10 +1835,11 @@ def riemann_surface(self,**kwargs): EXAMPLES:: - sage: R.=QQ[] - sage: C=Curve(x^3+3*y^3+5*z^3) + sage: R. = QQ[] + sage: C = Curve(x^3 + 3*y^3 + 5*z^3) sage: C.riemann_surface() - Riemann surface defined by polynomial f = x^3 + 3*y^3 + 5 = 0, with 53 bits of precision + Riemann surface defined by polynomial f = x^3 + 3*y^3 + 5 = 0, + with 53 bits of precision """ return self.affine_patch(2).riemann_surface(**kwargs) @@ -1813,62 +1865,62 @@ def rational_points_iterator(self): EXAMPLES:: - sage: F = GF(37) - sage: P2. = ProjectiveSpace(F,2) - sage: C = Curve(X^7+Y*X*Z^5*55+Y^7*12) - sage: len(list(C.rational_points_iterator())) + sage: F = GF(37) # optional - sage.rings.finite_rings + sage: P2. = ProjectiveSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(X^7 + Y*X*Z^5*55 + Y^7*12) # optional - sage.rings.finite_rings + sage: len(list(C.rational_points_iterator())) # optional - sage.rings.finite_rings 37 :: - sage: F = GF(2) - sage: P2. = ProjectiveSpace(F,2) - sage: C = Curve(X*Y*Z) - sage: a = C.rational_points_iterator() - sage: next(a) + sage: F = GF(2) # optional - sage.rings.finite_rings + sage: P2. = ProjectiveSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(X*Y*Z) # optional - sage.rings.finite_rings + sage: a = C.rational_points_iterator() # optional - sage.rings.finite_rings + sage: next(a) # optional - sage.rings.finite_rings (1 : 0 : 0) - sage: next(a) + sage: next(a) # optional - sage.rings.finite_rings (0 : 1 : 0) - sage: next(a) + sage: next(a) # optional - sage.rings.finite_rings (1 : 1 : 0) - sage: next(a) + sage: next(a) # optional - sage.rings.finite_rings (0 : 0 : 1) - sage: next(a) + sage: next(a) # optional - sage.rings.finite_rings (1 : 0 : 1) - sage: next(a) + sage: next(a) # optional - sage.rings.finite_rings (0 : 1 : 1) - sage: next(a) + sage: next(a) # optional - sage.rings.finite_rings Traceback (most recent call last): ... StopIteration :: - sage: F = GF(3^2,'a') - sage: P2. = ProjectiveSpace(F,2) - sage: C = Curve(X^3+5*Y^2*Z-33*X*Y*X) - sage: b = C.rational_points_iterator() - sage: next(b) + sage: F = GF(3^2,'a') # optional - sage.rings.finite_rings + sage: P2. = ProjectiveSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(X^3 + 5*Y^2*Z - 33*X*Y*X) # optional - sage.rings.finite_rings + sage: b = C.rational_points_iterator() # optional - sage.rings.finite_rings + sage: next(b) # optional - sage.rings.finite_rings (0 : 1 : 0) - sage: next(b) + sage: next(b) # optional - sage.rings.finite_rings (0 : 0 : 1) - sage: next(b) + sage: next(b) # optional - sage.rings.finite_rings (2*a + 2 : a : 1) - sage: next(b) + sage: next(b) # optional - sage.rings.finite_rings (2 : a + 1 : 1) - sage: next(b) + sage: next(b) # optional - sage.rings.finite_rings (a + 1 : 2*a + 1 : 1) - sage: next(b) + sage: next(b) # optional - sage.rings.finite_rings (1 : 2 : 1) - sage: next(b) + sage: next(b) # optional - sage.rings.finite_rings (2*a + 2 : 2*a : 1) - sage: next(b) + sage: next(b) # optional - sage.rings.finite_rings (2 : 2*a + 2 : 1) - sage: next(b) + sage: next(b) # optional - sage.rings.finite_rings (a + 1 : a + 2 : 1) - sage: next(b) + sage: next(b) # optional - sage.rings.finite_rings (1 : 1 : 1) - sage: next(b) + sage: next(b) # optional - sage.rings.finite_rings Traceback (most recent call last): ... StopIteration @@ -1923,15 +1975,15 @@ def _points_via_singular(self, sort=True): EXAMPLES:: - sage: x, y, z = PolynomialRing(GF(5), 3, 'xyz').gens() - sage: f = y^2*z^7 - x^9 - x*z^8 - sage: C = Curve(f); C + sage: x, y, z = PolynomialRing(GF(5), 3, 'xyz').gens() # optional - sage.rings.finite_rings + sage: f = y^2*z^7 - x^9 - x*z^8 # optional - sage.rings.finite_rings + sage: C = Curve(f); C # optional - sage.rings.finite_rings Projective Plane Curve over Finite Field of size 5 defined by -x^9 + y^2*z^7 - x*z^8 - sage: C._points_via_singular() + sage: C._points_via_singular() # optional - sage.rings.finite_rings [(0 : 0 : 1), (0 : 1 : 0), (2 : 2 : 1), (2 : 3 : 1), (3 : 1 : 1), (3 : 4 : 1)] - sage: C._points_via_singular(sort=False) #random + sage: C._points_via_singular(sort=False) # random # optional - sage.rings.finite_rings [(0 : 1 : 0), (3 : 1 : 1), (3 : 4 : 1), (2 : 2 : 1), (0 : 0 : 1), (2 : 3 : 1)] @@ -1993,20 +2045,20 @@ def riemann_roch_basis(self, D): EXAMPLES:: - sage: R. = GF(2)[] - sage: f = x^3*y + y^3*z + x*z^3 - sage: C = Curve(f); pts = C.rational_points() - sage: D = C.divisor([ (4, pts[0]), (4, pts[2]) ]) - sage: C.riemann_roch_basis(D) + sage: R. = GF(2)[] # optional - sage.rings.finite_rings + sage: f = x^3*y + y^3*z + x*z^3 # optional - sage.rings.finite_rings + sage: C = Curve(f); pts = C.rational_points() # optional - sage.rings.finite_rings + sage: D = C.divisor([ (4, pts[0]), (4, pts[2]) ]) # optional - sage.rings.finite_rings + sage: C.riemann_roch_basis(D) # optional - sage.rings.finite_rings [x/y, 1, z/y, z^2/y^2, z/x, z^2/(x*y)] :: - sage: R. = GF(5)[] - sage: f = x^7 + y^7 + z^7 - sage: C = Curve(f); pts = C.rational_points() - sage: D = C.divisor([ (3, pts[0]), (-1,pts[1]), (10, pts[5]) ]) - sage: C.riemann_roch_basis(D) + sage: R. = GF(5)[] # optional - sage.rings.finite_rings + sage: f = x^7 + y^7 + z^7 # optional - sage.rings.finite_rings + sage: C = Curve(f); pts = C.rational_points() # optional - sage.rings.finite_rings + sage: D = C.divisor([ (3, pts[0]), (-1,pts[1]), (10, pts[5]) ]) # optional - sage.rings.finite_rings + sage: C.riemann_roch_basis(D) # optional - sage.rings.finite_rings [(-2*x + y)/(x + y), (-x + z)/(x + y)] .. NOTE:: @@ -2082,55 +2134,55 @@ def rational_points(self, algorithm="enum", sort=True): EXAMPLES:: - sage: x, y, z = PolynomialRing(GF(5), 3, 'xyz').gens() - sage: f = y^2*z^7 - x^9 - x*z^8 - sage: C = Curve(f); C - Projective Plane Curve over Finite Field of size 5 defined by - -x^9 + y^2*z^7 - x*z^8 - sage: C.rational_points() + sage: x, y, z = PolynomialRing(GF(5), 3, 'xyz').gens() # optional - sage.rings.finite_rings + sage: f = y^2*z^7 - x^9 - x*z^8 # optional - sage.rings.finite_rings + sage: C = Curve(f); C # optional - sage.rings.finite_rings + Projective Plane Curve over Finite Field of size 5 + defined by -x^9 + y^2*z^7 - x*z^8 + sage: C.rational_points() # optional - sage.rings.finite_rings [(0 : 0 : 1), (0 : 1 : 0), (2 : 2 : 1), (2 : 3 : 1), (3 : 1 : 1), (3 : 4 : 1)] - sage: C = Curve(x - y + z) - sage: C.rational_points() + sage: C = Curve(x - y + z) # optional - sage.rings.finite_rings + sage: C.rational_points() # optional - sage.rings.finite_rings [(0 : 1 : 1), (1 : 1 : 0), (1 : 2 : 1), (2 : 3 : 1), (3 : 4 : 1), (4 : 0 : 1)] - sage: C = Curve(x*z+z^2) - sage: C.rational_points('all') + sage: C = Curve(x*z + z^2) # optional - sage.rings.finite_rings + sage: C.rational_points('all') # optional - sage.rings.finite_rings [(0 : 1 : 0), (1 : 0 : 0), (1 : 1 : 0), (2 : 1 : 0), (3 : 1 : 0), (4 : 0 : 1), (4 : 1 : 0), (4 : 1 : 1), (4 : 2 : 1), (4 : 3 : 1), (4 : 4 : 1)] :: - sage: F = GF(7) - sage: P2. = ProjectiveSpace(F,2) - sage: C = Curve(X^3+Y^3-Z^3) - sage: C.rational_points() + sage: F = GF(7) # optional - sage.rings.finite_rings + sage: P2. = ProjectiveSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(X^3 + Y^3 - Z^3) # optional - sage.rings.finite_rings + sage: C.rational_points() # optional - sage.rings.finite_rings [(0 : 1 : 1), (0 : 2 : 1), (0 : 4 : 1), (1 : 0 : 1), (2 : 0 : 1), (3 : 1 : 0), (4 : 0 : 1), (5 : 1 : 0), (6 : 1 : 0)] :: - sage: F = GF(1237) - sage: P2. = ProjectiveSpace(F,2) - sage: C = Curve(X^7+7*Y^6*Z+Z^4*X^2*Y*89) - sage: len(C.rational_points()) + sage: F = GF(1237) # optional - sage.rings.finite_rings + sage: P2. = ProjectiveSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(X^7 + 7*Y^6*Z + Z^4*X^2*Y*89) # optional - sage.rings.finite_rings + sage: len(C.rational_points()) # optional - sage.rings.finite_rings 1237 :: - sage: F = GF(2^6,'a') - sage: P2. = ProjectiveSpace(F,2) - sage: C = Curve(X^5+11*X*Y*Z^3 + X^2*Y^3 - 13*Y^2*Z^3) - sage: len(C.rational_points()) + sage: F = GF(2^6,'a') # optional - sage.rings.finite_rings + sage: P2. = ProjectiveSpace(F, 2) # optional - sage.rings.finite_rings + sage: C = Curve(X^5 + 11*X*Y*Z^3 + X^2*Y^3 - 13*Y^2*Z^3) # optional - sage.rings.finite_rings + sage: len(C.rational_points()) # optional - sage.rings.finite_rings 104 :: - sage: R. = GF(2)[] - sage: f = x^3*y + y^3*z + x*z^3 - sage: C = Curve(f); pts = C.rational_points() - sage: pts + sage: R. = GF(2)[] # optional - sage.rings.finite_rings + sage: f = x^3*y + y^3*z + x*z^3 # optional - sage.rings.finite_rings + sage: C = Curve(f); pts = C.rational_points() # optional - sage.rings.finite_rings + sage: pts # optional - sage.rings.finite_rings [(0 : 0 : 1), (0 : 1 : 0), (1 : 0 : 0)] """ @@ -2171,9 +2223,9 @@ def __init__(self, A, f): TESTS:: - sage: P. = ProjectiveSpace(GF(5), 2) - sage: C = Curve(y^2*z^7 - x^9 - x*z^8) - sage: loads(dumps(C)) == C + sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # optional - sage.rings.finite_rings + sage: loads(dumps(C)) == C # optional - sage.rings.finite_rings True """ super().__init__(A, f) @@ -2201,9 +2253,9 @@ def function_field(self): :: - sage: P. = ProjectiveSpace(GF(4), 2) - sage: C = Curve(x^5 + y^5 + x*y*z^3 + z^5) - sage: C.function_field() + sage: P. = ProjectiveSpace(GF(4), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y*z^3 + z^5) # optional - sage.rings.finite_rings + sage: C.function_field() # optional - sage.rings.finite_rings Function field in z defined by z^5 + y*z^3 + y^5 + 1 """ return self._function_field @@ -2215,9 +2267,9 @@ def _genus(self): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(4), 2) - sage: C = Curve(x^5 + y^5 + x*y*z^3 + z^5) - sage: C.genus() # indirect doctest + sage: P. = ProjectiveSpace(GF(4), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y*z^3 + z^5) # optional - sage.rings.finite_rings + sage: C.genus() # indirect doctest # optional - sage.rings.finite_rings 1 """ return self._open_affine.genus() @@ -2228,13 +2280,13 @@ def __call__(self, *args): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(4), 2) - sage: C = Curve(x^5 + y^5 + x*y*z^3 + z^5) - sage: C(1,1,1) + sage: P. = ProjectiveSpace(GF(4), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y*z^3 + z^5) # optional - sage.rings.finite_rings + sage: C(1,1,1) # optional - sage.rings.finite_rings (1 : 1 : 1) - sage: C(y/z) + sage: C(y/z) # optional - sage.rings.finite_rings (y/(y^5 + 1))*z^4 + (y^2/(y^5 + 1))*z^2 - sage: C(GF(4^2)) + sage: C(GF(4^2)) # optional - sage.rings.finite_rings Set of rational points of Closed subscheme of Projective Space of dimension 2 over Finite Field in z4 of size 2^4 defined by: x^5 + y^5 + x*y*z^3 + z^5 @@ -2253,11 +2305,11 @@ def function(self, f): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(4), 2) - sage: C = Curve(x^5 + y^5 + x*y*z^3 + z^5) - sage: f = C.function(x/y); f + sage: P. = ProjectiveSpace(GF(4), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y*z^3 + z^5) # optional - sage.rings.finite_rings + sage: f = C.function(x/y); f # optional - sage.rings.finite_rings 1/y - sage: f.divisor() + sage: f.divisor() # optional - sage.rings.finite_rings Place (1/y, 1/y^2*z^2 + z2/y*z + 1) + Place (1/y, 1/y^2*z^2 + ((z2 + 1)/y)*z + 1) + Place (1/y, 1/y*z + 1) @@ -2282,11 +2334,11 @@ def coordinate_functions(self, i=None): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(4), 2) - sage: C = Curve(x^5 + y^5 + x*y*z^3 + z^5) - sage: C.coordinate_functions(0) + sage: P. = ProjectiveSpace(GF(4), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^5 + y^5 + x*y*z^3 + z^5) # optional - sage.rings.finite_rings + sage: C.coordinate_functions(0) # optional - sage.rings.finite_rings (y, z) - sage: C.coordinate_functions(1) + sage: C.coordinate_functions(1) # optional - sage.rings.finite_rings (1/y, 1/y*z) """ coords = self._coordinate_functions @@ -2302,9 +2354,9 @@ def _function_field(self): TESTS:: - sage: P. = ProjectiveSpace(GF(5), 2) - sage: C = Curve(y^2*z^7 - x^9 - x*z^8) - sage: C._function_field + sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # optional - sage.rings.finite_rings + sage: C._function_field # optional - sage.rings.finite_rings Function field in z defined by z^8 + 4*y^2*z^7 + 1 """ return self._open_affine._function_field @@ -2316,9 +2368,9 @@ def _lift_to_function_field(self): TESTS:: - sage: P. = ProjectiveSpace(GF(5), 2) - sage: C = Curve(y^2*z^7 - x^9 - x*z^8) - sage: C._lift_to_function_field + sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # optional - sage.rings.finite_rings + sage: C._lift_to_function_field # optional - sage.rings.finite_rings Ring morphism: From: Multivariate Polynomial Ring in x, y, z over Finite Field of size 5 To: Function field in z defined by z^8 + 4*y^2*z^7 + 1 @@ -2337,9 +2389,9 @@ def _coordinate_functions(self): TESTS:: - sage: P. = ProjectiveSpace(GF(5), 2) - sage: C = Curve(y^2*z^7 - x^9 - x*z^8) - sage: C._coordinate_functions + sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # optional - sage.rings.finite_rings + sage: C._coordinate_functions # optional - sage.rings.finite_rings (1, y, z) """ # homogeneous coordinate functions @@ -2354,12 +2406,12 @@ def _singularities(self): TESTS:: - sage: P. = ProjectiveSpace(GF(5), 2) - sage: C = Curve(y^2*z^7 - x^9 - x*z^8) - sage: C._singularities + sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # optional - sage.rings.finite_rings + sage: C._singularities # optional - sage.rings.finite_rings [(Point (x, z), [Place (1/y, 1/y*z^5 + 4*y*z^4 + 1/y^2*z)])] - sage: D = Curve(x) - sage: D._singularities + sage: D = Curve(x) # optional - sage.rings.finite_rings + sage: D._singularities # optional - sage.rings.finite_rings [] """ @@ -2414,9 +2466,9 @@ def singular_closed_points(self): :: - sage: P. = ProjectiveSpace(GF(5), 2) - sage: C = Curve(y^2*z^7 - x^9 - x*z^8) - sage: C.singular_closed_points() + sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # optional - sage.rings.finite_rings + sage: C.singular_closed_points() # optional - sage.rings.finite_rings [Point (x, z)] """ return [p[0] for p in self._singularities] @@ -2432,13 +2484,13 @@ def place_to_closed_point(self, place): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(5), 2) - sage: C = Curve(y^2*z^7 - x^9 - x*z^8) - sage: pls = C.places() - sage: C.place_to_closed_point(pls[-1]) + sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # optional - sage.rings.finite_rings + sage: pls = C.places() # optional - sage.rings.finite_rings + sage: C.place_to_closed_point(pls[-1]) # optional - sage.rings.finite_rings Point (x - 2*z, y - 2*z) - sage: pls2 = C.places(2) - sage: C.place_to_closed_point(pls2[0]) + sage: pls2 = C.places(2) # optional - sage.rings.finite_rings + sage: C.place_to_closed_point(pls2[0]) # optional - sage.rings.finite_rings Point (y^2 + y*z + z^2, x + y) """ F = self.function_field() @@ -2522,7 +2574,8 @@ def places_on(self, point): [Point (x, y)] sage: p, = _ sage: C.places_on(p) - [Place (1/y, 1/y^2*z, 1/y^3*z^2, 1/y^4*z^3), Place (y, y*z, y*z^2, y*z^3)] + [Place (1/y, 1/y^2*z, 1/y^3*z^2, 1/y^4*z^3), + Place (y, y*z, y*z^2, y*z^3)] sage: pl1, pl2 =_ sage: C.place_to_closed_point(pl1) Point (x, y) @@ -2531,9 +2584,9 @@ def places_on(self, point): :: - sage: P. = ProjectiveSpace(GF(5), 2) - sage: C = Curve(x^2*z - y^3) - sage: [C.places_on(p) for p in C.closed_points()] + sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^2*z - y^3) # optional - sage.rings.finite_rings + sage: [C.places_on(p) for p in C.closed_points()] # optional - sage.rings.finite_rings [[Place (1/y)], [Place (y)], [Place (y + 1)], @@ -2573,11 +2626,11 @@ class IntegralProjectiveCurve_finite_field(IntegralProjectiveCurve): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(5), 2) - sage: C = Curve(y^2*z^7 - x^9 - x*z^8) - sage: C.function_field() + sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2*z^7 - x^9 - x*z^8) # optional - sage.rings.finite_rings + sage: C.function_field() # optional - sage.rings.finite_rings Function field in z defined by z^8 + 4*y^2*z^7 + 1 - sage: C.closed_points() + sage: C.closed_points() # optional - sage.rings.finite_rings [Point (x, z), Point (x, y), Point (x - 2*z, y + 2*z), @@ -2597,16 +2650,16 @@ def places(self, degree=1): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(5), 2) - sage: C = Curve(x^2*z - y^3) - sage: C.places() + sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings + sage: C = Curve(x^2*z - y^3) # optional - sage.rings.finite_rings + sage: C.places() # optional - sage.rings.finite_rings [Place (1/y), Place (y), Place (y + 1), Place (y + 2), Place (y + 3), Place (y + 4)] - sage: C.places(2) + sage: C.places(2) # optional - sage.rings.finite_rings [Place (y^2 + 2), Place (y^2 + 3), Place (y^2 + y + 1), @@ -2631,10 +2684,10 @@ def closed_points(self, degree=1): EXAMPLES:: - sage: A. = AffineSpace(GF(9),2) - sage: C = Curve(y^2 - x^5 - x^4 - 2*x^3 - 2*x-2) - sage: Cp = C.projective_closure() - sage: Cp.closed_points() + sage: A. = AffineSpace(GF(9),2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2 - x^5 - x^4 - 2*x^3 - 2*x-2) # optional - sage.rings.finite_rings + sage: Cp = C.projective_closure() # optional - sage.rings.finite_rings + sage: Cp.closed_points() # optional - sage.rings.finite_rings [Point (x0, x1), Point (x0 + (-z2 - 1)*x2, x1), Point (x0 + (z2 + 1)*x2, x1), @@ -2678,10 +2731,10 @@ def L_polynomial(self, name='t'): EXAMPLES:: - sage: A. = AffineSpace(GF(3), 2) - sage: C = Curve(y^2 - x^5 - x^4 - 2*x^3 - 2*x - 2) - sage: Cbar = C.projective_closure() - sage: Cbar.L_polynomial() + sage: A. = AffineSpace(GF(3), 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2 - x^5 - x^4 - 2*x^3 - 2*x - 2) # optional - sage.rings.finite_rings + sage: Cbar = C.projective_closure() # optional - sage.rings.finite_rings + sage: Cbar.L_polynomial() # optional - sage.rings.finite_rings 9*t^4 - 3*t^3 + t^2 - t + 1 """ @@ -2710,15 +2763,15 @@ def number_of_rational_points(self, r=1): EXAMPLES:: - sage: A. = AffineSpace(GF(3), 2) - sage: C = Curve(y^2 - x^5 - x^4 - 2*x^3 - 2*x - 2) - sage: Cbar = C.projective_closure() - sage: Cbar.number_of_rational_points(3) + sage: A. = AffineSpace(GF(3), 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2 - x^5 - x^4 - 2*x^3 - 2*x - 2) # optional - sage.rings.finite_rings + sage: Cbar = C.projective_closure() # optional - sage.rings.finite_rings + sage: Cbar.number_of_rational_points(3) # optional - sage.rings.finite_rings 21 - sage: D = Cbar.change_ring(Cbar.base_ring().extension(3)) - sage: D.base_ring() + sage: D = Cbar.change_ring(Cbar.base_ring().extension(3)) # optional - sage.rings.finite_rings + sage: D.base_ring() # optional - sage.rings.finite_rings Finite Field in z3 of size 3^3 - sage: len(D.closed_points()) + sage: len(D.closed_points()) # optional - sage.rings.finite_rings 21 """ @@ -2753,12 +2806,12 @@ class IntegralProjectivePlaneCurve_finite_field(IntegralProjectiveCurve_finite_f EXAMPLES:: - sage: A. = AffineSpace(GF(9),2) - sage: C = Curve(y^2-x^5-x^4-2*x^3-2*x-2) - sage: Cb = C.projective_closure() - sage: Cb.singular_closed_points() + sage: A. = AffineSpace(GF(9), 2) # optional - sage.rings.finite_rings + sage: C = Curve(y^2 - x^5 - x^4 - 2*x^3 - 2*x - 2) # optional - sage.rings.finite_rings + sage: Cb = C.projective_closure() # optional - sage.rings.finite_rings + sage: Cb.singular_closed_points() # optional - sage.rings.finite_rings [Point (x0, x1)] - sage: Cb.function_field() + sage: Cb.function_field() # optional - sage.rings.finite_rings Function field in y defined by y^2 + 2*x^5 + 2*x^4 + x^3 + x + 1 """ _point = IntegralProjectivePlaneCurvePoint_finite_field diff --git a/src/sage/schemes/curves/zariski_vankampen.py b/src/sage/schemes/curves/zariski_vankampen.py index 01e50f43ea0..751ed6502e0 100644 --- a/src/sage/schemes/curves/zariski_vankampen.py +++ b/src/sage/schemes/curves/zariski_vankampen.py @@ -24,7 +24,7 @@ sage: from sage.schemes.curves.zariski_vankampen import fundamental_group # optional - sirocco sage: R. = QQ[] - sage: f = y^3 + x^3 -1 + sage: f = y^3 + x^3 - 1 sage: fundamental_group(f) # optional - sirocco Finitely presented group < x0 | > """ From 7f6ea46c3653bf87c090497176e6ff7d903de1c6 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 22 Mar 2023 00:42:40 -0700 Subject: [PATCH 081/135] sage.schemes: Fix up # optional --- src/sage/schemes/curves/constructor.py | 2 +- src/sage/schemes/curves/projective_curve.py | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/sage/schemes/curves/constructor.py b/src/sage/schemes/curves/constructor.py index 08f6dfe4ecf..34bea0c9cd7 100644 --- a/src/sage/schemes/curves/constructor.py +++ b/src/sage/schemes/curves/constructor.py @@ -13,7 +13,7 @@ :: sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings - sage: Curve(y^2*z^7 - x^9 - x*z^8) + sage: Curve(y^2*z^7 - x^9 - x*z^8) # optional - sage.rings.finite_rings Projective Plane Curve over Finite Field of size 5 defined by -x^9 + y^2*z^7 - x*z^8 diff --git a/src/sage/schemes/curves/projective_curve.py b/src/sage/schemes/curves/projective_curve.py index 6cac33c1a50..275d7e2498c 100644 --- a/src/sage/schemes/curves/projective_curve.py +++ b/src/sage/schemes/curves/projective_curve.py @@ -1071,8 +1071,8 @@ def quadratic_transform(self): :: sage: P. = ProjectiveSpace(GF(17), 2) # optional - sage.rings.finite_rings - sage: C = P.curve([y^7*z^2 - 16*x^9 + x*y*z^7 + 2*z^9]) - sage: C.quadratic_transform() + sage: C = P.curve([y^7*z^2 - 16*x^9 + x*y*z^7 + 2*z^9]) # optional - sage.rings.finite_rings + sage: C.quadratic_transform() # optional - sage.rings.finite_rings Scheme morphism: From: Projective Plane Curve over Finite Field of size 17 defined by x^9 + y^7*z^2 + x*y*z^7 + 2*z^9 @@ -1715,7 +1715,7 @@ def fundamental_group(self): sage: P. = ProjectiveSpace(QQ, 2) sage: C = P.curve(x^2*z - y^3) - sage: C.fundamental_group() # optional - sirocco + sage: C.fundamental_group() # optional - sirocco Finitely presented group < x0 | x0^3 > In the case of number fields, they need to have an embedding @@ -1729,7 +1729,7 @@ def fundamental_group(self): sage: F.inject_variables() # optional - sage.rings.number_field Defining a sage: C = P.curve(x^2 + a * y^2) # optional - sage.rings.number_field - sage: C.fundamental_group() # optional - sirocco # optional - sage.rings.number_field + sage: C.fundamental_group() # optional - sirocco # optional - sage.rings.number_field Finitely presented group < x0 | > .. WARNING:: @@ -1739,11 +1739,10 @@ def fundamental_group(self): TESTS:: sage: P. = ProjectiveSpace(QQ, 2) - sage: f = z^2*y^3 - z*(33*x*z+2*x^2+8*z^2)*y^2 - ....: + (21*z^2+21*x*z-x^2)*(z^2+11*x*z-x^2)*y - ....: + (x-18*z)*(z^2+11*x*z-x^2)^2 - sage: C = P.curve(f) - sage: C.fundamental_group() # optional - sirocco + sage: C = P.curve(z^2*y^3 - z*(33*x*z+2*x^2+8*z^2)*y^2 + ....: + (21*z^2+21*x*z-x^2)*(z^2+11*x*z-x^2)*y + ....: + (x-18*z)*(z^2+11*x*z-x^2)^2) + sage: C.fundamental_group() # optional - sirocco Finitely presented group < x1, x3 | (x3^-1*x1^-1*x3*x1^-1)^2*x3^-1, x3*(x1^-1*x3^-1)^2*x1^-1*(x3*x1)^2 > From b7786890d585e0122edbab3e09359b9c3190298f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 22 Mar 2023 11:40:49 -0700 Subject: [PATCH 082/135] sage.schemes: More cosmetic changes to doctests --- src/sage/schemes/affine/affine_morphism.py | 138 ++++++++---------- src/sage/schemes/affine/affine_space.py | 17 +-- src/sage/schemes/affine/affine_subscheme.py | 65 ++++----- src/sage/schemes/product_projective/space.py | 105 ++++++------- .../schemes/product_projective/subscheme.py | 91 ++++++------ .../schemes/projective/projective_morphism.py | 132 ++++++++--------- .../schemes/projective/projective_space.py | 42 +++--- .../projective/projective_subscheme.py | 75 ++++------ 8 files changed, 306 insertions(+), 359 deletions(-) diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py index f6cb2606bfa..00ebc5f910e 100644 --- a/src/sage/schemes/affine/affine_morphism.py +++ b/src/sage/schemes/affine/affine_morphism.py @@ -13,14 +13,12 @@ sage: P2. = ProjectiveSpace(QQ, 2) sage: A2.hom([x, x + y], A2) Scheme endomorphism of Affine Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x, y) to - (x, x + y) + Defn: Defined on coordinates by sending (x, y) to (x, x + y) sage: A2.hom([1, x, x + y], P2) Scheme morphism: From: Affine Space of dimension 2 over Rational Field To: Projective Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x, y) to - (1 : x : x + y) + Defn: Defined on coordinates by sending (x, y) to (1 : x : x + y) AUTHORS: @@ -95,8 +93,7 @@ class SchemeMorphism_polynomial_affine_space(SchemeMorphism_polynomial): Scheme morphism: From: Affine Space of dimension 2 over Rational Field To: Projective Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x, y) to - (x : y : 1) + Defn: Defined on coordinates by sending (x, y) to (x : y : 1) """ def __init__(self, parent, polys, check=True): r""" @@ -134,8 +131,7 @@ def __init__(self, parent, polys, check=True): sage: H = Hom(A, A) sage: H([3/2*x^2, y^2]) Scheme endomorphism of Affine Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x, y) to - (3/2*x^2, y^2) + Defn: Defined on coordinates by sending (x, y) to (3/2*x^2, y^2) :: @@ -144,10 +140,8 @@ def __init__(self, parent, polys, check=True): sage: H = Hom(X, X) sage: H([9/4*x^2, 3/2*y]) Scheme endomorphism of Closed subscheme of Affine Space of dimension 2 - over Rational Field defined by: - -y^2 + x - Defn: Defined on coordinates by sending (x, y) to - (9/4*x^2, 3/2*y) + over Rational Field defined by: -y^2 + x + Defn: Defined on coordinates by sending (x, y) to (9/4*x^2, 3/2*y) sage: P. = ProjectiveSpace(ZZ, 2) sage: H = Hom(P, P) @@ -165,10 +159,8 @@ def __init__(self, parent, polys, check=True): sage: u,v,w = X.coordinate_ring().gens() sage: H([u, v, u + v]) Scheme endomorphism of Closed subscheme of Affine Space of dimension 3 - over Rational Field defined by: - x - y - Defn: Defined on coordinates by sending (x, y, z) to - (y, y, 2*y) + over Rational Field defined by: x - y + Defn: Defined on coordinates by sending (x, y, z) to (y, y, 2*y) You must use the ambient space variables to create rational functions:: @@ -468,8 +460,8 @@ def homogenize(self, n): sage: f.homogenize((2, 0)) Scheme endomorphism of Projective Space of dimension 2 over Complex Field with 53 bits of precision - Defn: Defined on coordinates by sending (x0 : x1 : x2) to - (x0*x1*x2^2 : x0^2*x2^2 + (-2.00000000000000)*x2^4 : x0*x1^3 - x0^2*x1*x2) + Defn: Defined on coordinates by sending (x0 : x1 : x2) to + (x0*x1*x2^2 : x0^2*x2^2 + (-2.00000000000000)*x2^4 : x0*x1^3 - x0^2*x1*x2) :: @@ -479,10 +471,9 @@ def homogenize(self, n): sage: f = H([9*y^2, 3*y]) sage: f.homogenize(2) Scheme endomorphism of Closed subscheme of Projective Space - of dimension 2 over Integer Ring defined by: - x1^2 - x0*x2 - Defn: Defined on coordinates by sending (x0 : x1 : x2) to - (9*x1^2 : 3*x1*x2 : x2^2) + of dimension 2 over Integer Ring defined by: x1^2 - x0*x2 + Defn: Defined on coordinates by sending (x0 : x1 : x2) to + (9*x1^2 : 3*x1*x2 : x2^2) :: @@ -493,8 +484,8 @@ def homogenize(self, n): sage: f.homogenize((2, 0)) Scheme endomorphism of Projective Space of dimension 2 over Univariate Polynomial Ring in t over Integer Ring - Defn: Defined on coordinates by sending (x0 : x1 : x2) to - (x1*x2^2 : x0^2*x2 + (-2)*x2^3 : x1^3 - x0*x1*x2) + Defn: Defined on coordinates by sending (x0 : x1 : x2) to + (x1*x2^2 : x0^2*x2 + (-2)*x2^3 : x1^3 - x0*x1*x2) :: @@ -502,10 +493,9 @@ def homogenize(self, n): sage: H = End(A) sage: f = H([x^2 - 1]) sage: f.homogenize((1, 0)) - Scheme endomorphism of Projective Space of dimension 1 - over Rational Field - Defn: Defined on coordinates by sending (x0 : x1) to - (x1^2 : x0^2 - x1^2) + Scheme endomorphism of Projective Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x0 : x1) to + (x1^2 : x0^2 - x1^2) :: @@ -514,8 +504,8 @@ def homogenize(self, n): sage: H = End(A) # optional - sage.rings.number_field sage: f = H([QQbar(sqrt(2))*x*y, a*x^2]) # optional - sage.rings.number_field sage.symbolic sage: f.homogenize(2) # optional - sage.rings.number_field sage.symbolic - Scheme endomorphism of Projective Space of dimension 2 over Univariate - Polynomial Ring in a over Algebraic Field + Scheme endomorphism of Projective Space of dimension 2 + over Univariate Polynomial Ring in a over Algebraic Field Defn: Defined on coordinates by sending (x0 : x1 : x2) to (1.414213562373095?*x0*x1 : a*x0^2 : x2^2) @@ -544,9 +534,9 @@ def homogenize(self, n): sage: H = End(A) # optional - sage.rings.number_field sage: f = H([2*z / (z^2 + 2*z + 3)]) # optional - sage.rings.number_field sage: f.homogenize(1) # optional - sage.rings.number_field - Scheme endomorphism of Projective Space of dimension 1 over Algebraic - Field - Defn: Defined on coordinates by sending (x0 : x1) to + Scheme endomorphism of Projective Space of dimension 1 + over Algebraic Field + Defn: Defined on coordinates by sending (x0 : x1) to (x0*x1 : 1/2*x0^2 + x0*x1 + 3/2*x1^2) :: @@ -556,9 +546,10 @@ def homogenize(self, n): sage: H = Hom(A, A) # optional - sage.rings.number_field sage: F = H([d*x^2 + c]) # optional - sage.rings.number_field sage: F.homogenize(1) # optional - sage.rings.number_field - Scheme endomorphism of Projective Space of dimension 1 over Multivariate Polynomial Ring in c, d over Algebraic Field - Defn: Defined on coordinates by sending (x0 : x1) to - (d*x0^2 + c*x1^2 : x1^2) + Scheme endomorphism of Projective Space of dimension 1 + over Multivariate Polynomial Ring in c, d over Algebraic Field + Defn: Defined on coordinates by sending (x0 : x1) to + (d*x0^2 + c*x1^2 : x1^2) TESTS:: @@ -652,7 +643,7 @@ def as_dynamical_system(self): sage: A. = AffineSpace(ZZ, 2) sage: H = End(A) - sage: f = H([x^2-y^2, y^2]) + sage: f = H([x^2 - y^2, y^2]) sage: type(f.as_dynamical_system()) @@ -1111,23 +1102,21 @@ def reduce_base_field(self): sage: H3 = Hom(A2, A) # optional - sage.rings.finite_rings sage: f = H([x^2 + 2*(t^3 + t^2 + t + 3)]) # optional - sage.rings.finite_rings sage: f.reduce_base_field() # optional - sage.rings.finite_rings - Scheme endomorphism of Affine Space of dimension 1 over Finite Field in t2 of size 5^2 - Defn: Defined on coordinates by sending (x) to - (x^2 + (2*t2)) + Scheme endomorphism of Affine Space of dimension 1 + over Finite Field in t2 of size 5^2 + Defn: Defined on coordinates by sending (x) to (x^2 + (2*t2)) sage: f2 = H2([x^2 + 4, 2*x]) # optional - sage.rings.finite_rings sage: f2.reduce_base_field() # optional - sage.rings.finite_rings Scheme morphism: From: Affine Space of dimension 1 over Finite Field of size 5 To: Affine Space of dimension 2 over Finite Field of size 5 - Defn: Defined on coordinates by sending (x) to - (x^2 - 1, 2*x) + Defn: Defined on coordinates by sending (x) to (x^2 - 1, 2*x) sage: f3 = H3([a^2 + t*b]) # optional - sage.rings.finite_rings sage: f3.reduce_base_field() # optional - sage.rings.finite_rings Scheme morphism: From: Affine Space of dimension 2 over Finite Field in t of size 5^4 To: Affine Space of dimension 1 over Finite Field in t of size 5^4 - Defn: Defined on coordinates by sending (a, b) to - (a^2 + t*b) + Defn: Defined on coordinates by sending (a, b) to (a^2 + t*b) :: @@ -1138,8 +1127,7 @@ def reduce_base_field(self): sage: g = f.reduce_base_field(); g # optional - sage.rings.number_field Scheme endomorphism of Affine Space of dimension 1 over Cyclotomic Field of order 4 and degree 2 - Defn: Defined on coordinates by sending (x) to - (x^2 + v) + Defn: Defined on coordinates by sending (x) to (x^2 + v) sage: g.base_ring() is K # optional - sage.rings.number_field True @@ -1180,12 +1168,11 @@ def reduce_base_field(self): sage: f = H([x^2 + a*x + 3, 5*x]) # optional - sage.rings.number_field sage: f.reduce_base_field() # optional - sage.rings.number_field Scheme morphism: - From: Affine Space of dimension 1 over Number Field in a with - defining polynomial x^3 - x + 1 with a = -1.324717957244746? - To: Affine Space of dimension 2 over Number Field in a with - defining polynomial x^3 - x + 1 with a = -1.324717957244746? - Defn: Defined on coordinates by sending (x) to - (x^2 + a*x + 3, 5*x) + From: Affine Space of dimension 1 over Number Field in a with + defining polynomial x^3 - x + 1 with a = -1.324717957244746? + To: Affine Space of dimension 2 over Number Field in a with + defining polynomial x^3 - x + 1 with a = -1.324717957244746? + Defn: Defined on coordinates by sending (x) to (x^2 + a*x + 3, 5*x) :: @@ -1195,8 +1182,7 @@ def reduce_base_field(self): sage: f = H([3*x^2 + x + 1]) # optional - sage.rings.number_field sage: f.reduce_base_field() # optional - sage.rings.number_field Scheme endomorphism of Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x) to - (3*x^2 + x + 1) + Defn: Defined on coordinates by sending (x) to (3*x^2 + x + 1) :: @@ -1387,8 +1373,8 @@ def representatives(self): sage: f = X.hom([x, x/y], A2) sage: f.representatives() [Scheme morphism: - From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - 0 + From: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: 0 To: Affine Space of dimension 2 over Rational Field Defn: Defined on coordinates by sending (x, y) to (x, x/y)] @@ -1401,29 +1387,27 @@ def representatives(self): sage: f = X.hom([x/y], A1) sage: f.representatives() [Scheme morphism: - From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - x^2 - y^2 - y + From: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: x^2 - y^2 - y To: Affine Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x, y) to (x/y), Scheme morphism: - From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - x^2 - y^2 - y + From: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: x^2 - y^2 - y To: Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x, y) to - ((y + 1)/x)] + Defn: Defined on coordinates by sending (x, y) to ((y + 1)/x)] sage: g = _[1] sage: g.representatives() [Scheme morphism: - From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - x^2 - y^2 - y + From: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: x^2 - y^2 - y To: Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x, y) to - (x/y), Scheme morphism: - From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - x^2 - y^2 - y + Defn: Defined on coordinates by sending (x, y) to (x/y), + Scheme morphism: + From: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: x^2 - y^2 - y To: Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x, y) to - ((y + 1)/x)] + Defn: Defined on coordinates by sending (x, y) to ((y + 1)/x)] :: @@ -1433,16 +1417,16 @@ def representatives(self): sage: f = X.hom([x, y], P1) sage: f.representatives() [Scheme morphism: - From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - x^2 - y^2 - y + From: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: x^2 - y^2 - y To: Projective Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x, y) to - (x : y), Scheme morphism: - From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - x^2 - y^2 - y + (x : y), + Scheme morphism: + From: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: x^2 - y^2 - y To: Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x, y) to - (y + 1 : x)] + Defn: Defined on coordinates by sending (x, y) to (y + 1 : x)] """ X = self.domain() Y = self.codomain() diff --git a/src/sage/schemes/affine/affine_space.py b/src/sage/schemes/affine/affine_space.py index cc09cd7b826..2b348f58554 100644 --- a/src/sage/schemes/affine/affine_space.py +++ b/src/sage/schemes/affine/affine_space.py @@ -825,10 +825,8 @@ def subscheme(self, X, **kwds): Spectrum of Rational Field sage: X.structure_morphism() Scheme morphism: - From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - x, - y^2, - x*y^2 + From: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: x, y^2, x*y^2 To: Spectrum of Rational Field Defn: Structure map sage: X.dimension() @@ -936,7 +934,8 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): sage: F. = FunctionField(QQ) sage: A. = AffineSpace(F,1) sage: A.chebyshev_polynomial(4, monic=True) - Dynamical System of Affine Space of dimension 1 over Rational function field in t over Rational Field + Dynamical System of Affine Space of dimension 1 + over Rational function field in t over Rational Field Defn: Defined on coordinates by sending (x) to (x^4 + (-4)*x^2 + 2) """ @@ -1052,8 +1051,8 @@ def points_of_bounded_height(self, **kwds): (-1, -1), (1/2, -1), (-1/2, -1), (2, -1), (-2, -1), (0, 1/2), (1, 1/2), (-1, 1/2), (1/2, 1/2), (-1/2, 1/2), (2, 1/2), (-2, 1/2), (0, -1/2), (1, -1/2), (-1, -1/2), (1/2, -1/2), (-1/2, -1/2), (2, -1/2), (-2, -1/2), (0, 2), (1, 2), - (-1, 2), (1/2, 2), (-1/2, 2), (2, 2), (-2, 2), (0, -2), (1, -2), (-1, -2), (1/2, -2), - (-1/2, -2), (2, -2), (-2, -2)] + (-1, 2), (1/2, 2), (-1/2, 2), (2, 2), (-2, 2), (0, -2), (1, -2), (-1, -2), + (1/2, -2), (-1/2, -2), (2, -2), (-2, -2)] :: @@ -1121,8 +1120,8 @@ def weil_restriction(self): sage: L. = K.extension(x^2 + 1) # optional - sage.rings.number_field sage: AL. = AffineSpace(L, 2) # optional - sage.rings.number_field sage: AL.weil_restriction() # optional - sage.rings.number_field - Affine Space of dimension 4 over Number Field in w with defining - polynomial x^5 - 2 + Affine Space of dimension 4 over Number Field in w + with defining polynomial x^5 - 2 """ try: X = self.__weil_restriction diff --git a/src/sage/schemes/affine/affine_subscheme.py b/src/sage/schemes/affine/affine_subscheme.py index 9f8880296fc..44962fccc83 100644 --- a/src/sage/schemes/affine/affine_subscheme.py +++ b/src/sage/schemes/affine/affine_subscheme.py @@ -154,12 +154,11 @@ def projective_embedding(self, i=None, PP=None): sage: S = A.subscheme([x*y - z]) sage: S.projective_embedding() Scheme morphism: - From: Closed subscheme of Affine Space of dimension 3 over Integer Ring defined by: - x*y - z - To: Closed subscheme of Projective Space of dimension 3 over Integer Ring defined by: - x0*x1 - x2*x3 - Defn: Defined on coordinates by sending (x, y, z) to - (x : y : z : 1) + From: Closed subscheme of Affine Space of dimension 3 over Integer Ring + defined by: x*y - z + To: Closed subscheme of Projective Space of dimension 3 over Integer Ring + defined by: x0*x1 - x2*x3 + Defn: Defined on coordinates by sending (x, y, z) to (x : y : z : 1) :: @@ -168,14 +167,11 @@ def projective_embedding(self, i=None, PP=None): sage: S = A.subscheme([x^2 - y*z]) sage: S.projective_embedding(1, P) Scheme morphism: - From: Closed subscheme of Affine Space of dimension 3 over Integer - Ring defined by: - x^2 - y*z - To: Closed subscheme of Projective Space of dimension 3 over Integer - Ring defined by: - u0^2 - u2*u3 - Defn: Defined on coordinates by sending (x, y, z) to - (x : 1 : y : z) + From: Closed subscheme of Affine Space of dimension 3 over Integer Ring + defined by: x^2 - y*z + To: Closed subscheme of Projective Space of dimension 3 over Integer Ring + defined by: u0^2 - u2*u3 + Defn: Defined on coordinates by sending (x, y, z) to (x : 1 : y : z) :: @@ -183,17 +179,11 @@ def projective_embedding(self, i=None, PP=None): sage: X = A.subscheme([y - x^2, z - x^3]) sage: X.projective_embedding() Scheme morphism: - From: Closed subscheme of Affine Space of dimension 3 over Rational - Field defined by: - -x^2 + y, - -x^3 + z - To: Closed subscheme of Projective Space of dimension 3 over - Rational Field defined by: - x0^2 - x1*x3, - x0*x1 - x2*x3, - x1^2 - x0*x2 - Defn: Defined on coordinates by sending (x, y, z) to - (x : y : z : 1) + From: Closed subscheme of Affine Space of dimension 3 over Rational Field + defined by: -x^2 + y, -x^3 + z + To: Closed subscheme of Projective Space of dimension 3 over Rational Field + defined by: x0^2 - x1*x3, x0*x1 - x2*x3, x1^2 - x0*x2 + Defn: Defined on coordinates by sending (x, y, z) to (x : y : z : 1) When taking a closed subscheme of an affine space with a projective embedding, the subscheme inherits the embedding:: @@ -202,12 +192,11 @@ def projective_embedding(self, i=None, PP=None): sage: X = A.subscheme(u - v) sage: X.projective_embedding() Scheme morphism: - From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - u - v - To: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - x0 - x2 - Defn: Defined on coordinates by sending (u, v) to - (u : 1 : v) + From: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: u - v + To: Closed subscheme of Projective Space of dimension 2 over Rational Field + defined by: x0 - x2 + Defn: Defined on coordinates by sending (u, v) to (u : 1 : v) sage: phi = X.projective_embedding() sage: psi = A.projective_embedding() sage: phi(X(2, 2)) == psi(A(X(2, 2))) @@ -524,20 +513,18 @@ def _morphism(self, *args, **kwds): sage: H = X.Hom(A2) sage: H([x, x/y]) Scheme morphism: - From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - x - y + From: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: x - y To: Affine Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x, y) to - (x, x/y) + Defn: Defined on coordinates by sending (x, y) to (x, x/y) sage: P2 = ProjectiveSpace(QQ, 2) sage: H = X.Hom(P2) sage: H([x*y, x, y]) Scheme morphism: - From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - x - y + From: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: x - y To: Projective Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x, y) to - (x*y : x : y) + Defn: Defined on coordinates by sending (x, y) to (x*y : x : y) """ return SchemeMorphism_polynomial_affine_subscheme_field(*args, **kwds) diff --git a/src/sage/schemes/product_projective/space.py b/src/sage/schemes/product_projective/space.py index 2e53ada413a..eb335337bb0 100644 --- a/src/sage/schemes/product_projective/space.py +++ b/src/sage/schemes/product_projective/space.py @@ -856,12 +856,10 @@ def subscheme(self, X): Spectrum of Finite Field of size 5 sage: X.structure_morphism() # optional - sage.rings.finite_rings Scheme morphism: - From: Closed subscheme of Product of projective spaces P^1 x P^1 - over Finite Field of size 5 defined by: - x - y, - z - w - To: Spectrum of Finite Field of size 5 - Defn: Structure map + From: Closed subscheme of Product of projective spaces P^1 x P^1 + over Finite Field of size 5 defined by: x - y, z - w + To: Spectrum of Finite Field of size 5 + Defn: Structure map """ return AlgebraicScheme_subscheme_product_projective(self, X) @@ -917,10 +915,10 @@ def affine_patch(self, I, return_embedding=False): Affine Space of dimension 6 over Integer Ring sage: phi Scheme morphism: - From: Affine Space of dimension 6 over Integer Ring - To: Product of projective spaces P^2 x P^2 x P^2 over Integer Ring - Defn: Defined on coordinates by sending (x0, x1, x2, x3, x4, x5) to - (1 : x0 : x1 , x2 : 1 : x3 , x4 : x5 : 1) + From: Affine Space of dimension 6 over Integer Ring + To: Product of projective spaces P^2 x P^2 x P^2 over Integer Ring + Defn: Defined on coordinates by sending (x0, x1, x2, x3, x4, x5) to + (1 : x0 : x1 , x2 : 1 : x3 , x4 : x5 : 1) """ if not isinstance(I, (list, tuple)): raise TypeError('the argument I=%s must be a list or tuple of positive integers'%I) @@ -982,16 +980,17 @@ def segre_embedding(self, PP=None, var='u'): sage: phi = X.segre_embedding(); phi Scheme morphism: From: Product of projective spaces P^2 x P^2 over Integer Ring - To: Closed subscheme of Projective Space of dimension 8 over Integer Ring defined by: - -u5*u7 + u4*u8, - -u5*u6 + u3*u8, - -u4*u6 + u3*u7, - -u2*u7 + u1*u8, - -u2*u4 + u1*u5, - -u2*u6 + u0*u8, - -u1*u6 + u0*u7, - -u2*u3 + u0*u5, - -u1*u3 + u0*u4 + To: Closed subscheme of Projective Space of dimension 8 over Integer Ring + defined by: + -u5*u7 + u4*u8, + -u5*u6 + u3*u8, + -u4*u6 + u3*u7, + -u2*u7 + u1*u8, + -u2*u4 + u1*u5, + -u2*u6 + u0*u8, + -u1*u6 + u0*u7, + -u2*u3 + u0*u5, + -u1*u3 + u0*u4 Defn: Defined by sending (y0 : y1 : y2 , y3 : y4 : y5) to (y0*y3 : y0*y4 : y0*y5 : y1*y3 : y1*y4 : y1*y5 : y2*y3 : y2*y4 : y2*y5). @@ -1000,11 +999,13 @@ def segre_embedding(self, PP=None, var='u'): sage: T = ProductProjectiveSpaces([1, 2], CC, 'z') sage: T.segre_embedding() Scheme morphism: - From: Product of projective spaces P^1 x P^2 over Complex Field with 53 bits of precision - To: Closed subscheme of Projective Space of dimension 5 over Complex Field with 53 bits of precision defined by: - -u2*u4 + u1*u5, - -u2*u3 + u0*u5, - -u1*u3 + u0*u4 + From: Product of projective spaces P^1 x P^2 + over Complex Field with 53 bits of precision + To: Closed subscheme of Projective Space of dimension 5 + over Complex Field with 53 bits of precision defined by: + -u2*u4 + u1*u5, + -u2*u3 + u0*u5, + -u1*u3 + u0*u4 Defn: Defined by sending (z0 : z1 , z2 : z3 : z4) to (z0*z2 : z0*z3 : z0*z4 : z1*z2 : z1*z3 : z1*z4). @@ -1014,35 +1015,35 @@ def segre_embedding(self, PP=None, var='u'): sage: T.segre_embedding() Scheme morphism: From: Product of projective spaces P^1 x P^2 x P^1 over Rational Field - To: Closed subscheme of Projective Space of dimension 11 over - Rational Field defined by: - -u9*u10 + u8*u11, - -u7*u10 + u6*u11, - -u7*u8 + u6*u9, - -u5*u10 + u4*u11, - -u5*u8 + u4*u9, - -u5*u6 + u4*u7, - -u5*u9 + u3*u11, - -u5*u8 + u3*u10, - -u5*u8 + u2*u11, - -u4*u8 + u2*u10, - -u3*u8 + u2*u9, - -u3*u6 + u2*u7, - -u3*u4 + u2*u5, - -u5*u7 + u1*u11, - -u5*u6 + u1*u10, - -u3*u7 + u1*u9, - -u3*u6 + u1*u8, - -u5*u6 + u0*u11, - -u4*u6 + u0*u10, - -u3*u6 + u0*u9, - -u2*u6 + u0*u8, - -u1*u6 + u0*u7, - -u1*u4 + u0*u5, - -u1*u2 + u0*u3 + To: Closed subscheme of Projective Space of dimension 11 + over Rational Field defined by: + -u9*u10 + u8*u11, + -u7*u10 + u6*u11, + -u7*u8 + u6*u9, + -u5*u10 + u4*u11, + -u5*u8 + u4*u9, + -u5*u6 + u4*u7, + -u5*u9 + u3*u11, + -u5*u8 + u3*u10, + -u5*u8 + u2*u11, + -u4*u8 + u2*u10, + -u3*u8 + u2*u9, + -u3*u6 + u2*u7, + -u3*u4 + u2*u5, + -u5*u7 + u1*u11, + -u5*u6 + u1*u10, + -u3*u7 + u1*u9, + -u3*u6 + u1*u8, + -u5*u6 + u0*u11, + -u4*u6 + u0*u10, + -u3*u6 + u0*u9, + -u2*u6 + u0*u8, + -u1*u6 + u0*u7, + -u1*u4 + u0*u5, + -u1*u2 + u0*u3 Defn: Defined by sending (z0 : z1 , z2 : z3 : z4 , z5 : z6) to (z0*z2*z5 : z0*z2*z6 : z0*z3*z5 : z0*z3*z6 : z0*z4*z5 : z0*z4*z6 - : z1*z2*z5 : z1*z2*z6 : z1*z3*z5 : z1*z3*z6 : z1*z4*z5 : z1*z4*z6). + : z1*z2*z5 : z1*z2*z6 : z1*z3*z5 : z1*z3*z6 : z1*z4*z5 : z1*z4*z6). """ N = self._dims M = prod([n+1 for n in N]) - 1 diff --git a/src/sage/schemes/product_projective/subscheme.py b/src/sage/schemes/product_projective/subscheme.py index 5c8dc6efbc6..dee45b41ae3 100644 --- a/src/sage/schemes/product_projective/subscheme.py +++ b/src/sage/schemes/product_projective/subscheme.py @@ -94,19 +94,19 @@ def segre_embedding(self, PP=None): sage: PP.subscheme([]).segre_embedding() Scheme morphism: From: Closed subscheme of Product of projective spaces P^1 x P^1 x P^1 - over Complex Field with 53 bits of precision defined by: - (no polynomials) - To: Closed subscheme of Projective Space of dimension 7 over Complex - Field with 53 bits of precision defined by: - -u5*u6 + u4*u7, - -u3*u6 + u2*u7, - -u3*u4 + u2*u5, - -u3*u5 + u1*u7, - -u3*u4 + u1*u6, - -u3*u4 + u0*u7, - -u2*u4 + u0*u6, - -u1*u4 + u0*u5, - -u1*u2 + u0*u3 + over Complex Field with 53 bits of precision defined by: + (no polynomials) + To: Closed subscheme of Projective Space of dimension 7 + over Complex Field with 53 bits of precision defined by: + -u5*u6 + u4*u7, + -u3*u6 + u2*u7, + -u3*u4 + u2*u5, + -u3*u5 + u1*u7, + -u3*u4 + u1*u6, + -u3*u4 + u0*u7, + -u2*u4 + u0*u6, + -u1*u4 + u0*u5, + -u1*u2 + u0*u3 Defn: Defined by sending (x : y , u : v , s : t) to (x*u*s : x*u*t : x*v*s : x*v*t : y*u*s : y*u*t : y*v*s : y*v*t). @@ -116,32 +116,32 @@ def segre_embedding(self, PP=None): sage: PP.subscheme([x^3, u - v, s^2 - t^2]).segre_embedding() Scheme morphism: From: Closed subscheme of Product of projective spaces P^2 x P^1 x P^1 - over Integer Ring defined by: - x^3, - u - v, - s^2 - t^2 - To: Closed subscheme of Projective Space of dimension 11 over - Integer Ring defined by: - u10^2 - u11^2, - u9 - u11, - u8 - u10, - -u7*u10 + u6*u11, - u6*u10 - u7*u11, - u6^2 - u7^2, - u5 - u7, - u4 - u6, - u3^3, - -u3*u10 + u2*u11, - u2*u10 - u3*u11, - -u3*u6 + u2*u7, - u2*u6 - u3*u7, - u2*u3^2, - u2^2 - u3^2, - u1 - u3, - u0 - u2 + over Integer Ring defined by: + x^3, + u - v, + s^2 - t^2 + To: Closed subscheme of Projective Space of dimension 11 + over Integer Ring defined by: + u10^2 - u11^2, + u9 - u11, + u8 - u10, + -u7*u10 + u6*u11, + u6*u10 - u7*u11, + u6^2 - u7^2, + u5 - u7, + u4 - u6, + u3^3, + -u3*u10 + u2*u11, + u2*u10 - u3*u11, + -u3*u6 + u2*u7, + u2*u6 - u3*u7, + u2*u3^2, + u2^2 - u3^2, + u1 - u3, + u0 - u2 Defn: Defined by sending (x : y : z , u : v , s : t) to - (x*u*s : x*u*t : x*v*s : x*v*t : y*u*s : y*u*t : y*v*s : y*v*t : - z*u*s : z*u*t : z*v*s : z*v*t). + (x*u*s : x*u*t : x*v*s : x*v*t : y*u*s : y*u*t : y*v*s : y*v*t + : z*u*s : z*u*t : z*v*s : z*v*t). """ AS = self.ambient_space() CR = AS.coordinate_ring() @@ -307,15 +307,12 @@ def affine_patch(self, I, return_embedding=False): (Closed subscheme of Affine Space of dimension 4 over Rational Field defined by: x0^2*x1 - 1, x1^2 - x2^2, - x3^3 - 1, Scheme morphism: - From: Closed subscheme of Affine Space of dimension 4 over Rational Field defined by: - x0^2*x1 - 1, - x1^2 - x2^2, - x3^3 - 1 - To: Closed subscheme of Product of projective spaces P^3 x P^1 over Rational Field defined by: - -x^3 + y^2*z, - z^2 - w^2, - u^3 - v^3 + x3^3 - 1, + Scheme morphism: + From: Closed subscheme of Affine Space of dimension 4 + over Rational Field defined by: x0^2*x1 - 1, x1^2 - x2^2, x3^3 - 1 + To: Closed subscheme of Product of projective spaces P^3 x P^1 + over Rational Field defined by: -x^3 + y^2*z, z^2 - w^2, u^3 - v^3 Defn: Defined on coordinates by sending (x0, x1, x2, x3) to (1 : x0 : x1 : x2 , x3 : 1)) """ diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index e2fab4be760..0a9abd631ff 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -133,11 +133,10 @@ class SchemeMorphism_polynomial_projective_space(SchemeMorphism_polynomial): sage: H12 = P1.Hom(P2) sage: H12([x^2, x*z, z^2]) Scheme morphism: - From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - x - y + From: Closed subscheme of Projective Space of dimension 2 over Rational Field + defined by: x - y To: Projective Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x : y : z) to - (x^2 : x*z : z^2) + Defn: Defined on coordinates by sending (x : y : z) to (x^2 : x*z : z^2) We illustrate some error checking:: @@ -836,8 +835,7 @@ def normalize_coordinates(self, **kwds): sage: H = Hom(P, P) sage: f = H([5/4*x^3, 5*x*y^2]) sage: f.normalize_coordinates(); f - Scheme endomorphism of Projective Space of dimension 1 over Rational - Field + Scheme endomorphism of Projective Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x : y) to (x^2 : 4*y^2) @@ -848,9 +846,8 @@ def normalize_coordinates(self, **kwds): sage: H = Hom(X, X) # optional - sage.rings.finite_rings sage: f = H([x^3 + x*y^2, x*y^2, x*z^2]) # optional - sage.rings.finite_rings sage: f.normalize_coordinates(); f # optional - sage.rings.finite_rings - Scheme endomorphism of Closed subscheme of Projective Space of dimension - 2 over Finite Field of size 7 defined by: - x^2 - y^2 + Scheme endomorphism of Closed subscheme of Projective Space of dimension 2 + over Finite Field of size 7 defined by: x^2 - y^2 Defn: Defined on coordinates by sending (x : y : z) to (2*y^2 : y^2 : z^2) @@ -872,8 +869,8 @@ def normalize_coordinates(self, **kwds): sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field sage: f = DynamicalSystem([w*x^2 + (1/5*w)*y^2, w*y^2]) # optional - sage.rings.number_field sage: f.normalize_coordinates(); f # optional - sage.rings.number_field - Dynamical System of Projective Space of dimension 1 over Number Field in - w with defining polynomial x^2 - 5 with w = 2.236067977499790? + Dynamical System of Projective Space of dimension 1 over Number Field in w + with defining polynomial x^2 - 5 with w = 2.236067977499790? Defn: Defined on coordinates by sending (x : y) to (5*x^2 + y^2 : 5*y^2) @@ -887,8 +884,9 @@ def normalize_coordinates(self, **kwds): sage: f.normalize_coordinates(); f # optional - sage.rings.number_field Dynamical System of Projective Space of dimension 1 over Number Field in b with defining polynomial t^3 - 11 - Defn: Defined on coordinates by sending (x : y) to - (-100*x^2 + (140*b^2 + 140*b + 140)*x*y + (-77*b^2 - 567*b - 1057)*y^2 : 100*y^2) + Defn: Defined on coordinates by sending (x : y) to + (-100*x^2 + (140*b^2 + 140*b + 140)*x*y + (-77*b^2 - 567*b - 1057)*y^2 : + 100*y^2) We can used ``ideal`` to scale with respect to a norm defined by an ideal:: @@ -896,8 +894,7 @@ def normalize_coordinates(self, **kwds): sage: f = DynamicalSystem_projective([2*x^3, 2*x^2*y + 4*x*y^2]) sage: f.normalize_coordinates(ideal=2); f Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x^3 : x^2*y + 2*x*y^2) + Defn: Defined on coordinates by sending (x : y) to (x^3 : x^2*y + 2*x*y^2) :: @@ -909,8 +906,7 @@ def normalize_coordinates(self, **kwds): sage: f = H([(a+1)*x^3 + 2*x*y^2, 4*x*y^2, 8*x*z^2]) # optional - sage.rings.number_field sage: f.normalize_coordinates(ideal=A.prime_above(2)); f # optional - sage.rings.number_field Scheme endomorphism of Closed subscheme of Projective Space of dimension 2 over - Number Field in a with defining polynomial w^2 + 1 defined by: - x^2 - y^2 + Number Field in a with defining polynomial w^2 + 1 defined by: x^2 - y^2 Defn: Defined on coordinates by sending (x : y : z) to ((-a + 2)*x*y^2 : (-2*a + 2)*x*y^2 : (-4*a + 4)*x*z^2) @@ -1144,10 +1140,9 @@ def dehomogenize(self, n): sage: H = Hom(X, X) sage: f = H([x^2, y^2, x*z]) sage: f.dehomogenize(2) - Scheme endomorphism of Closed subscheme of Affine Space of dimension 2 over Integer Ring defined by: - x^2 - y^2 - Defn: Defined on coordinates by sending (x, y) to - (x, y^2/x) + Scheme endomorphism of Closed subscheme of Affine Space of dimension 2 + over Integer Ring defined by: x^2 - y^2 + Defn: Defined on coordinates by sending (x, y) to (x, y^2/x) :: @@ -1168,8 +1163,7 @@ def dehomogenize(self, n): Scheme endomorphism of Affine Space of dimension 1 over Maximal Order in Number Field in w with defining polynomial x^2 - 3 with w = 1.732050807568878? - Defn: Defined on coordinates by sending (x) to - (x^2 - w) + Defn: Defined on coordinates by sending (x) to (x^2 - w) :: @@ -1181,8 +1175,7 @@ def dehomogenize(self, n): Scheme morphism: From: Affine Space of dimension 2 over Rational Field To: Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (u, v) to - (u/(v^2 + 1)) + Defn: Defined on coordinates by sending (u, v) to (u/(v^2 + 1)) """ # the dehomogenizations are stored for future use try: @@ -1733,10 +1726,12 @@ def _number_field_from_algebraics(self): sage: f = H([x^2 + QQbar(I)*x*y + 3*y^2, y^2, QQbar(sqrt(5))*x*y]) # optional - sage.rings.number_field sage: f._number_field_from_algebraics() # optional - sage.rings.number_field Scheme morphism: - From: Projective Space of dimension 1 over Number Field in a with - defining polynomial y^4 + 3*y^2 + 1 with a = 0.?e-113 + 0.618033988749895?*I - To: Projective Space of dimension 2 over Number Field in a with - defining polynomial y^4 + 3*y^2 + 1 with a = 0.?e-113 + 0.618033988749895?*I + From: Projective Space of dimension 1 over Number Field in a + with defining polynomial y^4 + 3*y^2 + 1 + with a = 0.?e-113 + 0.618033988749895?*I + To: Projective Space of dimension 2 over Number Field in a + with defining polynomial y^4 + 3*y^2 + 1 + with a = 0.?e-113 + 0.618033988749895?*I Defn: Defined on coordinates by sending (x : y) to (x^2 + (a^3 + 2*a)*x*y + 3*y^2 : y^2 : (2*a^2 + 3)*x*y) @@ -2040,7 +2035,8 @@ def reduce_base_field(self): sage: H3 = Hom(P2, P) # optional - sage.rings.finite_rings sage: f = H([x^2 + (2*t^3 + 2*t^2 + 1)*y^2, y^2]) # optional - sage.rings.finite_rings sage: f.reduce_base_field() # optional - sage.rings.finite_rings - Scheme endomorphism of Projective Space of dimension 1 over Finite Field in t2 of size 3^2 + Scheme endomorphism of Projective Space of dimension 1 + over Finite Field in t2 of size 3^2 Defn: Defined on coordinates by sending (x : y) to (x^2 + t2*y^2 : y^2) sage: f2 = H2([x^2 + 5*y^2, y^2, 2*x*y]) # optional - sage.rings.finite_rings @@ -2086,7 +2082,8 @@ def reduce_base_field(self): Dynamical System of Projective Space of dimension 1 over Finite Field in z6 of size 5^6 Defn: Defined on coordinates by sending (x : y) to - ((-z6^5 + z6^4 - z6^3 - z6^2 - 2*z6 - 2)*x^2 + (z6^5 - 2*z6^4 + z6^2 - z6 + 1)*y^2 : x*y) + ((-z6^5 + z6^4 - z6^3 - z6^2 - 2*z6 - 2)*x^2 + + (z6^5 - 2*z6^4 + z6^2 - z6 + 1)*y^2 : x*y) TESTS:: @@ -2337,11 +2334,10 @@ def representatives(self): sage: f = X.hom([x^2*y, x^2*z, x*y*z], P2) sage: f.representatives() [Scheme morphism: - From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - 0 + From: Closed subscheme of Projective Space of dimension 2 + over Rational Field defined by: 0 To: Projective Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x : y : z) to - (x*y : x*z : y*z)] + Defn: Defined on coordinates by sending (x : y : z) to (x*y : x*z : y*z)] :: @@ -2351,31 +2347,27 @@ def representatives(self): sage: f = X.hom([x, y], P1) sage: f.representatives() [Scheme morphism: - From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - x^2 - y^2 - y*z + From: Closed subscheme of Projective Space of dimension 2 + over Rational Field defined by: x^2 - y^2 - y*z To: Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y : z) to - (y + z : x), + Defn: Defined on coordinates by sending (x : y : z) to (y + z : x), Scheme morphism: - From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - x^2 - y^2 - y*z + From: Closed subscheme of Projective Space of dimension 2 + over Rational Field defined by: x^2 - y^2 - y*z To: Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y : z) to - (x : y)] + Defn: Defined on coordinates by sending (x : y : z) to (x : y)] sage: g = _[0] sage: g.representatives() [Scheme morphism: - From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - x^2 - y^2 - y*z + From: Closed subscheme of Projective Space of dimension 2 + over Rational Field defined by: x^2 - y^2 - y*z To: Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y : z) to - (y + z : x), + Defn: Defined on coordinates by sending (x : y : z) to (y + z : x), Scheme morphism: - From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - x^2 - y^2 - y*z + From: Closed subscheme of Projective Space of dimension 2 + over Rational Field defined by: x^2 - y^2 - y*z To: Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y : z) to - (x : y)] + Defn: Defined on coordinates by sending (x : y : z) to (x : y)] :: @@ -2385,33 +2377,29 @@ def representatives(self): sage: g = X.hom([y/x], A1) sage: g.representatives() [Scheme morphism: - From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - x^2 - y^2 - y*z + From: Closed subscheme of Projective Space of dimension 2 + over Rational Field defined by: x^2 - y^2 - y*z To: Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y : z) to - (x/(y + z)), - Scheme morphism: - From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - x^2 - y^2 - y*z + Defn: Defined on coordinates by sending (x : y : z) to (x/(y + z)), + Scheme morphism: + From: Closed subscheme of Projective Space of dimension 2 + over Rational Field defined by: x^2 - y^2 - y*z To: Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y : z) to - (y/x)] + Defn: Defined on coordinates by sending (x : y : z) to (y/x)] sage: g0, g1 = _ sage: emb = A1.projective_embedding(0) sage: emb*g0 Scheme morphism: - From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - x^2 - y^2 - y*z + From: Closed subscheme of Projective Space of dimension 2 + over Rational Field defined by: x^2 - y^2 - y*z To: Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y : z) to - (y + z : x) + Defn: Defined on coordinates by sending (x : y : z) to (y + z : x) sage: emb*g1 Scheme morphism: - From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - x^2 - y^2 - y*z + From: Closed subscheme of Projective Space of dimension 2 + over Rational Field defined by: x^2 - y^2 - y*z To: Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y : z) to - (x : y) + Defn: Defined on coordinates by sending (x : y : z) to (x : y) ALGORITHM: @@ -2661,11 +2649,11 @@ def graph(self): sage: phi = X.hom([x^2], A1) sage: mor = phi.homogenize(0) sage: G = mor.graph(); G - Closed subscheme of Product of projective spaces P^1 x P^1 over Rational Field defined by: - x1^2*x2 - x0^2*x3 + Closed subscheme of Product of projective spaces P^1 x P^1 + over Rational Field defined by: x1^2*x2 - x0^2*x3 sage: G.affine_patch([0, 0]) - Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - x0^2 - x1 + Closed subscheme of Affine Space of dimension 2 + over Rational Field defined by: x0^2 - x1 """ X = self.domain() Y = self.codomain() diff --git a/src/sage/schemes/projective/projective_space.py b/src/sage/schemes/projective/projective_space.py index 2696f4f6985..227c5eb50ed 100644 --- a/src/sage/schemes/projective/projective_space.py +++ b/src/sage/schemes/projective/projective_space.py @@ -961,7 +961,8 @@ def subscheme(self, X): sage: X.defining_polynomials () (x*z^2, y^2*z, x*y^2) sage: I = X.defining_ideal(); I - Ideal (x*z^2, y^2*z, x*y^2) of Multivariate Polynomial Ring in x, y, z over Rational Field + Ideal (x*z^2, y^2*z, x*y^2) of Multivariate Polynomial Ring in x, y, z + over Rational Field sage: I.groebner_basis() [x*y^2, y^2*z, x*z^2] sage: X.dimension() @@ -972,13 +973,13 @@ def subscheme(self, X): Spectrum of Rational Field sage: X.structure_morphism() Scheme morphism: - From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - x*z^2, - y^2*z, - x*y^2 + From: Closed subscheme of Projective Space of dimension 2 + over Rational Field defined by: x*z^2, y^2*z, x*y^2 To: Spectrum of Rational Field Defn: Structure map + TESTS:: + sage: TestSuite(X).run(skip=["_test_an_element", "_test_elements",\ "_test_elements_eq", "_test_some_elements", "_test_elements_eq_reflexive",\ "_test_elements_eq_symmetric", "_test_elements_eq_transitive",\ @@ -1183,16 +1184,16 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): sage: P. = ProjectiveSpace(QQ, 1) sage: P.chebyshev_polynomial(5, 'first') Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (16*x^5 - 20*x^3*y^2 + 5*x*y^4 : y^5) + Defn: Defined on coordinates by sending (x : y) to + (16*x^5 - 20*x^3*y^2 + 5*x*y^4 : y^5) :: sage: P. = ProjectiveSpace(QQ, 1) sage: P.chebyshev_polynomial(3, 'second') Dynamical System of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (8*x^3 - 4*x*y^2 : y^3) + Defn: Defined on coordinates by sending (x : y) to + (8*x^3 - 4*x*y^2 : y^3) :: @@ -2250,7 +2251,8 @@ def rational_points(self, F=None): sage: P.rational_points() # optional - sage.rings.finite_rings [(0 : 1), (1 : 1), (2 : 1), (1 : 0)] sage: P.rational_points(GF(3^2, 'b')) # optional - sage.rings.finite_rings - [(0 : 1), (b : 1), (b + 1 : 1), (2*b + 1 : 1), (2 : 1), (2*b : 1), (2*b + 2 : 1), (b + 2 : 1), (1 : 1), (1 : 0)] + [(0 : 1), (b : 1), (b + 1 : 1), (2*b + 1 : 1), (2 : 1), (2*b : 1), + (2*b + 2 : 1), (b + 2 : 1), (1 : 1), (1 : 0)] """ if F is None: return [P for P in self] @@ -2315,20 +2317,20 @@ def rational_points(self, bound=0): Returns the projective points `(x_0:\cdots:x_n)` over `\QQ` with `|x_i| \leq` bound. - ALGORITHM: + ALGORITHM: - The very simple algorithm works as follows: every point - `(x_0:\cdots:x_n)` in projective space has a unique - largest index `i` for which `x_i` is not - zero. The algorithm then iterates downward on this - index. We normalize by choosing `x_i` positive. Then, - the points `x_0,\ldots,x_{i-1}` are the points of - affine `i`-space that are relatively prime to - `x_i`. We access these by using the Tuples method. + The very simple algorithm works as follows: every point + `(x_0:\cdots:x_n)` in projective space has a unique + largest index `i` for which `x_i` is not + zero. The algorithm then iterates downward on this + index. We normalize by choosing `x_i` positive. Then, + the points `x_0,\ldots,x_{i-1}` are the points of + affine `i`-space that are relatively prime to + `x_i`. We access these by using the Tuples method. INPUT: - - ``bound`` - integer. + - ``bound`` - integer. EXAMPLES:: diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index 7ead2ef9fe0..8e665291246 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -232,10 +232,10 @@ def affine_patch(self, i, AA=None): Y^3*Z + Z^3 + Y sage: U.embedding_morphism() Scheme morphism: - From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - Y^3*Z + Z^3 + Y - To: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - X^3*Y + Y^3*Z + X*Z^3 + From: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: Y^3*Z + Z^3 + Y + To: Closed subscheme of Projective Space of dimension 2 over Rational Field + defined by: X^3*Y + Y^3*Z + X*Z^3 Defn: Defined on coordinates by sending (Y, Z) to (1 : Y : Z) sage: U.projective_embedding() is U.embedding_morphism() @@ -366,10 +366,10 @@ def neighborhood(self, point): x + 3*z sage: patch.embedding_morphism() Scheme morphism: - From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - x + 3*z - To: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - x + 2*y + 3*z + From: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: x + 3*z + To: Closed subscheme of Projective Space of dimension 2 over Rational Field + defined by: x + 2*y + 3*z Defn: Defined on coordinates by sending (x, z) to (x : -3/2 : z + 1) sage: patch.embedding_center() @@ -476,23 +476,17 @@ def orbit(self, f, N): sage: f = DynamicalSystem_projective([(x-2*y)^2, (x-2*z)^2, (x-2*w)^2, x^2]) sage: f.orbit(P.subscheme([x]), 5) [Closed subscheme of Projective Space of dimension 3 over Rational Field - defined by: - x, + defined by: x, Closed subscheme of Projective Space of dimension 3 over Rational Field - defined by: - w, + defined by: w, Closed subscheme of Projective Space of dimension 3 over Rational Field - defined by: - z - w, + defined by: z - w, Closed subscheme of Projective Space of dimension 3 over Rational Field - defined by: - y - z, + defined by: y - z, Closed subscheme of Projective Space of dimension 3 over Rational Field - defined by: - x - y, + defined by: x - y, Closed subscheme of Projective Space of dimension 3 over Rational Field - defined by: - x - w] + defined by: x - w] :: @@ -677,8 +671,7 @@ def _forward_image(self, f, check=True): Closed subscheme of Projective Space of dimension 2 over 3-adic Field with capped relative precision 20 defined by: z, - x + (1 + 3^2 + 3^4 + 3^6 + 3^8 + 3^10 + 3^12 + 3^14 + 3^16 + 3^18 + - O(3^20))*y + x + (1 + 3^2 + 3^4 + 3^6 + 3^8 + 3^10 + 3^12 + 3^14 + 3^16 + 3^18 + O(3^20))*y :: @@ -1205,15 +1198,14 @@ def veronese_embedding(self, d, CS=None, order='lex'): sage: v = L.veronese_embedding(2) sage: v Scheme morphism: - From: Closed subscheme of Projective Space of dimension 2 over - Rational Field defined by: - -x + y - To: Closed subscheme of Projective Space of dimension 5 over - Rational Field defined by: - -x4^2 + x3*x5, - x2 - x4, - x1 - x3, - x0 - x3 + From: Closed subscheme of Projective Space of dimension 2 + over Rational Field defined by: -x + y + To: Closed subscheme of Projective Space of dimension 5 + over Rational Field defined by: + -x4^2 + x3*x5, + x2 - x4, + x1 - x3, + x0 - x3 Defn: Defined on coordinates by sending (x : y : z) to (x^2 : x*y : x*z : y^2 : y*z : z^2) sage: v.codomain().degree() @@ -1228,14 +1220,13 @@ def veronese_embedding(self, d, CS=None, order='lex'): sage: Q. = ProjectiveSpace(QQ, 3) sage: P.subscheme([]).veronese_embedding(3, Q) Scheme morphism: - From: Closed subscheme of Projective Space of dimension 1 over - Rational Field defined by: - (no polynomials) - To: Closed subscheme of Projective Space of dimension 3 over - Rational Field defined by: - -s^2 + v*t, - -v*s + u*t, - -v^2 + u*s + From: Closed subscheme of Projective Space of dimension 1 + over Rational Field defined by: (no polynomials) + To: Closed subscheme of Projective Space of dimension 3 + over Rational Field defined by: + -s^2 + v*t, + -v*s + u*t, + -v^2 + u*s Defn: Defined on coordinates by sending (x : y) to (x^3 : x^2*y : x*y^2 : y^3) """ @@ -1273,14 +1264,12 @@ def _morphism(self, *args, **kwds): Scheme morphism: From: Projective Space of dimension 1 over Rational Field To: Projective Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x^2 : x*y : y^2) + Defn: Defined on coordinates by sending (x : y) to (x^2 : x*y : y^2) sage: P1._morphism(H12, [x^2, x*y, y^2]) Scheme morphism: From: Projective Space of dimension 1 over Rational Field To: Projective Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x^2 : x*y : y^2) + Defn: Defined on coordinates by sending (x : y) to (x^2 : x*y : y^2) """ return SchemeMorphism_polynomial_projective_subscheme_field(*args, **kwds) From 919ed50658011c0a8a1f29da948b809a5489df6f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 22 Mar 2023 15:58:26 -0700 Subject: [PATCH 083/135] sage.schemes: More # optional and cosmetic doctest changes --- .../cyclic_covers/charpoly_frobenius.py | 10 +- src/sage/schemes/cyclic_covers/constructor.py | 31 +- .../cyclic_covers/cycliccover_finite_field.py | 55 +- .../cyclic_covers/cycliccover_generic.py | 30 +- src/sage/schemes/elliptic_curves/BSD.py | 6 +- src/sage/schemes/elliptic_curves/Qcurves.py | 92 +- .../schemes/elliptic_curves/cardinality.py | 35 +- src/sage/schemes/elliptic_curves/cm.py | 77 +- .../schemes/elliptic_curves/constructor.py | 177 +- .../elliptic_curves/ell_curve_isogeny.py | 1718 +++++++++-------- src/sage/schemes/elliptic_curves/ell_field.py | 593 +++--- src/sage/schemes/plane_conics/con_field.py | 279 +-- .../schemes/plane_conics/con_finite_field.py | 34 +- .../schemes/plane_conics/con_number_field.py | 38 +- .../plane_conics/con_rational_field.py | 17 +- .../con_rational_function_field.py | 47 +- src/sage/schemes/plane_conics/constructor.py | 6 +- .../plane_quartics/quartic_constructor.py | 10 +- .../schemes/plane_quartics/quartic_generic.py | 15 +- 19 files changed, 1857 insertions(+), 1413 deletions(-) diff --git a/src/sage/schemes/cyclic_covers/charpoly_frobenius.py b/src/sage/schemes/cyclic_covers/charpoly_frobenius.py index 4c63fe44783..fd5abe0899d 100644 --- a/src/sage/schemes/cyclic_covers/charpoly_frobenius.py +++ b/src/sage/schemes/cyclic_covers/charpoly_frobenius.py @@ -41,12 +41,16 @@ def charpoly_frobenius(frob_matrix, charpoly_prec, p, weight, a=1, known_factor= sage: charpoly_frobenius(M, [2, 1, 1], 17, 1, 1) [17, 2, 1] - sage: R = Zq(17**2 , names=('a',)) - sage: M = Matrix(R, [[8*17 + 16*17**2 + O(17**3), 8 + 11*17 + O(17**2)], [7*17**2 + O(17**3), 15 + 8*17 + O(17**2)]]) + sage: R = Zq(17**2, names=('a',)) + sage: M = Matrix(R, [[8*17 + 16*17**2 + O(17**3), 8 + 11*17 + O(17**2)], + ....: [7*17**2 + O(17**3), 15 + 8*17 + O(17**2)]]) sage: charpoly_frobenius(M*M, [3, 2, 2], 17, 1, 2) [289, 30, 1] - sage: M = Matrix([[8*31 + 8*31**2 + O(31**3), O(31**3), O(31**3), O(31**3)], [O(31**3), 23*31 + 22*31**2 + O(31**3), O(31**3), O(31**3)], [O(31**3), O(31**3), 27 + 7*31 + O(31**3), O(31**3)], [O(31**3), O(31**3), O(31**3), 4 + 23*31 + O(31**3)]]) + sage: M = Matrix([[8*31 + 8*31**2 + O(31**3), O(31**3), O(31**3), O(31**3)], + ....: [O(31**3), 23*31 + 22*31**2 + O(31**3), O(31**3), O(31**3)], + ....: [O(31**3), O(31**3), 27 + 7*31 + O(31**3), O(31**3)], + ....: [O(31**3), O(31**3), O(31**3), 4 + 23*31 + O(31**3)]]) sage: charpoly_frobenius(M, [4, 3, 2, 2, 2], 31, 1, 1) [961, 0, 46, 0, 1] diff --git a/src/sage/schemes/cyclic_covers/constructor.py b/src/sage/schemes/cyclic_covers/constructor.py index 0a8926d7db6..555eee376bb 100644 --- a/src/sage/schemes/cyclic_covers/constructor.py +++ b/src/sage/schemes/cyclic_covers/constructor.py @@ -64,30 +64,34 @@ def CyclicCover(r, f, names=None, check_smooth=True): sage: CyclicCover(15, x^9 + x + 1) Cyclic Cover of P^1 over Rational Field defined by y^15 = x^9 + x + 1 - sage: k. = GF(9); R. = k[] - sage: CyclicCover(5, x^9 + x + 1) - Cyclic Cover of P^1 over Finite Field in a of size 3^2 defined by y^5 = x^9 + x + 1 - sage: CyclicCover(15, x^9 + x + 1) + sage: k. = GF(9); R. = k[] # optional - sage.rings.finite_rings + sage: CyclicCover(5, x^9 + x + 1) # optional - sage.rings.finite_rings + Cyclic Cover of P^1 over Finite Field in a of size 3^2 # optional - sage.rings.finite_rings + defined by y^5 = x^9 + x + 1 + sage: CyclicCover(15, x^9 + x + 1) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: As the characteristic divides the order of the cover, this model is not smooth. We can change the names of the variables in the output:: - sage: k. = GF(9); R. = k[] - sage: CyclicCover(5, x^9 + x + 1, names = ["A","B"]) - Cyclic Cover of P^1 over Finite Field in a of size 3^2 defined by B^5 = A^9 + A + 1 + sage: k. = GF(9); R. = k[] # optional - sage.rings.finite_rings + sage: CyclicCover(5, x^9 + x + 1, names=["A","B"]) # optional - sage.rings.finite_rings + Cyclic Cover of P^1 over Finite Field in a of size 3^2 + defined by B^5 = A^9 + A + 1 Double roots:: - sage: P. = GF(7)[] - sage: CyclicCover(2,(x^3-x+2)^2*(x^6-1)) + sage: P. = GF(7)[] # optional - sage.rings.finite_rings + sage: CyclicCover(2, (x^3-x+2)^2*(x^6-1)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Not a smooth Cyclic Cover of P^1: singularity in the provided affine patch. - sage: CyclicCover(2, (x^3-x+2)^2*(x^6-1), check_smooth=False) - Cyclic Cover of P^1 over Finite Field of size 7 defined by y^2 = x^12 - 2*x^10 - 3*x^9 + x^8 + 3*x^7 + 3*x^6 + 2*x^4 + 3*x^3 - x^2 - 3*x + 3 + sage: CyclicCover(2, (x^3-x+2)^2*(x^6-1), check_smooth=False) # optional - sage.rings.finite_rings + Cyclic Cover of P^1 over Finite Field of size 7 + defined by y^2 = x^12 - 2*x^10 - 3*x^9 + x^8 + 3*x^7 + 3*x^6 + + 2*x^4 + 3*x^3 - x^2 - 3*x + 3 Input with integer coefficients creates objects with the integers @@ -96,8 +100,9 @@ def CyclicCover(r, f, names=None, check_smooth=True): not checked whether the discriminant is a unit in `\ZZ^*`.:: sage: R. = ZZ[] - sage: CyclicCover(5,(x^3-x+2)*(x^6-1)) - Cyclic Cover of P^1 over Integer Ring defined by y^5 = x^9 - x^7 + 2*x^6 - x^3 + x - 2 + sage: CyclicCover(5, (x^3-x+2)*(x^6-1)) + Cyclic Cover of P^1 over Integer Ring + defined by y^5 = x^9 - x^7 + 2*x^6 - x^3 + x - 2 """ diff --git a/src/sage/schemes/cyclic_covers/cycliccover_finite_field.py b/src/sage/schemes/cyclic_covers/cycliccover_finite_field.py index ef39c87dabb..d6d8f2176ee 100644 --- a/src/sage/schemes/cyclic_covers/cycliccover_finite_field.py +++ b/src/sage/schemes/cyclic_covers/cycliccover_finite_field.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.rings.finite_rings r""" Cyclic covers over a finite field @@ -114,7 +115,7 @@ def __init__(self, AA, r, f, names=None, verbose=0): EXAMPLES:: sage: p = 13 - sage: x = PolynomialRing(GF(p),"x").gen() + sage: x = PolynomialRing(GF(p), "x").gen() sage: C = CyclicCover(4, x^4 + 1) sage: C.frobenius_polynomial() x^6 - 6*x^5 + 3*x^4 + 60*x^3 + 39*x^2 - 1014*x + 2197 @@ -306,7 +307,7 @@ def _divide_vector(self, D, vect, R): TESTS:: sage: p = 4999 - sage: x = PolynomialRing(GF(p),"x").gen() + sage: x = PolynomialRing(GF(p), "x").gen() sage: C = CyclicCover(3, x^4 + 4*x^3 + 9*x^2 + 3*x + 1) sage: C._init_frob() sage: C._divide_vector(p, vector(C._Qq, [p, p^2, p^3]), C._Qq) @@ -388,7 +389,7 @@ def _frob_sparse(self, i, j, N0): TESTS:: sage: p = 499 - sage: x = PolynomialRing(GF(p),"x").gen() + sage: x = PolynomialRing(GF(p), "x").gen() sage: C = CyclicCover(3, x^4 + 4*x^3 + 9*x^2 + 3*x + 1) sage: C._init_frob() sage: C._frob_sparse(2, 0, 1) @@ -490,7 +491,7 @@ def _horizontal_matrix_reduction(self, s): TESTS:: sage: p = 4999 - sage: x = PolynomialRing(GF(p),"x").gen() + sage: x = PolynomialRing(GF(p), "x").gen() sage: C = CyclicCover(3, x^4 + 4*x^3 + 9*x^2 + 3*x + 1) sage: C._init_frob() sage: C._horizontal_matrix_reduction(24995) @@ -559,7 +560,7 @@ def _vertical_matrix_reduction(self, s0): TESTS:: sage: p = 4999 - sage: x = PolynomialRing(GF(p),"x").gen() + sage: x = PolynomialRing(GF(p), "x").gen() sage: C = CyclicCover(3, x^4 + 4*x^3 + 9*x^2 + 3*x + 1) sage: C._init_frob() sage: C._vertical_matrix_reduction(1) @@ -627,7 +628,7 @@ def _reduce_vector_horizontal(self, G, e, s, k=1): TESTS:: sage: p = 4999 - sage: x = PolynomialRing(GF(p),"x").gen() + sage: x = PolynomialRing(GF(p), "x").gen() sage: C = CyclicCover(3, x^4 + 4*x^3 + 9*x^2 + 3*x + 1) sage: C._init_frob() sage: C._initialize_fat_horizontal(p, 3) @@ -656,7 +657,7 @@ def _reduce_vector_horizontal_BSGS(self, G, e, s): TESTS:: sage: p = 4999 - sage: x = PolynomialRing(GF(p),"x").gen() + sage: x = PolynomialRing(GF(p), "x").gen() sage: C = CyclicCover(3, x^4 + 4*x^3 + 9*x^2 + 3*x + 1) sage: C._init_frob() sage: C._initialize_fat_horizontal(p, 3) @@ -715,7 +716,7 @@ def _initialize_fat_horizontal(self, s, L): TESTS:: sage: p = 4999 - sage: x = PolynomialRing(GF(p),"x").gen() + sage: x = PolynomialRing(GF(p), "x").gen() sage: C = CyclicCover(3, x^4 + 4*x^3 + 9*x^2 + 3*x + 1) sage: C._init_frob() sage: C._initialize_fat_horizontal(p, 3) @@ -779,7 +780,7 @@ def _reduce_vector_horizontal_plain(self, G, e, s, k=1): TESTS:: sage: p = 4999 - sage: x = PolynomialRing(GF(p),"x").gen() + sage: x = PolynomialRing(GF(p), "x").gen() sage: C = CyclicCover(3, x^4 + 4*x^3 + 9*x^2 + 3*x + 1) sage: C._init_frob() sage: C._initialize_fat_horizontal(p, 3) @@ -910,7 +911,7 @@ def _initialize_fat_vertical(self, s0, max_upper_target): TESTS:: sage: p = 4999 - sage: x = PolynomialRing(GF(p),"x").gen() + sage: x = PolynomialRing(GF(p), "x").gen() sage: C = CyclicCover(3, x^4 + 4*x^3 + 9*x^2 + 3*x + 1) sage: C._init_frob() sage: C._initialize_fat_vertical(1, p + p // 3) @@ -959,7 +960,7 @@ def _frob(self, i, j, N0): TESTS:: sage: p = 4999 - sage: x = PolynomialRing(GF(p),"x").gen() + sage: x = PolynomialRing(GF(p), "x").gen() sage: C = CyclicCover(3, x^4 + 4*x^3 + 9*x^2 + 3*x + 1) sage: C._init_frob() sage: C._frob(2, 0, 1) @@ -1027,7 +1028,7 @@ def frobenius_matrix(self, N=None): EXAMPLES:: sage: p = 107 - sage: x = PolynomialRing(GF(p),"x").gen() + sage: x = PolynomialRing(GF(p), "x").gen() sage: CyclicCover(2, x^5 + x).frobenius_matrix() [ O(107^2) 89*107 + O(107^2) O(107^2) O(107^2)] [ 89*107 + O(107^2) O(107^2) O(107^2) O(107^2)] @@ -1094,7 +1095,7 @@ def frobenius_polynomial(self): Hyperelliptic curves:: sage: p = 11 - sage: x = PolynomialRing(GF(p),"x").gen() + sage: x = PolynomialRing(GF(p), "x").gen() sage: f = x^7 + 4*x^2 + 10*x + 4 sage: CyclicCover(2, f).frobenius_polynomial() == \ ....: HyperellipticCurve(f).frobenius_polynomial() @@ -1108,7 +1109,7 @@ def frobenius_polynomial(self): ....: HyperellipticCurve(f).frobenius_polynomial() True sage: p = 1117 - sage: x = PolynomialRing(GF(p),"x").gen() + sage: x = PolynomialRing(GF(p), "x").gen() sage: f = x^9 + 4*x^2 + 10*x + 4 sage: P1 = CyclicCover(2, f).frobenius_polynomial() sage: P2 = HyperellipticCurve(f).frobenius_polynomial() @@ -1122,7 +1123,7 @@ def frobenius_polynomial(self): Superelliptic curves:: sage: p = 11 - sage: x = PolynomialRing(GF(p),"x").gen() + sage: x = PolynomialRing(GF(p), "x").gen() sage: CyclicCover(3, x^4 + 4*x^3 + 9*x^2 + 3*x + 1).frobenius_polynomial() x^6 + 21*x^4 + 231*x^2 + 1331 sage: CyclicCover(4, x^3 + x + 1).frobenius_polynomial() @@ -1147,54 +1148,54 @@ def frobenius_polynomial(self): A non-monic example checking that :trac:`29015` is fixed:: sage: a = 3 - sage: K.=GF(83^3); - sage: R.= PolynomialRing(K) - sage: h = s*x^4 +x*3+ 8; - sage: C = CyclicCover(a,h) + sage: K. = GF(83^3); + sage: R. = PolynomialRing(K) + sage: h = s*x^4 + x*3 + 8 + sage: C = CyclicCover(a, h) sage: C.frobenius_polynomial() x^6 + 1563486*x^4 + 893980969482*x^2 + 186940255267540403 Non-superelliptic curves:: sage: p = 13 - sage: x = PolynomialRing(GF(p),"x").gen() + sage: x = PolynomialRing(GF(p), "x").gen() sage: C = CyclicCover(4, x^4 + 1) sage: C.frobenius_polynomial() x^6 - 6*x^5 + 3*x^4 + 60*x^3 + 39*x^2 - 1014*x + 2197 sage: R. = PowerSeriesRing(Integers()) - sage: C.projective_closure().zeta_series(2,t) + sage: C.projective_closure().zeta_series(2, t) 1 + 8*t + 102*t^2 + O(t^3) sage: C.frobenius_polynomial().reverse()(t)/((1-t)*(1-p*t)) + O(t^5) 1 + 8*t + 102*t^2 + 1384*t^3 + 18089*t^4 + O(t^5) - sage: x = PolynomialRing(GF(11),"x").gen() + sage: x = PolynomialRing(GF(11), "x").gen() sage: CyclicCover(4, x^6 - 11*x^3 + 70*x^2 - x + 961).frobenius_polynomial() # long time x^14 + 14*x^12 + 287*x^10 + 3025*x^8 + 33275*x^6 + 381997*x^4 + 2254714*x^2 + 19487171 - sage: x = PolynomialRing(GF(4999),"x").gen() + sage: x = PolynomialRing(GF(4999), "x").gen() sage: CyclicCover(4, x^6 - 11*x^3 + 70*x^2 - x + 961).frobenius_polynomial() # long time x^14 - 4*x^13 - 2822*x^12 - 30032*x^11 + 37164411*x^10 - 152369520*x^9 + 54217349361*x^8 - 1021791160888*x^7 + 271032529455639*x^6 - 3807714457169520*x^5 + 4642764601604000589*x^4 - 18754988504199390032*x^3 - 8809934776794570547178*x^2 - 62425037490001499880004*x + 78015690603129374475034999 sage: p = 11 - sage: x = PolynomialRing(GF(p),"x").gen() + sage: x = PolynomialRing(GF(p), "x").gen() sage: CyclicCover(3, 5*x^3 - 5*x + 13).frobenius_polynomial() x^2 + 11 sage: CyclicCover(3, x^6 + x^4 - x^3 + 2*x^2 - x - 1).frobenius_polynomial() x^8 + 32*x^6 + 462*x^4 + 3872*x^2 + 14641 sage: p = 4999 - sage: x = PolynomialRing(GF(p),"x").gen() + sage: x = PolynomialRing(GF(p), "x").gen() sage: CyclicCover(3, 5*x^3 - 5*x + 13).frobenius_polynomial() x^2 - 47*x + 4999 sage: CyclicCover(3, x^6 + x^4 - x^3 + 2*x^2 - x - 1).frobenius_polynomial() x^8 + 122*x^7 + 4594*x^6 - 639110*x^5 - 82959649*x^4 - 3194910890*x^3 + 114804064594*x^2 + 15240851829878*x + 624500149980001 sage: p = 11 - sage: x = PolynomialRing(GF(p),"x").gen() + sage: x = PolynomialRing(GF(p), "x").gen() sage: CyclicCover(5, x^5 + x).frobenius_polynomial() # long time x^12 + 4*x^11 + 22*x^10 + 108*x^9 + 503*x^8 + 1848*x^7 + 5588*x^6 + 20328*x^5 + 60863*x^4 + 143748*x^3 + 322102*x^2 + 644204*x + 1771561 sage: CyclicCover(5, 2*x^5 + x).frobenius_polynomial() # long time x^12 - 9*x^11 + 42*x^10 - 108*x^9 - 47*x^8 + 1782*x^7 - 8327*x^6 + 19602*x^5 - 5687*x^4 - 143748*x^3 + 614922*x^2 - 1449459*x + 1771561 sage: p = 49999 - sage: x = PolynomialRing(GF(p),"x").gen() + sage: x = PolynomialRing(GF(p), "x").gen() sage: CyclicCover(5, x^5 + x ).frobenius_polynomial() # long time x^12 + 299994*x^10 + 37498500015*x^8 + 2499850002999980*x^6 + 93742500224997000015*x^4 + 1874812507499850001499994*x^2 + 15623125093747500037499700001 sage: CyclicCover(5, 2*x^5 + x).frobenius_polynomial() # long time diff --git a/src/sage/schemes/cyclic_covers/cycliccover_generic.py b/src/sage/schemes/cyclic_covers/cycliccover_generic.py index 7531d933c0b..8d80d94c569 100644 --- a/src/sage/schemes/cyclic_covers/cycliccover_generic.py +++ b/src/sage/schemes/cyclic_covers/cycliccover_generic.py @@ -18,13 +18,13 @@ ValueError: As the characteristic divides the order of the cover, this model is not smooth. - sage: GF7x. = GF(7)[] - sage: C = CyclicCover(3, x^9 + x + 1) - sage: C + sage: GF7x. = GF(7)[] # optional - sage.rings.finite_rings + sage: C = CyclicCover(3, x^9 + x + 1) # optional - sage.rings.finite_rings + sage: C # optional - sage.rings.finite_rings Cyclic Cover of P^1 over Finite Field of size 7 defined by y^3 = x^9 + x + 1 - sage: C.genus() + sage: C.genus() # optional - sage.rings.finite_rings 7 - sage: C.projective_closure() + sage: C.projective_closure() # optional - sage.rings.finite_rings Traceback (most recent call last): ... NotImplementedError: Weighted Projective Space is not implemented @@ -73,19 +73,19 @@ def __init__(self, AA, r, f, names=None): Projective Plane Curve over Integer Ring defined by x0^5 + x0^4*x1 + x1^5 - x2^5 sage: D.change_ring(QQ).genus() 6 - sage: C.change_ring(GF(5)) + sage: C.change_ring(GF(5)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: As the characteristic divides the order of the cover, this model is not smooth. - sage: GF7x. = GF(7)[] - sage: C = CyclicCover(3, x^9 + x + 1) - sage: C + sage: GF7x. = GF(7)[] # optional - sage.rings.finite_rings + sage: C = CyclicCover(3, x^9 + x + 1) # optional - sage.rings.finite_rings + sage: C # optional - sage.rings.finite_rings Cyclic Cover of P^1 over Finite Field of size 7 defined by y^3 = x^9 + x + 1 - sage: C.genus() + sage: C.genus() # optional - sage.rings.finite_rings 7 - sage: C.projective_closure() + sage: C.projective_closure() # optional - sage.rings.finite_rings Traceback (most recent call last): ... NotImplementedError: Weighted Projective Space is not implemented @@ -120,11 +120,11 @@ def change_ring(self, R): Traceback (most recent call last): ... ValueError: As the characteristic divides the order of the cover, this model is not smooth. - sage: C.change_ring(GF(3)) + sage: C.change_ring(GF(3)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Not a smooth Cyclic Cover of P^1: singularity in the provided affine patch. - sage: C.change_ring(GF(17)) + sage: C.change_ring(GF(17)) # optional - sage.rings.finite_rings Cyclic Cover of P^1 over Finite Field of size 17 defined by y^5 = x^5 + x + 1 """ from .constructor import CyclicCover @@ -240,8 +240,8 @@ def projective_closure(self, **kwds): EXAMPLES:: - sage: GF7x. = GF(7)[] - sage: CyclicCover(3, x^9 + x + 1).projective_closure() + sage: GF7x. = GF(7)[] # optional - sage.rings.finite_rings + sage: CyclicCover(3, x^9 + x + 1).projective_closure() # optional - sage.rings.finite_rings Traceback (most recent call last): ... NotImplementedError: Weighted Projective Space is not implemented diff --git a/src/sage/schemes/elliptic_curves/BSD.py b/src/sage/schemes/elliptic_curves/BSD.py index b44ef5d9c16..a707d1bee06 100644 --- a/src/sage/schemes/elliptic_curves/BSD.py +++ b/src/sage/schemes/elliptic_curves/BSD.py @@ -21,7 +21,8 @@ class BSD_data: sage: D.curve=EllipticCurve('11a') sage: D.update() sage: D.Sha - Tate-Shafarevich group for the Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Tate-Shafarevich group for the Elliptic Curve + defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field """ def __init__(self): self.curve = None @@ -52,7 +53,8 @@ def update(self): sage: D.curve = EllipticCurve('11a') sage: D.update() sage: D.Sha - Tate-Shafarevich group for the Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Tate-Shafarevich group for the Elliptic Curve + defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field """ self.two_tor_rk = self.curve.two_torsion_rank() self.Sha = self.curve.sha() diff --git a/src/sage/schemes/elliptic_curves/Qcurves.py b/src/sage/schemes/elliptic_curves/Qcurves.py index d526915ac3f..23749f20cf5 100644 --- a/src/sage/schemes/elliptic_curves/Qcurves.py +++ b/src/sage/schemes/elliptic_curves/Qcurves.py @@ -130,9 +130,10 @@ def is_Q_curve(E, maxp=100, certificate=False, verbose=False): sage: from sage.schemes.elliptic_curves.Qcurves import is_Q_curve sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(R([3, 0, -5, 0, 1])) - sage: E = EllipticCurve([K([-3,-4,1,1]),K([4,-1,-1,0]),K([-2,0,1,0]),K([-621,778,138,-178]),K([9509,2046,-24728,10380])]) - sage: is_Q_curve(E, certificate=True, verbose=True) + sage: K. = NumberField(R([3, 0, -5, 0, 1])) # optional - sage.rings.number_field + sage: E = EllipticCurve([K([-3,-4,1,1]), K([4,-1,-1,0]), K([-2,0,1,0]), # optional - sage.rings.number_field + ....: K([-621,778,138,-178]), K([9509,2046,-24728,10380])]) + sage: is_Q_curve(E, certificate=True, verbose=True) # optional - sage.rings.number_field Checking whether Elliptic Curve defined by y^2 + (a^3+a^2-4*a-3)*x*y + (a^2-2)*y = x^3 + (-a^2-a+4)*x^2 + (-178*a^3+138*a^2+778*a-621)*x + (10380*a^3-24728*a^2+2046*a+9509) over Number Field in a with defining polynomial x^4 - 5*x^2 + 3 is a Q-curve No: inconsistency at the 2 primes dividing 3 - potentially multiplicative: [True, False] @@ -142,9 +143,10 @@ def is_Q_curve(E, maxp=100, certificate=False, verbose=False): primes is consistent, but the local test at good primes above `13` is not:: - sage: K. = NumberField(R([-10, 0, 1])) - sage: E = EllipticCurve([K([0,1]),K([-1,-1]),K([0,0]),K([-236,40]),K([-1840,464])]) - sage: is_Q_curve(E, certificate=True, verbose=True) + sage: K. = NumberField(R([-10, 0, 1])) # optional - sage.rings.number_field + sage: E = EllipticCurve([K([0,1]), K([-1,-1]), K([0,0]), # optional - sage.rings.number_field + ....: K([-236,40]), K([-1840,464])]) + sage: is_Q_curve(E, certificate=True, verbose=True) # optional - sage.rings.number_field Checking whether Elliptic Curve defined by y^2 + a*x*y = x^3 + (-a-1)*x^2 + (40*a-236)*x + (464*a-1840) over Number Field in a with defining polynomial x^2 - 10 is a Q-curve Applying local tests at good primes above p<=100 No: inconsistency at the 2 ordinary primes dividing 13 @@ -156,9 +158,9 @@ def is_Q_curve(E, maxp=100, certificate=False, verbose=False): sage: from sage.schemes.elliptic_curves.Qcurves import is_Q_curve sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(R([-1, -1, 1])) - sage: E = EllipticCurve([K([1,0]),K([-1,0]),K([0,1]),K([0,-2]),K([0,1])]) - sage: is_Q_curve(E, certificate=True, verbose=True) + sage: K. = NumberField(R([-1, -1, 1])) # optional - sage.rings.number_field + sage: E = EllipticCurve([K([1,0]), K([-1,0]), K([0,1]), K([0,-2]), K([0,1])]) + sage: is_Q_curve(E, certificate=True, verbose=True) # optional - sage.rings.number_field Checking whether Elliptic Curve defined by y^2 + x*y + a*y = x^3 + (-1)*x^2 + (-2*a)*x + a over Number Field in a with defining polynomial x^2 - x - 1 is a Q-curve Yes: E is CM (discriminant -15) (True, {'CM': -15}) @@ -168,12 +170,14 @@ def is_Q_curve(E, maxp=100, certificate=False, verbose=False): in fact there is an isogenous curve with rational `j`, so we have a so-called rational `\QQ`-curve:: - sage: K. = NumberField(R([1, 0, -4, 0, 1])) - sage: E = EllipticCurve([K([-2,-4,1,1]),K([0,1,0,0]),K([0,1,0,0]),K([-4780,9170,1265,-2463]),K([163923,-316598,-43876,84852])]) - sage: flag, cert = is_Q_curve(E, certificate=True) - sage: flag + sage: K. = NumberField(R([1, 0, -4, 0, 1])) # optional - sage.rings.number_field + sage: E = EllipticCurve([K([-2,-4,1,1]), K([0,1,0,0]), K([0,1,0,0]), # optional - sage.rings.number_field + ....: K([-4780,9170,1265,-2463]), + ....: K([163923,-316598,-43876,84852])]) + sage: flag, cert = is_Q_curve(E, certificate=True) # optional - sage.rings.number_field + sage: flag # optional - sage.rings.number_field True - sage: cert + sage: cert # optional - sage.rings.number_field {'CM': 0, 'N': 1, 'core_degs': [1], 'core_poly': x - 85184/3, 'r': 0, 'rho': 0} Over the same field, a so-called strict `\QQ`-curve which is not @@ -183,11 +187,12 @@ def is_Q_curve(E, maxp=100, certificate=False, verbose=False): quadratic conjugate `j`-invariants in `\QQ(\sqrt{3})` (but which are not base-changes from the quadratic subfield):: - sage: E = EllipticCurve([K([0,-3,0,1]),K([1,4,0,-1]),K([0,0,0,0]),K([-2,-16,0,4]),K([-19,-32,4,8])]) - sage: flag, cert = is_Q_curve(E, certificate=True) - sage: flag + sage: E = EllipticCurve([K([0,-3,0,1]), K([1,4,0,-1]), K([0,0,0,0]), # optional - sage.rings.number_field + ....: K([-2,-16,0,4]), K([-19,-32,4,8])]) + sage: flag, cert = is_Q_curve(E, certificate=True) # optional - sage.rings.number_field + sage: flag # optional - sage.rings.number_field True - sage: cert + sage: cert # optional - sage.rings.number_field {'CM': 0, 'N': 2, 'core_degs': [1, 2], @@ -197,8 +202,8 @@ def is_Q_curve(E, maxp=100, certificate=False, verbose=False): TESTS:: - sage: E = EllipticCurve([GF(5)(t) for t in [2,3,5,7,11]]) - sage: is_Q_curve(E) + sage: E = EllipticCurve([GF(5)(t) for t in [2,3,5,7,11]]) # optional - sage.rings.finite_rings + sage: is_Q_curve(E) # optional - sage.rings.finite_rings Traceback (most recent call last): ... TypeError: Elliptic Curve defined by ... must be an elliptic curve @@ -426,9 +431,10 @@ def Step4Test(E, B, oldB=0, verbose=False): sage: from sage.schemes.elliptic_curves.Qcurves import Step4Test sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(R([3, 0, -5, 0, 1])) - sage: E = EllipticCurve([K([-3,-4,1,1]),K([4,-1,-1,0]),K([-2,0,1,0]),K([-621,778,138,-178]),K([9509,2046,-24728,10380])]) - sage: Step4Test(E, 100, verbose=True) + sage: K. = NumberField(R([3, 0, -5, 0, 1])) # optional - sage.rings.number_field + sage: E = EllipticCurve([K([-3,-4,1,1]), K([4,-1,-1,0]), K([-2,0,1,0]), # optional - sage.rings.number_field + ....: K([-621,778,138,-178]), K([9509,2046,-24728,10380])]) + sage: Step4Test(E, 100, verbose=True) # optional - sage.rings.number_field No: inconsistency at the 2 ordinary primes dividing 13 - Frobenius discriminants mod squares: [-3, -1] (False, 13) @@ -438,8 +444,10 @@ def Step4Test(E, B, oldB=0, verbose=False): sage: from sage.schemes.elliptic_curves.Qcurves import Step4Test sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(R([-3, 0, 9, 0, -6, 0, 1])) - sage: E = EllipticCurve([K([1,-3,0,1,0,0]),K([5,-3,-6,1,1,0]),K([1,-3,0,1,0,0]),K([-139,-129,331,277,-76,-63]),K([2466,1898,-5916,-4582,1361,1055])]) + sage: K. = NumberField(R([-3, 0, 9, 0, -6, 0, 1])) # optional - sage.rings.number_field + sage: E = EllipticCurve([K([1,-3,0,1,0,0]), K([5,-3,-6,1,1,0]), + ....: K([1,-3,0,1,0,0]), K([-139,-129,331,277,-76,-63]), + ....: K([2466,1898,-5916,-4582,1361,1055])]) sage: Step4Test(E, 100, verbose=True) (True, 0) """ @@ -501,29 +509,29 @@ def conjugacy_test(jlist, verbose=False): sage: from sage.schemes.elliptic_curves.Qcurves import conjugacy_test sage: conjugacy_test([3]) [x - 3] - sage: K. = QuadraticField(2) - sage: conjugacy_test([K(3), a]) + sage: K. = QuadraticField(2) # optional - sage.rings.number_field + sage: conjugacy_test([K(3), a]) # optional - sage.rings.number_field [x - 3] - sage: conjugacy_test([K(3), 3+a]) + sage: conjugacy_test([K(3), 3 + a]) # optional - sage.rings.number_field [x - 3] - sage: conjugacy_test([3+a]) + sage: conjugacy_test([3 + a]) # optional - sage.rings.number_field [] - sage: conjugacy_test([3+a, 3-a]) + sage: conjugacy_test([3 + a, 3 - a]) # optional - sage.rings.number_field [x^2 - 6*x + 7] - sage: x = polygen(QQ) - sage: f = x^3-3 - sage: K. = f.splitting_field() - sage: js = f.roots(K, multiplicities=False) - sage: conjugacy_test(js) + sage: x = polygen(QQ) # optional - sage.rings.number_field + sage: f = x^3 - 3 + sage: K. = f.splitting_field() # optional - sage.rings.number_field + sage: js = f.roots(K, multiplicities=False) # optional - sage.rings.number_field + sage: conjugacy_test(js) # optional - sage.rings.number_field [] - sage: f = x^4-3 - sage: K. = NumberField(f) - sage: js = f.roots(K, multiplicities=False) - sage: conjugacy_test(js) + sage: f = x^4 - 3 # optional - sage.rings.number_field + sage: K. = NumberField(f) # optional - sage.rings.number_field + sage: js = f.roots(K, multiplicities=False) # optional - sage.rings.number_field + sage: conjugacy_test(js) # optional - sage.rings.number_field [] - sage: K. = f.splitting_field() - sage: js = f.roots(K, multiplicities=False) - sage: conjugacy_test(js) + sage: K. = f.splitting_field() # optional - sage.rings.number_field + sage: js = f.roots(K, multiplicities=False) # optional - sage.rings.number_field + sage: conjugacy_test(js) # optional - sage.rings.number_field [x^4 - 3] """ from sage.sets.set import Set diff --git a/src/sage/schemes/elliptic_curves/cardinality.py b/src/sage/schemes/elliptic_curves/cardinality.py index 345b0e761d4..d2f7f1daef8 100644 --- a/src/sage/schemes/elliptic_curves/cardinality.py +++ b/src/sage/schemes/elliptic_curves/cardinality.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.rings.finite_rings """ Specific algorithms to compute cardinality of elliptic curves over a finite field @@ -39,19 +40,22 @@ def _cardinality_with_j_invariant_1728(self): An example with q=p=1 (mod 4):: sage: F = GF(10009) - sage: [_cardinality_with_j_invariant_1728(EllipticCurve(F,[0,0,0,11^i,0])) for i in range(4)] + sage: [_cardinality_with_j_invariant_1728(EllipticCurve(F, [0,0,0,11^i,0])) + ....: for i in range(4)] [10016, 10210, 10004, 9810] An example with q=p=3 (mod 4):: sage: F = GF(10007) - sage: [_cardinality_with_j_invariant_1728(EllipticCurve(F,[0,0,0,5^i,0])) for i in range(4)] + sage: [_cardinality_with_j_invariant_1728(EllipticCurve(F, [0,0,0,5^i,0])) + ....: for i in range(4)] [10008, 10008, 10008, 10008] An example with `q=p^2`, p=3 (mod 4):: sage: F. = GF(10007^2,'a') - sage: [_cardinality_with_j_invariant_1728(EllipticCurve(F,[0,0,0,a^i,0])) for i in range(4)] + sage: [_cardinality_with_j_invariant_1728(EllipticCurve(F,[0,0,0,a^i,0])) + ....: for i in range(4)] [100160064, 100140050, 100120036, 100140050] Examples with `q=2^d`, d odd (3 isomorphism classes):: @@ -68,8 +72,9 @@ def _cardinality_with_j_invariant_1728(self): sage: F. = GF(2**16,'a') sage: b = a^11 # trace 1 - sage: ais = [[0,0,1,0,0],[0,0,1,0,b],[0,0,1,b,0],[0,0,a,0,0],[0,0,a,0,a^2*b],[0,0,a^2,0,0],[0,0,a^2,0,a^4*b]] - sage: curves = [EllipticCurve(F,ai) for ai in ais] + sage: ais = [[0,0,1,0,0], [0,0,1,0,b], [0,0,1,b,0], [0,0,a,0,0], + ....: [0,0,a,0,a^2*b], [0,0,a^2,0,0], [0,0,a^2,0,a^4*b]] + sage: curves = [EllipticCurve(F, ai) for ai in ais] sage: all((e1 == e2 or not e1.is_isomorphic(e2)) for e1 in curves for e2 in curves) True sage: [_cardinality_with_j_invariant_1728(e) for e in curves] @@ -79,8 +84,8 @@ def _cardinality_with_j_invariant_1728(self): sage: F. = GF(3**15,'a') sage: b = a^7 # has trace 1 - sage: ais = [[0,0,0,1,0],[0,0,0,-1,0],[0,0,0,-1,b],[0,0,0,-1,-b]] - sage: curves = [EllipticCurve(F,ai) for ai in ais] + sage: ais = [[0,0,0,1,0], [0,0,0,-1,0], [0,0,0,-1,b], [0,0,0,-1,-b]] + sage: curves = [EllipticCurve(F, ai) for ai in ais] sage: all((e1 == e2 or not e1.is_isomorphic(e2)) for e1 in curves for e2 in curves) True sage: [_cardinality_with_j_invariant_1728(e) for e in curves] @@ -91,8 +96,9 @@ def _cardinality_with_j_invariant_1728(self): sage: F. = GF(3^18,'g') sage: i = F(-1).sqrt() sage: a = g^8 # has trace 1 - sage: ais = [[0,0,0,1,0],[0,0,0,1,i*a],[0,0,0,g,0],[0,0,0,g^3,0],[0,0,0,g^2,0], [0,0,0,g^2,i*a*g^3]] - sage: curves = [EllipticCurve(F,ai) for ai in ais] + sage: ais = [[0,0,0,1,0], [0,0,0,1,i*a], [0,0,0,g,0], + ....: [0,0,0,g^3,0], [0,0,0,g^2,0], [0,0,0,g^2,i*a*g^3]] + sage: curves = [EllipticCurve(F, ai) for ai in ais] sage: all((e1 == e2 or not e1.is_isomorphic(e2)) for e1 in curves for e2 in curves) True sage: [_cardinality_with_j_invariant_1728(e) for e in curves] @@ -374,10 +380,10 @@ def cardinality_exhaustive(self): EXAMPLES:: sage: p = next_prime(10^3) - sage: E = EllipticCurve(GF(p),[3,4]) + sage: E = EllipticCurve(GF(p), [3,4]) sage: E.cardinality_exhaustive() 1020 - sage: E = EllipticCurve(GF(3^4,'a'),[1,1]) + sage: E = EllipticCurve(GF(3^4,'a'), [1,1]) sage: E.cardinality_exhaustive() 64 """ @@ -405,10 +411,10 @@ def cardinality_bsgs(self, verbose=False): EXAMPLES:: sage: p = next_prime(10^3) - sage: E = EllipticCurve(GF(p),[3,4]) + sage: E = EllipticCurve(GF(p), [3,4]) sage: E.cardinality_bsgs() 1020 - sage: E = EllipticCurve(GF(3^4,'a'),[1,1]) + sage: E = EllipticCurve(GF(3^4,'a'), [1,1]) sage: E.cardinality_bsgs() 64 sage: F. = GF(101^3,'a') @@ -543,7 +549,8 @@ def _cardinality_subfield(self, jpol): sage: from sage.schemes.elliptic_curves.cardinality import _cardinality_subfield sage: k. = GF(7^5) sage: E = EllipticCurve(k, [1,2,3,4,5]); E - Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Finite Field in a of size 7^5 + Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 + over Finite Field in a of size 7^5 sage: _cardinality_subfield(E, E.j_invariant().minimal_polynomial()) 17019 diff --git a/src/sage/schemes/elliptic_curves/cm.py b/src/sage/schemes/elliptic_curves/cm.py index 94b922a0365..ad65c21fe48 100644 --- a/src/sage/schemes/elliptic_curves/cm.py +++ b/src/sage/schemes/elliptic_curves/cm.py @@ -342,28 +342,29 @@ def cm_j_invariants(K, proof=None): EXAMPLES:: sage: cm_j_invariants(QQ) - [-262537412640768000, -147197952000, -884736000, -12288000, -884736, -32768, -3375, 0, 1728, 8000, 54000, 287496, 16581375] + [-262537412640768000, -147197952000, -884736000, -12288000, -884736, + -32768, -3375, 0, 1728, 8000, 54000, 287496, 16581375] Over imaginary quadratic fields there are no more than over `QQ`:: - sage: cm_j_invariants(QuadraticField(-1, 'i')) - [-262537412640768000, -147197952000, -884736000, -12288000, -884736, -32768, -3375, 0, 1728, 8000, 54000, 287496, 16581375] + sage: cm_j_invariants(QuadraticField(-1, 'i')) # optional - sage.rings.number_field + [-262537412640768000, -147197952000, -884736000, -12288000, -884736, + -32768, -3375, 0, 1728, 8000, 54000, 287496, 16581375] Over real quadratic fields there may be more, for example:: - sage: len(cm_j_invariants(QuadraticField(5, 'a'))) + sage: len(cm_j_invariants(QuadraticField(5, 'a'))) # optional - sage.rings.number_field 31 Over number fields K of many higher degrees this also works:: - sage: K. = NumberField(x^3 - 2) - sage: cm_j_invariants(K) - [-262537412640768000, -147197952000, -884736000, - -884736, -32768, 8000, -3375, 16581375, 1728, 287496, 0, - 54000, -12288000, + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: cm_j_invariants(K) # optional - sage.rings.number_field + [-262537412640768000, -147197952000, -884736000, -884736, -32768, + 8000, -3375, 16581375, 1728, 287496, 0, 54000, -12288000, 31710790944000*a^2 + 39953093016000*a + 50337742902000] - sage: K. = NumberField(x^4 - 2) - sage: len(cm_j_invariants(K)) + sage: K. = NumberField(x^4 - 2) # optional - sage.rings.number_field + sage: len(cm_j_invariants(K)) # optional - sage.rings.number_field 23 """ return sorted(j for D, f, j in cm_j_invariants_and_orders(K, proof=proof)) @@ -388,11 +389,14 @@ def cm_j_invariants_and_orders(K, proof=None): EXAMPLES:: sage: cm_j_invariants_and_orders(QQ) - [(-3, 3, -12288000), (-3, 2, 54000), (-3, 1, 0), (-4, 2, 287496), (-4, 1, 1728), (-7, 2, 16581375), (-7, 1, -3375), (-8, 1, 8000), (-11, 1, -32768), (-19, 1, -884736), (-43, 1, -884736000), (-67, 1, -147197952000), (-163, 1, -262537412640768000)] + [(-3, 3, -12288000), (-3, 2, 54000), (-3, 1, 0), (-4, 2, 287496), (-4, 1, 1728), + (-7, 2, 16581375), (-7, 1, -3375), (-8, 1, 8000), (-11, 1, -32768), + (-19, 1, -884736), (-43, 1, -884736000), (-67, 1, -147197952000), + (-163, 1, -262537412640768000)] Over an imaginary quadratic field there are no more than over `QQ`:: - sage: cm_j_invariants_and_orders(QuadraticField(-1, 'i')) + sage: cm_j_invariants_and_orders(QuadraticField(-1, 'i')) # optional - sage.rings.number_field [(-163, 1, -262537412640768000), (-67, 1, -147197952000), (-43, 1, -884736000), (-19, 1, -884736), (-11, 1, -32768), (-8, 1, 8000), (-7, 1, -3375), (-7, 2, 16581375), (-4, 1, 1728), @@ -400,17 +404,17 @@ def cm_j_invariants_and_orders(K, proof=None): Over real quadratic fields there may be more:: - sage: v = cm_j_invariants_and_orders(QuadraticField(5,'a')); len(v) + sage: v = cm_j_invariants_and_orders(QuadraticField(5,'a')); len(v) # optional - sage.rings.number_field 31 - sage: [(D, f) for D, f, j in v if j not in QQ] + sage: [(D, f) for D, f, j in v if j not in QQ] # optional - sage.rings.number_field [(-235, 1), (-235, 1), (-115, 1), (-115, 1), (-40, 1), (-40, 1), (-35, 1), (-35, 1), (-20, 1), (-20, 1), (-15, 1), (-15, 1), (-15, 2), (-15, 2), (-4, 5), (-4, 5), (-3, 5), (-3, 5)] Over number fields K of many higher degrees this also works:: - sage: K. = NumberField(x^3 - 2) - sage: cm_j_invariants_and_orders(K) + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: cm_j_invariants_and_orders(K) # optional - sage.rings.number_field [(-163, 1, -262537412640768000), (-67, 1, -147197952000), (-43, 1, -884736000), (-19, 1, -884736), (-11, 1, -32768), (-8, 1, 8000), (-7, 1, -3375), (-7, 2, 16581375), (-4, 1, 1728), @@ -466,11 +470,15 @@ def cm_orders(h, proof=None): sage: cm_orders(0) [] sage: v = cm_orders(1); v - [(-3, 1), (-3, 2), (-3, 3), (-4, 1), (-4, 2), (-7, 1), (-7, 2), (-8, 1), (-11, 1), (-19, 1), (-43, 1), (-67, 1), (-163, 1)] + [(-3, 1), (-3, 2), (-3, 3), (-4, 1), (-4, 2), (-7, 1), (-7, 2), (-8, 1), + (-11, 1), (-19, 1), (-43, 1), (-67, 1), (-163, 1)] sage: type(v[0][0]), type(v[0][1]) (<... 'sage.rings.integer.Integer'>, <... 'sage.rings.integer.Integer'>) sage: v = cm_orders(2); v - [(-3, 4), (-3, 5), (-3, 7), (-4, 3), (-4, 4), (-4, 5), (-7, 4), (-8, 2), (-8, 3), (-11, 3), (-15, 1), (-15, 2), (-20, 1), (-24, 1), (-35, 1), (-40, 1), (-51, 1), (-52, 1), (-88, 1), (-91, 1), (-115, 1), (-123, 1), (-148, 1), (-187, 1), (-232, 1), (-235, 1), (-267, 1), (-403, 1), (-427, 1)] + [(-3, 4), (-3, 5), (-3, 7), (-4, 3), (-4, 4), (-4, 5), (-7, 4), (-8, 2), + (-8, 3), (-11, 3), (-15, 1), (-15, 2), (-20, 1), (-24, 1), (-35, 1), + (-40, 1), (-51, 1), (-52, 1), (-88, 1), (-91, 1), (-115, 1), (-123, 1), + (-148, 1), (-187, 1), (-232, 1), (-235, 1), (-267, 1), (-403, 1), (-427, 1)] sage: len(v) 29 sage: set([hilbert_class_polynomial(D*f^2).degree() for D,f in v]) @@ -479,7 +487,10 @@ def cm_orders(h, proof=None): Any degree up to 100 is implemented, but may be slow:: sage: cm_orders(3) - [(-3, 6), (-3, 9), (-11, 2), (-19, 2), (-23, 1), (-23, 2), (-31, 1), (-31, 2), (-43, 2), (-59, 1), (-67, 2), (-83, 1), (-107, 1), (-139, 1), (-163, 2), (-211, 1), (-283, 1), (-307, 1), (-331, 1), (-379, 1), (-499, 1), (-547, 1), (-643, 1), (-883, 1), (-907, 1)] + [(-3, 6), (-3, 9), (-11, 2), (-19, 2), (-23, 1), (-23, 2), (-31, 1), (-31, 2), + (-43, 2), (-59, 1), (-67, 2), (-83, 1), (-107, 1), (-139, 1), (-163, 2), + (-211, 1), (-283, 1), (-307, 1), (-331, 1), (-379, 1), (-499, 1), (-547, 1), + (-643, 1), (-883, 1), (-907, 1)] sage: len(cm_orders(4)) 84 """ @@ -722,16 +733,24 @@ def discriminants_with_bounded_class_number(hmax, B=None, proof=None): EXAMPLES:: - sage: v = sage.schemes.elliptic_curves.cm.discriminants_with_bounded_class_number(3) + sage: from sage.schemes.elliptic_curves.cm import discriminants_with_bounded_class_number + sage: v = discriminants_with_bounded_class_number(3) sage: sorted(v) [1, 2, 3] sage: v[1] - [(-3, 1), (-3, 2), (-3, 3), (-4, 1), (-4, 2), (-7, 1), (-7, 2), (-8, 1), (-11, 1), (-19, 1), (-43, 1), (-67, 1), (-163, 1)] + [(-3, 1), (-3, 2), (-3, 3), (-4, 1), (-4, 2), (-7, 1), (-7, 2), (-8, 1), + (-11, 1), (-19, 1), (-43, 1), (-67, 1), (-163, 1)] sage: v[2] - [(-3, 4), (-3, 5), (-3, 7), (-4, 3), (-4, 4), (-4, 5), (-7, 4), (-8, 2), (-8, 3), (-11, 3), (-15, 1), (-15, 2), (-20, 1), (-24, 1), (-35, 1), (-40, 1), (-51, 1), (-52, 1), (-88, 1), (-91, 1), (-115, 1), (-123, 1), (-148, 1), (-187, 1), (-232, 1), (-235, 1), (-267, 1), (-403, 1), (-427, 1)] + [(-3, 4), (-3, 5), (-3, 7), (-4, 3), (-4, 4), (-4, 5), (-7, 4), (-8, 2), + (-8, 3), (-11, 3), (-15, 1), (-15, 2), (-20, 1), (-24, 1), (-35, 1), (-40, 1), + (-51, 1), (-52, 1), (-88, 1), (-91, 1), (-115, 1), (-123, 1), (-148, 1), + (-187, 1), (-232, 1), (-235, 1), (-267, 1), (-403, 1), (-427, 1)] sage: v[3] - [(-3, 6), (-3, 9), (-11, 2), (-19, 2), (-23, 1), (-23, 2), (-31, 1), (-31, 2), (-43, 2), (-59, 1), (-67, 2), (-83, 1), (-107, 1), (-139, 1), (-163, 2), (-211, 1), (-283, 1), (-307, 1), (-331, 1), (-379, 1), (-499, 1), (-547, 1), (-643, 1), (-883, 1), (-907, 1)] - sage: v = sage.schemes.elliptic_curves.cm.discriminants_with_bounded_class_number(8, proof=False) + [(-3, 6), (-3, 9), (-11, 2), (-19, 2), (-23, 1), (-23, 2), (-31, 1), (-31, 2), + (-43, 2), (-59, 1), (-67, 2), (-83, 1), (-107, 1), (-139, 1), (-163, 2), + (-211, 1), (-283, 1), (-307, 1), (-331, 1), (-379, 1), (-499, 1), (-547, 1), + (-643, 1), (-883, 1), (-907, 1)] + sage: v = discriminants_with_bounded_class_number(8, proof=False) sage: sorted(len(v[h]) for h in v) [13, 25, 29, 29, 38, 84, 101, 208] @@ -896,11 +915,11 @@ def is_cm_j_invariant(j, algorithm='CremonaSutherland', method=None): sage: is_cm_j_invariant(8000) (True, (-8, 1)) - sage: K. = QuadraticField(5) - sage: is_cm_j_invariant(282880*a + 632000) + sage: K. = QuadraticField(5) # optional - sage.rings.number_field + sage: is_cm_j_invariant(282880*a + 632000) # optional - sage.rings.number_field (True, (-20, 1)) - sage: K. = NumberField(x^3 - 2) - sage: is_cm_j_invariant(31710790944000*a^2 + 39953093016000*a + 50337742902000) + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: is_cm_j_invariant(31710790944000*a^2 + 39953093016000*a + 50337742902000) # optional - sage.rings.number_field (True, (-3, 6)) An example of large degree. This is only possible using the default algorithm:: diff --git a/src/sage/schemes/elliptic_curves/constructor.py b/src/sage/schemes/elliptic_curves/constructor.py index fc8bd096142..dc58f557744 100644 --- a/src/sage/schemes/elliptic_curves/constructor.py +++ b/src/sage/schemes/elliptic_curves/constructor.py @@ -113,9 +113,9 @@ class EllipticCurveFactory(UniqueFactory): We create curves over a finite field as follows:: - sage: EllipticCurve([GF(5)(0),0,1,-1,0]) + sage: EllipticCurve([GF(5)(0),0,1,-1,0]) # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 + y = x^3 + 4*x over Finite Field of size 5 - sage: EllipticCurve(GF(5), [0, 0,1,-1,0]) + sage: EllipticCurve(GF(5), [0, 0,1,-1,0]) # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 + y = x^3 + 4*x over Finite Field of size 5 Elliptic curves over `\ZZ/N\ZZ` with `N` prime are of type @@ -156,14 +156,14 @@ class EllipticCurveFactory(UniqueFactory): sage: EllipticCurve(y^2 + y - ( x^3 + x - 9 )) Elliptic Curve defined by y^2 + y = x^3 + x - 9 over Rational Field - sage: R. = GF(5)[] - sage: EllipticCurve(x^3 + x^2 + 2 - y^2 - y*x) + sage: R. = GF(5)[] # optional - sage.rings.finite_rings + sage: EllipticCurve(x^3 + x^2 + 2 - y^2 - y*x) # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 + x*y = x^3 + x^2 + 2 over Finite Field of size 5 We can also create elliptic curves by giving a smooth plane cubic with a rational point:: sage: R3. = PolynomialRing(QQ,3) - sage: F = x^3+y^3+30*z^3 + sage: F = x^3 + y^3 + 30*z^3 sage: P = [1,-1,0] sage: EllipticCurve(F,P) Elliptic Curve defined by y^2 - 270*y = x^3 - 24300 over Rational Field @@ -175,13 +175,13 @@ class EllipticCurveFactory(UniqueFactory): 1728 '32a2' - sage: E = EllipticCurve(j=GF(5)(2)); E; E.j_invariant() + sage: E = EllipticCurve(j=GF(5)(2)); E; E.j_invariant() # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 5 2 See :trac:`6657` :: - sage: EllipticCurve(GF(144169),j=1728) + sage: EllipticCurve(GF(144169), j=1728) # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 144169 Elliptic curves over the same ring with the same Weierstrass @@ -215,7 +215,7 @@ class EllipticCurveFactory(UniqueFactory): since both `j` and `j-1728` have to be factored to compute the minimal twist (see :trac:`13100`):: - sage: E = EllipticCurve_from_j(2^256+1,minimal_twist=False) + sage: E = EllipticCurve_from_j(2^256+1, minimal_twist=False) sage: E.j_invariant() == 2^256+1 True @@ -228,66 +228,70 @@ class EllipticCurveFactory(UniqueFactory): We create a curve and a point over ``QQbar`` (see :trac:`6879`):: - sage: E = EllipticCurve(QQbar,[0,1]) - sage: E(0) + sage: E = EllipticCurve(QQbar, [0,1]) # optional - sage.rings.number_field + sage: E(0) # optional - sage.rings.number_field (0 : 1 : 0) - sage: E.base_field() + sage: E.base_field() # optional - sage.rings.number_field Algebraic Field - sage: E = EllipticCurve(RR,[1,2]); E; E.base_field() - Elliptic Curve defined by y^2 = x^3 + 1.00000000000000*x + 2.00000000000000 over Real Field with 53 bits of precision - Real Field with 53 bits of precision - sage: EllipticCurve(CC,[3,4]); E; E.base_field() - Elliptic Curve defined by y^2 = x^3 + 3.00000000000000*x + 4.00000000000000 over Complex Field with 53 bits of precision - Elliptic Curve defined by y^2 = x^3 + 1.00000000000000*x + 2.00000000000000 over Real Field with 53 bits of precision + sage: E = EllipticCurve(RR, [1,2]); E; E.base_field() + Elliptic Curve defined by y^2 = x^3 + 1.00000000000000*x + 2.00000000000000 + over Real Field with 53 bits of precision Real Field with 53 bits of precision - sage: E = EllipticCurve(QQbar,[5,6]); E; E.base_field() + sage: E = EllipticCurve(CC,[3,4]); E; E.base_field() + Elliptic Curve defined by y^2 = x^3 + 3.00000000000000*x + 4.00000000000000 + over Complex Field with 53 bits of precision + Complex Field with 53 bits of precision + sage: E = EllipticCurve(QQbar, [5,6]); E; E.base_field() # optional - sage.rings.number_field Elliptic Curve defined by y^2 = x^3 + 5*x + 6 over Algebraic Field Algebraic Field See :trac:`6657` :: - sage: EllipticCurve(3,j=1728) + sage: EllipticCurve(3, j=1728) Traceback (most recent call last): ... ValueError: First parameter (if present) must be a ring when j is specified - sage: EllipticCurve(GF(5),j=3/5) + sage: EllipticCurve(GF(5), j=3/5) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: First parameter must be a ring containing 3/5 If the universe of the coefficients is a general field, the object - constructed has type EllipticCurve_field. Otherwise it is - EllipticCurve_generic. See :trac:`9816` :: + constructed has type :class:`EllipticCurve_field`. Otherwise it is + :class:`EllipticCurve_generic`. See :trac:`9816` :: - sage: E = EllipticCurve([QQbar(1),3]); E + sage: E = EllipticCurve([QQbar(1), 3]); E # optional - sage.rings.number_field Elliptic Curve defined by y^2 = x^3 + x + 3 over Algebraic Field - sage: type(E) + sage: type(E) # optional - sage.rings.number_field - sage: E = EllipticCurve([RR(1),3]); E - Elliptic Curve defined by y^2 = x^3 + 1.00000000000000*x + 3.00000000000000 over Real Field with 53 bits of precision + sage: E = EllipticCurve([RR(1), 3]); E + Elliptic Curve defined by y^2 = x^3 + 1.00000000000000*x + 3.00000000000000 + over Real Field with 53 bits of precision sage: type(E) - sage: E = EllipticCurve([SR(i),i]); E + sage: E = EllipticCurve([SR(i),i]); E # optional - sage.symbolic Elliptic Curve defined by y^2 = x^3 + I*x + I over Symbolic Ring - sage: type(E) + sage: type(E) # optional - sage.symbolic - sage: E.category() + sage: E.category() # optional - sage.symbolic Category of schemes over Symbolic Ring - sage: SR in Fields() + sage: SR in Fields() # optional - sage.symbolic True sage: F = FractionField(PolynomialRing(QQ,'t')) sage: t = F.gen() sage: E = EllipticCurve([t,0]); E - Elliptic Curve defined by y^2 = x^3 + t*x over Fraction Field of Univariate Polynomial Ring in t over Rational Field + Elliptic Curve defined by y^2 = x^3 + t*x + over Fraction Field of Univariate Polynomial Ring in t over Rational Field sage: type(E) sage: E.category() - Category of schemes over Fraction Field of Univariate Polynomial Ring in t over Rational Field + Category of schemes over Fraction Field of Univariate Polynomial Ring in t + over Rational Field See :trac:`12517`:: @@ -819,7 +823,7 @@ def EllipticCurve_from_cubic(F, P=None, morphism=True): with Cremona label 27a1:: sage: R. = QQ[] - sage: cubic = x^3+y^3+z^3 + sage: cubic = x^3 + y^3 + z^3 sage: P = [1,-1,0] sage: E = EllipticCurve_from_cubic(cubic, P, morphism=False); E Elliptic Curve defined by y^2 - 9*y = x^3 - 27 over Rational Field @@ -834,7 +838,7 @@ def EllipticCurve_from_cubic(F, P=None, morphism=True): Selmer curve:: sage: R. = QQ[] - sage: cubic = a^3+b^3+60*c^3 + sage: cubic = a^3 + b^3 + 60*c^3 sage: P = [1,-1,0] sage: E = EllipticCurve_from_cubic(cubic, P, morphism=False); E Elliptic Curve defined by y^2 - 540*y = x^3 - 97200 over Rational Field @@ -865,8 +869,8 @@ def EllipticCurve_from_cubic(F, P=None, morphism=True): Scheme morphism: From: Elliptic Curve defined by y^2 + 2*x*y + 20*y = x^3 - x^2 - 20*x - 400/3 over Rational Field - To: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - a^3 + b^3 + 60*c^3 + To: Closed subscheme of Projective Space of dimension 2 over Rational Field + defined by: a^3 + b^3 + 60*c^3 Defn: Defined on coordinates by sending (x : y : z) to (x + y + 20*z : -x - y : -x) @@ -897,10 +901,19 @@ def EllipticCurve_from_cubic(F, P=None, morphism=True): sage: cubic = x^2*y + 4*x*y^2 + x^2*z + 8*x*y*z + 4*y^2*z + 9*x*z^2 + 9*y*z^2 sage: f = EllipticCurve_from_cubic(cubic, [1,-1,1], morphism=True); f Scheme morphism: - From: Projective Plane Curve over Rational Field defined by x^2*y + 4*x*y^2 + x^2*z + 8*x*y*z + 4*y^2*z + 9*x*z^2 + 9*y*z^2 - To: Elliptic Curve defined by y^2 + 7560/19*x*y + 552960000000/2352637*y = x^3 - 3445200/133*x^2 over Rational Field + From: Projective Plane Curve over Rational Field defined + by x^2*y + 4*x*y^2 + x^2*z + 8*x*y*z + 4*y^2*z + 9*x*z^2 + 9*y*z^2 + To: Elliptic Curve defined + by y^2 + 7560/19*x*y + 552960000000/2352637*y = x^3 - 3445200/133*x^2 + over Rational Field Defn: Defined on coordinates by sending (x : y : z) to - (2527/17280*x^2 + 133/2160*x*y + 133/108000*y^2 + 133/2880*x*z + 931/18000*y*z - 3857/48000*z^2 : -6859/288*x^2 + 323/36*x*y + 359/1800*y^2 + 551/48*x*z + 2813/300*y*z + 24389/800*z^2 : -2352637/99532800000*x^2 - 2352637/124416000000*x*y - 2352637/622080000000*y^2 + 2352637/82944000000*x*z + 2352637/207360000000*y*z - 2352637/276480000000*z^2) + (2527/17280*x^2 + 133/2160*x*y + 133/108000*y^2 + 133/2880*x*z + + 931/18000*y*z - 3857/48000*z^2 + : -6859/288*x^2 + 323/36*x*y + 359/1800*y^2 + 551/48*x*z + + 2813/300*y*z + 24389/800*z^2 + : -2352637/99532800000*x^2 - 2352637/124416000000*x*y + - 2352637/622080000000*y^2 + 2352637/82944000000*x*z + + 2352637/207360000000*y*z - 2352637/276480000000*z^2) Note that the morphism returned cannot be evaluated directly at the given point ``P=(1:-1:1)`` since the polynomials defining it @@ -951,7 +964,7 @@ def EllipticCurve_from_cubic(F, P=None, morphism=True): Weierstrass model:: sage: R. = QQ[] - sage: cubic = a^3+7*b^3+64*c^3 + sage: cubic = a^3 + 7*b^3 + 64*c^3 sage: P = [2,2,-1] sage: f = EllipticCurve_from_cubic(cubic, P, morphism=True) sage: E = f.codomain(); E @@ -989,7 +1002,7 @@ def EllipticCurve_from_cubic(F, P=None, morphism=True): and one will be used as a base point:: sage: R. = QQ[] - sage: cubic = x^3+y^3+z^3 + sage: cubic = x^3 + y^3 + z^3 sage: f = EllipticCurve_from_cubic(cubic, morphism=True) sage: f Scheme morphism: @@ -1001,7 +1014,7 @@ def EllipticCurve_from_cubic(F, P=None, morphism=True): An error will be raised if no point is given and there are no rational flexes:: sage: R. = QQ[] - sage: cubic = 3*x^3+4*y^3+5*z^3 + sage: cubic = 3*x^3 + 4*y^3 + 5*z^3 sage: EllipticCurve_from_cubic(cubic) Traceback (most recent call last): ... @@ -1009,37 +1022,45 @@ def EllipticCurve_from_cubic(F, P=None, morphism=True): An example over a finite field, using a flex:: - sage: K = GF(17) - sage: R. = K[] - sage: cubic = 2*x^3+3*y^3+4*z^3 - sage: EllipticCurve_from_cubic(cubic,[0,3,1]) + sage: K = GF(17) # optional - sage.rings.finite_rings + sage: R. = K[] # optional - sage.rings.finite_rings + sage: cubic = 2*x^3 + 3*y^3 + 4*z^3 # optional - sage.rings.finite_rings + sage: EllipticCurve_from_cubic(cubic, [0,3,1]) # optional - sage.rings.finite_rings Scheme morphism: - From: Projective Plane Curve over Finite Field of size 17 defined by 2*x^3 + 3*y^3 + 4*z^3 + From: Projective Plane Curve over Finite Field of size 17 + defined by 2*x^3 + 3*y^3 + 4*z^3 To: Elliptic Curve defined by y^2 + 16*y = x^3 + 11 over Finite Field of size 17 Defn: Defined on coordinates by sending (x : y : z) to (-x : 4*y : 4*y + 5*z) An example in characteristic 3:: - sage: K = GF(3) - sage: R. = K[] - sage: cubic = x^3+y^3+z^3+x*y*z - sage: EllipticCurve_from_cubic(cubic,[0,1,-1]) + sage: K = GF(3) # optional - sage.rings.finite_rings + sage: R. = K[] # optional - sage.rings.finite_rings + sage: cubic = x^3 + y^3 + z^3 + x*y*z # optional - sage.rings.finite_rings + sage: EllipticCurve_from_cubic(cubic, [0,1,-1]) # optional - sage.rings.finite_rings Scheme morphism: - From: Projective Plane Curve over Finite Field of size 3 defined by x^3 + y^3 + x*y*z + z^3 + From: Projective Plane Curve over Finite Field of size 3 + defined by x^3 + y^3 + x*y*z + z^3 To: Elliptic Curve defined by y^2 + x*y = x^3 + 1 over Finite Field of size 3 Defn: Defined on coordinates by sending (x : y : z) to (y + z : -y : x) An example over a number field, using a non-flex and where there are no rational flexes:: - sage: K. = QuadraticField(-3) - sage: R. = K[] - sage: cubic = 2*x^3+3*y^3+5*z^3 - sage: EllipticCurve_from_cubic(cubic,[1,1,-1]) + sage: K. = QuadraticField(-3) # optional - sage.rings.number_field + sage: R. = K[] # optional - sage.rings.number_field + sage: cubic = 2*x^3 + 3*y^3 + 5*z^3 # optional - sage.rings.number_field + sage: EllipticCurve_from_cubic(cubic, [1,1,-1]) # optional - sage.rings.number_field Scheme morphism: - From: Projective Plane Curve over Number Field in a with defining polynomial x^2 + 3 with a = 1.732050807568878?*I defined by 2*x^3 + 3*y^3 + 5*z^3 - To: Elliptic Curve defined by y^2 + 1754460/2053*x*y + 5226454388736000/8653002877*y = x^3 + (-652253285700/4214809)*x^2 over Number Field in a with defining polynomial x^2 + 3 with a = 1.732050807568878?*I + From: Projective Plane Curve over Number Field in a + with defining polynomial x^2 + 3 with a = 1.732050807568878?*I + defined by 2*x^3 + 3*y^3 + 5*z^3 + To: Elliptic Curve defined by + y^2 + 1754460/2053*x*y + 5226454388736000/8653002877*y + = x^3 + (-652253285700/4214809)*x^2 + over Number Field in a with defining polynomial x^2 + 3 + with a = 1.732050807568878?*I Defn: Defined on coordinates by sending (x : y : z) to (-16424/127575*x^2 - 231989/680400*x*y - 14371/64800*y^2 - 26689/81648*x*z - 10265/27216*y*z - 2053/163296*z^2 : 24496/315*x^2 + 119243/840*x*y + 4837/80*y^2 + 67259/504*x*z + 25507/168*y*z + 5135/1008*z^2 : 8653002877/2099914709760000*x^2 + 8653002877/699971569920000*x*y + 8653002877/933295426560000*y^2 + 8653002877/419982941952000*x*z + 8653002877/279988627968000*y*z + 8653002877/335986353561600*z^2) @@ -1047,8 +1068,8 @@ def EllipticCurve_from_cubic(F, P=None, morphism=True): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: cubic = x^3+t*y^3+(1+t)*z^3 - sage: EllipticCurve_from_cubic(cubic,[1,1,-1], morphism=False) + sage: cubic = x^3 + t*y^3 + (1+t)*z^3 + sage: EllipticCurve_from_cubic(cubic, [1,1,-1], morphism=False) Elliptic Curve defined by y^2 + ((162*t^6+486*t^5+810*t^4+810*t^3+486*t^2+162*t)/(t^6+12*t^5-3*t^4-20*t^3-3*t^2+12*t+1))*x*y + ((314928*t^14+4094064*t^13+23462136*t^12+78102144*t^11+167561379*t^10+243026001*t^9+243026001*t^8+167561379*t^7+78102144*t^6+23462136*t^5+4094064*t^4+314928*t^3)/(t^14+40*t^13+577*t^12+3524*t^11+8075*t^10+5288*t^9-8661*t^8-17688*t^7-8661*t^6+5288*t^5+8075*t^4+3524*t^3+577*t^2+40*t+1))*y = x^3 + ((2187*t^12+13122*t^11-17496*t^10-207765*t^9-516132*t^8-673596*t^7-516132*t^6-207765*t^5-17496*t^4+13122*t^3+2187*t^2)/(t^12+24*t^11+138*t^10-112*t^9-477*t^8+72*t^7+708*t^6+72*t^5-477*t^4-112*t^3+138*t^2+24*t+1))*x^2 over Rational function field in t over Rational Field TESTS: @@ -1059,8 +1080,10 @@ def EllipticCurve_from_cubic(F, P=None, morphism=True): sage: cubic = -3*x^2*y + 3*x*y^2 + 4*x^2*z + 4*y^2*z - 3*x*z^2 + 3*y*z^2 - 8*z^3 sage: EllipticCurve_from_cubic(cubic, (-4/5, 4/5, 3/5) ) Scheme morphism: - From: Projective Plane Curve over Rational Field defined by -3*x^2*y + 3*x*y^2 + 4*x^2*z + 4*y^2*z - 3*x*z^2 + 3*y*z^2 - 8*z^3 - To: Elliptic Curve defined by y^2 + 24*x*y + 3024*y = x^3 + 495*x^2 + 36288*x over Rational Field + From: Projective Plane Curve over Rational Field defined + by -3*x^2*y + 3*x*y^2 + 4*x^2*z + 4*y^2*z - 3*x*z^2 + 3*y*z^2 - 8*z^3 + To: Elliptic Curve defined by y^2 + 24*x*y + 3024*y = x^3 + 495*x^2 + 36288*x + over Rational Field Defn: Defined on coordinates by sending (x : y : z) to (-1/3*z : 3*x : -1/1008*x + 1/1008*y + 1/378*z) """ @@ -1233,13 +1256,13 @@ def tangent_at_smooth_point(C,P): sage: R. = QQ[] sage: from sage.schemes.elliptic_curves.constructor import tangent_at_smooth_point - sage: C = Curve(x^3+y^3+60*z^3) + sage: C = Curve(x^3 + y^3 + 60*z^3) sage: tangent_at_smooth_point(C, [1,-1,0]) x + y sage: K. = FunctionField(QQ) sage: R. = K[] - sage: C = Curve(x^3+2*y^3+3*z^3) + sage: C = Curve(x^3 + 2*y^3 + 3*z^3) sage: from sage.schemes.elliptic_curves.constructor import tangent_at_smooth_point sage: tangent_at_smooth_point(C,[1,1,-1]) 3*x + 6*y + 9*z @@ -1278,11 +1301,11 @@ def chord_and_tangent(F, P): sage: R. = QQ[] sage: from sage.schemes.elliptic_curves.constructor import chord_and_tangent - sage: F = x^3+y^3+60*z^3 + sage: F = x^3 + y^3 + 60*z^3 sage: chord_and_tangent(F, [1,-1,0]) (-1 : 1 : 0) - sage: F = x^3+7*y^3+64*z^3 + sage: F = x^3 + 7*y^3 + 64*z^3 sage: p0 = [2,2,-1] sage: p1 = chord_and_tangent(F, p0); p1 (5 : -3 : 1) @@ -1424,9 +1447,9 @@ def EllipticCurves_with_good_reduction_outside_S(S=[], proof=None, verbose=False sage: elist = EllipticCurves_with_good_reduction_outside_S([2]) sage: elist [Elliptic Curve defined by y^2 = x^3 + 4*x over Rational Field, - Elliptic Curve defined by y^2 = x^3 - x over Rational Field, - ... - Elliptic Curve defined by y^2 = x^3 - x^2 - 13*x + 21 over Rational Field] + Elliptic Curve defined by y^2 = x^3 - x over Rational Field, + ... + Elliptic Curve defined by y^2 = x^3 - x^2 - 13*x + 21 over Rational Field] sage: len(elist) 24 sage: ', '.join(e.label() for e in elist) @@ -1434,19 +1457,19 @@ def EllipticCurves_with_good_reduction_outside_S(S=[], proof=None, verbose=False Without ``Proof=False``, this example gives two warnings:: - sage: elist = EllipticCurves_with_good_reduction_outside_S([11],proof=False) # long time (14s on sage.math, 2011) - sage: len(elist) # long time + sage: elist = EllipticCurves_with_good_reduction_outside_S([11], proof=False) # long time (14s on sage.math, 2011) + sage: len(elist) # long time 12 - sage: ', '.join(e.label() for e in elist) # long time + sage: ', '.join(e.label() for e in elist) # long time '11a1, 11a2, 11a3, 121a1, 121a2, 121b1, 121b2, 121c1, 121c2, 121d1, 121d2, 121d3' - sage: elist = EllipticCurves_with_good_reduction_outside_S([2,3]) # long time (26s on sage.math, 2011) - sage: len(elist) # long time + sage: elist = EllipticCurves_with_good_reduction_outside_S([2,3]) # long time (26s on sage.math, 2011) + sage: len(elist) # long time 752 - sage: conds = sorted(set([e.conductor() for e in elist])) # long time - sage: max(conds) # long time + sage: conds = sorted(set([e.conductor() for e in elist])) # long time + sage: max(conds) # long time 62208 - sage: [N.factor() for N in conds] # long time + sage: [N.factor() for N in conds] # long time [2^3 * 3, 3^3, 2^5, diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index 213ac83d73b..98c6f7ec224 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -13,20 +13,20 @@ The usual way to create and work with isogenies is illustrated with the following example:: - sage: k = GF(11) - sage: E = EllipticCurve(k,[1,1]) - sage: Q = E(6,5) - sage: phi = E.isogeny(Q) - sage: phi + sage: k = GF(11) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(k, [1,1]) # optional - sage.rings.finite_rings + sage: Q = E(6,5) # optional - sage.rings.finite_rings + sage: phi = E.isogeny(Q) # optional - sage.rings.finite_rings + sage: phi # optional - sage.rings.finite_rings Isogeny of degree 7 from Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 11 to Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 11 - sage: P = E(4,5) - sage: phi(P) + sage: P = E(4,5) # optional - sage.rings.finite_rings + sage: phi(P) # optional - sage.rings.finite_rings (10 : 0 : 1) - sage: phi.codomain() + sage: phi.codomain() # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 11 - sage: phi.rational_maps() + sage: phi.rational_maps() # optional - sage.rings.finite_rings ((x^7 + 4*x^6 - 3*x^5 - 2*x^4 - 3*x^3 + 3*x^2 + x - 2)/(x^6 + 4*x^5 - 4*x^4 - 5*x^3 + 5*x^2), (x^9*y - 5*x^8*y - x^7*y + x^5*y - x^4*y - 5*x^3*y - 5*x^2*y - 2*x*y - 5*y)/(x^9 - 5*x^8 + 4*x^6 - 3*x^4 + 2*x^3)) @@ -125,32 +125,32 @@ def _isogeny_determine_algorithm(E, kernel): This helper function will be implicitly called by the following examples:: - sage: R. = GF(5)[] - sage: E = EllipticCurve(GF(5), [0,0,0,1,0]) # indirect doctest + sage: R. = GF(5)[] # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(5), [0,0,0,1,0]) # indirect doctest # optional - sage.rings.finite_rings We can construct the same isogeny from a kernel polynomial:: - sage: phi = EllipticCurveIsogeny(E, x+3) # indirect doctest + sage: phi = EllipticCurveIsogeny(E, x + 3) # indirect doctest # optional - sage.rings.finite_rings or from a list of coefficients of a kernel polynomial:: - sage: phi == EllipticCurveIsogeny(E, [3,1]) # indirect doctest + sage: phi == EllipticCurveIsogeny(E, [3,1]) # indirect doctest # optional - sage.rings.finite_rings True or from a rational point which generates the kernel:: - sage: phi == EllipticCurveIsogeny(E, E((2,0))) # indirect doctest + sage: phi == EllipticCurveIsogeny(E, E((2,0))) # indirect doctest # optional - sage.rings.finite_rings True In the first two cases, Kohel's algorithm will be used, while in the third case it is Vélu:: sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import _isogeny_determine_algorithm - sage: _isogeny_determine_algorithm(E, x+3) + sage: _isogeny_determine_algorithm(E, x + 3) # optional - sage.rings.finite_rings 'kohel' - sage: _isogeny_determine_algorithm(E, [3, 1]) + sage: _isogeny_determine_algorithm(E, [3, 1]) # optional - sage.rings.finite_rings 'kohel' - sage: _isogeny_determine_algorithm(E, E((2,0))) + sage: _isogeny_determine_algorithm(E, E((2,0))) # optional - sage.rings.finite_rings 'velu' """ kernel_is_list = isinstance(kernel, list) @@ -192,32 +192,38 @@ def isogeny_codomain_from_kernel(E, kernel, degree=None): EXAMPLES:: sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import isogeny_codomain_from_kernel - sage: E = EllipticCurve(GF(7), [1,0,1,0,1]) - sage: R. = GF(7)[] - sage: isogeny_codomain_from_kernel(E, [4,1]) - Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + 6 over Finite Field of size 7 - sage: EllipticCurveIsogeny(E, [4,1]).codomain() == isogeny_codomain_from_kernel(E, [4,1]) + sage: E = EllipticCurve(GF(7), [1,0,1,0,1]) # optional - sage.rings.finite_rings + sage: R. = GF(7)[] # optional - sage.rings.finite_rings + sage: isogeny_codomain_from_kernel(E, [4,1]) # optional - sage.rings.finite_rings + Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + 6 + over Finite Field of size 7 + sage: (EllipticCurveIsogeny(E, [4,1]).codomain() # optional - sage.rings.finite_rings + ....: == isogeny_codomain_from_kernel(E, [4,1])) True - sage: isogeny_codomain_from_kernel(E, x^3 + x^2 + 4*x + 3) - Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + 6 over Finite Field of size 7 - sage: isogeny_codomain_from_kernel(E, x^3 + 2*x^2 + 4*x + 3) - Elliptic Curve defined by y^2 + x*y + y = x^3 + 5*x + 2 over Finite Field of size 7 - - sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) - sage: kernel_list = [E((15,10)), E((10,3)), E((6,5))] - sage: isogeny_codomain_from_kernel(E, kernel_list) - Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 3*x + 15 over Finite Field of size 19 + sage: isogeny_codomain_from_kernel(E, x^3 + x^2 + 4*x + 3) # optional - sage.rings.finite_rings + Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + 6 + over Finite Field of size 7 + sage: isogeny_codomain_from_kernel(E, x^3 + 2*x^2 + 4*x + 3) # optional - sage.rings.finite_rings + Elliptic Curve defined by y^2 + x*y + y = x^3 + 5*x + 2 + over Finite Field of size 7 + + sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) # optional - sage.rings.finite_rings + sage: kernel_list = [E((15,10)), E((10,3)), E((6,5))] # optional - sage.rings.finite_rings + sage: isogeny_codomain_from_kernel(E, kernel_list) # optional - sage.rings.finite_rings + Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 3*x + 15 + over Finite Field of size 19 TESTS: Test deprecation warning for obsolete argument:: - sage: isogeny_codomain_from_kernel(E, kernel_list, degree=4) + sage: isogeny_codomain_from_kernel(E, kernel_list, degree=4) # optional - sage.rings.finite_rings doctest:warning ... DeprecationWarning: The "degree" argument to isogeny_codomain_from_kernel() does nothing and will be removed. ... - Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 3*x + 15 over Finite Field of size 19 + Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 3*x + 15 + over Finite Field of size 19 """ if degree is not None: from sage.misc.superseded import deprecation @@ -257,14 +263,15 @@ def compute_codomain_formula(E, v, w): This formula is used by every invocation of the :class:`EllipticCurveIsogeny` constructor:: - sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) - sage: phi = EllipticCurveIsogeny(E, E((1,2)) ) - sage: phi.codomain() - Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 9*x + 13 over Finite Field of size 19 + sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((1,2)) ) # optional - sage.rings.finite_rings + sage: phi.codomain() # optional - sage.rings.finite_rings + Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 9*x + 13 + over Finite Field of size 19 sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import compute_codomain_formula - sage: v = phi._EllipticCurveIsogeny__v - sage: w = phi._EllipticCurveIsogeny__w - sage: compute_codomain_formula(E, v, w) == phi.codomain() + sage: v = phi._EllipticCurveIsogeny__v # optional - sage.rings.finite_rings + sage: w = phi._EllipticCurveIsogeny__w # optional - sage.rings.finite_rings + sage: compute_codomain_formula(E, v, w) == phi.codomain() # optional - sage.rings.finite_rings True """ a1, a2, a3, a4, a6 = E.a_invariants() @@ -293,14 +300,18 @@ def compute_vw_kohel_even_deg1(x0, y0, a1, a2, a4): This function will be implicitly called by the following example:: - sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) - sage: phi = EllipticCurveIsogeny(E, [9,1]); phi - Isogeny of degree 2 from Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Finite Field of size 19 to Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 9*x + 8 over Finite Field of size 19 + sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, [9,1]); phi # optional - sage.rings.finite_rings + Isogeny of degree 2 + from Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 + over Finite Field of size 19 + to Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 9*x + 8 + over Finite Field of size 19 sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import compute_vw_kohel_even_deg1 - sage: a1,a2,a3,a4,a6 = E.a_invariants() - sage: x0 = -9 - sage: y0 = -(a1*x0 + a3)/2 - sage: compute_vw_kohel_even_deg1(x0, y0, a1, a2, a4) + sage: a1,a2,a3,a4,a6 = E.a_invariants() # optional - sage.rings.finite_rings + sage: x0 = -9 # optional - sage.rings.finite_rings + sage: y0 = -(a1*x0 + a3)/2 # optional - sage.rings.finite_rings + sage: compute_vw_kohel_even_deg1(x0, y0, a1, a2, a4) # optional - sage.rings.finite_rings (18, 9) """ v = 3*x0**2 + 2*a2*x0 + a4 - a1*y0 @@ -327,14 +338,18 @@ def compute_vw_kohel_even_deg3(b2, b4, s1, s2, s3): This function will be implicitly called by the following example:: - sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) - sage: R. = GF(19)[] - sage: phi = EllipticCurveIsogeny(E, x^3 + 7*x^2 + 15*x + 12); phi - Isogeny of degree 4 from Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Finite Field of size 19 to Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 3*x + 15 over Finite Field of size 19 + sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) # optional - sage.rings.finite_rings + sage: R. = GF(19)[] # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x^3 + 7*x^2 + 15*x + 12); phi # optional - sage.rings.finite_rings + Isogeny of degree 4 + from Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 + over Finite Field of size 19 + to Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 3*x + 15 + over Finite Field of size 19 sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import compute_vw_kohel_even_deg3 - sage: b2,b4 = E.b2(), E.b4() - sage: s1, s2, s3 = -7, 15, -12 - sage: compute_vw_kohel_even_deg3(b2, b4, s1, s2, s3) + sage: b2,b4 = E.b2(), E.b4() # optional - sage.rings.finite_rings + sage: s1, s2, s3 = -7, 15, -12 # optional - sage.rings.finite_rings + sage: compute_vw_kohel_even_deg3(b2, b4, s1, s2, s3) # optional - sage.rings.finite_rings (4, 7) """ temp1 = s1**2 - 2*s2 @@ -364,14 +379,18 @@ def compute_vw_kohel_odd(b2, b4, b6, s1, s2, s3, n): This function will be implicitly called by the following example:: - sage: E = EllipticCurve(GF(19), [18,17,16,15,14]) - sage: R. = GF(19)[] - sage: phi = EllipticCurveIsogeny(E, x^3 + 14*x^2 + 3*x + 11); phi - Isogeny of degree 7 from Elliptic Curve defined by y^2 + 18*x*y + 16*y = x^3 + 17*x^2 + 15*x + 14 over Finite Field of size 19 to Elliptic Curve defined by y^2 + 18*x*y + 16*y = x^3 + 17*x^2 + 18*x + 18 over Finite Field of size 19 + sage: E = EllipticCurve(GF(19), [18,17,16,15,14]) # optional - sage.rings.finite_rings + sage: R. = GF(19)[] # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x^3 + 14*x^2 + 3*x + 11); phi # optional - sage.rings.finite_rings + Isogeny of degree 7 + from Elliptic Curve defined by y^2 + 18*x*y + 16*y = x^3 + 17*x^2 + 15*x + 14 + over Finite Field of size 19 + to Elliptic Curve defined by y^2 + 18*x*y + 16*y = x^3 + 17*x^2 + 18*x + 18 + over Finite Field of size 19 sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import compute_vw_kohel_odd - sage: b2,b4,b6 = E.b2(), E.b4(), E.b6() - sage: s1,s2,s3 = -14,3,-11 - sage: compute_vw_kohel_odd(b2,b4,b6,s1,s2,s3,3) + sage: b2,b4,b6 = E.b2(), E.b4(), E.b6() # optional - sage.rings.finite_rings + sage: s1,s2,s3 = -14,3,-11 # optional - sage.rings.finite_rings + sage: compute_vw_kohel_odd(b2,b4,b6,s1,s2,s3,3) # optional - sage.rings.finite_rings (7, 1) """ v = 6*(s1**2 - 2*s2) + b2*s1 + n*b4 @@ -398,25 +417,28 @@ def compute_codomain_kohel(E, kernel): EXAMPLES:: sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import compute_codomain_kohel - sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) - sage: phi = EllipticCurveIsogeny(E, [9,1]) - sage: phi.codomain() == isogeny_codomain_from_kernel(E, [9,1]) + sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, [9,1]) # optional - sage.rings.finite_rings + sage: phi.codomain() == isogeny_codomain_from_kernel(E, [9,1]) # optional - sage.rings.finite_rings True - sage: compute_codomain_kohel(E, [9,1]) - Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 9*x + 8 over Finite Field of size 19 - sage: R. = GF(19)[] - sage: E = EllipticCurve(GF(19), [18,17,16,15,14]) - sage: phi = EllipticCurveIsogeny(E, x^3 + 14*x^2 + 3*x + 11) - sage: phi.codomain() == isogeny_codomain_from_kernel(E, x^3 + 14*x^2 + 3*x + 11) + sage: compute_codomain_kohel(E, [9,1]) # optional - sage.rings.finite_rings + Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 9*x + 8 + over Finite Field of size 19 + sage: R. = GF(19)[] # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(19), [18,17,16,15,14]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x^3 + 14*x^2 + 3*x + 11) # optional - sage.rings.finite_rings + sage: phi.codomain() == isogeny_codomain_from_kernel(E, x^3 + 14*x^2 + 3*x + 11) # optional - sage.rings.finite_rings True - sage: compute_codomain_kohel(E, x^3 + 14*x^2 + 3*x + 11) - Elliptic Curve defined by y^2 + 18*x*y + 16*y = x^3 + 17*x^2 + 18*x + 18 over Finite Field of size 19 - sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) - sage: phi = EllipticCurveIsogeny(E, x^3 + 7*x^2 + 15*x + 12) - sage: isogeny_codomain_from_kernel(E, x^3 + 7*x^2 + 15*x + 12) == phi.codomain() + sage: compute_codomain_kohel(E, x^3 + 14*x^2 + 3*x + 11) # optional - sage.rings.finite_rings + Elliptic Curve defined by y^2 + 18*x*y + 16*y = x^3 + 17*x^2 + 18*x + 18 + over Finite Field of size 19 + sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x^3 + 7*x^2 + 15*x + 12) # optional - sage.rings.finite_rings + sage: isogeny_codomain_from_kernel(E, x^3 + 7*x^2 + 15*x + 12) == phi.codomain() # optional - sage.rings.finite_rings True - sage: compute_codomain_kohel(E, x^3 + 7*x^2 + 15*x + 12) - Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 3*x + 15 over Finite Field of size 19 + sage: compute_codomain_kohel(E, x^3 + 7*x^2 + 15*x + 12) # optional - sage.rings.finite_rings + Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 3*x + 15 + over Finite Field of size 19 ALGORITHM: @@ -505,13 +527,13 @@ def two_torsion_part(E, psi): Every function that computes the kernel polynomial via Kohel's formulas will call this function:: - sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) - sage: R. = GF(19)[] - sage: phi = EllipticCurveIsogeny(E, x + 13) - sage: isogeny_codomain_from_kernel(E, x + 13) == phi.codomain() + sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) # optional - sage.rings.finite_rings + sage: R. = GF(19)[] # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x + 13) # optional - sage.rings.finite_rings + sage: isogeny_codomain_from_kernel(E, x + 13) == phi.codomain() # optional - sage.rings.finite_rings True sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import two_torsion_part - sage: two_torsion_part(E, x+13) + sage: two_torsion_part(E, x + 13) # optional - sage.rings.finite_rings x + 13 """ x = psi.parent().gen() # NB psi is univariate but could be constant @@ -588,91 +610,105 @@ class EllipticCurveIsogeny(EllipticCurveHom): A simple example of creating an isogeny of a field of small characteristic:: - sage: E = EllipticCurve(GF(7), [0,0,0,1,0]) - sage: phi = EllipticCurveIsogeny(E, E((0,0)) ); phi - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 7 to Elliptic Curve defined by y^2 = x^3 + 3*x over Finite Field of size 7 - sage: phi.degree() == 2 + sage: E = EllipticCurve(GF(7), [0,0,0,1,0]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0)) ); phi # optional - sage.rings.finite_rings + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 3*x over Finite Field of size 7 + sage: phi.degree() == 2 # optional - sage.rings.finite_rings True - sage: phi.kernel_polynomial() + sage: phi.kernel_polynomial() # optional - sage.rings.finite_rings x - sage: phi.rational_maps() + sage: phi.rational_maps() # optional - sage.rings.finite_rings ((x^2 + 1)/x, (x^2*y - y)/x^2) - sage: phi == loads(dumps(phi)) # known bug + sage: phi == loads(dumps(phi)) # known bug # optional - sage.rings.finite_rings True A more complicated example of a characteristic-2 field:: - sage: E = EllipticCurve(GF(2^4,'alpha'), [0,0,1,0,1]) - sage: P = E((1,1)) - sage: phi_v = EllipticCurveIsogeny(E, P); phi_v - Isogeny of degree 3 from Elliptic Curve defined by y^2 + y = x^3 + 1 over Finite Field in alpha of size 2^4 to Elliptic Curve defined by y^2 + y = x^3 over Finite Field in alpha of size 2^4 - sage: phi_ker_poly = phi_v.kernel_polynomial() - sage: phi_ker_poly + sage: E = EllipticCurve(GF(2^4,'alpha'), [0,0,1,0,1]) # optional - sage.rings.finite_rings + sage: P = E((1,1)) # optional - sage.rings.finite_rings + sage: phi_v = EllipticCurveIsogeny(E, P); phi_v # optional - sage.rings.finite_rings + Isogeny of degree 3 + from Elliptic Curve defined by y^2 + y = x^3 + 1 + over Finite Field in alpha of size 2^4 + to Elliptic Curve defined by y^2 + y = x^3 + over Finite Field in alpha of size 2^4 + sage: phi_ker_poly = phi_v.kernel_polynomial() # optional - sage.rings.finite_rings + sage: phi_ker_poly # optional - sage.rings.finite_rings x + 1 - sage: phi_k = EllipticCurveIsogeny(E, phi_ker_poly) - sage: phi_k == phi_v + sage: phi_k = EllipticCurveIsogeny(E, phi_ker_poly) # optional - sage.rings.finite_rings + sage: phi_k == phi_v # optional - sage.rings.finite_rings True - sage: phi_k.rational_maps() + sage: phi_k.rational_maps() # optional - sage.rings.finite_rings ((x^3 + x + 1)/(x^2 + 1), (x^3*y + x^2*y + x*y + x + y)/(x^3 + x^2 + x + 1)) - sage: phi_v.rational_maps() + sage: phi_v.rational_maps() # optional - sage.rings.finite_rings ((x^3 + x + 1)/(x^2 + 1), (x^3*y + x^2*y + x*y + x + y)/(x^3 + x^2 + x + 1)) - sage: phi_k.degree() == phi_v.degree() == 3 + sage: phi_k.degree() == phi_v.degree() == 3 # optional - sage.rings.finite_rings True - sage: phi_k.is_separable() + sage: phi_k.is_separable() # optional - sage.rings.finite_rings True - sage: phi_v(E(0)) + sage: phi_v(E(0)) # optional - sage.rings.finite_rings (0 : 1 : 0) - sage: alpha = E.base_field().gen() - sage: Q = E((0, alpha*(alpha + 1))) - sage: phi_v(Q) + sage: alpha = E.base_field().gen() # optional - sage.rings.finite_rings + sage: Q = E((0, alpha*(alpha + 1))) # optional - sage.rings.finite_rings + sage: phi_v(Q) # optional - sage.rings.finite_rings (1 : alpha^2 + alpha : 1) - sage: phi_v(P) == phi_k(P) + sage: phi_v(P) == phi_k(P) # optional - sage.rings.finite_rings True - sage: phi_k(P) == phi_v.codomain()(0) + sage: phi_k(P) == phi_v.codomain()(0) # optional - sage.rings.finite_rings True We can create an isogeny whose kernel equals the full 2-torsion:: - sage: E = EllipticCurve(GF((3,2)), [0,0,0,1,1]) - sage: ker_poly = E.division_polynomial(2) - sage: phi = EllipticCurveIsogeny(E, ker_poly); phi - Isogeny of degree 4 from Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field in z2 of size 3^2 to Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field in z2 of size 3^2 - sage: P1,P2,P3 = filter(bool, E(0).division_points(2)) - sage: phi(P1) + sage: E = EllipticCurve(GF((3,2)), [0,0,0,1,1]) # optional - sage.rings.finite_rings + sage: ker_poly = E.division_polynomial(2) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, ker_poly); phi # optional - sage.rings.finite_rings + Isogeny of degree 4 + from Elliptic Curve defined by y^2 = x^3 + x + 1 + over Finite Field in z2 of size 3^2 + to Elliptic Curve defined by y^2 = x^3 + x + 1 + over Finite Field in z2 of size 3^2 + sage: P1,P2,P3 = filter(bool, E(0).division_points(2)) # optional - sage.rings.finite_rings + sage: phi(P1) # optional - sage.rings.finite_rings (0 : 1 : 0) - sage: phi(P2) + sage: phi(P2) # optional - sage.rings.finite_rings (0 : 1 : 0) - sage: phi(P3) + sage: phi(P3) # optional - sage.rings.finite_rings (0 : 1 : 0) - sage: phi.degree() + sage: phi.degree() # optional - sage.rings.finite_rings 4 We can also create trivial isogenies with the trivial kernel:: - sage: E = EllipticCurve(GF(17), [11, 11, 4, 12, 10]) - sage: phi_v = EllipticCurveIsogeny(E, E(0)) - sage: phi_v.degree() + sage: E = EllipticCurve(GF(17), [11, 11, 4, 12, 10]) # optional - sage.rings.finite_rings + sage: phi_v = EllipticCurveIsogeny(E, E(0)) # optional - sage.rings.finite_rings + sage: phi_v.degree() # optional - sage.rings.finite_rings 1 - sage: phi_v.rational_maps() + sage: phi_v.rational_maps() # optional - sage.rings.finite_rings (x, y) - sage: E == phi_v.codomain() + sage: E == phi_v.codomain() # optional - sage.rings.finite_rings True - sage: P = E.random_point() - sage: phi_v(P) == P + sage: P = E.random_point() # optional - sage.rings.finite_rings + sage: phi_v(P) == P # optional - sage.rings.finite_rings True - sage: E = EllipticCurve(GF(31), [23, 1, 22, 7, 18]) - sage: phi_k = EllipticCurveIsogeny(E, [1]); phi_k - Isogeny of degree 1 from Elliptic Curve defined by y^2 + 23*x*y + 22*y = x^3 + x^2 + 7*x + 18 over Finite Field of size 31 to Elliptic Curve defined by y^2 + 23*x*y + 22*y = x^3 + x^2 + 7*x + 18 over Finite Field of size 31 - sage: phi_k.degree() + sage: E = EllipticCurve(GF(31), [23, 1, 22, 7, 18]) # optional - sage.rings.finite_rings + sage: phi_k = EllipticCurveIsogeny(E, [1]); phi_k # optional - sage.rings.finite_rings + Isogeny of degree 1 + from Elliptic Curve defined by y^2 + 23*x*y + 22*y = x^3 + x^2 + 7*x + 18 + over Finite Field of size 31 + to Elliptic Curve defined by y^2 + 23*x*y + 22*y = x^3 + x^2 + 7*x + 18 + over Finite Field of size 31 + sage: phi_k.degree() # optional - sage.rings.finite_rings 1 - sage: phi_k.rational_maps() + sage: phi_k.rational_maps() # optional - sage.rings.finite_rings (x, y) - sage: phi_k.codomain() == E + sage: phi_k.codomain() == E # optional - sage.rings.finite_rings True - sage: phi_k.kernel_polynomial() + sage: phi_k.kernel_polynomial() # optional - sage.rings.finite_rings 1 - sage: P = E.random_point(); P == phi_k(P) + sage: P = E.random_point(); P == phi_k(P) # optional - sage.rings.finite_rings True Vélu and Kohel also work in characteristic `0`:: @@ -680,7 +716,9 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: E = EllipticCurve(QQ, [0,0,0,3,4]) sage: P_list = E.torsion_points() sage: phi = EllipticCurveIsogeny(E, P_list); phi - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 3*x + 4 over Rational Field to Elliptic Curve defined by y^2 = x^3 - 27*x + 46 over Rational Field + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 3*x + 4 over Rational Field + to Elliptic Curve defined by y^2 = x^3 - 27*x + 46 over Rational Field sage: P = E((0,2)) sage: phi(P) (6 : -10 : 1) @@ -688,7 +726,9 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: phi_ker_poly x + 1 sage: phi_k = EllipticCurveIsogeny(E, phi_ker_poly); phi_k - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 3*x + 4 over Rational Field to Elliptic Curve defined by y^2 = x^3 - 27*x + 46 over Rational Field + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 3*x + 4 over Rational Field + to Elliptic Curve defined by y^2 = x^3 - 27*x + 46 over Rational Field sage: phi_k(P) == phi(P) True sage: phi_k == phi @@ -703,14 +743,18 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: E = EllipticCurve('11a1') sage: P_list = E.torsion_points() sage: phi_v = EllipticCurveIsogeny(E, P_list); phi_v - Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field + Isogeny of degree 5 + from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field sage: P = E((16,-61)) sage: phi_v(P) (0 : 1 : 0) sage: ker_poly = phi_v.kernel_polynomial(); ker_poly x^2 - 21*x + 80 sage: phi_k = EllipticCurveIsogeny(E, ker_poly); phi_k - Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field + Isogeny of degree 5 + from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field sage: phi_k == phi_v True sage: phi_v(P) == phi_k(P) @@ -723,29 +767,37 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: E = EllipticCurve('11a1') sage: P_list = E.torsion_points() - sage: K. = NumberField(x^3 - 2* x^2 - 40*x - 158) - sage: EK = E.change_ring(K) - sage: P_list = [EK(P) for P in P_list] - sage: phi_v = EllipticCurveIsogeny(EK, P_list); phi_v - Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in alpha with defining polynomial x^3 - 2*x^2 - 40*x - 158 to Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-7820)*x + (-263580) over Number Field in alpha with defining polynomial x^3 - 2*x^2 - 40*x - 158 - sage: P = EK((alpha/2,-1/2)) - sage: phi_v(P) + sage: K. = NumberField(x^3 - 2* x^2 - 40*x - 158) # optional - sage.rings.number_field + sage: EK = E.change_ring(K) # optional - sage.rings.number_field + sage: P_list = [EK(P) for P in P_list] # optional - sage.rings.number_field + sage: phi_v = EllipticCurveIsogeny(EK, P_list); phi_v # optional - sage.rings.number_field + Isogeny of degree 5 + from Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) + over Number Field in alpha with defining polynomial x^3 - 2*x^2 - 40*x - 158 + to Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-7820)*x + (-263580) + over Number Field in alpha with defining polynomial x^3 - 2*x^2 - 40*x - 158 + sage: P = EK((alpha/2,-1/2)) # optional - sage.rings.number_field + sage: phi_v(P) # optional - sage.rings.number_field (122/121*alpha^2 + 1633/242*alpha - 3920/121 : -1/2 : 1) - sage: ker_poly = phi_v.kernel_polynomial() - sage: ker_poly + sage: ker_poly = phi_v.kernel_polynomial() # optional - sage.rings.number_field + sage: ker_poly # optional - sage.rings.number_field x^2 - 21*x + 80 - sage: phi_k = EllipticCurveIsogeny(EK, ker_poly) - sage: phi_k - Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in alpha with defining polynomial x^3 - 2*x^2 - 40*x - 158 to Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-7820)*x + (-263580) over Number Field in alpha with defining polynomial x^3 - 2*x^2 - 40*x - 158 - sage: phi_v == phi_k + sage: phi_k = EllipticCurveIsogeny(EK, ker_poly) # optional - sage.rings.number_field + sage: phi_k # optional - sage.rings.number_field + Isogeny of degree 5 + from Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) + over Number Field in alpha with defining polynomial x^3 - 2*x^2 - 40*x - 158 + to Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-7820)*x + (-263580) + over Number Field in alpha with defining polynomial x^3 - 2*x^2 - 40*x - 158 + sage: phi_v == phi_k # optional - sage.rings.number_field True - sage: phi_k(P) == phi_v(P) + sage: phi_k(P) == phi_v(P) # optional - sage.rings.number_field True - sage: phi_k == phi_v + sage: phi_k == phi_v # optional - sage.rings.number_field True - sage: phi_k.degree() + sage: phi_k.degree() # optional - sage.rings.number_field 5 - sage: phi_v.is_separable() + sage: phi_v.is_separable() # optional - sage.rings.number_field True The following example shows how to specify an isogeny from domain @@ -758,7 +810,9 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: E2 = phi.codomain() sage: phi_s = EllipticCurveIsogeny(E, None, E2, 5) sage: phi_s - Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field + Isogeny of degree 5 + from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field sage: phi_s == phi True sage: phi_s.rational_maps() == phi.rational_maps() @@ -779,24 +833,28 @@ class EllipticCurveIsogeny(EllipticCurveHom): ... ValueError: the two curves are not linked by a cyclic normalized isogeny of degree 5 sage: phihat = phi.dual(); phihat - Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Isogeny of degree 5 + from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 + over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: phihat.is_normalized() False Here an example of a construction of a endomorphisms with cyclic kernel on a CM-curve:: - sage: K. = NumberField(x^2+1) - sage: E = EllipticCurve(K, [1,0]) - sage: RK. = K[] - sage: f = X^2 - 2/5*i + 1/5 - sage: phi= E.isogeny(f) - sage: isom = phi.codomain().isomorphism_to(E) - sage: phi = isom * phi - sage: phi.codomain() == phi.domain() + sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [1,0]) # optional - sage.rings.number_field + sage: RK. = K[] # optional - sage.rings.number_field + sage: f = X^2 - 2/5*i + 1/5 # optional - sage.rings.number_field + sage: phi= E.isogeny(f) # optional - sage.rings.number_field + sage: isom = phi.codomain().isomorphism_to(E) # optional - sage.rings.number_field + sage: phi = isom * phi # optional - sage.rings.number_field + sage: phi.codomain() == phi.domain() # optional - sage.rings.number_field True - sage: phi.rational_maps() - (((4/25*i + 3/25)*x^5 + (4/5*i - 2/5)*x^3 - x)/(x^4 + (-4/5*i + 2/5)*x^2 + (-4/25*i - 3/25)), ((11/125*i + 2/125)*x^6*y + (-23/125*i + 64/125)*x^4*y + (141/125*i + 162/125)*x^2*y + (3/25*i - 4/25)*y)/(x^6 + (-6/5*i + 3/5)*x^4 + (-12/25*i - 9/25)*x^2 + (2/125*i - 11/125))) + sage: phi.rational_maps() # optional - sage.rings.number_field + (((4/25*i + 3/25)*x^5 + (4/5*i - 2/5)*x^3 - x)/(x^4 + (-4/5*i + 2/5)*x^2 + (-4/25*i - 3/25)), + ((11/125*i + 2/125)*x^6*y + (-23/125*i + 64/125)*x^4*y + (141/125*i + 162/125)*x^2*y + (3/25*i - 4/25)*y)/(x^6 + (-6/5*i + 3/5)*x^4 + (-12/25*i - 9/25)*x^2 + (2/125*i - 11/125))) TESTS: @@ -809,19 +867,21 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: phi.codomain() Elliptic Curve defined by y^2 = x^3 - 4*x over Rational Field - sage: E = EllipticCurve(GF(31), [1,0,0,1,2]) - sage: phi = EllipticCurveIsogeny(E, [17, 1]) - sage: phi.domain() + sage: E = EllipticCurve(GF(31), [1,0,0,1,2]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, [17, 1]) # optional - sage.rings.finite_rings + sage: phi.domain() # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 + x*y = x^3 + x + 2 over Finite Field of size 31 - sage: phi.codomain() + sage: phi.codomain() # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 + x*y = x^3 + 24*x + 6 over Finite Field of size 31 Composition tests (see :trac:`16245`, cf. :trac:`34410`):: - sage: E = EllipticCurve(j=GF(7)(0)) - sage: phi = E.isogeny([E(0), E((0,1)), E((0,-1))]); phi - Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 7 to Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 7 - sage: phi2 = phi * phi; phi2 + sage: E = EllipticCurve(j=GF(7)(0)) # optional - sage.rings.finite_rings + sage: phi = E.isogeny([E(0), E((0,1)), E((0,-1))]); phi # optional - sage.rings.finite_rings + Isogeny of degree 3 + from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 7 + sage: phi2 = phi * phi; phi2 # optional - sage.rings.finite_rings Composite morphism of degree 9 = 3^2: From: Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 7 To: Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 7 @@ -829,15 +889,15 @@ class EllipticCurveIsogeny(EllipticCurveHom): Examples over relative number fields used not to work (see :trac:`16779`):: sage: pol26 = hilbert_class_polynomial(-4*26) - sage: pol = NumberField(pol26,'a').optimized_representation()[0].polynomial() - sage: K. = NumberField(pol) - sage: j = pol26.roots(K)[0][0] - sage: E = EllipticCurve(j=j) - sage: L. = K.extension(x^2+26) - sage: EL = E.change_ring(L) - sage: iso2 = EL.isogenies_prime_degree(2); len(iso2) + sage: pol = NumberField(pol26,'a').optimized_representation()[0].polynomial() # optional - sage.rings.number_field + sage: K. = NumberField(pol) # optional - sage.rings.number_field + sage: j = pol26.roots(K)[0][0] # optional - sage.rings.number_field + sage: E = EllipticCurve(j=j) # optional - sage.rings.number_field + sage: L. = K.extension(x^2 + 26) # optional - sage.rings.number_field + sage: EL = E.change_ring(L) # optional - sage.rings.number_field + sage: iso2 = EL.isogenies_prime_degree(2); len(iso2) # optional - sage.rings.number_field 1 - sage: iso3 = EL.isogenies_prime_degree(3); len(iso3) + sage: iso3 = EL.isogenies_prime_degree(3); len(iso3) # optional - sage.rings.number_field 2 Examples over function fields used not to work (see :trac:`11327`):: @@ -846,16 +906,28 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: E = EllipticCurve([0,0,0,-t^2,0]) sage: isogs = E.isogenies_prime_degree(2) sage: isogs[0] - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + (-t^2)*x over Rational function field in t over Rational Field to Elliptic Curve defined by y^2 = x^3 + 4*t^2*x over Rational function field in t over Rational Field + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + (-t^2)*x + over Rational function field in t over Rational Field + to Elliptic Curve defined by y^2 = x^3 + 4*t^2*x + over Rational function field in t over Rational Field sage: isogs[0].rational_maps() ((x^2 - t^2)/x, (x^2*y + t^2*y)/x^2) sage: duals = [phi.dual() for phi in isogs] sage: duals[0] - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 4*t^2*x over Rational function field in t over Rational Field to Elliptic Curve defined by y^2 = x^3 + (-t^2)*x over Rational function field in t over Rational Field + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 4*t^2*x + over Rational function field in t over Rational Field + to Elliptic Curve defined by y^2 = x^3 + (-t^2)*x + over Rational function field in t over Rational Field sage: duals[0].rational_maps() ((1/4*x^2 + t^2)/x, (1/8*x^2*y + (-1/2*t^2)*y)/x^2) sage: duals[0] - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 4*t^2*x over Rational function field in t over Rational Field to Elliptic Curve defined by y^2 = x^3 + (-t^2)*x over Rational function field in t over Rational Field + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 4*t^2*x + over Rational function field in t over Rational Field + to Elliptic Curve defined by y^2 = x^3 + (-t^2)*x + over Rational function field in t over Rational Field """ #################### @@ -944,29 +1016,43 @@ def __init__(self, E, kernel, codomain=None, degree=None, model=None, check=True EXAMPLES:: - sage: E = EllipticCurve(GF(2), [0,0,1,0,1]) - sage: phi = EllipticCurveIsogeny(E, [1,1]); phi - Isogeny of degree 3 from Elliptic Curve defined by y^2 + y = x^3 + 1 over Finite Field of size 2 to Elliptic Curve defined by y^2 + y = x^3 over Finite Field of size 2 + sage: E = EllipticCurve(GF(2), [0,0,1,0,1]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, [1,1]); phi # optional - sage.rings.finite_rings + Isogeny of degree 3 + from Elliptic Curve defined by y^2 + y = x^3 + 1 over Finite Field of size 2 + to Elliptic Curve defined by y^2 + y = x^3 over Finite Field of size 2 - sage: E = EllipticCurve(GF(31), [0,0,0,1,0]) - sage: P = E((2,17)) - sage: phi = EllipticCurveIsogeny(E, P); phi - Isogeny of degree 8 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 31 to Elliptic Curve defined by y^2 = x^3 + 10*x + 28 over Finite Field of size 31 + sage: E = EllipticCurve(GF(31), [0,0,0,1,0]) # optional - sage.rings.finite_rings + sage: P = E((2,17)) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, P); phi # optional - sage.rings.finite_rings + Isogeny of degree 8 + from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 31 + to Elliptic Curve defined by y^2 = x^3 + 10*x + 28 over Finite Field of size 31 sage: E = EllipticCurve('17a1') sage: phi = EllipticCurveIsogeny(E, [41/3, -55, -1, -1, 1]); phi - Isogeny of degree 9 from Elliptic Curve defined by y^2 + x*y + y = x^3 - x^2 - x - 14 over Rational Field to Elliptic Curve defined by y^2 + x*y + y = x^3 - x^2 - 56*x - 10124 over Rational Field + Isogeny of degree 9 + from Elliptic Curve defined by y^2 + x*y + y = x^3 - x^2 - x - 14 + over Rational Field + to Elliptic Curve defined by y^2 + x*y + y = x^3 - x^2 - 56*x - 10124 + over Rational Field sage: E = EllipticCurve('37a1') sage: triv = EllipticCurveIsogeny(E, E(0)); triv - Isogeny of degree 1 from Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field to Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field + Isogeny of degree 1 + from Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field sage: triv.rational_maps() (x, y) sage: E = EllipticCurve('49a3') sage: R. = QQ[] - sage: EllipticCurveIsogeny(E, X^3-13*X^2-58*X+503, check=False) - Isogeny of degree 7 from Elliptic Curve defined by y^2 + x*y = x^3 - x^2 - 107*x + 552 over Rational Field to Elliptic Curve defined by y^2 + x*y = x^3 - x^2 - 5252*x - 178837 over Rational Field + sage: EllipticCurveIsogeny(E, X^3 - 13*X^2 - 58*X + 503, check=False) + Isogeny of degree 7 + from Elliptic Curve defined by y^2 + x*y = x^3 - x^2 - 107*x + 552 + over Rational Field + to Elliptic Curve defined by y^2 + x*y = x^3 - x^2 - 5252*x - 178837 + over Rational Field """ if not is_EllipticCurve(E): raise ValueError("given E is not an elliptic curve") @@ -1039,8 +1125,8 @@ def _eval(self, P): sage: E = EllipticCurve([1,0]); E Elliptic Curve defined by y^2 = x^3 + x over Rational Field sage: phi = E.isogeny(E(0,0)) - sage: P = E.change_ring(QQbar).lift_x(QQbar.random_element()) - sage: phi._eval(P).curve() + sage: P = E.change_ring(QQbar).lift_x(QQbar.random_element()) # optional - sage.rings.number_field + sage: phi._eval(P).curve() # optional - sage.rings.number_field Elliptic Curve defined by y^2 = x^3 + (-4)*x over Algebraic Field :: @@ -1048,8 +1134,8 @@ def _eval(self, P): sage: E = EllipticCurve(j=Mod(0,419)) sage: K = next(filter(bool, E(0).division_points(5))) sage: psi = E.isogeny(K) - sage: Ps = E.change_ring(GF(419**2))(0).division_points(5) - sage: {psi._eval(P).curve() for P in Ps} + sage: Ps = E.change_ring(GF(419**2))(0).division_points(5) # optional - sage.rings.number_field + sage: {psi._eval(P).curve() for P in Ps} # optional - sage.rings.number_field {Elliptic Curve defined by y^2 = x^3 + 140*x + 214 over Finite Field in z2 of size 419^2} """ if self._domain.defining_polynomial()(*P): @@ -1089,78 +1175,80 @@ def _call_(self, P): EXAMPLES:: - sage: E = EllipticCurve(GF(17), [1, 9, 5, 4, 3]) - sage: phi = EllipticCurveIsogeny(E, [6,13,1]) - sage: phi(E((1,0))) + sage: E = EllipticCurve(GF(17), [1, 9, 5, 4, 3]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, [6,13,1]) # optional - sage.rings.finite_rings + sage: phi(E((1,0))) # optional - sage.rings.finite_rings (15 : 13 : 1) - sage: E = EllipticCurve(GF(23), [0,0,0,1,0]) - sage: phi = EllipticCurveIsogeny(E, E((0,0))) - sage: phi(E((1,5))) + sage: E = EllipticCurve(GF(23), [0,0,0,1,0]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))) # optional - sage.rings.finite_rings + sage: phi(E((1,5))) # optional - sage.rings.finite_rings (2 : 0 : 1) - sage: E = EllipticCurve(QQ, [0,0,0,3,0]) - sage: P = E((1,2)) - sage: phi = EllipticCurveIsogeny(E, [0,1]) - sage: phi(P) + sage: E = EllipticCurve(QQ, [0,0,0,3,0]) # optional - sage.rings.finite_rings + sage: P = E((1,2)) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, [0,1]) # optional - sage.rings.finite_rings + sage: phi(P) # optional - sage.rings.finite_rings (4 : -4 : 1) - sage: phi(-P) + sage: phi(-P) # optional - sage.rings.finite_rings (4 : 4 : 1) - sage: E = EllipticCurve(GF(17), [0,-1,0,-3,-1]) - sage: Q = E((16,0)) - sage: tau = E.isogeny([Q], E) - sage: tau(Q) + sage: E = EllipticCurve(GF(17), [0,-1,0,-3,-1]) # optional - sage.rings.finite_rings + sage: Q = E((16,0)) # optional - sage.rings.finite_rings + sage: tau = E.isogeny([Q], E) # optional - sage.rings.finite_rings + sage: tau(Q) # optional - sage.rings.finite_rings (0 : 1 : 0) TESTS: Tests for :trac:`10888`:: - sage: K. = NumberField(x^2+3) - sage: E = EllipticCurve(K,[7,0]) - sage: phi = E.isogeny(E(0,0)) - sage: P = E(-3,4*th) - sage: phi(P) + sage: K. = NumberField(x^2 + 3) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [7,0]) # optional - sage.rings.number_field + sage: phi = E.isogeny(E(0,0)) # optional - sage.rings.number_field + sage: P = E(-3,4*th) # optional - sage.rings.number_field + sage: phi(P) # optional - sage.rings.number_field (-16/3 : 8/9*th : 1) - sage: Q = phi(P) - sage: phihat = phi.dual() - sage: phihat(Q) + sage: Q = phi(P) # optional - sage.rings.number_field + sage: phihat = phi.dual() # optional - sage.rings.number_field + sage: phihat(Q) # optional - sage.rings.number_field (-1/48 : 127/576*th : 1) Call a composed isogeny (added for :trac:`16238`):: - sage: E = EllipticCurve(j=GF(7)(0)) - sage: phi = E.isogeny([E(0), E((0,1)), E((0,-1))]) - sage: phi(E.points()[0]) + sage: E = EllipticCurve(j=GF(7)(0)) # optional - sage.rings.finite_rings + sage: phi = E.isogeny([E(0), E((0,1)), E((0,-1))]) # optional - sage.rings.finite_rings + sage: phi(E.points()[0]) # optional - sage.rings.finite_rings (0 : 1 : 0) - sage: phi2 = phi * phi - sage: phi2(E.points()[0]) + sage: phi2 = phi * phi # optional - sage.rings.finite_rings + sage: phi2(E.points()[0]) # optional - sage.rings.finite_rings (0 : 1 : 0) Coercion works fine with :meth:`_call_` (added for :trac:`16238`):: - sage: K. = NumberField(x^2+3) - sage: E = EllipticCurve(K,[7,0]) - sage: E2 = EllipticCurve(K,[5,0]) - sage: phi = E.isogeny(E(0)) - sage: phi(E2(0)) + sage: K. = NumberField(x^2 + 3) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [7,0]) # optional - sage.rings.number_field + sage: E2 = EllipticCurve(K, [5,0]) # optional - sage.rings.number_field + sage: phi = E.isogeny(E(0)) # optional - sage.rings.number_field + sage: phi(E2(0)) # optional - sage.rings.number_field (0 : 1 : 0) - sage: E2(20,90) + sage: E2(20,90) # optional - sage.rings.number_field (20 : 90 : 1) - sage: phi(E2(20,90)) + sage: phi(E2(20,90)) # optional - sage.rings.number_field Traceback (most recent call last): ... - TypeError: (20 : 90 : 1) fails to convert into the map's domain Elliptic Curve defined by y^2 = x^3 + 7*x over Number Field in th with defining polynomial x^2 + 3, but a `pushforward` method is not properly implemented + TypeError: (20 : 90 : 1) fails to convert into the map's domain + Elliptic Curve defined by y^2 = x^3 + 7*x over Number Field in th with defining polynomial x^2 + 3, + but a `pushforward` method is not properly implemented Check that copying the order over works:: - sage: E = EllipticCurve(GF(431), [1,0]) - sage: P, = E.gens() - sage: Q = 2^99*P; Q.order() + sage: E = EllipticCurve(GF(431), [1,0]) # optional - sage.rings.finite_rings + sage: P, = E.gens() # optional - sage.rings.finite_rings + sage: Q = 2^99*P; Q.order() # optional - sage.rings.finite_rings 27 - sage: phi = E.isogeny(3^99*P) - sage: phi(Q)._order + sage: phi = E.isogeny(3^99*P) # optional - sage.rings.finite_rings + sage: phi(Q)._order # optional - sage.rings.finite_rings 27 """ if P.is_zero(): @@ -1224,11 +1312,11 @@ def __getitem__(self, i): sage: phi[1] y - sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) - sage: phi = EllipticCurveIsogeny(E, E((0,0))) - sage: phi[0] + sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))) # optional - sage.rings.finite_rings + sage: phi[0] # optional - sage.rings.finite_rings (x^2 + 3)/x - sage: phi[1] + sage: phi[1] # optional - sage.rings.finite_rings (x^2*y - 3*y)/x^2 """ return self.rational_maps()[i] @@ -1245,9 +1333,9 @@ def __iter__(self): x y - sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) - sage: phi = EllipticCurveIsogeny(E, E((0,0))) - sage: for c in phi: print(c) + sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))) # optional - sage.rings.finite_rings + sage: for c in phi: print(c) # optional - sage.rings.finite_rings (x^2 + 3)/x (x^2*y - 3*y)/x^2 """ @@ -1263,19 +1351,19 @@ def __neg__(self): The following examples inherently exercise this function:: - sage: E = EllipticCurve(j=GF(17)(0)) - sage: phi = EllipticCurveIsogeny(E, E((-1,0)) ) - sage: negphi = -phi - sage: phi(E((0,1))) + negphi(E((0,1))) == 0 + sage: E = EllipticCurve(j=GF(17)(0)) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((-1,0)) ) # optional - sage.rings.finite_rings + sage: negphi = -phi # optional - sage.rings.finite_rings + sage: phi(E((0,1))) + negphi(E((0,1))) == 0 # optional - sage.rings.finite_rings True - sage: E = EllipticCurve(j=GF(19)(1728)) - sage: R. = GF(19)[] - sage: phi = EllipticCurveIsogeny(E, x) - sage: negphi = -phi - sage: phi(E((3,7))) + negphi(E((3,12))) == phi(2*E((3,7))) + sage: E = EllipticCurve(j=GF(19)(1728)) # optional - sage.rings.finite_rings + sage: R. = GF(19)[] # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x) # optional - sage.rings.finite_rings + sage: negphi = -phi # optional - sage.rings.finite_rings + sage: phi(E((3,7))) + negphi(E((3,12))) == phi(2*E((3,7))) # optional - sage.rings.finite_rings True - sage: negphi(E((18,6))) + sage: negphi(E((18,6))) # optional - sage.rings.finite_rings (17 : 0 : 1) sage: R. = QQ[] @@ -1290,27 +1378,31 @@ def __neg__(self): sage: phi(P) + negphi(P) == 0 True - sage: E = EllipticCurve(GF(23), [0,0,0,1,0]) - sage: f = E.torsion_polynomial(3)/3 - sage: phi = EllipticCurveIsogeny(E, f, E) - sage: phi.rational_maps() == E.multiplication_by_m(3) + sage: E = EllipticCurve(GF(23), [0,0,0,1,0]) # optional - sage.rings.finite_rings + sage: f = E.torsion_polynomial(3)/3 # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f, E) # optional - sage.rings.finite_rings + sage: phi.rational_maps() == E.multiplication_by_m(3) # optional - sage.rings.finite_rings False - sage: negphi = -phi - sage: negphi.rational_maps() == E.multiplication_by_m(3) + sage: negphi = -phi # optional - sage.rings.finite_rings + sage: negphi.rational_maps() == E.multiplication_by_m(3) # optional - sage.rings.finite_rings True - sage: E = EllipticCurve(GF(17), [-2, 3, -5, 7, -11]) - sage: R. = GF(17)[] - sage: f = x+6 - sage: phi = EllipticCurveIsogeny(E, f) - sage: phi - Isogeny of degree 2 from Elliptic Curve defined by y^2 + 15*x*y + 12*y = x^3 + 3*x^2 + 7*x + 6 over Finite Field of size 17 to Elliptic Curve defined by y^2 + 15*x*y + 12*y = x^3 + 3*x^2 + 4*x + 8 over Finite Field of size 17 - sage: phi.rational_maps() + sage: E = EllipticCurve(GF(17), [-2, 3, -5, 7, -11]) # optional - sage.rings.finite_rings + sage: R. = GF(17)[] # optional - sage.rings.finite_rings + sage: f = x+6 # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # optional - sage.rings.finite_rings + sage: phi # optional - sage.rings.finite_rings + Isogeny of degree 2 + from Elliptic Curve defined by y^2 + 15*x*y + 12*y = x^3 + 3*x^2 + 7*x + 6 over Finite Field of size 17 + to Elliptic Curve defined by y^2 + 15*x*y + 12*y = x^3 + 3*x^2 + 4*x + 8 over Finite Field of size 17 + sage: phi.rational_maps() # optional - sage.rings.finite_rings ((x^2 + 6*x + 4)/(x + 6), (x^2*y - 5*x*y + 8*x - 2*y)/(x^2 - 5*x + 2)) - sage: negphi = -phi - sage: negphi - Isogeny of degree 2 from Elliptic Curve defined by y^2 + 15*x*y + 12*y = x^3 + 3*x^2 + 7*x + 6 over Finite Field of size 17 to Elliptic Curve defined by y^2 + 15*x*y + 12*y = x^3 + 3*x^2 + 4*x + 8 over Finite Field of size 17 - sage: negphi.rational_maps() + sage: negphi = -phi # optional - sage.rings.finite_rings + sage: negphi # optional - sage.rings.finite_rings + Isogeny of degree 2 + from Elliptic Curve defined by y^2 + 15*x*y + 12*y = x^3 + 3*x^2 + 7*x + 6 over Finite Field of size 17 + to Elliptic Curve defined by y^2 + 15*x*y + 12*y = x^3 + 3*x^2 + 4*x + 8 over Finite Field of size 17 + sage: negphi.rational_maps() # optional - sage.rings.finite_rings ((x^2 + 6*x + 4)/(x + 6), (2*x^3 - x^2*y - 5*x^2 + 5*x*y - 4*x + 2*y + 7)/(x^2 - 5*x + 2)) @@ -1326,14 +1418,14 @@ def __neg__(self): sage: ymap1 == -ymap2 - E.a1()*xmap2 - E.a3() True - sage: K. = NumberField(x^2 + 1) - sage: E = EllipticCurve(K, [0,0,0,1,0]) - sage: R. = K[] - sage: phi = EllipticCurveIsogeny(E, x-a) - sage: phi.rational_maps() + sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,0,1,0]) # optional - sage.rings.number_field + sage: R. = K[] # optional - sage.rings.number_field + sage: phi = EllipticCurveIsogeny(E, x - a) # optional - sage.rings.number_field + sage: phi.rational_maps() # optional - sage.rings.number_field ((x^2 + (-a)*x - 2)/(x + (-a)), (x^2*y + (-2*a)*x*y + y)/(x^2 + (-2*a)*x - 1)) - sage: negphi = -phi - sage: negphi.rational_maps() + sage: negphi = -phi # optional - sage.rings.number_field + sage: negphi.rational_maps() # optional - sage.rings.number_field ((x^2 + (-a)*x - 2)/(x + (-a)), (-x^2*y + (2*a)*x*y - y)/(x^2 + (-2*a)*x - 1)) """ output = copy(self) @@ -1350,9 +1442,9 @@ def _repr_(self): EXAMPLES:: - sage: E = EllipticCurve(GF(31), [1,0,1,1,0]) - sage: phi = EllipticCurveIsogeny(E, E((0,0)) ) - sage: phi._repr_() + sage: E = EllipticCurve(GF(31), [1,0,1,1,0]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0)) ) # optional - sage.rings.finite_rings + sage: phi._repr_() # optional - sage.rings.finite_rings 'Isogeny of degree 17 from Elliptic Curve defined by y^2 + x*y + y = x^3 + x over Finite Field of size 31 to Elliptic Curve defined by y^2 + x*y + y = x^3 + 14*x + 9 over Finite Field of size 31' sage: E = EllipticCurve(QQ, [1,0,0,1,9]) @@ -1376,10 +1468,10 @@ def _latex_(self): sage: phi._latex_() '\\left( x , y \\right)' - sage: E = EllipticCurve(GF(17), [0,0,0,1,-1]) - sage: R. = GF(17)[] - sage: phi = EllipticCurveIsogeny(E, X+11) - sage: phi._latex_() + sage: E = EllipticCurve(GF(17), [0,0,0,1,-1]) # optional - sage.rings.finite_rings + sage: R. = GF(17)[] # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, X + 11) # optional - sage.rings.finite_rings + sage: phi._latex_() # optional - sage.rings.finite_rings '\\left( \\frac{x^{2} + 11 x + 7}{x + 11} , \\frac{x^{2} y + 5 x y + 12 y}{x^{2} + 5 x + 2} \\right)' """ fx,fy = self.rational_maps() @@ -1408,16 +1500,17 @@ def __clear_cached_values(self): sage: old_ratl_maps[1] == -phi.rational_maps()[1] True - sage: F = GF(127); R. = F[] - sage: E = EllipticCurve(j=F(1728)) - sage: f = x^5 + 43*x^4 + 97*x^3 + 81*x^2 + 42*x + 82 - sage: phi = EllipticCurveIsogeny(E, f) - sage: old_ratl_maps = phi.rational_maps() + sage: F = GF(127); R. = F[] # optional - sage.rings.finite_rings + sage: E = EllipticCurve(j=F(1728)) # optional - sage.rings.finite_rings + sage: f = x^5 + 43*x^4 + 97*x^3 + 81*x^2 + 42*x + 82 # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # optional - sage.rings.finite_rings + sage: old_ratl_maps = phi.rational_maps() # optional - sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: phi._set_post_isomorphism(WeierstrassIsomorphism(phi.codomain(), (-13,13,-13,13))) - sage: old_ratl_maps == phi.rational_maps() + sage: phi._set_post_isomorphism(WeierstrassIsomorphism(phi.codomain(), # optional - sage.rings.finite_rings + ....: (-13,13,-13,13))) + sage: old_ratl_maps == phi.rational_maps() # optional - sage.rings.finite_rings False - sage: phi._EllipticCurveIsogeny__clear_cached_values() + sage: phi._EllipticCurveIsogeny__clear_cached_values() # optional - sage.rings.finite_rings """ self.__ratl_maps = None self.__dual = None @@ -1432,17 +1525,17 @@ def __perform_inheritance_housekeeping(self): The following examples will implicitly exercise this function:: - sage: E = EllipticCurve(GF(43), [2,3,5,7,11]) - sage: R. = GF(43)[]; f = x + 42 - sage: phi = EllipticCurveIsogeny(E, f) - sage: phi._EllipticCurveIsogeny__perform_inheritance_housekeeping() + sage: E = EllipticCurve(GF(43), [2,3,5,7,11]) # optional - sage.rings.finite_rings + sage: R. = GF(43)[]; f = x + 42 # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__perform_inheritance_housekeeping() # optional - sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: E2 = phi.codomain() - sage: post_isom = WeierstrassIsomorphism(E2, (41, 37, 31, 29)) - sage: phi._set_post_isomorphism(post_isom) - sage: E1pr = WeierstrassIsomorphism(E, (-1, 2, -3, 4)).codomain() - sage: pre_isom = E1pr.isomorphism_to(E) - sage: phi._set_pre_isomorphism(pre_isom) + sage: E2 = phi.codomain() # optional - sage.rings.finite_rings + sage: post_isom = WeierstrassIsomorphism(E2, (41, 37, 31, 29)) # optional - sage.rings.finite_rings + sage: phi._set_post_isomorphism(post_isom) # optional - sage.rings.finite_rings + sage: E1pr = WeierstrassIsomorphism(E, (-1, 2, -3, 4)).codomain() # optional - sage.rings.finite_rings + sage: pre_isom = E1pr.isomorphism_to(E) # optional - sage.rings.finite_rings + sage: phi._set_pre_isomorphism(pre_isom) # optional - sage.rings.finite_rings """ EllipticCurveHom.__init__(self, self._domain, self._codomain) @@ -1453,31 +1546,31 @@ def __init_algebraic_structs(self, E): EXAMPLES:: - sage: E = EllipticCurve(j=GF(17)(0)) - sage: phi = EllipticCurveIsogeny(E, E((-1,0))) + sage: E = EllipticCurve(j=GF(17)(0)) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((-1,0))) # optional - sage.rings.finite_rings The constructor calls this function itself, so the fields it sets are already defined:: - sage: phi._domain + sage: phi._domain # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 17 - sage: phi._EllipticCurveIsogeny__base_field + sage: phi._EllipticCurveIsogeny__base_field # optional - sage.rings.finite_rings Finite Field of size 17 - sage: phi._EllipticCurveIsogeny__poly_ring + sage: phi._EllipticCurveIsogeny__poly_ring # optional - sage.rings.finite_rings Univariate Polynomial Ring in x over Finite Field of size 17 - sage: phi._EllipticCurveIsogeny__mpoly_ring + sage: phi._EllipticCurveIsogeny__mpoly_ring # optional - sage.rings.finite_rings Multivariate Polynomial Ring in x, y over Finite Field of size 17 Now, calling the initialization function does nothing more:: - sage: phi._EllipticCurveIsogeny__init_algebraic_structs(E) - sage: phi._domain + sage: phi._EllipticCurveIsogeny__init_algebraic_structs(E) # optional - sage.rings.finite_rings + sage: phi._domain # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 17 - sage: phi._EllipticCurveIsogeny__base_field + sage: phi._EllipticCurveIsogeny__base_field # optional - sage.rings.finite_rings Finite Field of size 17 - sage: phi._EllipticCurveIsogeny__poly_ring + sage: phi._EllipticCurveIsogeny__poly_ring # optional - sage.rings.finite_rings Univariate Polynomial Ring in x over Finite Field of size 17 - sage: phi._EllipticCurveIsogeny__mpoly_ring + sage: phi._EllipticCurveIsogeny__mpoly_ring # optional - sage.rings.finite_rings Multivariate Polynomial Ring in x, y over Finite Field of size 17 sage: E = EllipticCurve(QQ, [0,0,0,1,0]) @@ -1492,17 +1585,17 @@ def __init_algebraic_structs(self, E): sage: phi._EllipticCurveIsogeny__mpoly_ring Multivariate Polynomial Ring in x, y over Rational Field - sage: F = GF(19); R. = F[] - sage: E = EllipticCurve(j=GF(19)(0)) - sage: phi = EllipticCurveIsogeny(E, x) - sage: phi._EllipticCurveIsogeny__init_algebraic_structs(E) - sage: phi._domain + sage: F = GF(19); R. = F[] # optional - sage.rings.finite_rings + sage: E = EllipticCurve(j=GF(19)(0)) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x) # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__init_algebraic_structs(E) # optional - sage.rings.finite_rings + sage: phi._domain # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 19 - sage: phi._EllipticCurveIsogeny__base_field + sage: phi._EllipticCurveIsogeny__base_field # optional - sage.rings.finite_rings Finite Field of size 19 - sage: phi._EllipticCurveIsogeny__poly_ring + sage: phi._EllipticCurveIsogeny__poly_ring # optional - sage.rings.finite_rings Univariate Polynomial Ring in x over Finite Field of size 19 - sage: phi._EllipticCurveIsogeny__mpoly_ring + sage: phi._EllipticCurveIsogeny__mpoly_ring # optional - sage.rings.finite_rings Multivariate Polynomial Ring in x, y over Finite Field of size 19 """ self._domain = E @@ -1520,17 +1613,17 @@ def __compute_codomain(self): These examples inherently exercise this function:: - sage: E = EllipticCurve(j=GF(7)(1728)) - sage: phi = EllipticCurveIsogeny(E, E((0,0))) - sage: phi.codomain() + sage: E = EllipticCurve(j=GF(7)(1728)) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))) # optional - sage.rings.finite_rings + sage: phi.codomain() # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + 3*x over Finite Field of size 7 - sage: phi._EllipticCurveIsogeny__compute_codomain() + sage: phi._EllipticCurveIsogeny__compute_codomain() # optional - sage.rings.finite_rings - sage: R. = GF(7)[] - sage: phi = EllipticCurveIsogeny(E, x) - sage: phi.codomain() + sage: R. = GF(7)[] # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x) # optional - sage.rings.finite_rings + sage: phi.codomain() # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + 3*x over Finite Field of size 7 - sage: phi._EllipticCurveIsogeny__compute_codomain() + sage: phi._EllipticCurveIsogeny__compute_codomain() # optional - sage.rings.finite_rings """ if self.__algorithm == 'velu': self._codomain = self.__compute_codomain_via_velu() @@ -1553,14 +1646,14 @@ def __initialize_rational_maps(self, precomputed_maps=None): The following examples inherently exercise this function:: - sage: E = EllipticCurve(j=GF(7)(1728)) - sage: phi = EllipticCurveIsogeny(E, E((0,0))) - sage: phi.rational_maps() # implicit doctest + sage: E = EllipticCurve(j=GF(7)(1728)) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))) # optional - sage.rings.finite_rings + sage: phi.rational_maps() # implicit doctest # optional - sage.rings.finite_rings ((x^2 + 1)/x, (x^2*y - y)/x^2) - sage: R. = GF(7)[] - sage: phi = EllipticCurveIsogeny(E, x) - sage: phi.rational_maps() # implicit doctest + sage: R. = GF(7)[] # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x) # optional - sage.rings.finite_rings + sage: phi.rational_maps() # implicit doctest # optional - sage.rings.finite_rings ((x^2 + 1)/x, (x^2*y - y)/x^2) sage: E = EllipticCurve([1,2,3,4,5]) @@ -1610,9 +1703,9 @@ def __init_kernel_polynomial(self): The following examples inherently exercise this function:: - sage: E = EllipticCurve(j=GF(7)(1728)) - sage: phi = EllipticCurveIsogeny(E, E((0,0))) - sage: phi.kernel_polynomial() # implicit doctest + sage: E = EllipticCurve(j=GF(7)(1728)) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))) # optional - sage.rings.finite_rings + sage: phi.kernel_polynomial() # implicit doctest # optional - sage.rings.finite_rings x """ if self.__kernel_polynomial is None: @@ -1628,16 +1721,16 @@ def __set_pre_isomorphism(self, domain, isomorphism): EXAMPLES:: - sage: E = EllipticCurve(GF(43), [2,3,5,7,11]) - sage: R. = GF(43)[]; f = x + 42 - sage: phi = EllipticCurveIsogeny(E, f) - sage: phi._EllipticCurveIsogeny__perform_inheritance_housekeeping() + sage: E = EllipticCurve(GF(43), [2,3,5,7,11]) # optional - sage.rings.finite_rings + sage: R. = GF(43)[]; f = x + 42 # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__perform_inheritance_housekeeping() # optional - sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: E1pr = WeierstrassIsomorphism(E, (-1, 2, -3, 4)).codomain() - sage: pre_isom = E1pr.isomorphism_to(E) - sage: phi._set_pre_isomorphism(pre_isom) - sage: phi._EllipticCurveIsogeny__set_pre_isomorphism(E, WeierstrassIsomorphism(E, (-1, 3, -3, 4))) - sage: E == phi.domain() + sage: E1pr = WeierstrassIsomorphism(E, (-1, 2, -3, 4)).codomain() # optional - sage.rings.finite_rings + sage: pre_isom = E1pr.isomorphism_to(E) # optional - sage.rings.finite_rings + sage: phi._set_pre_isomorphism(pre_isom) # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__set_pre_isomorphism(E, WeierstrassIsomorphism(E, (-1, 3, -3, 4))) # optional - sage.rings.finite_rings + sage: E == phi.domain() # optional - sage.rings.finite_rings True """ self._domain = domain @@ -1672,14 +1765,14 @@ def __set_post_isomorphism(self, codomain, isomorphism): The following examples inherently exercise this function:: - sage: E = EllipticCurve(j=GF(7)(1728)) - sage: phi = EllipticCurveIsogeny(E, E((0,0))) + sage: E = EllipticCurve(j=GF(7)(1728)) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))) # optional - sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: E2 = phi.codomain() - sage: isom = WeierstrassIsomorphism(E2, (-1,2,-3,4)) - sage: phi._set_post_isomorphism(isom) - sage: phi._EllipticCurveIsogeny__set_post_isomorphism(E2, WeierstrassIsomorphism(phi.codomain(), (1,-2,3,-4))) - sage: E2 == phi.codomain() + sage: E2 = phi.codomain() # optional - sage.rings.finite_rings + sage: isom = WeierstrassIsomorphism(E2, (-1,2,-3,4)) # optional - sage.rings.finite_rings + sage: phi._set_post_isomorphism(isom) # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__set_post_isomorphism(E2, WeierstrassIsomorphism(phi.codomain(), (1,-2,3,-4))) # optional - sage.rings.finite_rings + sage: E2 == phi.codomain() # optional - sage.rings.finite_rings True """ self._codomain = codomain @@ -1708,28 +1801,38 @@ def __setup_post_isomorphism(self, codomain, model): The following examples inherently exercise this function:: - sage: E = EllipticCurve(j=GF(7)(1728)) - sage: E2 = EllipticCurve(GF(7), [0,0,0,5,0]) - sage: phi = EllipticCurveIsogeny(E, E((0,0)), E2); phi - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 7 to Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 7 - sage: E3 = EllipticCurve(GF(7), [0,0,0,6,0]) - sage: phi._EllipticCurveIsogeny__setup_post_isomorphism(E3, None) - sage: phi - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 7 to Elliptic Curve defined by y^2 = x^3 + 6*x over Finite Field of size 7 - - sage: EllipticCurveIsogeny(E, E(0,0), model='montgomery') - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 7 to Elliptic Curve defined by y^2 = x^3 + x^2 + x over Finite Field of size 7 + sage: E = EllipticCurve(j=GF(7)(1728)) # optional - sage.rings.finite_rings + sage: E2 = EllipticCurve(GF(7), [0,0,0,5,0]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0)), E2); phi # optional - sage.rings.finite_rings + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 7 + sage: E3 = EllipticCurve(GF(7), [0,0,0,6,0]) # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__setup_post_isomorphism(E3, None) # optional - sage.rings.finite_rings + sage: phi # optional - sage.rings.finite_rings + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 6*x over Finite Field of size 7 + + sage: EllipticCurveIsogeny(E, E(0,0), model='montgomery') # optional - sage.rings.finite_rings + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + x^2 + x over Finite Field of size 7 sage: R. = QQ[] sage: E = EllipticCurve(j=1728) sage: f = x^3 - x sage: phi = EllipticCurveIsogeny(E, f, model='minimal'); phi - Isogeny of degree 4 from Elliptic Curve defined by y^2 = x^3 - x over Rational Field to Elliptic Curve defined by y^2 = x^3 - x over Rational Field + Isogeny of degree 4 + from Elliptic Curve defined by y^2 = x^3 - x over Rational Field + to Elliptic Curve defined by y^2 = x^3 - x over Rational Field sage: phi = EllipticCurveIsogeny(E, f, model=None) sage: phi._EllipticCurveIsogeny__setup_post_isomorphism(None, 'minimal') sage: phi - Isogeny of degree 4 from Elliptic Curve defined by y^2 = x^3 - x over Rational Field to Elliptic Curve defined by y^2 = x^3 - x over Rational Field + Isogeny of degree 4 + from Elliptic Curve defined by y^2 = x^3 - x over Rational Field + to Elliptic Curve defined by y^2 = x^3 - x over Rational Field """ if model is codomain is None: return @@ -1770,21 +1873,27 @@ def __init_from_kernel_list(self, kernel_gens): The following example inherently exercises this function:: - sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) - sage: phi = EllipticCurveIsogeny(E, E((0,0))); phi - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 6*x over Finite Field of size 7 to Elliptic Curve defined by y^2 = x^3 + 4*x over Finite Field of size 7 - sage: phi._EllipticCurveIsogeny__init_from_kernel_list([E(0), E((0,0))]) + sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))); phi # optional - sage.rings.finite_rings + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 6*x over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 4*x over Finite Field of size 7 + sage: phi._EllipticCurveIsogeny__init_from_kernel_list([E(0), E((0,0))]) # optional - sage.rings.finite_rings The following example demonstrates the necessity of avoiding any calls to P.order(), since such calls involve factoring the group order which could take a long time. :: - sage: p = 12 * next_prime(2^180) * next_prime(2^194) - 1 - sage: F = FiniteField(p, proof=False) - sage: E = EllipticCurve([F(1), F(0)]) - sage: P = E(0).division_points(3)[1] - sage: EllipticCurveIsogeny(E, P) - Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 461742260113997803268895001173557974278278194575766957660028841364655249961609425998827452443620996655395008156411 to Elliptic Curve defined by y^2 = x^3 + 80816485163488178037199320944019099858815874115367810482828676054000067654558381377552245721755005198633191074893*x + 301497584865165444049833326660609767433467459033532853758006118022998267706948164646650354324860226263546558337993 over Finite Field of size 461742260113997803268895001173557974278278194575766957660028841364655249961609425998827452443620996655395008156411 + sage: p = 12 * next_prime(2^180) * next_prime(2^194) - 1 # optional - sage.rings.finite_rings + sage: F = FiniteField(p, proof=False) # optional - sage.rings.finite_rings + sage: E = EllipticCurve([F(1), F(0)]) # optional - sage.rings.finite_rings + sage: P = E(0).division_points(3)[1] # optional - sage.rings.finite_rings + sage: EllipticCurveIsogeny(E, P) # optional - sage.rings.finite_rings + Isogeny of degree 3 + from Elliptic Curve defined by y^2 = x^3 + x + over Finite Field of size 461742260113997803268895001173557974278278194575766957660028841364655249961609425998827452443620996655395008156411 + to Elliptic Curve defined by y^2 = x^3 + 80816485163488178037199320944019099858815874115367810482828676054000067654558381377552245721755005198633191074893*x + 301497584865165444049833326660609767433467459033532853758006118022998267706948164646650354324860226263546558337993 + over Finite Field of size 461742260113997803268895001173557974278278194575766957660028841364655249961609425998827452443620996655395008156411 """ if self.__check : for P in kernel_gens: @@ -1826,11 +1935,13 @@ def __sort_kernel_list(self): The following example inherently exercises this function:: - sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) - sage: P = E((4,2)) - sage: phi = EllipticCurveIsogeny(E, P); phi - Isogeny of degree 4 from Elliptic Curve defined by y^2 = x^3 + 6*x over Finite Field of size 7 to Elliptic Curve defined by y^2 = x^3 + 2*x over Finite Field of size 7 - sage: phi._EllipticCurveIsogeny__sort_kernel_list() + sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) # optional - sage.rings.finite_rings + sage: P = E((4,2)) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, P); phi # optional - sage.rings.finite_rings + Isogeny of degree 4 + from Elliptic Curve defined by y^2 = x^3 + 6*x over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 2*x over Finite Field of size 7 + sage: phi._EllipticCurveIsogeny__sort_kernel_list() # optional - sage.rings.finite_rings """ a1, a2, a3, a4, _ = self._domain.a_invariants() @@ -1876,12 +1987,12 @@ def __compute_codomain_via_velu(self): The following example inherently exercises this function:: - sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) - sage: P = E((4,2)) - sage: phi = EllipticCurveIsogeny(E, P) - sage: phi.codomain() + sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) # optional - sage.rings.finite_rings + sage: P = E((4,2)) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, P) # optional - sage.rings.finite_rings + sage: phi.codomain() # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + 2*x over Finite Field of size 7 - sage: phi._EllipticCurveIsogeny__compute_codomain_via_velu() + sage: phi._EllipticCurveIsogeny__compute_codomain_via_velu() # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + 2*x over Finite Field of size 7 """ return compute_codomain_formula(self._domain, self.__v, self.__w) @@ -1896,22 +2007,22 @@ def __velu_sum_helper(xQ, Qvalues, a1, a3, x, y): The following example inherently exercises this function:: - sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) - sage: P = E((4,2)) - sage: phi = EllipticCurveIsogeny(E, P) - sage: Q = E((0,0)); phi(Q) + sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) # optional - sage.rings.finite_rings + sage: P = E((4,2)) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, P) # optional - sage.rings.finite_rings + sage: Q = E((0,0)); phi(Q) # optional - sage.rings.finite_rings (0 : 0 : 1) - sage: phi.rational_maps() + sage: phi.rational_maps() # optional - sage.rings.finite_rings ((x^4 - 2*x^3 + x^2 - 3*x)/(x^3 - 2*x^2 + 3*x - 2), (x^5*y - 2*x^3*y - x^2*y - 2*x*y + 2*y)/(x^5 + 3*x^3 + 3*x^2 + x - 1)) - sage: F = GF(7) - sage: E = EllipticCurve(F, [0,0,0,1,0]) - sage: phi = EllipticCurveIsogeny(E, E((0,0)) ) - sage: Qvals = phi._EllipticCurveIsogeny__kernel_mod_sign[0] - sage: phi._EllipticCurveIsogeny__velu_sum_helper(0, Qvals, 0, 0, F(5), F(5)) + sage: F = GF(7) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F, [0,0,0,1,0]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0)) ) # optional - sage.rings.finite_rings + sage: Qvals = phi._EllipticCurveIsogeny__kernel_mod_sign[0] # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__velu_sum_helper(0, Qvals, 0, 0, F(5), F(5)) # optional - sage.rings.finite_rings (3, 3) - sage: R. = GF(7)[] - sage: phi._EllipticCurveIsogeny__velu_sum_helper(0, Qvals, 0, 0, x, y) + sage: R. = GF(7)[] # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__velu_sum_helper(0, Qvals, 0, 0, x, y) # optional - sage.rings.finite_rings (1/x, y/x^2) """ yQ, gxQ, gyQ, vQ, uQ = Qvalues @@ -1944,17 +2055,17 @@ def __compute_via_velu_numeric(self, xP, yP): The following example inherently exercises this function:: - sage: F = GF(7) - sage: E = EllipticCurve(F, [0,0,0,-1,0]) - sage: P = E((4,2)) - sage: phi = EllipticCurveIsogeny(E, P) - sage: Q = E((0,0)); phi(Q) + sage: F = GF(7) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F, [0,0,0,-1,0]) # optional - sage.rings.finite_rings + sage: P = E((4,2)) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, P) # optional - sage.rings.finite_rings + sage: Q = E((0,0)); phi(Q) # optional - sage.rings.finite_rings (0 : 0 : 1) - sage: Q = E((-1,0)); phi(Q) + sage: Q = E((-1,0)); phi(Q) # optional - sage.rings.finite_rings (0 : 0 : 1) - sage: phi._EllipticCurveIsogeny__compute_via_velu_numeric(F(0), F(0)) + sage: phi._EllipticCurveIsogeny__compute_via_velu_numeric(F(0), F(0)) # optional - sage.rings.finite_rings (0, 0) - sage: phi._EllipticCurveIsogeny__compute_via_velu_numeric(F(-1), F(0)) + sage: phi._EllipticCurveIsogeny__compute_via_velu_numeric(F(-1), F(0)) # optional - sage.rings.finite_rings (0, 0) """ # first check if the point is in the kernel @@ -1971,18 +2082,18 @@ def __compute_via_velu(self, xP, yP): The following example inherently exercises this function:: - sage: F = GF(7) - sage: E = EllipticCurve(F, [0,0,0,-1,0]) - sage: P = E((4,2)) - sage: phi = EllipticCurveIsogeny(E, P) - sage: Q = E((0,0)); phi(Q) + sage: F = GF(7) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F, [0,0,0,-1,0]) # optional - sage.rings.finite_rings + sage: P = E((4,2)) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, P) # optional - sage.rings.finite_rings + sage: Q = E((0,0)); phi(Q) # optional - sage.rings.finite_rings (0 : 0 : 1) - sage: phi.rational_maps() + sage: phi.rational_maps() # optional - sage.rings.finite_rings ((x^4 - 2*x^3 + x^2 - 3*x)/(x^3 - 2*x^2 + 3*x - 2), (x^5*y - 2*x^3*y - x^2*y - 2*x*y + 2*y)/(x^5 + 3*x^3 + 3*x^2 + x - 1)) - sage: phi._EllipticCurveIsogeny__compute_via_velu(F(0), F(0)) + sage: phi._EllipticCurveIsogeny__compute_via_velu(F(0), F(0)) # optional - sage.rings.finite_rings (0, 0) - sage: R. = GF(7)[] - sage: phi._EllipticCurveIsogeny__compute_via_velu(x, y) + sage: R. = GF(7)[] # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_via_velu(x, y) # optional - sage.rings.finite_rings ((x^4 - 2*x^3 + x^2 - 3*x)/(x^3 - 2*x^2 + 3*x - 2), (x^5*y - 2*x^3*y - x^2*y - 2*x*y + 2*y)/(x^5 + 3*x^3 + 3*x^2 + x - 1)) @@ -1990,24 +2101,24 @@ def __compute_via_velu(self, xP, yP): Check for :trac:`33214`:: - sage: z2 = GF(71^2).gen() - sage: E = EllipticCurve(GF(71^2), [5,5]) - sage: phi = E.isogeny(E.lift_x(0)) - sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: pre = WeierstrassIsomorphism(None, (z2,7,8,9), E) - sage: phi = phi * pre - sage: P = phi.domain()(1, 46*z2+49) - sage: phi(P) # indirect doctest + sage: z2 = GF(71^2).gen() # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(71^2), [5,5]) # optional - sage.rings.finite_rings + sage: phi = E.isogeny(E.lift_x(0)) # optional - sage.rings.finite_rings + sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism # optional - sage.rings.finite_rings + sage: pre = WeierstrassIsomorphism(None, (z2,7,8,9), E) # optional - sage.rings.finite_rings + sage: phi = phi * pre # optional - sage.rings.finite_rings + sage: P = phi.domain()(1, 46*z2+49) # optional - sage.rings.finite_rings + sage: phi(P) # indirect doctest # optional - sage.rings.finite_rings (33 : 61*z2 + 10 : 1) The rational maps are also computed via this code path; check that they are plausible (this failed prior to :trac:`33214`):: - sage: fx,fy = phi.rational_maps() # indirect doctest - sage: R. = GF(71^2)[] - sage: E0, E2 = phi.domain(), phi.codomain() - sage: eqs = [EE.defining_polynomial()(x,y,1) for EE in (E0,E2)] - sage: eqs[1](fx,fy).numerator() % eqs[0] + sage: fx,fy = phi.rational_maps() # indirect doctest # optional - sage.rings.finite_rings + sage: R. = GF(71^2)[] # optional - sage.rings.finite_rings + sage: E0, E2 = phi.domain(), phi.codomain() # optional - sage.rings.finite_rings + sage: eqs = [EE.defining_polynomial()(x,y,1) for EE in (E0,E2)] # optional - sage.rings.finite_rings + sage: eqs[1](fx,fy).numerator() % eqs[0] # optional - sage.rings.finite_rings 0 """ if self.__pre_isomorphism is None: @@ -2037,12 +2148,12 @@ def __initialize_rational_maps_via_velu(self): The following example inherently exercises this function:: - sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) - sage: P = E((4,2)) - sage: phi = EllipticCurveIsogeny(E, P) - sage: phi.rational_maps() + sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) # optional - sage.rings.finite_rings + sage: P = E((4,2)) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, P) # optional - sage.rings.finite_rings + sage: phi.rational_maps() # optional - sage.rings.finite_rings ((x^4 - 2*x^3 + x^2 - 3*x)/(x^3 - 2*x^2 + 3*x - 2), (x^5*y - 2*x^3*y - x^2*y - 2*x*y + 2*y)/(x^5 + 3*x^3 + 3*x^2 + x - 1)) - sage: phi._EllipticCurveIsogeny__initialize_rational_maps_via_velu() + sage: phi._EllipticCurveIsogeny__initialize_rational_maps_via_velu() # optional - sage.rings.finite_rings ((x^4 + 5*x^3 + x^2 + 4*x)/(x^3 + 5*x^2 + 3*x + 5), (x^5*y - 2*x^3*y - x^2*y - 2*x*y + 2*y)/(x^5 + 3*x^3 + 3*x^2 + x - 1)) """ x = self.__poly_ring.gen() @@ -2058,10 +2169,10 @@ def __init_kernel_polynomial_velu(self): The following example inherently exercises this function:: - sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) - sage: P = E((4,2)) - sage: phi = EllipticCurveIsogeny(E, P) - sage: phi.kernel_polynomial() # implicit doctest + sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) # optional - sage.rings.finite_rings + sage: P = E((4,2)) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, P) # optional - sage.rings.finite_rings + sage: phi.kernel_polynomial() # implicit doctest # optional - sage.rings.finite_rings x^2 + 2*x + 4 """ poly_ring, x = self.__poly_ring.objgen() @@ -2091,18 +2202,22 @@ def __init_from_kernel_polynomial(self, kernel_polynomial): These examples inherently exercise this private function:: - sage: R. = GF(7)[] - sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) - sage: phi = EllipticCurveIsogeny(E, x);phi - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 6*x over Finite Field of size 7 to Elliptic Curve defined by y^2 = x^3 + 4*x over Finite Field of size 7 + sage: R. = GF(7)[] # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,0,0,-1,0]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x);phi # optional - sage.rings.finite_rings + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 6*x over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 4*x over Finite Field of size 7 - sage: phi._EllipticCurveIsogeny__init_from_kernel_polynomial(x) + sage: phi._EllipticCurveIsogeny__init_from_kernel_polynomial(x) # optional - sage.rings.finite_rings - sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) - sage: phi = EllipticCurveIsogeny(E, x+6, degree=3); phi - Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 1 over Finite Field of size 7 to Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 4*x + 2 over Finite Field of size 7 + sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x+6, degree=3); phi # optional - sage.rings.finite_rings + Isogeny of degree 3 + from Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 1 over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 4*x + 2 over Finite Field of size 7 - sage: phi._EllipticCurveIsogeny__init_from_kernel_polynomial(x+6) + sage: phi._EllipticCurveIsogeny__init_from_kernel_polynomial(x+6) # optional - sage.rings.finite_rings """ poly_ring = self.__poly_ring E = self._domain @@ -2189,33 +2304,39 @@ def __init_even_kernel_polynomial(self, E, psi_G): These examples inherently exercise this private function:: - sage: R. = GF(7)[] - sage: E = EllipticCurve(GF(7), [-1,0]) - sage: phi = EllipticCurveIsogeny(E, x); phi - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 6*x over Finite Field of size 7 to Elliptic Curve defined by y^2 = x^3 + 4*x over Finite Field of size 7 + sage: R. = GF(7)[] # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [-1,0]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x); phi # optional - sage.rings.finite_rings + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 6*x over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 4*x over Finite Field of size 7 sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import two_torsion_part - sage: psig = two_torsion_part(E,x) - sage: phi._EllipticCurveIsogeny__init_even_kernel_polynomial(E,psig) + sage: psig = two_torsion_part(E,x) # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__init_even_kernel_polynomial(E,psig) # optional - sage.rings.finite_rings (x^3 + 6*x, x^3*y + x*y, 6, 0, 1, 2) - sage: F = GF(2^4, 'alpha'); R. = F[] - sage: E = EllipticCurve(F, [1,1,0,1,0]) - sage: phi = EllipticCurveIsogeny(E, x); phi - Isogeny of degree 2 from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 + x over Finite Field in alpha of size 2^4 to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 + 1 over Finite Field in alpha of size 2^4 + sage: F = GF(2^4, 'alpha'); R. = F[] # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F, [1,1,0,1,0]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x); phi # optional - sage.rings.finite_rings + Isogeny of degree 2 + from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 + x over Finite Field in alpha of size 2^4 + to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 + 1 over Finite Field in alpha of size 2^4 - sage: psig = two_torsion_part(E,x) - sage: phi._EllipticCurveIsogeny__init_even_kernel_polynomial(E,psig) + sage: psig = two_torsion_part(E,x) # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__init_even_kernel_polynomial(E,psig) # optional - sage.rings.finite_rings (x^3 + x, x^3*y + x^2 + x*y, 1, 0, 1, 2) - sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) - sage: R. = GF(7)[] - sage: f = x^3 + 6*x^2 + 1 - sage: phi = EllipticCurveIsogeny(E, f); phi - Isogeny of degree 4 from Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 1 over Finite Field of size 7 to Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 2*x + 5 over Finite Field of size 7 - sage: psig = two_torsion_part(E,f) - sage: psig = two_torsion_part(E,f) - sage: phi._EllipticCurveIsogeny__init_even_kernel_polynomial(E,psig) + sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # optional - sage.rings.finite_rings + sage: R. = GF(7)[] # optional - sage.rings.finite_rings + sage: f = x^3 + 6*x^2 + 1 # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f); phi # optional - sage.rings.finite_rings + Isogeny of degree 4 + from Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 1 over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 2*x + 5 over Finite Field of size 7 + sage: psig = two_torsion_part(E,f) # optional - sage.rings.finite_rings + sage: psig = two_torsion_part(E,f) # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__init_even_kernel_polynomial(E,psig) # optional - sage.rings.finite_rings (x^7 + 5*x^6 + 2*x^5 + 6*x^4 + 3*x^3 + 5*x^2 + 6*x + 3, x^9*y - 3*x^8*y + 2*x^7*y - 3*x^3*y + 2*x^2*y + x*y - y, 1, 6, 3, 4) """ # check if the polynomial really divides the two_torsion_polynomial @@ -2300,33 +2421,39 @@ def __init_odd_kernel_polynomial(self, E, psi): These examples inherently exercise this private function:: - sage: R. = GF(7)[] - sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) - sage: phi = EllipticCurveIsogeny(E, x+6, degree=3); phi - Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 1 over Finite Field of size 7 to Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 4*x + 2 over Finite Field of size 7 + sage: R. = GF(7)[] # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x+6, degree=3); phi # optional - sage.rings.finite_rings + Isogeny of degree 3 + from Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 1 over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 4*x + 2 over Finite Field of size 7 - sage: R. = GF(7)[] - sage: phi._EllipticCurveIsogeny__init_odd_kernel_polynomial(E, x+6) + sage: R. = GF(7)[] # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__init_odd_kernel_polynomial(E, x+6) # optional - sage.rings.finite_rings (x^3 + 5*x^2 + 3*x + 2, x^3*y - 3*x^2*y + x*y, 2, 6, 1, 3) - sage: F = GF(2^4, 'alpha'); R. = F[] - sage: alpha = F.gen() - sage: E = EllipticCurve(F, [1,1,F.gen(),F.gen()^2+1,1]) - sage: f = x + alpha^2 + 1 - sage: phi = EllipticCurveIsogeny(E, f); phi - Isogeny of degree 3 from Elliptic Curve defined by y^2 + x*y + alpha*y = x^3 + x^2 + (alpha^2+1)*x + 1 over Finite Field in alpha of size 2^4 to Elliptic Curve defined by y^2 + x*y + alpha*y = x^3 + x^2 + alpha*x + alpha^3 over Finite Field in alpha of size 2^4 - - sage: R. = F[] - sage: f = x + alpha^2 + 1 - sage: phi._EllipticCurveIsogeny__init_odd_kernel_polynomial(E, f) + sage: F = GF(2^4, 'alpha'); R. = F[] # optional - sage.rings.finite_rings + sage: alpha = F.gen() # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F, [1,1,F.gen(),F.gen()^2+1,1]) # optional - sage.rings.finite_rings + sage: f = x + alpha^2 + 1 # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f); phi # optional - sage.rings.finite_rings + Isogeny of degree 3 + from Elliptic Curve defined by y^2 + x*y + alpha*y = x^3 + x^2 + (alpha^2+1)*x + 1 over Finite Field in alpha of size 2^4 + to Elliptic Curve defined by y^2 + x*y + alpha*y = x^3 + x^2 + alpha*x + alpha^3 over Finite Field in alpha of size 2^4 + + sage: R. = F[] # optional - sage.rings.finite_rings + sage: f = x + alpha^2 + 1 # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__init_odd_kernel_polynomial(E, f) # optional - sage.rings.finite_rings (x^3 + (alpha^2 + 1)*x + alpha^3 + alpha^2 + alpha, x^3*y + (alpha^2 + 1)*x^2*y + (alpha^2 + alpha + 1)*x^2 + (alpha^2 + 1)*x*y + (alpha^2 + alpha)*x + alpha*y + alpha, alpha^2 + alpha + 1, alpha^3 + alpha^2 + alpha, 1, 3) - sage: E = EllipticCurve(j=-262537412640768000) - sage: f = E.isogenies_prime_degree()[0].kernel_polynomial() - sage: f.degree() + sage: E = EllipticCurve(j=-262537412640768000) # optional - sage.rings.finite_rings + sage: f = E.isogenies_prime_degree()[0].kernel_polynomial() # optional - sage.rings.finite_rings + sage: f.degree() # optional - sage.rings.finite_rings 81 - sage: E.isogeny(kernel=f, check=False) - Isogeny of degree 163 from Elliptic Curve defined by y^2 + y = x^3 - 2174420*x + 1234136692 over Rational Field to Elliptic Curve defined by y^2 + y = x^3 - 57772164980*x - 5344733777551611 over Rational Field + sage: E.isogeny(kernel=f, check=False) # optional - sage.rings.finite_rings + Isogeny of degree 163 + from Elliptic Curve defined by y^2 + y = x^3 - 2174420*x + 1234136692 over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - 57772164980*x - 5344733777551611 over Rational Field """ n = psi.degree() d = 2*n + 1 @@ -2396,17 +2523,19 @@ def __compute_omega_fast(self, E, psi, psi_pr, phi, phi_pr): These examples inherently exercise this private function:: - sage: R. = GF(7)[] - sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) - sage: phi = EllipticCurveIsogeny(E, x+6, degree=3); phi - Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 1 over Finite Field of size 7 to Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 4*x + 2 over Finite Field of size 7 - - sage: R. = GF(7)[] - sage: psi = phi._EllipticCurveIsogeny__psi - sage: psi_pr = psi.derivative() - sage: fi = phi._EllipticCurveIsogeny__phi - sage: fi_pr = fi.derivative() - sage: phi._EllipticCurveIsogeny__compute_omega_fast(E, psi, psi_pr, fi, fi_pr) + sage: R. = GF(7)[] # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x+6, degree=3); phi # optional - sage.rings.finite_rings + Isogeny of degree 3 + from Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 1 over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 4*x + 2 over Finite Field of size 7 + + sage: R. = GF(7)[] # optional - sage.rings.finite_rings + sage: psi = phi._EllipticCurveIsogeny__psi # optional - sage.rings.finite_rings + sage: psi_pr = psi.derivative() # optional - sage.rings.finite_rings + sage: fi = phi._EllipticCurveIsogeny__phi # optional - sage.rings.finite_rings + sage: fi_pr = fi.derivative() # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_omega_fast(E, psi, psi_pr, fi, fi_pr) # optional - sage.rings.finite_rings x^3*y - 3*x^2*y + x*y """ a1 = E.a1() @@ -2443,30 +2572,35 @@ def __compute_omega_general(self, E, psi, psi_pr, phi, phi_pr): These examples inherently exercise this private function:: - sage: F = GF(2^4, 'alpha'); R. = F[] - sage: alpha = F.gen() - sage: E = EllipticCurve(F, [1, 1, F.gen(), F.gen()^2+1, 1]) - sage: f = x + alpha^2 + 1 - sage: phi = EllipticCurveIsogeny(E, f); phi - Isogeny of degree 3 from Elliptic Curve defined by y^2 + x*y + alpha*y = x^3 + x^2 + (alpha^2+1)*x + 1 over Finite Field in alpha of size 2^4 to Elliptic Curve defined by y^2 + x*y + alpha*y = x^3 + x^2 + alpha*x + alpha^3 over Finite Field in alpha of size 2^4 - - sage: R. = F[] - sage: psi = phi._EllipticCurveIsogeny__psi - sage: psi_pr = psi.derivative() - sage: fi = phi._EllipticCurveIsogeny__phi - sage: fi_pr = fi.derivative() - sage: phi._EllipticCurveIsogeny__compute_omega_general(E, psi, psi_pr, fi, fi_pr) + sage: F = GF(2^4, 'alpha'); R. = F[] # optional - sage.rings.finite_rings + sage: alpha = F.gen() # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F, [1, 1, F.gen(), F.gen()^2+1, 1]) # optional - sage.rings.finite_rings + sage: f = x + alpha^2 + 1 # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f); phi # optional - sage.rings.finite_rings + Isogeny of degree 3 + from Elliptic Curve defined by y^2 + x*y + alpha*y = x^3 + x^2 + (alpha^2+1)*x + 1 over Finite Field in alpha of size 2^4 + to Elliptic Curve defined by y^2 + x*y + alpha*y = x^3 + x^2 + alpha*x + alpha^3 over Finite Field in alpha of size 2^4 + + sage: R. = F[] # optional - sage.rings.finite_rings + sage: psi = phi._EllipticCurveIsogeny__psi # optional - sage.rings.finite_rings + sage: psi_pr = psi.derivative() # optional - sage.rings.finite_rings + sage: fi = phi._EllipticCurveIsogeny__phi # optional - sage.rings.finite_rings + sage: fi_pr = fi.derivative() # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_omega_general(E, psi, psi_pr, fi, fi_pr) # optional - sage.rings.finite_rings x^3*y + (alpha^2 + 1)*x^2*y + (alpha^2 + alpha + 1)*x^2 + (alpha^2 + 1)*x*y + (alpha^2 + alpha)*x + alpha*y + alpha A bug fixed in :trac:`7907`:: - sage: F = GF(128,'a') - sage: a = F.gen() - sage: E = EllipticCurve([1,0,0,0,(a**6+a**4+a**2+a)]) - sage: x = polygen(F) - sage: ker = x^6 + (a^6 + a^5 + a^4 + a^3 + a^2 + a)*x^5 + (a^6 + a^5 + a^2 + 1)*x^4 + (a^6 + a^5 + a^4 + a^3 + a^2 + 1)*x^3 + (a^6 + a^3 + a)*x^2 + (a^4 + a^3 + 1)*x + a^5 + a^4 + a - sage: E.isogeny(ker) - Isogeny of degree 13 from Elliptic Curve defined by y^2 + x*y = x^3 + (a^6+a^4+a^2+a) over Finite Field in a of size 2^7 to Elliptic Curve defined by y^2 + x*y = x^3 + (a^6+a^5+a^4+a^3+a^2+a)*x + (a^5+a^3) over Finite Field in a of size 2^7 + sage: F = GF(128,'a') # optional - sage.rings.finite_rings + sage: a = F.gen() # optional - sage.rings.finite_rings + sage: E = EllipticCurve([1,0,0,0,(a**6+a**4+a**2+a)]) # optional - sage.rings.finite_rings + sage: x = polygen(F) # optional - sage.rings.finite_rings + sage: ker = x^6 + (a^6 + a^5 + a^4 + a^3 + a^2 + a)*x^5 + (a^6 + a^5 + a^2 + 1)*x^4 + ....: + (a^6 + a^5 + a^4 + a^3 + a^2 + 1)*x^3 + (a^6 + a^3 + a)*x^2 + (a^4 + a^3 + 1)*x + a^5 + a^4 + a # optional - sage.rings.finite_rings + sage: E.isogeny(ker) # optional - sage.rings.finite_rings + Isogeny of degree 13 + from Elliptic Curve defined by y^2 + x*y = x^3 + (a^6+a^4+a^2+a) over Finite Field in a of size 2^7 + to Elliptic Curve defined by y^2 + x*y = x^3 + (a^6+a^5+a^4+a^3+a^2+a)*x + (a^5+a^3) over Finite Field in a of size 2^7 """ a1, a2, a3, a4, a6 = E.a_invariants() b2, b4, _, _ = E.b_invariants() @@ -2519,16 +2653,16 @@ def __compute_via_kohel_numeric(self, xP, yP): These examples inherently exercise this private function:: - sage: R. = GF(7)[] - sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) - sage: phi = EllipticCurveIsogeny(E, x+6, degree=3) - sage: P = E((0,1)); phi(P) + sage: R. = GF(7)[] # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x+6, degree=3) # optional - sage.rings.finite_rings + sage: P = E((0,1)); phi(P) # optional - sage.rings.finite_rings (2 : 0 : 1) - sage: P = E((1,1)); phi(P) + sage: P = E((1,1)); phi(P) # optional - sage.rings.finite_rings (0 : 1 : 0) - sage: phi._EllipticCurveIsogeny__compute_via_kohel_numeric(0, 1) + sage: phi._EllipticCurveIsogeny__compute_via_kohel_numeric(0, 1) # optional - sage.rings.finite_rings (2, 0) - sage: phi._EllipticCurveIsogeny__compute_via_kohel_numeric(1, 1) + sage: phi._EllipticCurveIsogeny__compute_via_kohel_numeric(1, 1) # optional - sage.rings.finite_rings () """ # first check if the point is in the kernel @@ -2545,17 +2679,17 @@ def __compute_via_kohel(self, xP, yP): These examples inherently exercise this private function:: - sage: R. = GF(7)[] - sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) - sage: phi = EllipticCurveIsogeny(E, x+6, degree=3) - sage: P = E((0,1)); phi(P) + sage: R. = GF(7)[] # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x+6, degree=3) # optional - sage.rings.finite_rings + sage: P = E((0,1)); phi(P) # optional - sage.rings.finite_rings (2 : 0 : 1) - sage: phi.rational_maps() + sage: phi.rational_maps() # optional - sage.rings.finite_rings ((x^3 - 2*x^2 + 3*x + 2)/(x^2 - 2*x + 1), (x^3*y - 3*x^2*y + x*y)/(x^3 - 3*x^2 + 3*x - 1)) - sage: phi._EllipticCurveIsogeny__compute_via_kohel(0,1) + sage: phi._EllipticCurveIsogeny__compute_via_kohel(0,1) # optional - sage.rings.finite_rings (2, 0) - sage: R. = GF(7)[] - sage: phi._EllipticCurveIsogeny__compute_via_kohel(x,y) + sage: R. = GF(7)[] # optional - sage.rings.finite_rings + sage: phi._EllipticCurveIsogeny__compute_via_kohel(x,y) # optional - sage.rings.finite_rings ((x^3 - 2*x^2 + 3*x + 2)/(x^2 - 2*x + 1), (x^3*y - 3*x^2*y + x*y)/(x^3 - 3*x^2 + 3*x - 1)) """ a = self.__phi(xP) @@ -2572,12 +2706,12 @@ def __initialize_rational_maps_via_kohel(self): These examples inherently exercise this private function:: - sage: R. = GF(7)[] - sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) - sage: phi = EllipticCurveIsogeny(E, x+6, degree=3) - sage: phi.rational_maps() + sage: R. = GF(7)[] # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x+6, degree=3) # optional - sage.rings.finite_rings + sage: phi.rational_maps() # optional - sage.rings.finite_rings ((x^3 - 2*x^2 + 3*x + 2)/(x^2 - 2*x + 1), (x^3*y - 3*x^2*y + x*y)/(x^3 - 3*x^2 + 3*x - 1)) - sage: phi._EllipticCurveIsogeny__initialize_rational_maps_via_kohel() + sage: phi._EllipticCurveIsogeny__initialize_rational_maps_via_kohel() # optional - sage.rings.finite_rings ((x^3 + 5*x^2 + 3*x + 2)/(x^2 + 5*x + 1), (x^3*y - 3*x^2*y + x*y)/(x^3 - 3*x^2 + 3*x - 1)) """ x = self.__poly_ring.gen() @@ -2596,12 +2730,12 @@ def __compute_codomain_via_kohel(self): These examples inherently exercise this private function:: - sage: R. = GF(7)[] - sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) - sage: phi = EllipticCurveIsogeny(E, x+6, degree=3) - sage: phi.codomain() + sage: R. = GF(7)[] # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(7), [0,-1,0,0,1]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x+6, degree=3) # optional - sage.rings.finite_rings + sage: phi.codomain() # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 4*x + 2 over Finite Field of size 7 - sage: phi._EllipticCurveIsogeny__compute_codomain_via_kohel() + sage: phi._EllipticCurveIsogeny__compute_codomain_via_kohel() # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 4*x + 2 over Finite Field of size 7 """ return compute_codomain_formula(self._domain, self.__v, self.__w) @@ -2629,9 +2763,9 @@ def rational_maps(self): sage: phi.rational_maps() (x, y) - sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) - sage: phi = EllipticCurveIsogeny(E, E((0,0))) - sage: phi.rational_maps() + sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))) # optional - sage.rings.finite_rings + sage: phi.rational_maps() # optional - sage.rings.finite_rings ((x^2 + 3)/x, (x^2*y - 3*y)/x^2) """ self.__initialize_rational_maps() @@ -2656,9 +2790,9 @@ def x_rational_map(self): sage: phi.x_rational_map() x - sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) - sage: phi = EllipticCurveIsogeny(E, E((0,0))) - sage: phi.x_rational_map() + sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))) # optional - sage.rings.finite_rings + sage: phi.x_rational_map() # optional - sage.rings.finite_rings (x^2 + 3)/x """ self.__initialize_rational_maps() @@ -2677,13 +2811,13 @@ def scaling_factor(self): EXAMPLES:: - sage: E = EllipticCurve(GF(257^2), [0,1]) - sage: phi = E.isogeny(E.lift_x(240)) - sage: phi.degree() + sage: E = EllipticCurve(GF(257^2), [0,1]) # optional - sage.rings.finite_rings + sage: phi = E.isogeny(E.lift_x(240)) # optional - sage.rings.finite_rings + sage: phi.degree() # optional - sage.rings.finite_rings 43 - sage: phi.scaling_factor() + sage: phi.scaling_factor() # optional - sage.rings.finite_rings 1 - sage: phi.dual().scaling_factor() + sage: phi.dual().scaling_factor() # optional - sage.rings.finite_rings 43 ALGORITHM: The "inner" isogeny is normalized by construction, @@ -2713,14 +2847,14 @@ def kernel_polynomial(self): sage: phi.kernel_polynomial() x^2 - 21*x + 80 - sage: E = EllipticCurve(GF(17), [1,-1,1,-1,1]) - sage: phi = EllipticCurveIsogeny(E, [1]) - sage: phi.kernel_polynomial() + sage: E = EllipticCurve(GF(17), [1,-1,1,-1,1]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, [1]) # optional - sage.rings.finite_rings + sage: phi.kernel_polynomial() # optional - sage.rings.finite_rings 1 - sage: E = EllipticCurve(GF(31), [0,0,0,3,0]) - sage: phi = EllipticCurveIsogeny(E, [0,3,0,1]) - sage: phi.kernel_polynomial() + sage: E = EllipticCurve(GF(31), [0,0,0,3,0]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, [0,3,0,1]) # optional - sage.rings.finite_rings + sage: phi.kernel_polynomial() # optional - sage.rings.finite_rings x^3 + 3*x """ if self.__kernel_polynomial is None: @@ -2737,9 +2871,9 @@ def is_separable(self): EXAMPLES:: - sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) - sage: phi = EllipticCurveIsogeny(E, E((0,0))) - sage: phi.is_separable() + sage: E = EllipticCurve(GF(17), [0,0,0,3,0]) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, E((0,0))) # optional - sage.rings.finite_rings + sage: phi.is_separable() # optional - sage.rings.finite_rings True :: @@ -2761,53 +2895,62 @@ def _set_pre_isomorphism(self, preWI): TESTS:: - sage: E = EllipticCurve(GF(31), [1,1,0,1,-1]) - sage: R. = GF(31)[] - sage: f = x^3 + 9*x^2 + x + 30 - sage: phi = EllipticCurveIsogeny(E, f) - sage: Epr = E.short_weierstrass_model() - sage: isom = Epr.isomorphism_to(E) - sage: phi._set_pre_isomorphism(isom) - sage: phi.rational_maps() - ((-6*x^4 - 3*x^3 + 12*x^2 + 10*x - 1)/(x^3 + x - 12), (3*x^7 + x^6*y - 14*x^6 - 3*x^5 + 5*x^4*y + 7*x^4 + 8*x^3*y - 8*x^3 - 5*x^2*y + 5*x^2 - 14*x*y + 14*x - 6*y - 6)/(x^6 + 2*x^4 + 7*x^3 + x^2 + 7*x - 11)) - sage: phi(Epr((0,22))) + sage: E = EllipticCurve(GF(31), [1,1,0,1,-1]) # optional - sage.rings.finite_rings + sage: R. = GF(31)[] # optional - sage.rings.finite_rings + sage: f = x^3 + 9*x^2 + x + 30 # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # optional - sage.rings.finite_rings + sage: Epr = E.short_weierstrass_model() # optional - sage.rings.finite_rings + sage: isom = Epr.isomorphism_to(E) # optional - sage.rings.finite_rings + sage: phi._set_pre_isomorphism(isom) # optional - sage.rings.finite_rings + sage: phi.rational_maps() # optional - sage.rings.finite_rings + ((-6*x^4 - 3*x^3 + 12*x^2 + 10*x - 1)/(x^3 + x - 12), + (3*x^7 + x^6*y - 14*x^6 - 3*x^5 + 5*x^4*y + 7*x^4 + 8*x^3*y - 8*x^3 - 5*x^2*y + 5*x^2 - 14*x*y + 14*x - 6*y - 6)/(x^6 + 2*x^4 + 7*x^3 + x^2 + 7*x - 11)) + sage: phi(Epr((0,22))) # optional - sage.rings.finite_rings (13 : 21 : 1) - sage: phi(Epr((3,7))) + sage: phi(Epr((3,7))) # optional - sage.rings.finite_rings (14 : 17 : 1) - sage: E = EllipticCurve(GF(29), [0,0,0,1,0]) - sage: R. = GF(29)[] - sage: f = x^2 + 5 - sage: phi = EllipticCurveIsogeny(E, f) - sage: phi - Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 29 to Elliptic Curve defined by y^2 = x^3 + 20*x over Finite Field of size 29 + sage: E = EllipticCurve(GF(29), [0,0,0,1,0]) # optional - sage.rings.finite_rings + sage: R. = GF(29)[] # optional - sage.rings.finite_rings + sage: f = x^2 + 5 # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # optional - sage.rings.finite_rings + sage: phi # optional - sage.rings.finite_rings + Isogeny of degree 5 + from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 29 + to Elliptic Curve defined by y^2 = x^3 + 20*x over Finite Field of size 29 sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: inv_isom = WeierstrassIsomorphism(E, (1,-2,5,10)) - sage: Epr = inv_isom.codomain() - sage: isom = Epr.isomorphism_to(E) - sage: phi._set_pre_isomorphism(isom) - sage: phi - Isogeny of degree 5 from Elliptic Curve defined by y^2 + 10*x*y + 20*y = x^3 + 27*x^2 + 6 over Finite Field of size 29 to Elliptic Curve defined by y^2 = x^3 + 20*x over Finite Field of size 29 - sage: phi(Epr((12,1))) + sage: inv_isom = WeierstrassIsomorphism(E, (1,-2,5,10)) # optional - sage.rings.finite_rings + sage: Epr = inv_isom.codomain() # optional - sage.rings.finite_rings + sage: isom = Epr.isomorphism_to(E) # optional - sage.rings.finite_rings + sage: phi._set_pre_isomorphism(isom) # optional - sage.rings.finite_rings + sage: phi # optional - sage.rings.finite_rings + Isogeny of degree 5 + from Elliptic Curve defined by y^2 + 10*x*y + 20*y = x^3 + 27*x^2 + 6 over Finite Field of size 29 + to Elliptic Curve defined by y^2 = x^3 + 20*x over Finite Field of size 29 + sage: phi(Epr((12,1))) # optional - sage.rings.finite_rings (26 : 0 : 1) - sage: phi(Epr((2,9))) + sage: phi(Epr((2,9))) # optional - sage.rings.finite_rings (0 : 0 : 1) - sage: phi(Epr((21,12))) + sage: phi(Epr((21,12))) # optional - sage.rings.finite_rings (3 : 0 : 1) - sage: phi.rational_maps()[0] + sage: phi.rational_maps()[0] # optional - sage.rings.finite_rings (x^5 - 10*x^4 - 6*x^3 - 7*x^2 - x + 3)/(x^4 - 8*x^3 + 5*x^2 - 14*x - 6) sage: E = EllipticCurve('11a1') sage: R. = QQ[] sage: f = x^2 - 21*x + 80 sage: phi = EllipticCurveIsogeny(E, f); phi - Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field + Isogeny of degree 5 + from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism sage: Epr = E.short_weierstrass_model() sage: isom = Epr.isomorphism_to(E) sage: phi._set_pre_isomorphism(isom) sage: phi - Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 - 13392*x - 1080432 over Rational Field to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field + Isogeny of degree 5 + from Elliptic Curve defined by y^2 = x^3 - 13392*x - 1080432 over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field sage: phi(Epr((168,1188))) (0 : 1 : 0) """ @@ -2841,24 +2984,26 @@ def _set_post_isomorphism(self, postWI): TESTS:: - sage: E = EllipticCurve(j=GF(31)(0)) - sage: R. = GF(31)[] - sage: phi = EllipticCurveIsogeny(E, x+18) + sage: E = EllipticCurve(j=GF(31)(0)) # optional - sage.rings.finite_rings + sage: R. = GF(31)[] # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, x+18) # optional - sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: phi._set_post_isomorphism(WeierstrassIsomorphism(phi.codomain(), (6,8,10,12))) - sage: phi - Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 31 to Elliptic Curve defined by y^2 + 24*x*y + 7*y = x^3 + 22*x^2 + 16*x + 20 over Finite Field of size 31 - - sage: E = EllipticCurve(j=GF(47)(0)) - sage: f = E.torsion_polynomial(3)/3 - sage: phi = EllipticCurveIsogeny(E, f) - sage: E2 = phi.codomain() - sage: post_isom = E2.isomorphism_to(E) - sage: phi._set_post_isomorphism(post_isom) - sage: phi.rational_maps() == E.multiplication_by_m(3) + sage: phi._set_post_isomorphism(WeierstrassIsomorphism(phi.codomain(), (6,8,10,12))) # optional - sage.rings.finite_rings + sage: phi # optional - sage.rings.finite_rings + Isogeny of degree 3 + from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 31 + to Elliptic Curve defined by y^2 + 24*x*y + 7*y = x^3 + 22*x^2 + 16*x + 20 over Finite Field of size 31 + + sage: E = EllipticCurve(j=GF(47)(0)) # optional - sage.rings.finite_rings + sage: f = E.torsion_polynomial(3)/3 # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # optional - sage.rings.finite_rings + sage: E2 = phi.codomain() # optional - sage.rings.finite_rings + sage: post_isom = E2.isomorphism_to(E) # optional - sage.rings.finite_rings + sage: phi._set_post_isomorphism(post_isom) # optional - sage.rings.finite_rings + sage: phi.rational_maps() == E.multiplication_by_m(3) # optional - sage.rings.finite_rings False - sage: phi = -phi - sage: phi.rational_maps() == E.multiplication_by_m(3) + sage: phi = -phi # optional - sage.rings.finite_rings + sage: phi.rational_maps() == E.multiplication_by_m(3) # optional - sage.rings.finite_rings True sage: R. = QQ[] @@ -2869,7 +3014,9 @@ def _set_post_isomorphism(self, postWI): sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism sage: post_isom = WeierstrassIsomorphism(phi.codomain(), (a,2,3,5)) sage: phi - Isogeny of degree 4 from Elliptic Curve defined by y^2 = x^3 + x over Number Field in a with defining polynomial x^2 + 2 to Elliptic Curve defined by y^2 = x^3 + (-44)*x + 112 over Number Field in a with defining polynomial x^2 + 2 + Isogeny of degree 4 + from Elliptic Curve defined by y^2 = x^3 + x over Number Field in a with defining polynomial x^2 + 2 + to Elliptic Curve defined by y^2 = x^3 + (-44)*x + 112 over Number Field in a with defining polynomial x^2 + 2 """ WIdom = postWI.domain() WIcod = postWI.codomain() @@ -2923,71 +3070,82 @@ def dual(self): sage: (Xm, Ym) == E.multiplication_by_m(5) True - sage: E = EllipticCurve(GF(37), [0,0,0,1,8]) - sage: R. = GF(37)[] - sage: f = x^3 + x^2 + 28*x + 33 - sage: phi = EllipticCurveIsogeny(E, f) - sage: phi_hat = phi.dual() - sage: phi_hat.codomain() == phi.domain() + sage: E = EllipticCurve(GF(37), [0,0,0,1,8]) # optional - sage.rings.finite_rings + sage: R. = GF(37)[] # optional - sage.rings.finite_rings + sage: f = x^3 + x^2 + 28*x + 33 # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # optional - sage.rings.finite_rings + sage: phi_hat = phi.dual() # optional - sage.rings.finite_rings + sage: phi_hat.codomain() == phi.domain() # optional - sage.rings.finite_rings True - sage: phi_hat.domain() == phi.codomain() + sage: phi_hat.domain() == phi.codomain() # optional - sage.rings.finite_rings True - sage: (X, Y) = phi.rational_maps() - sage: (Xhat, Yhat) = phi_hat.rational_maps() - sage: Xm = Xhat.subs(x=X, y=Y) - sage: Ym = Yhat.subs(x=X, y=Y) - sage: (Xm, Ym) == E.multiplication_by_m(7) + sage: (X, Y) = phi.rational_maps() # optional - sage.rings.finite_rings + sage: (Xhat, Yhat) = phi_hat.rational_maps() # optional - sage.rings.finite_rings + sage: Xm = Xhat.subs(x=X, y=Y) # optional - sage.rings.finite_rings + sage: Ym = Yhat.subs(x=X, y=Y) # optional - sage.rings.finite_rings + sage: (Xm, Ym) == E.multiplication_by_m(7) # optional - sage.rings.finite_rings True - sage: E = EllipticCurve(GF(31), [0,0,0,1,8]) - sage: R. = GF(31)[] - sage: f = x^2 + 17*x + 29 - sage: phi = EllipticCurveIsogeny(E, f) - sage: phi_hat = phi.dual() - sage: phi_hat.codomain() == phi.domain() + sage: E = EllipticCurve(GF(31), [0,0,0,1,8]) # optional - sage.rings.finite_rings + sage: R. = GF(31)[] # optional - sage.rings.finite_rings + sage: f = x^2 + 17*x + 29 # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # optional - sage.rings.finite_rings + sage: phi_hat = phi.dual() # optional - sage.rings.finite_rings + sage: phi_hat.codomain() == phi.domain() # optional - sage.rings.finite_rings True - sage: phi_hat.domain() == phi.codomain() + sage: phi_hat.domain() == phi.codomain() # optional - sage.rings.finite_rings True - sage: (X, Y) = phi.rational_maps() - sage: (Xhat, Yhat) = phi_hat.rational_maps() - sage: Xm = Xhat.subs(x=X, y=Y) - sage: Ym = Yhat.subs(x=X, y=Y) - sage: (Xm, Ym) == E.multiplication_by_m(5) + sage: (X, Y) = phi.rational_maps() # optional - sage.rings.finite_rings + sage: (Xhat, Yhat) = phi_hat.rational_maps() # optional - sage.rings.finite_rings + sage: Xm = Xhat.subs(x=X, y=Y) # optional - sage.rings.finite_rings + sage: Ym = Yhat.subs(x=X, y=Y) # optional - sage.rings.finite_rings + sage: (Xm, Ym) == E.multiplication_by_m(5) # optional - sage.rings.finite_rings True Inseparable duals should be computed correctly:: - sage: z2 = GF(71^2).gen() - sage: E = EllipticCurve(j=57*z2+51) - sage: E.isogeny(3*E.lift_x(0)).dual() + sage: z2 = GF(71^2).gen() # optional - sage.rings.finite_rings + sage: E = EllipticCurve(j=57*z2+51) # optional - sage.rings.finite_rings + sage: E.isogeny(3*E.lift_x(0)).dual() # optional - sage.rings.finite_rings Composite morphism of degree 71 = 71*1^2: - From: Elliptic Curve defined by y^2 = x^3 + (32*z2+67)*x + (24*z2+37) over Finite Field in z2 of size 71^2 - To: Elliptic Curve defined by y^2 = x^3 + (41*z2+56)*x + (18*z2+42) over Finite Field in z2 of size 71^2 - sage: E.isogeny(E.lift_x(0)).dual() + From: Elliptic Curve defined by y^2 = x^3 + (32*z2+67)*x + (24*z2+37) + over Finite Field in z2 of size 71^2 + To: Elliptic Curve defined by y^2 = x^3 + (41*z2+56)*x + (18*z2+42) + over Finite Field in z2 of size 71^2 + sage: E.isogeny(E.lift_x(0)).dual() # optional - sage.rings.finite_rings Composite morphism of degree 213 = 71*3: - From: Elliptic Curve defined by y^2 = x^3 + (58*z2+31)*x + (34*z2+58) over Finite Field in z2 of size 71^2 - To: Elliptic Curve defined by y^2 = x^3 + (41*z2+56)*x + (18*z2+42) over Finite Field in z2 of size 71^2 + From: Elliptic Curve defined by y^2 = x^3 + (58*z2+31)*x + (34*z2+58) + over Finite Field in z2 of size 71^2 + To: Elliptic Curve defined by y^2 = x^3 + (41*z2+56)*x + (18*z2+42) + over Finite Field in z2 of size 71^2 ...even if pre- or post-isomorphisms are present:: sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: phi = E.isogeny(E.lift_x(0)) - sage: pre = ~WeierstrassIsomorphism(phi.domain(), (z2,2,3,4)) - sage: post = WeierstrassIsomorphism(phi.codomain(), (5,6,7,8)) - sage: phi = post * phi * pre - sage: phi.dual() + sage: phi = E.isogeny(E.lift_x(0)) # optional - sage.rings.finite_rings + sage: pre = ~WeierstrassIsomorphism(phi.domain(), (z2,2,3,4)) # optional - sage.rings.finite_rings + sage: post = WeierstrassIsomorphism(phi.codomain(), (5,6,7,8)) # optional - sage.rings.finite_rings + sage: phi = post * phi * pre # optional - sage.rings.finite_rings + sage: phi.dual() # optional - sage.rings.finite_rings Composite morphism of degree 213 = 71*3: - From: Elliptic Curve defined by y^2 + 17*x*y + 45*y = x^3 + 30*x^2 + (6*z2+64)*x + (48*z2+65) over Finite Field in z2 of size 71^2 - To: Elliptic Curve defined by y^2 + (60*z2+22)*x*y + (69*z2+37)*y = x^3 + (32*z2+48)*x^2 + (19*z2+58)*x + (56*z2+22) over Finite Field in z2 of size 71^2 + From: Elliptic Curve defined + by y^2 + 17*x*y + 45*y = x^3 + 30*x^2 + (6*z2+64)*x + (48*z2+65) + over Finite Field in z2 of size 71^2 + To: Elliptic Curve defined + by y^2 + (60*z2+22)*x*y + (69*z2+37)*y = x^3 + (32*z2+48)*x^2 + + (19*z2+58)*x + (56*z2+22) + over Finite Field in z2 of size 71^2 TESTS: Test for :trac:`23928`:: - sage: E = EllipticCurve(j=GF(431**2)(4)) - sage: phi = E.isogeny(E.lift_x(0)) - sage: phi.dual() - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 427*x over Finite Field in z2 of size 431^2 to Elliptic Curve defined by y^2 = x^3 + x over Finite Field in z2 of size 431^2 + sage: E = EllipticCurve(j=GF(431**2)(4)) # optional - sage.rings.finite_rings + sage: phi = E.isogeny(E.lift_x(0)) # optional - sage.rings.finite_rings + sage: phi.dual() # optional - sage.rings.finite_rings + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 427*x over Finite Field in z2 of size 431^2 + to Elliptic Curve defined by y^2 = x^3 + x over Finite Field in z2 of size 431^2 Test (for :trac:`7096`):: @@ -2996,30 +3154,34 @@ def dual(self): sage: phi.dual().dual() == phi True - sage: k = GF(103) - sage: E = EllipticCurve(k,[11,11]) - sage: phi = E.isogeny(E(4,4)) - sage: phi - Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 11*x + 11 over Finite Field of size 103 to Elliptic Curve defined by y^2 = x^3 + 25*x + 80 over Finite Field of size 103 + sage: k = GF(103) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(k,[11,11]) # optional - sage.rings.finite_rings + sage: phi = E.isogeny(E(4,4)) # optional - sage.rings.finite_rings + sage: phi # optional - sage.rings.finite_rings + Isogeny of degree 5 + from Elliptic Curve defined by y^2 = x^3 + 11*x + 11 over Finite Field of size 103 + to Elliptic Curve defined by y^2 = x^3 + 25*x + 80 over Finite Field of size 103 sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: phi = WeierstrassIsomorphism(phi.codomain(),(5,0,1,2)) * phi - sage: phi.dual().dual() == phi + sage: phi = WeierstrassIsomorphism(phi.codomain(),(5,0,1,2)) * phi # optional - sage.rings.finite_rings + sage: phi.dual().dual() == phi # optional - sage.rings.finite_rings True - sage: E = EllipticCurve(GF(103),[1,0,0,1,-1]) - sage: phi = E.isogeny(E(60,85)) - sage: phi.dual() - Isogeny of degree 7 from Elliptic Curve defined by y^2 + x*y = x^3 + 84*x + 34 over Finite Field of size 103 to Elliptic Curve defined by y^2 + x*y = x^3 + x + 102 over Finite Field of size 103 + sage: E = EllipticCurve(GF(103),[1,0,0,1,-1]) # optional - sage.rings.finite_rings + sage: phi = E.isogeny(E(60,85)) # optional - sage.rings.finite_rings + sage: phi.dual() # optional - sage.rings.finite_rings + Isogeny of degree 7 + from Elliptic Curve defined by y^2 + x*y = x^3 + 84*x + 34 over Finite Field of size 103 + to Elliptic Curve defined by y^2 + x*y = x^3 + x + 102 over Finite Field of size 103 Check that :trac:`17293` is fixed:: - sage: k. = QuadraticField(2) - sage: E = EllipticCurve(k, [-3*s*(4 + 5*s), 2*s*(2 + 14*s + 11*s^2)]) - sage: phi = E.isogenies_prime_degree(3)[0] - sage: (-phi).dual() == -phi.dual() + sage: k. = QuadraticField(2) # optional - sage.rings.number_field + sage: E = EllipticCurve(k, [-3*s*(4 + 5*s), 2*s*(2 + 14*s + 11*s^2)]) # optional - sage.rings.number_field + sage: phi = E.isogenies_prime_degree(3)[0] # optional - sage.rings.number_field + sage: (-phi).dual() == -phi.dual() # optional - sage.rings.number_field True - sage: phi._EllipticCurveIsogeny__clear_cached_values() # forget the dual - sage: -phi.dual() == (-phi).dual() + sage: phi._EllipticCurveIsogeny__clear_cached_values() # forget the dual # optional - sage.rings.number_field + sage: -phi.dual() == (-phi).dual() # optional - sage.rings.number_field True """ if self.__base_field.characteristic() in (2, 3): @@ -3112,23 +3274,29 @@ def _composition_impl(left, right): EXAMPLES:: - sage: E = EllipticCurve(GF(127), [5,2]) - sage: phi = E.isogeny(E.lift_x(47)); E2 = phi.codomain() - sage: iso1 = E.change_weierstrass_model(1,1,1,1).isomorphism_to(E) - sage: iso2 = E2.isomorphism_to(E2.change_weierstrass_model(39,0,0,0)) - sage: phi * iso1 # indirect doctest - Isogeny of degree 11 from Elliptic Curve defined by y^2 + 2*x*y + 2*y = x^3 + 2*x^2 + 6*x + 7 over Finite Field of size 127 to Elliptic Curve defined by y^2 = x^3 + 37*x + 85 over Finite Field of size 127 - sage: iso2 * phi # indirect doctest - Isogeny of degree 11 from Elliptic Curve defined by y^2 = x^3 + 5*x + 2 over Finite Field of size 127 to Elliptic Curve defined by y^2 = x^3 + 117*x + 58 over Finite Field of size 127 - sage: iso2 * phi * iso1 # indirect doctest - Isogeny of degree 11 from Elliptic Curve defined by y^2 + 2*x*y + 2*y = x^3 + 2*x^2 + 6*x + 7 over Finite Field of size 127 to Elliptic Curve defined by y^2 = x^3 + 117*x + 58 over Finite Field of size 127 + sage: E = EllipticCurve(GF(127), [5,2]) # optional - sage.rings.finite_rings + sage: phi = E.isogeny(E.lift_x(47)); E2 = phi.codomain() # optional - sage.rings.finite_rings + sage: iso1 = E.change_weierstrass_model(1,1,1,1).isomorphism_to(E) # optional - sage.rings.finite_rings + sage: iso2 = E2.isomorphism_to(E2.change_weierstrass_model(39,0,0,0)) # optional - sage.rings.finite_rings + sage: phi * iso1 # indirect doctest # optional - sage.rings.finite_rings + Isogeny of degree 11 + from Elliptic Curve defined by y^2 + 2*x*y + 2*y = x^3 + 2*x^2 + 6*x + 7 over Finite Field of size 127 + to Elliptic Curve defined by y^2 = x^3 + 37*x + 85 over Finite Field of size 127 + sage: iso2 * phi # indirect doctest # optional - sage.rings.finite_rings + Isogeny of degree 11 + from Elliptic Curve defined by y^2 = x^3 + 5*x + 2 over Finite Field of size 127 + to Elliptic Curve defined by y^2 = x^3 + 117*x + 58 over Finite Field of size 127 + sage: iso2 * phi * iso1 # indirect doctest # optional - sage.rings.finite_rings + Isogeny of degree 11 + from Elliptic Curve defined by y^2 + 2*x*y + 2*y = x^3 + 2*x^2 + 6*x + 7 over Finite Field of size 127 + to Elliptic Curve defined by y^2 = x^3 + 117*x + 58 over Finite Field of size 127 TESTS: We should return ``NotImplemented`` when passed a combination of elliptic-curve morphism types that we don't handle here:: - sage: phi._composition_impl(iso1, iso1**-1) + sage: phi._composition_impl(iso1, iso1**-1) # optional - sage.rings.finite_rings NotImplemented """ if isinstance(left, WeierstrassIsomorphism) and isinstance(right, EllipticCurveIsogeny): @@ -3183,22 +3351,22 @@ def compute_isogeny_stark(E1, E2, ell): sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import compute_isogeny_stark, compute_sequence_of_maps - sage: E = EllipticCurve(GF(97), [1,0,1,1,0]) - sage: R. = GF(97)[]; f = x^5 + 27*x^4 + 61*x^3 + 58*x^2 + 28*x + 21 - sage: phi = EllipticCurveIsogeny(E, f) - sage: E2 = phi.codomain() - sage: (isom1, isom2, E1pr, E2pr, ker_poly) = compute_sequence_of_maps(E, E2, 11) - sage: compute_isogeny_stark(E1pr, E2pr, 11) + sage: E = EllipticCurve(GF(97), [1,0,1,1,0]) # optional - sage.rings.finite_rings + sage: R. = GF(97)[]; f = x^5 + 27*x^4 + 61*x^3 + 58*x^2 + 28*x + 21 # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # optional - sage.rings.finite_rings + sage: E2 = phi.codomain() # optional - sage.rings.finite_rings + sage: isom1, isom2, E1pr, E2pr, ker_poly = compute_sequence_of_maps(E, E2, 11) # optional - sage.rings.finite_rings + sage: compute_isogeny_stark(E1pr, E2pr, 11) # optional - sage.rings.finite_rings x^10 + 37*x^9 + 53*x^8 + 66*x^7 + 66*x^6 + 17*x^5 + 57*x^4 + 6*x^3 + 89*x^2 + 53*x + 8 - sage: E = EllipticCurve(GF(37), [0,0,0,1,8]) - sage: R. = GF(37)[] - sage: f = (x + 14) * (x + 30) - sage: phi = EllipticCurveIsogeny(E, f) - sage: E2 = phi.codomain() - sage: compute_isogeny_stark(E, E2, 5) + sage: E = EllipticCurve(GF(37), [0,0,0,1,8]) # optional - sage.rings.finite_rings + sage: R. = GF(37)[] # optional - sage.rings.finite_rings + sage: f = (x + 14) * (x + 30) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # optional - sage.rings.finite_rings + sage: E2 = phi.codomain() # optional - sage.rings.finite_rings + sage: compute_isogeny_stark(E, E2, 5) # optional - sage.rings.finite_rings x^4 + 14*x^3 + x^2 + 34*x + 21 - sage: f**2 + sage: f**2 # optional - sage.rings.finite_rings x^4 + 14*x^3 + x^2 + 34*x + 21 sage: E = EllipticCurve(QQ, [0,0,0,1,0]) @@ -3280,11 +3448,11 @@ def split_kernel_polynomial(poly): Check that this behaves identically to ``.radical()``:: sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import split_kernel_polynomial - sage: q = next_prime(randrange(3,10^3)) - sage: e = randrange(1,5) - sage: R = GF(q^e,'a')['x'] - sage: f = R.random_element(randrange(10,100)).monic() - sage: split_kernel_polynomial(f) == f.radical() + sage: q = next_prime(randrange(3,10^3)) # optional - sage.rings.finite_rings + sage: e = randrange(1,5) # optional - sage.rings.finite_rings + sage: R = GF(q^e,'a')['x'] # optional - sage.rings.finite_rings + sage: f = R.random_element(randrange(10,100)).monic() # optional - sage.rings.finite_rings + sage: split_kernel_polynomial(f) == f.radical() # optional - sage.rings.finite_rings doctest:warning ... DeprecationWarning: ... True @@ -3324,40 +3492,40 @@ def compute_isogeny_kernel_polynomial(E1, E2, ell, algorithm="stark"): sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import compute_isogeny_kernel_polynomial - sage: E = EllipticCurve(GF(37), [0,0,0,1,8]) - sage: R. = GF(37)[] - sage: f = (x + 14) * (x + 30) - sage: phi = EllipticCurveIsogeny(E, f) - sage: E2 = phi.codomain() - sage: compute_isogeny_kernel_polynomial(E, E2, 5) + sage: E = EllipticCurve(GF(37), [0,0,0,1,8]) # optional - sage.rings.finite_rings + sage: R. = GF(37)[] # optional - sage.rings.finite_rings + sage: f = (x + 14) * (x + 30) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # optional - sage.rings.finite_rings + sage: E2 = phi.codomain() # optional - sage.rings.finite_rings + sage: compute_isogeny_kernel_polynomial(E, E2, 5) # optional - sage.rings.finite_rings x^2 + 7*x + 13 - sage: f + sage: f # optional - sage.rings.finite_rings x^2 + 7*x + 13 sage: R. = QQ[] - sage: K. = NumberField(x^2 + 1) - sage: E = EllipticCurve(K, [0,0,0,1,0]) - sage: E2 = EllipticCurve(K, [0,0,0,16,0]) - sage: compute_isogeny_kernel_polynomial(E, E2, 4) + sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,0,1,0]) # optional - sage.rings.number_field + sage: E2 = EllipticCurve(K, [0,0,0,16,0]) # optional - sage.rings.number_field + sage: compute_isogeny_kernel_polynomial(E, E2, 4) # optional - sage.rings.number_field x^3 + x TESTS: Check that :meth:`Polynomial.radical` is doing the right thing for us:: - sage: E = EllipticCurve(GF(37), [0,0,0,1,8]) - sage: R. = GF(37)[] - sage: f = (x + 10) * (x + 12) * (x + 16) - sage: phi = EllipticCurveIsogeny(E, f) - sage: E2 = phi.codomain() + sage: E = EllipticCurve(GF(37), [0,0,0,1,8]) # optional - sage.rings.finite_rings + sage: R. = GF(37)[] # optional - sage.rings.finite_rings + sage: f = (x + 10) * (x + 12) * (x + 16) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # optional - sage.rings.finite_rings + sage: E2 = phi.codomain() # optional - sage.rings.finite_rings sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import compute_isogeny_stark - sage: ker_poly = compute_isogeny_stark(E, E2, 7); ker_poly + sage: ker_poly = compute_isogeny_stark(E, E2, 7); ker_poly # optional - sage.rings.finite_rings x^6 + 2*x^5 + 20*x^4 + 11*x^3 + 36*x^2 + 35*x + 16 - sage: ker_poly.factor() + sage: ker_poly.factor() # optional - sage.rings.finite_rings (x + 10)^2 * (x + 12)^2 * (x + 16)^2 - sage: poly = ker_poly.radical(); poly + sage: poly = ker_poly.radical(); poly # optional - sage.rings.finite_rings x^3 + x^2 + 28*x + 33 - sage: poly.factor() + sage: poly.factor() # optional - sage.rings.finite_rings (x + 10) * (x + 12) * (x + 16) """ if algorithm == 'starks': @@ -3405,32 +3573,40 @@ def compute_intermediate_curves(E1, E2): EXAMPLES:: sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import compute_intermediate_curves - sage: E = EllipticCurve(GF(83), [1,0,1,1,0]) - sage: R. = GF(83)[]; f = x+24 - sage: phi = EllipticCurveIsogeny(E, f) - sage: E2 = phi.codomain() - sage: compute_intermediate_curves(E, E2) + sage: E = EllipticCurve(GF(83), [1,0,1,1,0]) # optional - sage.rings.finite_rings + sage: R. = GF(83)[]; f = x + 24 # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # optional - sage.rings.finite_rings + sage: E2 = phi.codomain() # optional - sage.rings.finite_rings + sage: compute_intermediate_curves(E, E2) # optional - sage.rings.finite_rings (Elliptic Curve defined by y^2 = x^3 + 62*x + 74 over Finite Field of size 83, Elliptic Curve defined by y^2 = x^3 + 65*x + 69 over Finite Field of size 83, Elliptic-curve morphism: - From: Elliptic Curve defined by y^2 + x*y + y = x^3 + x over Finite Field of size 83 - To: Elliptic Curve defined by y^2 = x^3 + 62*x + 74 over Finite Field of size 83 + From: Elliptic Curve defined by y^2 + x*y + y = x^3 + x + over Finite Field of size 83 + To: Elliptic Curve defined by y^2 = x^3 + 62*x + 74 + over Finite Field of size 83 Via: (u,r,s,t) = (1, 76, 41, 3), Elliptic-curve morphism: - From: Elliptic Curve defined by y^2 = x^3 + 65*x + 69 over Finite Field of size 83 - To: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + 16 over Finite Field of size 83 + From: Elliptic Curve defined by y^2 = x^3 + 65*x + 69 + over Finite Field of size 83 + To: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + 16 + over Finite Field of size 83 Via: (u,r,s,t) = (1, 7, 42, 42)) sage: R. = QQ[] - sage: K. = NumberField(x^2 + 1) - sage: E = EllipticCurve(K, [0,0,0,1,0]) - sage: E2 = EllipticCurve(K, [0,0,0,16,0]) - sage: compute_intermediate_curves(E, E2) - (Elliptic Curve defined by y^2 = x^3 + x over Number Field in i with defining polynomial x^2 + 1, - Elliptic Curve defined by y^2 = x^3 + 16*x over Number Field in i with defining polynomial x^2 + 1, - Elliptic-curve endomorphism of Elliptic Curve defined by y^2 = x^3 + x over Number Field in i with defining polynomial x^2 + 1 + sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,0,1,0]) # optional - sage.rings.number_field + sage: E2 = EllipticCurve(K, [0,0,0,16,0]) # optional - sage.rings.number_field + sage: compute_intermediate_curves(E, E2) # optional - sage.rings.number_field + (Elliptic Curve defined by y^2 = x^3 + x + over Number Field in i with defining polynomial x^2 + 1, + Elliptic Curve defined by y^2 = x^3 + 16*x + over Number Field in i with defining polynomial x^2 + 1, + Elliptic-curve endomorphism of Elliptic Curve defined by y^2 = x^3 + x + over Number Field in i with defining polynomial x^2 + 1 Via: (u,r,s,t) = (1, 0, 0, 0), - Elliptic-curve endomorphism of Elliptic Curve defined by y^2 = x^3 + 16*x over Number Field in i with defining polynomial x^2 + 1 + Elliptic-curve endomorphism of Elliptic Curve defined by y^2 = x^3 + 16*x + over Number Field in i with defining polynomial x^2 + 1 Via: (u,r,s,t) = (1, 0, 0, 0)) """ if E1.base_ring().characteristic() in (2, 3): @@ -3493,41 +3669,55 @@ def compute_sequence_of_maps(E1, E2, ell): sage: E2 = phi.codomain() sage: compute_sequence_of_maps(E, E2, 5) (Elliptic-curve morphism: - From: Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field - To: Elliptic Curve defined by y^2 = x^3 - 31/3*x - 2501/108 over Rational Field + From: Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 + over Rational Field + To: Elliptic Curve defined by y^2 = x^3 - 31/3*x - 2501/108 + over Rational Field Via: (u,r,s,t) = (1, 1/3, 0, -1/2), Elliptic-curve morphism: - From: Elliptic Curve defined by y^2 = x^3 - 23461/3*x - 28748141/108 over Rational Field - To: Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field + From: Elliptic Curve defined by y^2 = x^3 - 23461/3*x - 28748141/108 + over Rational Field + To: Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 + over Rational Field Via: (u,r,s,t) = (1, -1/3, 0, 1/2), - Elliptic Curve defined by y^2 = x^3 - 31/3*x - 2501/108 over Rational Field, - Elliptic Curve defined by y^2 = x^3 - 23461/3*x - 28748141/108 over Rational Field, + Elliptic Curve defined by y^2 = x^3 - 31/3*x - 2501/108 + over Rational Field, + Elliptic Curve defined by y^2 = x^3 - 23461/3*x - 28748141/108 + over Rational Field, x^2 - 61/3*x + 658/9) sage: K. = NumberField(x^2 + 1) - sage: E = EllipticCurve(K, [0,0,0,1,0]) - sage: E2 = EllipticCurve(K, [0,0,0,16,0]) - sage: compute_sequence_of_maps(E, E2, 4) - (Elliptic-curve endomorphism of Elliptic Curve defined by y^2 = x^3 + x over Number Field in i with defining polynomial x^2 + 1 + sage: E = EllipticCurve(K, [0,0,0,1,0]) # optional - sage.rings.number_field + sage: E2 = EllipticCurve(K, [0,0,0,16,0]) # optional - sage.rings.number_field + sage: compute_sequence_of_maps(E, E2, 4) # optional - sage.rings.number_field + (Elliptic-curve endomorphism of Elliptic Curve defined by y^2 = x^3 + x + over Number Field in i with defining polynomial x^2 + 1 Via: (u,r,s,t) = (1, 0, 0, 0), - Elliptic-curve endomorphism of Elliptic Curve defined by y^2 = x^3 + 16*x over Number Field in i with defining polynomial x^2 + 1 + Elliptic-curve endomorphism of Elliptic Curve defined by y^2 = x^3 + 16*x + over Number Field in i with defining polynomial x^2 + 1 Via: (u,r,s,t) = (1, 0, 0, 0), - Elliptic Curve defined by y^2 = x^3 + x over Number Field in i with defining polynomial x^2 + 1, - Elliptic Curve defined by y^2 = x^3 + 16*x over Number Field in i with defining polynomial x^2 + 1, + Elliptic Curve defined by y^2 = x^3 + x + over Number Field in i with defining polynomial x^2 + 1, + Elliptic Curve defined by y^2 = x^3 + 16*x + over Number Field in i with defining polynomial x^2 + 1, x^3 + x) - sage: E = EllipticCurve(GF(97), [1,0,1,1,0]) - sage: R. = GF(97)[]; f = x^5 + 27*x^4 + 61*x^3 + 58*x^2 + 28*x + 21 - sage: phi = EllipticCurveIsogeny(E, f) - sage: E2 = phi.codomain() - sage: compute_sequence_of_maps(E, E2, 11) + sage: E = EllipticCurve(GF(97), [1,0,1,1,0]) # optional - sage.rings.finite_rings + sage: R. = GF(97)[]; f = x^5 + 27*x^4 + 61*x^3 + 58*x^2 + 28*x + 21 # optional - sage.rings.finite_rings + sage: phi = EllipticCurveIsogeny(E, f) # optional - sage.rings.finite_rings + sage: E2 = phi.codomain() # optional - sage.rings.finite_rings + sage: compute_sequence_of_maps(E, E2, 11) # optional - sage.rings.finite_rings (Elliptic-curve morphism: - From: Elliptic Curve defined by y^2 + x*y + y = x^3 + x over Finite Field of size 97 - To: Elliptic Curve defined by y^2 = x^3 + 52*x + 31 over Finite Field of size 97 + From: Elliptic Curve defined by y^2 + x*y + y = x^3 + x + over Finite Field of size 97 + To: Elliptic Curve defined by y^2 = x^3 + 52*x + 31 + over Finite Field of size 97 Via: (u,r,s,t) = (1, 8, 48, 44), Elliptic-curve morphism: - From: Elliptic Curve defined by y^2 = x^3 + 41*x + 66 over Finite Field of size 97 - To: Elliptic Curve defined by y^2 + x*y + y = x^3 + 87*x + 26 over Finite Field of size 97 + From: Elliptic Curve defined by y^2 = x^3 + 41*x + 66 + over Finite Field of size 97 + To: Elliptic Curve defined by y^2 + x*y + y = x^3 + 87*x + 26 + over Finite Field of size 97 Via: (u,r,s,t) = (1, 89, 49, 49), Elliptic Curve defined by y^2 = x^3 + 52*x + 31 over Finite Field of size 97, Elliptic Curve defined by y^2 = x^3 + 41*x + 66 over Finite Field of size 97, @@ -3559,7 +3749,8 @@ def fill_isogeny_matrix(M): EXAMPLES:: - sage: M = Matrix([[0, 2, 3, 3, 0, 0], [2, 0, 0, 0, 3, 3], [3, 0, 0, 0, 2, 0], [3, 0, 0, 0, 0, 2], [0, 3, 2, 0, 0, 0], [0, 3, 0, 2, 0, 0]]); M + sage: M = Matrix([[0, 2, 3, 3, 0, 0], [2, 0, 0, 0, 3, 3], [3, 0, 0, 0, 2, 0], + ....: [3, 0, 0, 0, 0, 2], [0, 3, 2, 0, 0, 0], [0, 3, 0, 2, 0, 0]]); M [0 2 3 3 0 0] [2 0 0 0 3 3] [3 0 0 0 2 0] @@ -3614,7 +3805,8 @@ def unfill_isogeny_matrix(M): EXAMPLES:: - sage: M = Matrix([[0, 2, 3, 3, 0, 0], [2, 0, 0, 0, 3, 3], [3, 0, 0, 0, 2, 0], [3, 0, 0, 0, 0, 2], [0, 3, 2, 0, 0, 0], [0, 3, 0, 2, 0, 0]]); M + sage: M = Matrix([[0, 2, 3, 3, 0, 0], [2, 0, 0, 0, 3, 3], [3, 0, 0, 0, 2, 0], + ....: [3, 0, 0, 0, 0, 2], [0, 3, 2, 0, 0, 0], [0, 3, 0, 2, 0, 0]]); M [0 2 3 3 0 0] [2 0 0 0 3 3] [3 0 0 0 2 0] diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py index 49958afae66..a974fbe3729 100644 --- a/src/sage/schemes/elliptic_curves/ell_field.py +++ b/src/sage/schemes/elliptic_curves/ell_field.py @@ -46,8 +46,8 @@ def genus(self): EXAMPLES:: - sage: E = EllipticCurve(GF(3), [0, -1, 0, -346, 2652]) - sage: E.genus() + sage: E = EllipticCurve(GF(3), [0, -1, 0, -346, 2652]) # optional - sage.rings.finite_rings + sage: E.genus() # optional - sage.rings.finite_rings 1 sage: R = FractionField(QQ['z']) @@ -96,46 +96,52 @@ def quadratic_twist(self, D=None): EXAMPLES:: - sage: E = EllipticCurve([GF(1103)(1), 0, 0, 107, 340]); E - Elliptic Curve defined by y^2 + x*y = x^3 + 107*x + 340 over Finite Field of size 1103 - sage: F=E.quadratic_twist(-1); F - Elliptic Curve defined by y^2 = x^3 + 1102*x^2 + 609*x + 300 over Finite Field of size 1103 - sage: E.is_isomorphic(F) + sage: E = EllipticCurve([GF(1103)(1), 0, 0, 107, 340]); E # optional - sage.rings.finite_rings + Elliptic Curve defined by y^2 + x*y = x^3 + 107*x + 340 + over Finite Field of size 1103 + sage: F = E.quadratic_twist(-1); F # optional - sage.rings.finite_rings + Elliptic Curve defined by y^2 = x^3 + 1102*x^2 + 609*x + 300 + over Finite Field of size 1103 + sage: E.is_isomorphic(F) # optional - sage.rings.finite_rings False - sage: E.is_isomorphic(F,GF(1103^2,'a')) + sage: E.is_isomorphic(F, GF(1103^2,'a')) # optional - sage.rings.finite_rings True A characteristic 2 example:: - sage: E=EllipticCurve(GF(2),[1,0,1,1,1]) - sage: E1=E.quadratic_twist(1) - sage: E.is_isomorphic(E1) + sage: E = EllipticCurve(GF(2), [1,0,1,1,1]) # optional - sage.rings.finite_rings + sage: E1 = E.quadratic_twist(1) # optional - sage.rings.finite_rings + sage: E.is_isomorphic(E1) # optional - sage.rings.finite_rings False - sage: E.is_isomorphic(E1,GF(4,'a')) + sage: E.is_isomorphic(E1, GF(4,'a')) # optional - sage.rings.finite_rings True Over finite fields, the twisting parameter may be omitted:: - sage: k. = GF(2^10) - sage: E = EllipticCurve(k,[a^2,a,1,a+1,1]) - sage: Et = E.quadratic_twist() - sage: Et # random (only determined up to isomorphism) - Elliptic Curve defined by y^2 + x*y = x^3 + (a^7+a^4+a^3+a^2+a+1)*x^2 + (a^8+a^6+a^4+1) over Finite Field in a of size 2^10 - sage: E.is_isomorphic(Et) + sage: k. = GF(2^10) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(k, [a^2,a,1,a+1,1]) # optional - sage.rings.finite_rings + sage: Et = E.quadratic_twist() # optional - sage.rings.finite_rings + sage: Et # random (only determined up to isomorphism) # optional - sage.rings.finite_rings + Elliptic Curve defined + by y^2 + x*y = x^3 + (a^7+a^4+a^3+a^2+a+1)*x^2 + (a^8+a^6+a^4+1) + over Finite Field in a of size 2^10 + sage: E.is_isomorphic(Et) # optional - sage.rings.finite_rings False - sage: E.j_invariant()==Et.j_invariant() + sage: E.j_invariant() == Et.j_invariant() # optional - sage.rings.finite_rings True - sage: p=next_prime(10^10) - sage: k = GF(p) - sage: E = EllipticCurve(k,[1,2,3,4,5]) - sage: Et = E.quadratic_twist() - sage: Et # random (only determined up to isomorphism) - Elliptic Curve defined by y^2 = x^3 + 7860088097*x^2 + 9495240877*x + 3048660957 over Finite Field of size 10000000019 - sage: E.is_isomorphic(Et) + sage: p = next_prime(10^10) # optional - sage.rings.finite_rings + sage: k = GF(p) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(k, [1,2,3,4,5]) # optional - sage.rings.finite_rings + sage: Et = E.quadratic_twist() # optional - sage.rings.finite_rings + sage: Et # random (only determined up to isomorphism) # optional - sage.rings.finite_rings + Elliptic Curve defined + by y^2 = x^3 + 7860088097*x^2 + 9495240877*x + 3048660957 + over Finite Field of size 10000000019 + sage: E.is_isomorphic(Et) # optional - sage.rings.finite_rings False - sage: k2 = GF(p^2,'a') - sage: E.change_ring(k2).is_isomorphic(Et.change_ring(k2)) + sage: k2 = GF(p^2,'a') # optional - sage.rings.finite_rings + sage: E.change_ring(k2).is_isomorphic(Et.change_ring(k2)) # optional - sage.rings.finite_rings True """ K = self.base_ring() @@ -199,11 +205,11 @@ def two_torsion_rank(self): EXAMPLES:: - sage: E=EllipticCurve('11a1') + sage: E = EllipticCurve('11a1') sage: E.two_torsion_rank() 0 - sage: K.=QQ.extension(E.division_polynomial(2).monic()) - sage: E.base_extend(K).two_torsion_rank() + sage: K. = QQ.extension(E.division_polynomial(2).monic()) # optional - sage.rings.number_field + sage: E.base_extend(K).two_torsion_rank() # optional - sage.rings.number_field 1 sage: E.reduction(53).two_torsion_rank() 2 @@ -213,8 +219,9 @@ def two_torsion_rank(self): sage: E = EllipticCurve('14a1') sage: E.two_torsion_rank() 1 - sage: K.=QQ.extension(E.division_polynomial(2).monic().factor()[1][0]) - sage: E.base_extend(K).two_torsion_rank() + sage: f = E.division_polynomial(2).monic().factor()[1][0] + sage: K. = QQ.extension(f) # optional - sage.rings.number_field + sage: E.base_extend(K).two_torsion_rank() # optional - sage.rings.number_field 2 :: @@ -241,15 +248,15 @@ def quartic_twist(self, D): EXAMPLES:: - sage: E=EllipticCurve_from_j(GF(13)(1728)); E + sage: E = EllipticCurve_from_j(GF(13)(1728)); E # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 13 - sage: E1=E.quartic_twist(2); E1 + sage: E1 = E.quartic_twist(2); E1 # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 13 - sage: E.is_isomorphic(E1) + sage: E.is_isomorphic(E1) # optional - sage.rings.finite_rings False - sage: E.is_isomorphic(E1,GF(13^2,'a')) + sage: E.is_isomorphic(E1, GF(13^2,'a')) # optional - sage.rings.finite_rings False - sage: E.is_isomorphic(E1,GF(13^4,'a')) + sage: E.is_isomorphic(E1, GF(13^4,'a')) # optional - sage.rings.finite_rings True """ K=self.base_ring() @@ -284,17 +291,17 @@ def sextic_twist(self, D): EXAMPLES:: - sage: E=EllipticCurve_from_j(GF(13)(0)); E + sage: E = EllipticCurve_from_j(GF(13)(0)); E # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 13 - sage: E1=E.sextic_twist(2); E1 + sage: E1 = E.sextic_twist(2); E1 # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + 11 over Finite Field of size 13 - sage: E.is_isomorphic(E1) + sage: E.is_isomorphic(E1) # optional - sage.rings.finite_rings False - sage: E.is_isomorphic(E1,GF(13^2,'a')) + sage: E.is_isomorphic(E1, GF(13^2,'a')) # optional - sage.rings.finite_rings False - sage: E.is_isomorphic(E1,GF(13^4,'a')) + sage: E.is_isomorphic(E1, GF(13^4,'a')) # optional - sage.rings.finite_rings False - sage: E.is_isomorphic(E1,GF(13^6,'a')) + sage: E.is_isomorphic(E1, GF(13^6,'a')) # optional - sage.rings.finite_rings True """ K=self.base_ring() @@ -344,10 +351,10 @@ def is_quadratic_twist(self, other): sage: E.is_quadratic_twist(Et) -6 - sage: E1=EllipticCurve([0,0,1,0,0]) + sage: E1 = EllipticCurve([0,0,1,0,0]) sage: E1.j_invariant() 0 - sage: E2=EllipticCurve([0,0,0,0,2]) + sage: E2 = EllipticCurve([0,0,0,0,2]) sage: E1.is_quadratic_twist(E2) 2 sage: E1.is_quadratic_twist(E1) @@ -357,52 +364,52 @@ def is_quadratic_twist(self, other): :: - sage: E1=EllipticCurve([0,0,0,1,0]) + sage: E1 = EllipticCurve([0,0,0,1,0]) sage: E1.j_invariant() 1728 - sage: E2=EllipticCurve([0,0,0,2,0]) + sage: E2 = EllipticCurve([0,0,0,2,0]) sage: E1.is_quadratic_twist(E2) 0 - sage: E2=EllipticCurve([0,0,0,25,0]) + sage: E2 = EllipticCurve([0,0,0,25,0]) sage: E1.is_quadratic_twist(E2) 5 :: - sage: F = GF(101) - sage: E1 = EllipticCurve(F,[4,7]) - sage: E2 = E1.quadratic_twist() - sage: D = E1.is_quadratic_twist(E2); D!=0 + sage: F = GF(101) # optional - sage.rings.finite_rings + sage: E1 = EllipticCurve(F, [4,7]) # optional - sage.rings.finite_rings + sage: E2 = E1.quadratic_twist() # optional - sage.rings.finite_rings + sage: D = E1.is_quadratic_twist(E2); D != 0 # optional - sage.rings.finite_rings True - sage: F = GF(101) - sage: E1 = EllipticCurve(F,[4,7]) - sage: E2 = E1.quadratic_twist() - sage: D = E1.is_quadratic_twist(E2) - sage: E1.quadratic_twist(D).is_isomorphic(E2) + sage: F = GF(101) # optional - sage.rings.finite_rings + sage: E1 = EllipticCurve(F, [4,7]) # optional - sage.rings.finite_rings + sage: E2 = E1.quadratic_twist() # optional - sage.rings.finite_rings + sage: D = E1.is_quadratic_twist(E2) # optional - sage.rings.finite_rings + sage: E1.quadratic_twist(D).is_isomorphic(E2) # optional - sage.rings.finite_rings True - sage: E1.is_isomorphic(E2) + sage: E1.is_isomorphic(E2) # optional - sage.rings.finite_rings False - sage: F2 = GF(101^2,'a') - sage: E1.change_ring(F2).is_isomorphic(E2.change_ring(F2)) + sage: F2 = GF(101^2,'a') # optional - sage.rings.finite_rings + sage: E1.change_ring(F2).is_isomorphic(E2.change_ring(F2)) # optional - sage.rings.finite_rings True A characteristic 3 example:: - sage: F = GF(3^5,'a') - sage: E1 = EllipticCurve_from_j(F(1)) - sage: E2 = E1.quadratic_twist(-1) - sage: D = E1.is_quadratic_twist(E2); D!=0 + sage: F = GF(3^5,'a') # optional - sage.rings.finite_rings + sage: E1 = EllipticCurve_from_j(F(1)) # optional - sage.rings.finite_rings + sage: E2 = E1.quadratic_twist(-1) # optional - sage.rings.finite_rings + sage: D = E1.is_quadratic_twist(E2); D != 0 # optional - sage.rings.finite_rings True - sage: E1.quadratic_twist(D).is_isomorphic(E2) + sage: E1.quadratic_twist(D).is_isomorphic(E2) # optional - sage.rings.finite_rings True :: - sage: E1 = EllipticCurve_from_j(F(0)) - sage: E2 = E1.quadratic_twist() - sage: D = E1.is_quadratic_twist(E2); D + sage: E1 = EllipticCurve_from_j(F(0)) # optional - sage.rings.finite_rings + sage: E2 = E1.quadratic_twist() # optional - sage.rings.finite_rings + sage: D = E1.is_quadratic_twist(E2); D # optional - sage.rings.finite_rings 1 - sage: E1.is_isomorphic(E2) + sage: E1.is_isomorphic(E2) # optional - sage.rings.finite_rings True """ from sage.schemes.elliptic_curves.ell_generic import is_EllipticCurve @@ -488,11 +495,11 @@ def is_quartic_twist(self, other): EXAMPLES:: - sage: E = EllipticCurve_from_j(GF(13)(1728)) - sage: E1 = E.quartic_twist(2) - sage: D = E.is_quartic_twist(E1); D!=0 + sage: E = EllipticCurve_from_j(GF(13)(1728)) # optional - sage.rings.finite_rings + sage: E1 = E.quartic_twist(2) # optional - sage.rings.finite_rings + sage: D = E.is_quartic_twist(E1); D!=0 # optional - sage.rings.finite_rings True - sage: E.quartic_twist(D).is_isomorphic(E1) + sage: E.quartic_twist(D).is_isomorphic(E1) # optional - sage.rings.finite_rings True :: @@ -557,11 +564,11 @@ def is_sextic_twist(self, other): EXAMPLES:: - sage: E = EllipticCurve_from_j(GF(13)(0)) - sage: E1 = E.sextic_twist(2) - sage: D = E.is_sextic_twist(E1); D!=0 + sage: E = EllipticCurve_from_j(GF(13)(0)) # optional - sage.rings.finite_rings + sage: E1 = E.sextic_twist(2) # optional - sage.rings.finite_rings + sage: D = E.is_sextic_twist(E1); D != 0 # optional - sage.rings.finite_rings True - sage: E.sextic_twist(D).is_isomorphic(E1) + sage: E.sextic_twist(D).is_isomorphic(E1) # optional - sage.rings.finite_rings True :: @@ -642,46 +649,50 @@ def descend_to(self, K, f=None): :: - sage: F. = QuadraticField(23) - sage: G. = F.extension(x^3+5) - sage: E = EllipticCurve(j=1728*b).change_ring(G) - sage: EF = E.descend_to(F); EF - [Elliptic Curve defined by y^2 = x^3 + (27*b-621)*x + (-1296*b+2484) over Number Field in b with defining polynomial x^2 - 23 with b = 4.795831523312720?] - sage: all(Ei.change_ring(G).is_isomorphic(E) for Ei in EF) + sage: F. = QuadraticField(23) # optional - sage.rings.number_field + sage: G. = F.extension(x^3 + 5) + sage: E = EllipticCurve(j=1728*b).change_ring(G) # optional - sage.rings.number_field + sage: EF = E.descend_to(F); EF # optional - sage.rings.number_field + [Elliptic Curve defined by y^2 = x^3 + (27*b-621)*x + (-1296*b+2484) + over Number Field in b with defining polynomial x^2 - 23 + with b = 4.795831523312720?] + sage: all(Ei.change_ring(G).is_isomorphic(E) for Ei in EF) # optional - sage.rings.number_field True :: - sage: L. = NumberField(x^4 - 7) - sage: K. = NumberField(x^2 - 7, embedding=a^2) - sage: E = EllipticCurve([a^6,0]) - sage: EK = E.descend_to(K); EK - [Elliptic Curve defined by y^2 = x^3 + b*x over Number Field in b with defining polynomial x^2 - 7 with b = a^2, - Elliptic Curve defined by y^2 = x^3 + 7*b*x over Number Field in b with defining polynomial x^2 - 7 with b = a^2] - sage: all(Ei.change_ring(L).is_isomorphic(E) for Ei in EK) + sage: L. = NumberField(x^4 - 7) # optional - sage.rings.number_field + sage: K. = NumberField(x^2 - 7, embedding=a^2) # optional - sage.rings.number_field + sage: E = EllipticCurve([a^6, 0]) # optional - sage.rings.number_field + sage: EK = E.descend_to(K); EK # optional - sage.rings.number_field + [Elliptic Curve defined by y^2 = x^3 + b*x over Number Field in b + with defining polynomial x^2 - 7 with b = a^2, + Elliptic Curve defined by y^2 = x^3 + 7*b*x over Number Field in b + with defining polynomial x^2 - 7 with b = a^2] + sage: all(Ei.change_ring(L).is_isomorphic(E) for Ei in EK) # optional - sage.rings.number_field True :: - sage: K. = QuadraticField(17) - sage: E = EllipticCurve(j = 2*a) - sage: E.descend_to(QQ) + sage: K. = QuadraticField(17) # optional - sage.rings.number_field + sage: E = EllipticCurve(j=2*a) # optional - sage.rings.number_field + sage: E.descend_to(QQ) # optional - sage.rings.number_field [] TESTS: Check that :trac:`16456` is fixed:: - sage: K. = NumberField(x^3-2) - sage: E = EllipticCurve('11a1').quadratic_twist(2) - sage: EK = E.change_ring(K) - sage: EK2 = EK.change_weierstrass_model((a,a,a,a+1)) - sage: EK2.descend_to(QQ) + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: E = EllipticCurve('11a1').quadratic_twist(2) # optional - sage.rings.number_field + sage: EK = E.change_ring(K) # optional - sage.rings.number_field + sage: EK2 = EK.change_weierstrass_model((a,a,a,a+1)) # optional - sage.rings.number_field + sage: EK2.descend_to(QQ) # optional - sage.rings.number_field [Elliptic Curve defined by y^2 = x^3 + x^2 - 41*x - 199 over Rational Field] - sage: k. = QuadraticField(-1) - sage: E = EllipticCurve(k,[0,0,0,1,0]) - sage: E.descend_to(QQ) + sage: k. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve(k,[0,0,0,1,0]) # optional - sage.rings.number_field + sage: E.descend_to(QQ) # optional - sage.rings.number_field [Elliptic Curve defined by y^2 = x^3 + x over Rational Field, Elliptic Curve defined by y^2 = x^3 - 4*x over Rational Field] """ @@ -808,88 +819,104 @@ def division_field(self, l, names='t', map=False, **kwds): the 2-division polynomial (therefore, it has degree 1, 2, 3 or 6):: sage: E = EllipticCurve('15a1') - sage: K. = E.division_field(2); K + sage: K. = E.division_field(2); K # optional - sage.rings.number_field Number Field in b with defining polynomial x sage: E = EllipticCurve('14a1') - sage: K. = E.division_field(2); K + sage: K. = E.division_field(2); K # optional - sage.rings.number_field Number Field in b with defining polynomial x^2 + 5*x + 92 sage: E = EllipticCurve('196b1') - sage: K. = E.division_field(2); K + sage: K. = E.division_field(2); K # optional - sage.rings.number_field Number Field in b with defining polynomial x^3 + x^2 - 114*x - 127 sage: E = EllipticCurve('19a1') - sage: K. = E.division_field(2); K - Number Field in b with defining polynomial x^6 + 10*x^5 + 24*x^4 - 212*x^3 + 1364*x^2 + 24072*x + 104292 + sage: K. = E.division_field(2); K # optional - sage.rings.number_field + Number Field in b with defining polynomial + x^6 + 10*x^5 + 24*x^4 - 212*x^3 + 1364*x^2 + 24072*x + 104292 For odd primes `\ell`, the division field is either the splitting field of the `\ell`-division polynomial, or a quadratic extension of it. :: sage: E = EllipticCurve('50a1') - sage: F. = E.division_polynomial(3).splitting_field(simplify_all=True); F - Number Field in a with defining polynomial x^6 - 3*x^5 + 4*x^4 - 3*x^3 - 2*x^2 + 3*x + 3 - sage: K. = E.division_field(3, simplify_all=True); K - Number Field in b with defining polynomial x^6 - 3*x^5 + 4*x^4 - 3*x^3 - 2*x^2 + 3*x + 3 + sage: F. = E.division_polynomial(3).splitting_field(simplify_all=True); F # optional - sage.rings.number_field + Number Field in a + with defining polynomial x^6 - 3*x^5 + 4*x^4 - 3*x^3 - 2*x^2 + 3*x + 3 + sage: K. = E.division_field(3, simplify_all=True); K # optional - sage.rings.number_field + Number Field in b + with defining polynomial x^6 - 3*x^5 + 4*x^4 - 3*x^3 - 2*x^2 + 3*x + 3 If we take any quadratic twist, the splitting field of the 3-division polynomial remains the same, but the 3-division field becomes a quadratic extension:: - sage: E = E.quadratic_twist(5) # 50b3 - sage: F. = E.division_polynomial(3).splitting_field(simplify_all=True); F - Number Field in a with defining polynomial x^6 - 3*x^5 + 4*x^4 - 3*x^3 - 2*x^2 + 3*x + 3 - sage: K. = E.division_field(3, simplify_all=True); K - Number Field in b with defining polynomial x^12 - 3*x^11 + 8*x^10 - 15*x^9 + 30*x^8 - 63*x^7 + 109*x^6 - 144*x^5 + 150*x^4 - 120*x^3 + 68*x^2 - 24*x + 4 + sage: E = E.quadratic_twist(5) # 50b3 # optional - sage.rings.number_field + sage: F. = E.division_polynomial(3).splitting_field(simplify_all=True); F # optional - sage.rings.number_field + Number Field in a + with defining polynomial x^6 - 3*x^5 + 4*x^4 - 3*x^3 - 2*x^2 + 3*x + 3 + sage: K. = E.division_field(3, simplify_all=True); K # optional - sage.rings.number_field + Number Field in b with defining polynomial x^12 - 3*x^11 + 8*x^10 - 15*x^9 + + 30*x^8 - 63*x^7 + 109*x^6 - 144*x^5 + 150*x^4 - 120*x^3 + 68*x^2 - 24*x + 4 Try another quadratic twist, this time over a subfield of `F`:: - sage: G.,_,_ = F.subfields(3)[0] - sage: E = E.base_extend(G).quadratic_twist(c); E - Elliptic Curve defined by y^2 = x^3 + 5*a0*x^2 + (-200*a0^2)*x + (-42000*a0^2+42000*a0+126000) over Number Field in a0 with defining polynomial x^3 - 3*x^2 + 3*x + 9 - sage: K. = E.division_field(3, simplify_all=True); K - Number Field in b with defining polynomial x^12 + 5*x^10 + 40*x^8 + 315*x^6 + 750*x^4 + 675*x^2 + 2025 + sage: G.,_,_ = F.subfields(3)[0] # optional - sage.rings.number_field + sage: E = E.base_extend(G).quadratic_twist(c); E # optional - sage.rings.number_field + Elliptic Curve defined + by y^2 = x^3 + 5*a0*x^2 + (-200*a0^2)*x + (-42000*a0^2+42000*a0+126000) + over Number Field in a0 with defining polynomial x^3 - 3*x^2 + 3*x + 9 + sage: K. = E.division_field(3, simplify_all=True); K # optional - sage.rings.number_field + Number Field in b with defining polynomial + x^12 + 5*x^10 + 40*x^8 + 315*x^6 + 750*x^4 + 675*x^2 + 2025 Some higher-degree examples:: - sage: E = EllipticCurve('11a1') - sage: K. = E.division_field(2); K - Number Field in b with defining polynomial x^6 + 2*x^5 - 48*x^4 - 436*x^3 + 1668*x^2 + 28792*x + 73844 - sage: K. = E.division_field(3); K # long time (3s on sage.math, 2014) + sage: E = EllipticCurve('11a1') # optional - sage.rings.number_field + sage: K. = E.division_field(2); K # optional - sage.rings.number_field + Number Field in b with defining polynomial + x^6 + 2*x^5 - 48*x^4 - 436*x^3 + 1668*x^2 + 28792*x + 73844 + sage: K. = E.division_field(3); K # long time (3s on sage.math, 2014) # optional - sage.rings.number_field Number Field in b with defining polynomial x^48 ... - sage: K. = E.division_field(5); K + sage: K. = E.division_field(5); K # optional - sage.rings.number_field Number Field in b with defining polynomial x^4 - x^3 + x^2 - x + 1 - sage: E.division_field(5, 'b', simplify=False) + sage: E.division_field(5, 'b', simplify=False) # optional - sage.rings.number_field Number Field in b with defining polynomial x^4 + x^3 + 11*x^2 + 41*x + 101 - sage: E.base_extend(K).torsion_subgroup() # long time (2s on sage.math, 2014) - Torsion Subgroup isomorphic to Z/5 + Z/5 associated to the Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in b with defining polynomial x^4 - x^3 + x^2 - x + 1 + sage: E.base_extend(K).torsion_subgroup() # long time (2s on sage.math, 2014) # optional - sage.rings.number_field + Torsion Subgroup isomorphic to Z/5 + Z/5 associated to the Elliptic Curve + defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) + over Number Field in b with defining polynomial x^4 - x^3 + x^2 - x + 1 - sage: E = EllipticCurve('27a1') - sage: K. = E.division_field(3); K + sage: E = EllipticCurve('27a1') # optional - sage.rings.number_field + sage: K. = E.division_field(3); K # optional - sage.rings.number_field Number Field in b with defining polynomial x^2 + 3*x + 9 - sage: K. = E.division_field(2); K - Number Field in b with defining polynomial x^6 + 6*x^5 + 24*x^4 - 52*x^3 - 228*x^2 + 744*x + 3844 - sage: K. = E.division_field(2, simplify_all=True); K + sage: K. = E.division_field(2); K # optional - sage.rings.number_field + Number Field in b with defining polynomial + x^6 + 6*x^5 + 24*x^4 - 52*x^3 - 228*x^2 + 744*x + 3844 + sage: K. = E.division_field(2, simplify_all=True); K # optional - sage.rings.number_field Number Field in b with defining polynomial x^6 - 3*x^5 + 5*x^3 - 3*x + 1 - sage: K. = E.division_field(5); K # long time (4s on sage.math, 2014) + sage: K. = E.division_field(5); K # long time (4s on sage.math, 2014) # optional - sage.rings.number_field Number Field in b with defining polynomial x^48 ... - sage: K. = E.division_field(7); K # long time (8s on sage.math, 2014) + sage: K. = E.division_field(7); K # long time (8s on sage.math, 2014) # optional - sage.rings.number_field Number Field in b with defining polynomial x^72 ... Over a number field:: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2 + 1) - sage: E = EllipticCurve([0,0,0,0,i]) - sage: L. = E.division_field(2); L + sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,0,0,0,i]) # optional - sage.rings.number_field + sage: L. = E.division_field(2); L # optional - sage.rings.number_field Number Field in b with defining polynomial x^4 - x^2 + 1 - sage: L., phi = E.division_field(2, map=True); phi + sage: L., phi = E.division_field(2, map=True); phi # optional - sage.rings.number_field Ring morphism: From: Number Field in i with defining polynomial x^2 + 1 To: Number Field in b with defining polynomial x^4 - x^2 + 1 Defn: i |--> -b^3 - sage: L., phi = E.division_field(3, map=True) - sage: L - Number Field in b with defining polynomial x^24 - 6*x^22 - 12*x^21 - 21*x^20 + 216*x^19 + 48*x^18 + 804*x^17 + 1194*x^16 - 13488*x^15 + 21222*x^14 + 44196*x^13 - 47977*x^12 - 102888*x^11 + 173424*x^10 - 172308*x^9 + 302046*x^8 + 252864*x^7 - 931182*x^6 + 180300*x^5 + 879567*x^4 - 415896*x^3 + 1941012*x^2 + 650220*x + 443089 - sage: phi + sage: L., phi = E.division_field(3, map=True) # optional - sage.rings.number_field + sage: L # optional - sage.rings.number_field + Number Field in b with defining polynomial x^24 - 6*x^22 - 12*x^21 + - 21*x^20 + 216*x^19 + 48*x^18 + 804*x^17 + 1194*x^16 - 13488*x^15 + + 21222*x^14 + 44196*x^13 - 47977*x^12 - 102888*x^11 + 173424*x^10 + - 172308*x^9 + 302046*x^8 + 252864*x^7 - 931182*x^6 + 180300*x^5 + + 879567*x^4 - 415896*x^3 + 1941012*x^2 + 650220*x + 443089 + sage: phi # optional - sage.rings.number_field Ring morphism: From: Number Field in i with defining polynomial x^2 + 1 To: Number Field in b with defining polynomial x^24 ... @@ -897,8 +924,8 @@ def division_field(self, l, names='t', map=False, **kwds): Over a finite field:: - sage: E = EllipticCurve(GF(431^2), [1,0]) - sage: E.division_field(5, map=True) + sage: E = EllipticCurve(GF(431^2), [1,0]) # optional - sage.rings.finite_rings + sage: E.division_field(5, map=True) # optional - sage.rings.finite_rings (Finite Field in t of size 431^4, Ring morphism: From: Finite Field in z2 of size 431^2 @@ -907,8 +934,8 @@ def division_field(self, l, names='t', map=False, **kwds): :: - sage: E = EllipticCurve(GF(433^2), [1,0]) - sage: K. = E.division_field(7); K + sage: E = EllipticCurve(GF(433^2), [1,0]) # optional - sage.rings.finite_rings + sage: K. = E.division_field(7); K # optional - sage.rings.finite_rings Finite Field in v of size 433^16 .. SEEALSO:: @@ -946,20 +973,20 @@ def division_field(self, l, names='t', map=False, **kwds): ....: assert False ....: deg = lcm(el.minpoly().degree() for el in sum(map(list,Ps),[])) ....: assert max(deg, E.base_field().degree()) == K.degree() - sage: q = next_prime_power(randrange(1, 10^9)) - sage: F. = GF(q) - sage: while True: + sage: q = next_prime_power(randrange(1, 10^9)) # optional - sage.rings.finite_rings + sage: F. = GF(q) # optional - sage.rings.finite_rings + sage: while True: # optional - sage.rings.finite_rings ....: try: ....: E = EllipticCurve([F.random_element() for _ in range(5)]) ....: except ArithmeticError: ....: continue ....: break - sage: l = random_prime(8) - sage: K = E.division_field(l) - sage: n = E.cardinality(extension_degree=K.degree()//F.degree()) - sage: (l^2 if q%l else 0 + E.is_ordinary()).divides(n) + sage: l = random_prime(8) # optional - sage.rings.finite_rings + sage: K = E.division_field(l) # optional - sage.rings.finite_rings + sage: n = E.cardinality(extension_degree=K.degree()//F.degree()) # optional - sage.rings.finite_rings + sage: (l^2 if q%l else 0 + E.is_ordinary()).divides(n) # optional - sage.rings.finite_rings True - sage: check(E, l, K) # long time + sage: check(E, l, K) # long time # optional - sage.rings.finite_rings AUTHORS: @@ -1133,11 +1160,11 @@ def isogeny(self, kernel, codomain=None, degree=None, model=None, check=True, al EXAMPLES:: - sage: F = GF(2^5, 'alpha'); alpha = F.gen() - sage: E = EllipticCurve(F, [1,0,1,1,1]) - sage: R. = F[] - sage: phi = E.isogeny(x+1) - sage: phi.rational_maps() + sage: F = GF(2^5, 'alpha'); alpha = F.gen() # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F, [1,0,1,1,1]) # optional - sage.rings.finite_rings + sage: R. = F[] # optional - sage.rings.finite_rings + sage: phi = E.isogeny(x + 1) # optional - sage.rings.finite_rings + sage: phi.rational_maps() # optional - sage.rings.finite_rings ((x^2 + x + 1)/(x + 1), (x^2*y + x)/(x^2 + 1)) :: @@ -1145,35 +1172,45 @@ def isogeny(self, kernel, codomain=None, degree=None, model=None, check=True, al sage: E = EllipticCurve('11a1') sage: P = E.torsion_points()[1] sage: E.isogeny(P) - Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field + Isogeny of degree 5 + from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 + over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 + over Rational Field :: - sage: E = EllipticCurve(GF(19),[1,1]) - sage: P = E(15,3); Q = E(2,12); - sage: (P.order(), Q.order()) + sage: E = EllipticCurve(GF(19),[1,1]) # optional - sage.rings.finite_rings + sage: P = E(15,3); Q = E(2,12) # optional - sage.rings.finite_rings + sage: (P.order(), Q.order()) # optional - sage.rings.finite_rings (7, 3) - sage: phi = E.isogeny([P,Q]); phi - Isogeny of degree 21 from Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 19 to Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 19 - sage: phi(E.random_point()) # all points defined over GF(19) are in the kernel + sage: phi = E.isogeny([P,Q]); phi # optional - sage.rings.finite_rings + Isogeny of degree 21 + from Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 19 + to Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 19 + sage: phi(E.random_point()) # all points defined over GF(19) are in the kernel # optional - sage.rings.finite_rings (0 : 1 : 0) :: - sage: E = EllipticCurve(GF(2^32-5), [170246996, 2036646110]) - sage: P = E.lift_x(2) - sage: E.isogeny(P, algorithm="factored") + sage: E = EllipticCurve(GF(2^32 - 5), [170246996, 2036646110]) # optional - sage.rings.finite_rings + sage: P = E.lift_x(2) # optional - sage.rings.finite_rings + sage: E.isogeny(P, algorithm="factored") # optional - sage.rings.finite_rings Composite morphism of degree 1073721825 = 3^4*5^2*11*19*43*59: - From: Elliptic Curve defined by y^2 = x^3 + 170246996*x + 2036646110 over Finite Field of size 4294967291 - To: Elliptic Curve defined by y^2 = x^3 + 272790262*x + 1903695400 over Finite Field of size 4294967291 + From: Elliptic Curve defined by y^2 = x^3 + 170246996*x + 2036646110 + over Finite Field of size 4294967291 + To: Elliptic Curve defined by y^2 = x^3 + 272790262*x + 1903695400 + over Finite Field of size 4294967291 Not all polynomials define a finite subgroup (:trac:`6384`):: - sage: E = EllipticCurve(GF(31),[1,0,0,1,2]) - sage: phi = E.isogeny([14,27,4,1]) + sage: E = EllipticCurve(GF(31), [1,0,0,1,2]) # optional - sage.rings.finite_rings + sage: phi = E.isogeny([14,27,4,1]) # optional - sage.rings.finite_rings Traceback (most recent call last): ... - ValueError: the polynomial x^3 + 4*x^2 + 27*x + 14 does not define a finite subgroup of Elliptic Curve defined by y^2 + x*y = x^3 + x + 2 over Finite Field of size 31 + ValueError: the polynomial x^3 + 4*x^2 + 27*x + 14 does not define a finite + subgroup of Elliptic Curve defined by y^2 + x*y = x^3 + x + 2 + over Finite Field of size 31 .. SEEALSO:: @@ -1188,20 +1225,20 @@ def isogeny(self, kernel, codomain=None, degree=None, model=None, check=True, al invalid morphism. See also :trac:`11578`:: sage: R. = QQ[] - sage: K. = NumberField(x^2-x-1) - sage: E = EllipticCurve(K, [-13392, -1080432]) - sage: R. = K[] - sage: phi = E.isogeny( (x-564)*(x - 396/5*a + 348/5) ) + sage: K. = NumberField(x^2 - x - 1) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [-13392, -1080432]) # optional - sage.rings.number_field + sage: R. = K[] # optional - sage.rings.number_field + sage: phi = E.isogeny( (x-564)*(x - 396/5*a + 348/5) ) # optional - sage.rings.number_field Traceback (most recent call last): ... ValueError: the polynomial x^2 + (-396/5*a - 2472/5)*x + 223344/5*a - 196272/5 does not define a finite subgroup of Elliptic Curve defined by y^2 = x^3 + (-13392)*x + (-1080432) over Number Field in a with defining polynomial x^2 - x - 1 We check that the cached order is correctly copied over:: - sage: E = EllipticCurve(GF(2^127-1), [1,2,3,4,5]) - sage: E.set_order(170141183460469231746191640949390434666) - sage: phi = E.isogeny(E.lift_x(77347718128277853096420969229987528666)) - sage: phi.codomain()._order + sage: E = EllipticCurve(GF(2^127-1), [1,2,3,4,5]) # optional - sage.rings.finite_rings + sage: E.set_order(170141183460469231746191640949390434666) # optional - sage.rings.finite_rings + sage: phi = E.isogeny(E.lift_x(77347718128277853096420969229987528666)) # optional - sage.rings.finite_rings + sage: phi.codomain()._order # optional - sage.rings.finite_rings 170141183460469231746191640949390434666 """ if algorithm is not None and degree is not None: @@ -1237,26 +1274,28 @@ def isogeny_codomain(self, kernel, degree=None): sage: E = EllipticCurve('17a1') sage: R. = QQ[] sage: E2 = E.isogeny_codomain(x - 11/4); E2 - Elliptic Curve defined by y^2 + x*y + y = x^3 - x^2 - 1461/16*x - 19681/64 over Rational Field + Elliptic Curve defined by y^2 + x*y + y = x^3 - x^2 - 1461/16*x - 19681/64 + over Rational Field TESTS: We check that the cached order is correctly copied over:: - sage: E = EllipticCurve(GF(2^127-1), [1,2,3,4,5]) - sage: E.set_order(170141183460469231746191640949390434666) - sage: E2 = E.isogeny_codomain(E.lift_x(77347718128277853096420969229987528666)) - sage: E2._order + sage: E = EllipticCurve(GF(2^127 - 1), [1,2,3,4,5]) # optional - sage.rings.finite_rings + sage: E.set_order(170141183460469231746191640949390434666) # optional - sage.rings.finite_rings + sage: E2 = E.isogeny_codomain(E.lift_x(77347718128277853096420969229987528666)) # optional - sage.rings.finite_rings + sage: E2._order # optional - sage.rings.finite_rings 170141183460469231746191640949390434666 Test deprecation warning for obsolete argument:: - sage: E.isogeny_codomain(E.lift_x(77347718128277853096420969229987528666), degree=11) + sage: E.isogeny_codomain(E.lift_x(77347718128277853096420969229987528666), degree=11) # optional - sage.rings.finite_rings doctest:warning ... DeprecationWarning: The "degree" argument to .isogeny_codomain() does nothing and will be removed. ... - Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 20731788786372791581385345584850817122*x + 125200507378516567345719286707201096361 over Finite Field of size 170141183460469231731687303715884105727 + Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 20731788786372791581385345584850817122*x + 125200507378516567345719286707201096361 + over Finite Field of size 170141183460469231731687303715884105727 """ if degree is not None: from sage.misc.superseded import deprecation @@ -1297,9 +1336,15 @@ def isogenies_prime_degree(self, l=None, max_l=31): sage: E = EllipticCurve(GF(next_prime(1000000)), [7,8]) sage: E.isogenies_prime_degree(2) - [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 970389*x + 794257 over Finite Field of size 1000003, - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 29783*x + 206196 over Finite Field of size 1000003, - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 999960*x + 78 over Finite Field of size 1000003] + [Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 + to Elliptic Curve defined by y^2 = x^3 + 970389*x + 794257 over Finite Field of size 1000003, + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 + to Elliptic Curve defined by y^2 = x^3 + 29783*x + 206196 over Finite Field of size 1000003, + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 + to Elliptic Curve defined by y^2 = x^3 + 999960*x + 78 over Finite Field of size 1000003] sage: E.isogenies_prime_degree(3) [] sage: E.isogenies_prime_degree(5) @@ -1309,62 +1354,122 @@ def isogenies_prime_degree(self, l=None, max_l=31): sage: E.isogenies_prime_degree(11) [] sage: E.isogenies_prime_degree(13) - [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 878063*x + 845666 over Finite Field of size 1000003, - Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 375648*x + 342776 over Finite Field of size 1000003] + [Isogeny of degree 13 + from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 + to Elliptic Curve defined by y^2 = x^3 + 878063*x + 845666 over Finite Field of size 1000003, + Isogeny of degree 13 + from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 + to Elliptic Curve defined by y^2 = x^3 + 375648*x + 342776 over Finite Field of size 1000003] sage: E.isogenies_prime_degree(max_l=13) - [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 970389*x + 794257 over Finite Field of size 1000003, - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 29783*x + 206196 over Finite Field of size 1000003, - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 999960*x + 78 over Finite Field of size 1000003, - Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 878063*x + 845666 over Finite Field of size 1000003, - Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 375648*x + 342776 over Finite Field of size 1000003] + [Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 + to Elliptic Curve defined by y^2 = x^3 + 970389*x + 794257 over Finite Field of size 1000003, + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 + to Elliptic Curve defined by y^2 = x^3 + 29783*x + 206196 over Finite Field of size 1000003, + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 + to Elliptic Curve defined by y^2 = x^3 + 999960*x + 78 over Finite Field of size 1000003, + Isogeny of degree 13 + from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 + to Elliptic Curve defined by y^2 = x^3 + 878063*x + 845666 over Finite Field of size 1000003, + Isogeny of degree 13 + from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 + to Elliptic Curve defined by y^2 = x^3 + 375648*x + 342776 over Finite Field of size 1000003] sage: E.isogenies_prime_degree() # Default limit of 31 - [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 970389*x + 794257 over Finite Field of size 1000003, - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 29783*x + 206196 over Finite Field of size 1000003, - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 999960*x + 78 over Finite Field of size 1000003, - Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 878063*x + 845666 over Finite Field of size 1000003, - Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 375648*x + 342776 over Finite Field of size 1000003, - Isogeny of degree 17 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 347438*x + 594729 over Finite Field of size 1000003, - Isogeny of degree 17 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 674846*x + 7392 over Finite Field of size 1000003, - Isogeny of degree 23 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 390065*x + 605596 over Finite Field of size 1000003] + [Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 + to Elliptic Curve defined by y^2 = x^3 + 970389*x + 794257 over Finite Field of size 1000003, + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 + to Elliptic Curve defined by y^2 = x^3 + 29783*x + 206196 over Finite Field of size 1000003, + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 + to Elliptic Curve defined by y^2 = x^3 + 999960*x + 78 over Finite Field of size 1000003, + Isogeny of degree 13 + from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 + to Elliptic Curve defined by y^2 = x^3 + 878063*x + 845666 over Finite Field of size 1000003, + Isogeny of degree 13 + from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 + to Elliptic Curve defined by y^2 = x^3 + 375648*x + 342776 over Finite Field of size 1000003, + Isogeny of degree 17 + from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 + to Elliptic Curve defined by y^2 = x^3 + 347438*x + 594729 over Finite Field of size 1000003, + Isogeny of degree 17 + from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 + to Elliptic Curve defined by y^2 = x^3 + 674846*x + 7392 over Finite Field of size 1000003, + Isogeny of degree 23 + from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 + to Elliptic Curve defined by y^2 = x^3 + 390065*x + 605596 over Finite Field of size 1000003] sage: E = EllipticCurve(GF(17), [2,0]) sage: E.isogenies_prime_degree(3) [] sage: E.isogenies_prime_degree(2) - [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 2*x over Finite Field of size 17 to Elliptic Curve defined by y^2 = x^3 + 9*x over Finite Field of size 17, - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 2*x over Finite Field of size 17 to Elliptic Curve defined by y^2 = x^3 + 5*x + 9 over Finite Field of size 17, - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 2*x over Finite Field of size 17 to Elliptic Curve defined by y^2 = x^3 + 5*x + 8 over Finite Field of size 17] + [Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 2*x over Finite Field of size 17 + to Elliptic Curve defined by y^2 = x^3 + 9*x over Finite Field of size 17, + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 2*x over Finite Field of size 17 + to Elliptic Curve defined by y^2 = x^3 + 5*x + 9 over Finite Field of size 17, + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 2*x over Finite Field of size 17 + to Elliptic Curve defined by y^2 = x^3 + 5*x + 8 over Finite Field of size 17] The base field matters, over a field extension we find more isogenies:: sage: E = EllipticCurve(GF(13), [2,8]) sage: E.isogenies_prime_degree(max_l=3) - [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field of size 13 to Elliptic Curve defined by y^2 = x^3 + 7*x + 4 over Finite Field of size 13, - Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field of size 13 to Elliptic Curve defined by y^2 = x^3 + 9*x + 11 over Finite Field of size 13] + [Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field of size 13 + to Elliptic Curve defined by y^2 = x^3 + 7*x + 4 over Finite Field of size 13, + Isogeny of degree 3 + from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field of size 13 + to Elliptic Curve defined by y^2 = x^3 + 9*x + 11 over Finite Field of size 13] sage: E = EllipticCurve(GF(13^6), [2,8]) sage: E.isogenies_prime_degree(max_l=3) - [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 to Elliptic Curve defined by y^2 = x^3 + 7*x + 4 over Finite Field in z6 of size 13^6, - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 to Elliptic Curve defined by y^2 = x^3 + (2*z6^5+6*z6^4+9*z6^3+8*z6+7)*x + (3*z6^5+9*z6^4+7*z6^3+12*z6+7) over Finite Field in z6 of size 13^6, - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 to Elliptic Curve defined by y^2 = x^3 + (11*z6^5+7*z6^4+4*z6^3+5*z6+9)*x + (10*z6^5+4*z6^4+6*z6^3+z6+10) over Finite Field in z6 of size 13^6, - Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 to Elliptic Curve defined by y^2 = x^3 + 9*x + 11 over Finite Field in z6 of size 13^6, - Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 to Elliptic Curve defined by y^2 = x^3 + (3*z6^5+5*z6^4+8*z6^3+11*z6^2+5*z6+12)*x + (12*z6^5+6*z6^4+8*z6^3+4*z6^2+7*z6+6) over Finite Field in z6 of size 13^6, - Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 to Elliptic Curve defined by y^2 = x^3 + (7*z6^4+12*z6^3+7*z6^2+4)*x + (6*z6^5+10*z6^3+12*z6^2+10*z6+8) over Finite Field in z6 of size 13^6, - Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 to Elliptic Curve defined by y^2 = x^3 + (10*z6^5+z6^4+6*z6^3+8*z6^2+8*z6)*x + (8*z6^5+7*z6^4+8*z6^3+10*z6^2+9*z6+7) over Finite Field in z6 of size 13^6] + [Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 + to Elliptic Curve defined by y^2 = x^3 + 7*x + 4 over Finite Field in z6 of size 13^6, + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 + to Elliptic Curve defined by y^2 = x^3 + (2*z6^5+6*z6^4+9*z6^3+8*z6+7)*x + (3*z6^5+9*z6^4+7*z6^3+12*z6+7) over Finite Field in z6 of size 13^6, + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 + to Elliptic Curve defined by y^2 = x^3 + (11*z6^5+7*z6^4+4*z6^3+5*z6+9)*x + (10*z6^5+4*z6^4+6*z6^3+z6+10) over Finite Field in z6 of size 13^6, + Isogeny of degree 3 + from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 + to Elliptic Curve defined by y^2 = x^3 + 9*x + 11 over Finite Field in z6 of size 13^6, + Isogeny of degree 3 + from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 + to Elliptic Curve defined by y^2 = x^3 + (3*z6^5+5*z6^4+8*z6^3+11*z6^2+5*z6+12)*x + (12*z6^5+6*z6^4+8*z6^3+4*z6^2+7*z6+6) over Finite Field in z6 of size 13^6, + Isogeny of degree 3 + from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 + to Elliptic Curve defined by y^2 = x^3 + (7*z6^4+12*z6^3+7*z6^2+4)*x + (6*z6^5+10*z6^3+12*z6^2+10*z6+8) over Finite Field in z6 of size 13^6, + Isogeny of degree 3 + from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 + to Elliptic Curve defined by y^2 = x^3 + (10*z6^5+z6^4+6*z6^3+8*z6^2+8*z6)*x + (8*z6^5+7*z6^4+8*z6^3+10*z6^2+9*z6+7) over Finite Field in z6 of size 13^6] If the degree equals the characteristic, we find only separable isogenies:: sage: E = EllipticCurve(GF(13), [2,8]) sage: E.isogenies_prime_degree(13) - [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field of size 13 to Elliptic Curve defined by y^2 = x^3 + 6*x + 5 over Finite Field of size 13] + [Isogeny of degree 13 + from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field of size 13 + to Elliptic Curve defined by y^2 = x^3 + 6*x + 5 over Finite Field of size 13] sage: E = EllipticCurve(GF(5), [1,1]) sage: E.isogenies_prime_degree(5) - [Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 5 to Elliptic Curve defined by y^2 = x^3 + x + 4 over Finite Field of size 5] + [Isogeny of degree 5 + from Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 5 + to Elliptic Curve defined by y^2 = x^3 + x + 4 over Finite Field of size 5] sage: k. = GF(3^4) sage: E = EllipticCurve(k, [0,1,0,0,a]) sage: E.isogenies_prime_degree(3) - [Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + x^2 + a over Finite Field in a of size 3^4 to Elliptic Curve defined by y^2 = x^3 + x^2 + (2*a^3+a^2+2)*x + (a^2+2) over Finite Field in a of size 3^4] + [Isogeny of degree 3 + from Elliptic Curve defined by y^2 = x^3 + x^2 + a over Finite Field in a of size 3^4 + to Elliptic Curve defined by y^2 = x^3 + x^2 + (2*a^3+a^2+2)*x + (a^2+2) over Finite Field in a of size 3^4] In the supersingular case, there are no separable isogenies of degree equal to the characteristic:: @@ -1379,24 +1484,38 @@ def isogenies_prime_degree(self, l=None, max_l=31): sage: K = R.fraction_field() sage: E = EllipticCurve(K, [1, t^5]) sage: E.isogenies_prime_degree(5) - [Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + x + t^5 over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5 to Elliptic Curve defined by y^2 = x^3 + x + 4*t over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5] + [Isogeny of degree 5 + from Elliptic Curve defined by y^2 = x^3 + x + t^5 over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5 + to Elliptic Curve defined by y^2 = x^3 + x + 4*t over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5] Examples over number fields (other than QQ):: sage: QQroot2. = NumberField(x^2-2) sage: E = EllipticCurve(QQroot2, j=8000) sage: E.isogenies_prime_degree() - [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + (-150528000)*x + (-629407744000) over Number Field in e with defining polynomial x^2 - 2 to Elliptic Curve defined by y^2 = x^3 + (-36750)*x + 2401000 over Number Field in e with defining polynomial x^2 - 2, - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + (-150528000)*x + (-629407744000) over Number Field in e with defining polynomial x^2 - 2 to Elliptic Curve defined by y^2 = x^3 + (220500*e-257250)*x + (54022500*e-88837000) over Number Field in e with defining polynomial x^2 - 2, - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + (-150528000)*x + (-629407744000) over Number Field in e with defining polynomial x^2 - 2 to Elliptic Curve defined by y^2 = x^3 + (-220500*e-257250)*x + (-54022500*e-88837000) over Number Field in e with defining polynomial x^2 - 2] + [Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + (-150528000)*x + (-629407744000) over Number Field in e with defining polynomial x^2 - 2 + to Elliptic Curve defined by y^2 = x^3 + (-36750)*x + 2401000 over Number Field in e with defining polynomial x^2 - 2, + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + (-150528000)*x + (-629407744000) over Number Field in e with defining polynomial x^2 - 2 + to Elliptic Curve defined by y^2 = x^3 + (220500*e-257250)*x + (54022500*e-88837000) over Number Field in e with defining polynomial x^2 - 2, + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + (-150528000)*x + (-629407744000) over Number Field in e with defining polynomial x^2 - 2 + to Elliptic Curve defined by y^2 = x^3 + (-220500*e-257250)*x + (-54022500*e-88837000) over Number Field in e with defining polynomial x^2 - 2] sage: E = EllipticCurve(QQroot2, [1,0,1,4, -6]); E Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + (-6) over Number Field in e with defining polynomial x^2 - 2 sage: E.isogenies_prime_degree(2) - [Isogeny of degree 2 from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + (-6) over Number Field in e with defining polynomial x^2 - 2 to Elliptic Curve defined by y^2 + x*y + y = x^3 + (-36)*x + (-70) over Number Field in e with defining polynomial x^2 - 2] + [Isogeny of degree 2 + from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + (-6) over Number Field in e with defining polynomial x^2 - 2 + to Elliptic Curve defined by y^2 + x*y + y = x^3 + (-36)*x + (-70) over Number Field in e with defining polynomial x^2 - 2] sage: E.isogenies_prime_degree(3) - [Isogeny of degree 3 from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + (-6) over Number Field in e with defining polynomial x^2 - 2 to Elliptic Curve defined by y^2 + x*y + y = x^3 + (-1)*x over Number Field in e with defining polynomial x^2 - 2, - Isogeny of degree 3 from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + (-6) over Number Field in e with defining polynomial x^2 - 2 to Elliptic Curve defined by y^2 + x*y + y = x^3 + (-171)*x + (-874) over Number Field in e with defining polynomial x^2 - 2] + [Isogeny of degree 3 + from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + (-6) over Number Field in e with defining polynomial x^2 - 2 + to Elliptic Curve defined by y^2 + x*y + y = x^3 + (-1)*x over Number Field in e with defining polynomial x^2 - 2, + Isogeny of degree 3 + from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + (-6) over Number Field in e with defining polynomial x^2 - 2 + to Elliptic Curve defined by y^2 + x*y + y = x^3 + (-171)*x + (-874) over Number Field in e with defining polynomial x^2 - 2] These are not implemented yet:: @@ -1476,18 +1595,22 @@ def is_isogenous(self, other, field=None): EXAMPLES:: sage: E1 = EllipticCurve(CC, [1,18]); E1 - Elliptic Curve defined by y^2 = x^3 + 1.00000000000000*x + 18.0000000000000 over Complex Field with 53 bits of precision + Elliptic Curve defined by y^2 = x^3 + 1.00000000000000*x + 18.0000000000000 + over Complex Field with 53 bits of precision sage: E2 = EllipticCurve(CC, [2,7]); E2 - Elliptic Curve defined by y^2 = x^3 + 2.00000000000000*x + 7.00000000000000 over Complex Field with 53 bits of precision + Elliptic Curve defined by y^2 = x^3 + 2.00000000000000*x + 7.00000000000000 + over Complex Field with 53 bits of precision sage: E1.is_isogenous(E2) Traceback (most recent call last): ... NotImplementedError: Only implemented for isomorphic curves over general fields. sage: E1 = EllipticCurve(Frac(PolynomialRing(ZZ,'t')), [2,19]); E1 - Elliptic Curve defined by y^2 = x^3 + 2*x + 19 over Fraction Field of Univariate Polynomial Ring in t over Integer Ring + Elliptic Curve defined by y^2 = x^3 + 2*x + 19 + over Fraction Field of Univariate Polynomial Ring in t over Integer Ring sage: E2 = EllipticCurve(CC, [23,4]); E2 - Elliptic Curve defined by y^2 = x^3 + 23.0000000000000*x + 4.00000000000000 over Complex Field with 53 bits of precision + Elliptic Curve defined by y^2 = x^3 + 23.0000000000000*x + 4.00000000000000 + over Complex Field with 53 bits of precision sage: E1.is_isogenous(E2) Traceback (most recent call last): ... diff --git a/src/sage/schemes/plane_conics/con_field.py b/src/sage/schemes/plane_conics/con_field.py index b5454923998..7b052147c55 100644 --- a/src/sage/schemes/plane_conics/con_field.py +++ b/src/sage/schemes/plane_conics/con_field.py @@ -51,7 +51,8 @@ class ProjectiveConic_field(ProjectivePlaneCurve_field): sage: K = FractionField(PolynomialRing(QQ, 't')) sage: P. = K[] sage: Conic(X^2 + Y^2 - Z^2) - Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Rational Field defined by X^2 + Y^2 - Z^2 + Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t + over Rational Field defined by X^2 + Y^2 - Z^2 TESTS:: @@ -104,9 +105,10 @@ def base_extend(self, S): Projective Conic Curve over Rational Field defined by x^2 + y^2 + z^2 sage: c.has_rational_point() False - sage: d = c.base_extend(QuadraticField(-1, 'i')); d - Projective Conic Curve over Number Field in i with defining polynomial x^2 + 1 with i = 1*I defined by x^2 + y^2 + z^2 - sage: d.rational_point(algorithm = 'rnfisnorm') + sage: d = c.base_extend(QuadraticField(-1, 'i')); d # optional - sage.rings.number_field + Projective Conic Curve over Number Field in i + with defining polynomial x^2 + 1 with i = 1*I defined by x^2 + y^2 + z^2 + sage: d.rational_point(algorithm='rnfisnorm') # optional - sage.rings.number_field (i : 1 : 0) """ if S in _Fields: @@ -158,11 +160,12 @@ def coefficients(self): sage: Conic(QQ, [1,2,3,4,5,6]).coefficients() [1, 2, 3, 4, 5, 6] - sage: P. = GF(13)[] - sage: a = Conic(x^2+5*x*y+y^2+z^2).coefficients(); a + sage: P. = GF(13)[] # optional - sage.rings.finite_rings + sage: a = Conic(x^2 + 5*x*y + y^2 + z^2).coefficients(); a # optional - sage.rings.finite_rings [1, 5, 0, 1, 0, 1] - sage: Conic(a) - Projective Conic Curve over Finite Field of size 13 defined by x^2 + 5*x*y + y^2 + z^2 + sage: Conic(a) # optional - sage.rings.finite_rings + Projective Conic Curve over Finite Field of size 13 + defined by x^2 + 5*x*y + y^2 + z^2 """ return self._coefficients @@ -191,12 +194,14 @@ def derivative_matrix(self): An example in characteristic `2`:: - sage: P. = GF(2)[] - sage: c = Conic([t, 1, t^2, 1, 1, 0]); c - Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 2 (using GF2X) defined by t*x^2 + x*y + y^2 + (t^2)*x*z + y*z - sage: c.is_smooth() + sage: P. = GF(2)[] # optional - sage.rings.finite_rings + sage: c = Conic([t, 1, t^2, 1, 1, 0]); c # optional - sage.rings.finite_rings + Projective Conic Curve over Fraction Field of Univariate Polynomial + Ring in t over Finite Field of size 2 (using GF2X) + defined by t*x^2 + x*y + y^2 + (t^2)*x*z + y*z + sage: c.is_smooth() # optional - sage.rings.finite_rings True - sage: c.derivative_matrix() + sage: c.derivative_matrix() # optional - sage.rings.finite_rings [ 0 1 t^2] [ 1 0 1] [t^2 1 0] @@ -303,16 +308,21 @@ def diagonalization(self, names=None): EXAMPLES:: - sage: Conic(GF(5), [1,0,1,1,0,1]).diagonalization() - (Projective Conic Curve over Finite Field of size 5 defined by x^2 + y^2 + 2*z^2, + sage: Conic(GF(5), [1,0,1,1,0,1]).diagonalization() # optional - sage.rings.finite_rings + (Projective Conic Curve over Finite Field of size 5 + defined by x^2 + y^2 + 2*z^2, Scheme morphism: - From: Projective Conic Curve over Finite Field of size 5 defined by x^2 + y^2 + 2*z^2 - To: Projective Conic Curve over Finite Field of size 5 defined by x^2 + y^2 + x*z + z^2 + From: Projective Conic Curve over Finite Field of size 5 + defined by x^2 + y^2 + 2*z^2 + To: Projective Conic Curve over Finite Field of size 5 + defined by x^2 + y^2 + x*z + z^2 Defn: Defined on coordinates by sending (x : y : z) to (x + 2*z : y : z), Scheme morphism: - From: Projective Conic Curve over Finite Field of size 5 defined by x^2 + y^2 + x*z + z^2 - To: Projective Conic Curve over Finite Field of size 5 defined by x^2 + y^2 + 2*z^2 + From: Projective Conic Curve over Finite Field of size 5 + defined by x^2 + y^2 + x*z + z^2 + To: Projective Conic Curve over Finite Field of size 5 d + efined by x^2 + y^2 + 2*z^2 Defn: Defined on coordinates by sending (x : y : z) to (x - 2*z : y : z)) @@ -321,7 +331,7 @@ def diagonalization(self, names=None): :: - sage: Conic(GF(2), [1,1,1,1,1,0]).diagonalization() + sage: Conic(GF(2), [1,1,1,1,1,0]).diagonalization() # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: The conic self (= Projective Conic Curve over Finite Field of size 2 defined by x^2 + x*y + y^2 + x*z + y*z) has no symmetric matrix because the base field has characteristic 2 @@ -330,19 +340,29 @@ def diagonalization(self, names=None): :: - sage: K = FractionField(PolynomialRing(GF(7), 't')) - sage: (t,) = K.gens() - sage: C = Conic(K, [t/2,0, 1, 2, 0, 3]) - sage: C.diagonalization() - (Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 7 defined by (-3*t)*x^2 + 2*y^2 + (3*t + 3)/t*z^2, + sage: K = FractionField(PolynomialRing(GF(7), 't')) # optional - sage.rings.finite_rings + sage: (t,) = K.gens() # optional - sage.rings.finite_rings + sage: C = Conic(K, [t/2,0, 1, 2, 0, 3]) # optional - sage.rings.finite_rings + sage: C.diagonalization() # optional - sage.rings.finite_rings + (Projective Conic Curve over Fraction Field of Univariate + Polynomial Ring in t over Finite Field of size 7 + defined by (-3*t)*x^2 + 2*y^2 + (3*t + 3)/t*z^2, Scheme morphism: - From: Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 7 defined by (-3*t)*x^2 + 2*y^2 + (3*t + 3)/t*z^2 - To: Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 7 defined by (-3*t)*x^2 + 2*y^2 + x*z + 3*z^2 + From: Projective Conic Curve over Fraction Field of Univariate + Polynomial Ring in t over Finite Field of size 7 + defined by (-3*t)*x^2 + 2*y^2 + (3*t + 3)/t*z^2 + To: Projective Conic Curve over Fraction Field of Univariate + Polynomial Ring in t over Finite Field of size 7 + defined by (-3*t)*x^2 + 2*y^2 + x*z + 3*z^2 Defn: Defined on coordinates by sending (x : y : z) to (x - 1/t*z : y : z), Scheme morphism: - From: Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 7 defined by (-3*t)*x^2 + 2*y^2 + x*z + 3*z^2 - To: Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 7 defined by (-3*t)*x^2 + 2*y^2 + (3*t + 3)/t*z^2 + From: Projective Conic Curve over Fraction Field of Univariate + Polynomial Ring in t over Finite Field of size 7 + defined by (-3*t)*x^2 + 2*y^2 + x*z + 3*z^2 + To: Projective Conic Curve over Fraction Field of Univariate + Polynomial Ring in t over Finite Field of size 7 + defined by (-3*t)*x^2 + 2*y^2 + (3*t + 3)/t*z^2 Defn: Defined on coordinates by sending (x : y : z) to (x + 1/t*z : y : z)) @@ -424,13 +444,13 @@ def has_rational_point(self, point=False, And they can also be solved with Magma:: - sage: C.has_rational_point(algorithm='magma') # optional - magma + sage: C.has_rational_point(algorithm='magma') # optional - magma True - sage: C.has_rational_point(algorithm='magma', point=True) # optional - magma + sage: C.has_rational_point(algorithm='magma', point=True) # optional - magma (True, (-t : 1 : 1)) sage: D = Conic([t,1,t^2]) - sage: D.has_rational_point(algorithm='magma') # optional - magma + sage: D.has_rational_point(algorithm='magma') # optional - magma False TESTS: @@ -445,12 +465,12 @@ def has_rational_point(self, point=False, From: Number Field in i with defining polynomial x^2 + 1 with i = 1*I To: Complex Lazy Field Defn: i -> 1*I - sage: Conic(K, [1,1,1]).rational_point(algorithm='magma') # optional - magma + sage: Conic(K, [1,1,1]).rational_point(algorithm='magma') # optional - magma (-i : 1 : 0) sage: x = QQ['x'].gen() sage: L. = NumberField(x^2+1, embedding=None) - sage: Conic(L, [1,1,1]).rational_point(algorithm='magma') # optional - magma + sage: Conic(L, [1,1,1]).rational_point(algorithm='magma') # optional - magma (-i : 1 : 0) sage: L == K False @@ -629,8 +649,7 @@ def hom(self, x, Y=None): Scheme morphism: From: Projective Conic Curve over Rational Field defined by -x^2 + y^2 + z^2 To: Projective Conic Curve over Rational Field defined by -x^2 + 2*x*y + z^2 - Defn: Defined on coordinates by sending (x : y : z) to - (x + y : y : z) + Defn: Defined on coordinates by sending (x : y : z) to (x + y : y : z) sage: h([-1, 1, 0]) (0 : 1 : 0) @@ -640,8 +659,7 @@ def hom(self, x, Y=None): Scheme morphism: From: Projective Conic Curve over Rational Field defined by -x^2 + y^2 + z^2 To: Projective Conic Curve over Rational Field defined by 4*x^2 + y^2 - z^2 - Defn: Defined on coordinates by sending (x : y : z) to - (1/2*z : y : x) + Defn: Defined on coordinates by sending (x : y : z) to (1/2*z : y : x) ``ValueError`` is raised if the wrong codomain ``Y`` is specified: @@ -663,10 +681,11 @@ def hom(self, x, Y=None): sage: D = Conic([2,4,6,8,10,12]) sage: C.hom(identity_matrix(3), D) Scheme morphism: - From: Projective Conic Curve over Rational Field defined by x^2 + 2*x*y + 4*y^2 + 3*x*z + 5*y*z + 6*z^2 - To: Projective Conic Curve over Rational Field defined by 2*x^2 + 4*x*y + 8*y^2 + 6*x*z + 10*y*z + 12*z^2 - Defn: Defined on coordinates by sending (x : y : z) to - (x : y : z) + From: Projective Conic Curve over Rational Field + defined by x^2 + 2*x*y + 4*y^2 + 3*x*z + 5*y*z + 6*z^2 + To: Projective Conic Curve over Rational Field + defined by 2*x^2 + 4*x*y + 8*y^2 + 6*x*z + 10*y*z + 12*z^2 + Defn: Defined on coordinates by sending (x : y : z) to (x : y : z) An example not over the rational numbers: @@ -746,30 +765,31 @@ def _magma_init_(self, magma): EXAMPLES:: sage: C = Conic(QQ, [1,2,3]) - sage: C._magma_init_(magma) # optional - magma + sage: C._magma_init_(magma) # optional - magma 'Conic([_sage_ref...|1/1,2/1,3/1,0/1,0/1,0/1])' - sage: C = Conic(GF(41), [-1,2,5]) # optional - magma - sage: C._magma_init_(magma) # optional - magma + sage: C = Conic(GF(41), [-1,2,5]) # optional - magma # optional - sage.rings.finite_rings + sage: C._magma_init_(magma) # optional - magma # optional - sage.rings.finite_rings 'Conic([_sage_ref...|GF(41)!40,GF(41)!2,GF(41)!5,GF(41)!0,GF(41)!0,GF(41)!0])' - sage: F. = GF(25) - sage: C = Conic([3,0,1,4,a,2]) - sage: C - Projective Conic Curve over Finite Field in a of size 5^2 defined by -2*x^2 - y^2 + x*z + a*y*z + 2*z^2 - sage: magma(C) # optional - magma + sage: F. = GF(25) # optional - sage.rings.finite_rings + sage: C = Conic([3,0,1,4,a,2]) # optional - sage.rings.finite_rings + sage: C # optional - sage.rings.finite_rings + Projective Conic Curve over Finite Field in a of size 5^2 + defined by -2*x^2 - y^2 + x*z + a*y*z + 2*z^2 + sage: magma(C) # optional - magma # optional - sage.rings.finite_rings Conic over GF(5^2) defined by 3*X^2 + 4*Y^2 + X*Z + a*Y*Z + 2*Z^2 - sage: magma(Conic([1/2,2/3,-4/5,6/7,8/9,-10/11])) # optional - magma + sage: magma(Conic([1/2,2/3,-4/5,6/7,8/9,-10/11])) # optional - magma Conic over Rational Field defined by 1/2*X^2 + 2/3*X*Y + 6/7*Y^2 - 4/5*X*Z + 8/9*Y*Z - 10/11*Z^2 sage: R. = Frac(QQ['x']) - sage: magma(Conic([x,1+x,1-x])) # optional - magma + sage: magma(Conic([x, 1 + x, 1 - x])) # optional - magma Conic over Univariate rational function field over Rational Field defined by x*X^2 + (x + 1)*Y^2 + (-x + 1)*Z^2 sage: P. = QQ[] - sage: K. = NumberField(x^3+x+1) - sage: magma(Conic([b,1,2])) # optional - magma - Conic over Number Field with defining polynomial x^3 + x + 1 over the Rational Field defined by - b*X^2 + Y^2 + 2*Z^2 + sage: K. = NumberField(x^3 + x + 1) # optional - sage.rings.number_field + sage: magma(Conic([b,1,2])) # optional - magma # optional - sage.rings.number_field + Conic over Number Field with defining polynomial x^3 + x + 1 + over the Rational Field defined by b*X^2 + Y^2 + 2*Z^2 """ kmn = magma(self.base_ring())._ref() coeffs = self.coefficients() @@ -793,9 +813,9 @@ def matrix(self): [1/2 1 0] [ 0 0 1] - sage: R. = GF(2)[] - sage: C = Conic(x^2 + x*y + y^2 + x*z + z^2) - sage: C.matrix() + sage: R. = GF(2)[] # optional - sage.rings.finite_rings + sage: C = Conic(x^2 + x*y + y^2 + x*z + z^2) # optional - sage.rings.finite_rings + sage: C.matrix() # optional - sage.rings.finite_rings [1 1 1] [0 1 0] [0 0 1] @@ -823,57 +843,59 @@ def parametrization(self, point=None, morphism=True): An example over a finite field :: - sage: c = Conic(GF(2), [1,1,1,1,1,0]) - sage: f, g = c.parametrization(); f, g + sage: c = Conic(GF(2), [1,1,1,1,1,0]) # optional - sage.rings.finite_rings + sage: f, g = c.parametrization(); f, g # optional - sage.rings.finite_rings (Scheme morphism: From: Projective Space of dimension 1 over Finite Field of size 2 - To: Projective Conic Curve over Finite Field of size 2 defined by x^2 + x*y - + y^2 + x*z + y*z + To: Projective Conic Curve over Finite Field of size 2 + defined by x^2 + x*y + y^2 + x*z + y*z Defn: Defined on coordinates by sending (x : y) to ..., Scheme morphism: - From: Projective Conic Curve over Finite Field of size 2 defined by x^2 + x*y - + y^2 + x*z + y*z + From: Projective Conic Curve over Finite Field of size 2 + defined by x^2 + x*y + y^2 + x*z + y*z To: Projective Space of dimension 1 over Finite Field of size 2 Defn: Defined on coordinates by sending (x : y : z) to ...) - sage: set(f(p) for p in f.domain()) + sage: set(f(p) for p in f.domain()) # optional - sage.rings.finite_rings {(0 : 0 : 1), (0 : 1 : 1), (1 : 0 : 1)} Verfication of the example :: - sage: h = g*f; h - Scheme endomorphism of Projective Space of dimension 1 over Finite Field of size 2 + sage: h = g*f; h # optional - sage.rings.finite_rings + Scheme endomorphism of Projective Space of dimension 1 + over Finite Field of size 2 Defn: Defined on coordinates by sending (x : y) to ... - sage: h[0]/h[1] + sage: h[0]/h[1] # optional - sage.rings.finite_rings x/y - sage: h.is_one() # known bug (see :trac:`31892`) + sage: h.is_one() # known bug (see :trac:`31892`) # optional - sage.rings.finite_rings True - sage: (x,y,z) = c.gens() - sage: x.parent() - Quotient of Multivariate Polynomial Ring in x, y, z over Finite Field of size 2 by the ideal (x^2 + x*y + y^2 + x*z + y*z) - sage: k = f*g - sage: k[0]*z-k[2]*x + sage: (x,y,z) = c.gens() # optional - sage.rings.finite_rings + sage: x.parent() # optional - sage.rings.finite_rings + Quotient of Multivariate Polynomial Ring in x, y, z + over Finite Field of size 2 by the ideal (x^2 + x*y + y^2 + x*z + y*z) + sage: k = f*g # optional - sage.rings.finite_rings + sage: k[0]*z-k[2]*x # optional - sage.rings.finite_rings 0 - sage: k[1]*z-k[2]*y + sage: k[1]*z-k[2]*y # optional - sage.rings.finite_rings 0 The morphisms are mathematically defined in all points, but don't work completely in SageMath (see :trac:`31892`) :: - sage: f, g = c.parametrization([0,0,1]) - sage: g([0,1,1]) + sage: f, g = c.parametrization([0,0,1]) # optional - sage.rings.finite_rings + sage: g([0,1,1]) # optional - sage.rings.finite_rings (1 : 0) - sage: f([1,0]) + sage: f([1,0]) # optional - sage.rings.finite_rings (0 : 1 : 1) - sage: f([1,1]) + sage: f([1,1]) # optional - sage.rings.finite_rings (0 : 0 : 1) - sage: g([0,0,1]) + sage: g([0,0,1]) # optional - sage.rings.finite_rings (1 : 1) An example with ``morphism = False`` :: sage: R. = QQ[] sage: C = Curve(7*x^2 + 2*y*z + z^2) - sage: (p, i) = C.parametrization(morphism = False); (p, i) + sage: (p, i) = C.parametrization(morphism=False); (p, i) ([-2*x*y, x^2 + 7*y^2, -2*x^2], [-1/2*x, 1/7*y + 1/14*z]) sage: C.defining_polynomial()(p) 0 @@ -979,12 +1001,13 @@ def random_rational_point(self, *args1, **args2): EXAMPLES:: - sage: c = Conic(GF(2), [1,1,1,1,1,0]) - sage: [c.random_rational_point() for i in range(10)] # output is random - [(1 : 0 : 1), (1 : 0 : 1), (1 : 0 : 1), (0 : 1 : 1), (1 : 0 : 1), (0 : 0 : 1), (1 : 0 : 1), (1 : 0 : 1), (0 : 0 : 1), (1 : 0 : 1)] + sage: c = Conic(GF(2), [1,1,1,1,1,0]) # optional - sage.rings.finite_rings + sage: [c.random_rational_point() for i in range(10)] # random # optional - sage.rings.finite_rings + [(1 : 0 : 1), (1 : 0 : 1), (1 : 0 : 1), (0 : 1 : 1), (1 : 0 : 1), + (0 : 0 : 1), (1 : 0 : 1), (1 : 0 : 1), (0 : 0 : 1), (1 : 0 : 1)] sage: d = Conic(QQ, [1, 1, -1]) - sage: d.random_rational_point(den_bound = 1, num_bound = 5) # output is random + sage: d.random_rational_point(den_bound=1, num_bound=5) # random (-24/25 : 7/25 : 1) sage: Conic(QQ, [1, 1, 1]).random_rational_point() @@ -1038,83 +1061,91 @@ def rational_point(self, algorithm='default', read_cache=True): Examples over number fields :: sage: P. = QQ[] - sage: L. = NumberField(x^3-5) - sage: C = Conic(L, [3, 2, -b]) - sage: p = C.rational_point(algorithm = 'rnfisnorm') - sage: p # output is random + sage: L. = NumberField(x^3 - 5) # optional - sage.rings.number_field + sage: C = Conic(L, [3, 2, -b]) # optional - sage.rings.number_field + sage: p = C.rational_point(algorithm = 'rnfisnorm') # optional - sage.rings.number_field + sage: p # output is random # optional - sage.rings.number_field (1/3*b^2 - 4/3*b + 4/3 : b^2 - 2 : 1) - sage: C.defining_polynomial()(list(p)) + sage: C.defining_polynomial()(list(p)) # optional - sage.rings.number_field 0 - sage: K. = QuadraticField(-1) - sage: D = Conic(K, [3, 2, 5]) - sage: D.rational_point(algorithm = 'rnfisnorm') # output is random + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: D = Conic(K, [3, 2, 5]) # optional - sage.rings.number_field + sage: D.rational_point(algorithm = 'rnfisnorm') # output is random # optional - sage.rings.number_field (-3 : 4*i : 1) - sage: L. = QuadraticField(2) - sage: Conic(QQ, [1, 1, -3]).has_rational_point() + sage: L. = QuadraticField(2) # optional - sage.rings.number_field + sage: Conic(QQ, [1, 1, -3]).has_rational_point() # optional - sage.rings.number_field False - sage: E = Conic(L, [1, 1, -3]) - sage: E.rational_point() # output is random + sage: E = Conic(L, [1, 1, -3]) # optional - sage.rings.number_field + sage: E.rational_point() # output is random # optional - sage.rings.number_field (-1 : -s : 1) Currently Magma is better at solving conics over number fields than Sage, so it helps to use the algorithm 'magma' if Magma is installed:: - sage: q = C.rational_point(algorithm = 'magma', read_cache=False) # optional - magma - sage: q # output is random, optional - magma + sage: q = C.rational_point(algorithm='magma', # optional - magma # optional - sage.rings.number_field + ....: read_cache=False) + sage: q # output is random, # optional - magma # optional - sage.rings.number_field (1/5*b^2 : 1/5*b^2 : 1) - sage: C.defining_polynomial()(list(q)) # optional - magma + sage: C.defining_polynomial()(list(q)) # optional - magma # optional - sage.rings.number_field 0 - sage: len(str(p)) > 1.5*len(str(q)) # optional - magma + sage: len(str(p)) > 1.5*len(str(q)) # optional - magma # optional - sage.rings.number_field True - sage: D.rational_point(algorithm = 'magma', read_cache=False) # random, optional - magma + sage: D.rational_point(algorithm='magma', # random, optional - magma # optional - sage.rings.number_field (1 : 2*i : 1) - sage: E.rational_point(algorithm='magma', read_cache=False) # random, optional - magma + sage: E.rational_point(algorithm='magma', # random, optional - magma # optional - sage.rings.number_field + ....: read_cache=False) (-s : 1 : 1) - sage: F = Conic([L.gen(), 30, -20]) - sage: q = F.rational_point(algorithm='magma') # optional - magma - sage: q # output is random, optional - magma + sage: F = Conic([L.gen(), 30, -20]) # optional - sage.rings.number_field + sage: q = F.rational_point(algorithm='magma') # optional - magma # optional - sage.rings.number_field + sage: q # random, optional - magma # optional - sage.rings.number_field (-10/7*s + 40/7 : 5/7*s - 6/7 : 1) - sage: p = F.rational_point(read_cache=False) - sage: p # output is random + sage: p = F.rational_point(read_cache=False) # optional - sage.rings.number_field + sage: p # random # optional - sage.rings.number_field (788210*s - 1114700 : -171135*s + 242022 : 1) - sage: len(str(p)) > len(str(q)) # optional - magma + sage: len(str(p)) > len(str(q)) # optional - magma # optional - sage.rings.number_field True - sage: G = Conic([L.gen(), 30, -21]) - sage: G.has_rational_point(algorithm='magma') # optional - magma + sage: G = Conic([L.gen(), 30, -21]) # optional - sage.rings.number_field + sage: G.has_rational_point(algorithm='magma') # optional - magma # optional - sage.rings.number_field False - sage: G.has_rational_point(read_cache=False) + sage: G.has_rational_point(read_cache=False) # optional - sage.rings.number_field False - sage: G.has_rational_point(algorithm='local', read_cache=False) + sage: G.has_rational_point(algorithm='local', read_cache=False) # optional - sage.rings.number_field False - sage: G.rational_point(algorithm='magma') # optional - magma + sage: G.rational_point(algorithm='magma') # optional - magma # optional - sage.rings.number_field Traceback (most recent call last): ... ValueError: Conic Projective Conic Curve over Number Field in s with defining polynomial x^2 - 2 with s = 1.414213562373095? defined by s*x^2 + 30*y^2 - 21*z^2 has no rational points over Number Field in s with defining polynomial x^2 - 2 with s = 1.414213562373095?! - sage: G.rational_point(algorithm='magma', read_cache=False) # optional - magma + sage: G.rational_point(algorithm='magma', # optional - magma # optional - sage.rings.number_field + ....: read_cache=False) Traceback (most recent call last): ... ValueError: Conic Projective Conic Curve over Number Field in s with defining polynomial x^2 - 2 with s = 1.414213562373095? defined by s*x^2 + 30*y^2 - 21*z^2 has no rational points over Number Field in s with defining polynomial x^2 - 2 with s = 1.414213562373095?! Examples over finite fields :: - sage: F. = FiniteField(7^20) - sage: C = Conic([1, a, -5]); C - Projective Conic Curve over Finite Field in a of size 7^20 defined by x^2 + a*y^2 + 2*z^2 - sage: C.rational_point() # output is random - (4*a^19 + 5*a^18 + 4*a^17 + a^16 + 6*a^15 + 3*a^13 + 6*a^11 + a^9 + 3*a^8 + 2*a^7 + 4*a^6 + 3*a^5 + 3*a^4 + a^3 + a + 6 : 5*a^18 + a^17 + a^16 + 6*a^15 + 4*a^14 + a^13 + 5*a^12 + 5*a^10 + 2*a^9 + 6*a^8 + 6*a^7 + 6*a^6 + 2*a^4 + 3 : 1) + sage: F. = FiniteField(7^20) # optional - sage.rings.finite_rings + sage: C = Conic([1, a, -5]); C # optional - sage.rings.finite_rings + Projective Conic Curve over Finite Field in a of size 7^20 + defined by x^2 + a*y^2 + 2*z^2 + sage: C.rational_point() # output is random # optional - sage.rings.finite_rings + (4*a^19 + 5*a^18 + 4*a^17 + a^16 + 6*a^15 + 3*a^13 + 6*a^11 + a^9 + + 3*a^8 + 2*a^7 + 4*a^6 + 3*a^5 + 3*a^4 + a^3 + a + 6 + : 5*a^18 + a^17 + a^16 + 6*a^15 + 4*a^14 + a^13 + 5*a^12 + 5*a^10 + + 2*a^9 + 6*a^8 + 6*a^7 + 6*a^6 + 2*a^4 + 3 + : 1) Examples over `\RR` and `\CC` :: - sage: Conic(CC, [1, 2, 3]).rational_point() + sage: Conic(CC, [1, 2, 3]).rational_point() # optional - sage.rings.finite_rings (0 : 1.22474487139159*I : 1) - sage: Conic(RR, [1, 1, 1]).rational_point() + sage: Conic(RR, [1, 1, 1]).rational_point() # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Conic Projective Conic Curve over Real Field with 53 bits of precision defined by x^2 + y^2 + z^2 has no rational points over Real Field with 53 bits of precision! @@ -1134,7 +1165,7 @@ def singular_point(self): :: - sage: Conic(GF(2), [1,1,1,1,1,1]).singular_point() + sage: Conic(GF(2), [1,1,1,1,1,1]).singular_point() # optional - sage.rings.finite_rings (1 : 1 : 1) ``ValueError`` is raised if the conic has no rational singular point diff --git a/src/sage/schemes/plane_conics/con_finite_field.py b/src/sage/schemes/plane_conics/con_finite_field.py index 7eb316746f3..af97eaec4a2 100644 --- a/src/sage/schemes/plane_conics/con_finite_field.py +++ b/src/sage/schemes/plane_conics/con_finite_field.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.rings.finite_rings r""" Projective plane conics over finite fields @@ -37,7 +38,8 @@ class ProjectiveConic_finite_field(ProjectiveConic_field, ProjectivePlaneCurve_f sage: K. = FiniteField(9, 'a') sage: P. = K[] sage: Conic(X^2 + Y^2 - a*Z^2) - Projective Conic Curve over Finite Field in a of size 3^2 defined by X^2 + Y^2 + (-a)*Z^2 + Projective Conic Curve over Finite Field in a of size 3^2 + defined by X^2 + Y^2 + (-a)*Z^2 :: @@ -94,36 +96,50 @@ def has_rational_point(self, point=False, read_cache=True, True sage: C = Conic(FiniteField(2), [1, 1, 1, 1, 1, 0]); C - Projective Conic Curve over Finite Field of size 2 defined by x^2 + x*y + y^2 + x*z + y*z + Projective Conic Curve over Finite Field of size 2 + defined by x^2 + x*y + y^2 + x*z + y*z sage: C.has_rational_point(point = True) # output is random (True, (0 : 0 : 1)) sage: p = next_prime(10^50) sage: F = FiniteField(p) sage: C = Conic(F, [1, 2, 3]); C - Projective Conic Curve over Finite Field of size 100000000000000000000000000000000000000000000000151 defined by x^2 + 2*y^2 + 3*z^2 + Projective Conic Curve over Finite Field + of size 100000000000000000000000000000000000000000000000151 + defined by x^2 + 2*y^2 + 3*z^2 sage: C.has_rational_point(point = True) # output is random (True, - (14971942941468509742682168602989039212496867586852 : 75235465708017792892762202088174741054630437326388 : 1) + (14971942941468509742682168602989039212496867586852 + : 75235465708017792892762202088174741054630437326388 : 1) sage: F. = FiniteField(7^20) sage: C = Conic([1, a, -5]); C - Projective Conic Curve over Finite Field in a of size 7^20 defined by x^2 + a*y^2 + 2*z^2 + Projective Conic Curve over Finite Field in a of size 7^20 + defined by x^2 + a*y^2 + 2*z^2 sage: C.has_rational_point(point = True) # output is random (True, - (a^18 + 2*a^17 + 4*a^16 + 6*a^13 + a^12 + 6*a^11 + 3*a^10 + 4*a^9 + 2*a^8 + 4*a^7 + a^6 + 4*a^4 + 6*a^2 + 3*a + 6 : 5*a^19 + 5*a^18 + 5*a^17 + a^16 + 2*a^15 + 3*a^14 + 4*a^13 + 5*a^12 + a^11 + 3*a^10 + 2*a^8 + 3*a^7 + 4*a^6 + 4*a^5 + 6*a^3 + 5*a^2 + 2*a + 4 : 1)) + (a^18 + 2*a^17 + 4*a^16 + 6*a^13 + a^12 + 6*a^11 + 3*a^10 + 4*a^9 + 2*a^8 + + 4*a^7 + a^6 + 4*a^4 + 6*a^2 + 3*a + 6 + : 5*a^19 + 5*a^18 + 5*a^17 + a^16 + 2*a^15 + 3*a^14 + 4*a^13 + 5*a^12 + + a^11 + 3*a^10 + 2*a^8 + 3*a^7 + 4*a^6 + 4*a^5 + 6*a^3 + 5*a^2 + 2*a + 4 + : 1)) TESTS:: sage: l = Sequence(cartesian_product_iterator([[0, 1] for i in range(6)])) sage: bigF = GF(next_prime(2^100)) sage: bigF2 = GF(next_prime(2^50)^2, 'b') - sage: m = [[F(b) for b in a] for a in l for F in [GF(2), GF(4, 'a'), GF(5), GF(9, 'a'), bigF, bigF2]] - sage: m += [[F.random_element() for i in range(6)] for j in range(20) for F in [GF(5), bigF]] + sage: m = [[F(b) for b in a] + ....: for a in l + ....: for F in [GF(2), GF(4, 'a'), GF(5), GF(9, 'a'), bigF, bigF2]] + sage: m += [[F.random_element() for i in range(6)] + ....: for j in range(20) for F in [GF(5), bigF]] sage: c = [Conic(a) for a in m if a != [0,0,0,0,0,0]] sage: assert all(C.has_rational_point() for C in c) sage: r = randrange(0, 5) - sage: assert all(C.defining_polynomial()(Sequence(C.has_rational_point(point = True)[1])) == 0 for C in c[r::5]) # long time (1.4s on sage.math, 2013) + sage: assert all(C.defining_polynomial()( # long time (1.4s on sage.math, 2013) + ....: Sequence(C.has_rational_point(point=True)[1])) == 0 + ....: for C in c[r::5]) """ if not point: return True diff --git a/src/sage/schemes/plane_conics/con_number_field.py b/src/sage/schemes/plane_conics/con_number_field.py index 4d2c55f36d9..da20b6f3802 100644 --- a/src/sage/schemes/plane_conics/con_number_field.py +++ b/src/sage/schemes/plane_conics/con_number_field.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.rings.number_field r""" Projective plane conics over a number field @@ -36,7 +37,8 @@ class ProjectiveConic_number_field(ProjectiveConic_field): sage: K. = NumberField(x^3 - 2, 'a') sage: P. = K[] sage: Conic(X^2 + Y^2 - a*Z^2) - Projective Conic Curve over Number Field in a with defining polynomial x^3 - 2 defined by X^2 + Y^2 + (-a)*Z^2 + Projective Conic Curve over Number Field in a with defining polynomial x^3 - 2 + defined by X^2 + Y^2 + (-a)*Z^2 TESTS:: @@ -113,18 +115,19 @@ def has_rational_point(self, point=False, obstruction=False, sage: C = Conic(QQ, [1, 113922743, -310146482690273725409]) sage: C.has_rational_point(point = True) (True, (-76842858034579/5424 : -5316144401/5424 : 1)) - sage: C.has_rational_point(algorithm = 'local', read_cache = False) + sage: C.has_rational_point(algorithm='local', read_cache=False) True Examples over number fields:: sage: K. = QuadraticField(-1) sage: C = Conic(K, [1, 3, -5]) - sage: C.has_rational_point(point = True, obstruction = True) + sage: C.has_rational_point(point=True, obstruction=True) (False, Fractional ideal (-i - 2)) - sage: C.has_rational_point(algorithm = "rnfisnorm") + sage: C.has_rational_point(algorithm="rnfisnorm") False - sage: C.has_rational_point(algorithm = "rnfisnorm", obstruction = True, read_cache=False) + sage: C.has_rational_point(algorithm="rnfisnorm", obstruction=True, + ....: read_cache=False) Traceback (most recent call last): ... ValueError: Algorithm rnfisnorm cannot be combined with obstruction = True in has_rational_point @@ -132,7 +135,7 @@ def has_rational_point(self, point=False, obstruction=False, sage: P. = QQ[] sage: L. = NumberField(x^3-5) sage: C = Conic(L, [1, 2, -3]) - sage: C.has_rational_point(point = True, algorithm = 'rnfisnorm') + sage: C.has_rational_point(point=True, algorithm='rnfisnorm') (True, (5/3 : -1/3 : 1)) sage: K. = NumberField(x^4+2) @@ -140,7 +143,8 @@ def has_rational_point(self, point=False, obstruction=False, False sage: Conic(K, [4,5,6]).has_rational_point() True - sage: Conic(K, [4,5,6]).has_rational_point(algorithm='magma', read_cache=False) # optional - magma + sage: Conic(K, [4,5,6]).has_rational_point(algorithm='magma', # optional - magma + ....: read_cache=False) True sage: P. = QuadraticField(2) @@ -152,13 +156,15 @@ def has_rational_point(self, point=False, obstruction=False, sage: C.has_rational_point(obstruction=True) (False, Ring morphism: - From: Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? + From: Number Field in a with defining polynomial x^2 - 2 + with a = 1.414213562373095? To: Algebraic Real Field Defn: a |--> -1.414213562373095?) sage: C.has_rational_point(point=True, obstruction=True) (False, Ring morphism: - From: Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? + From: Number Field in a with defining polynomial x^2 - 2 + with a = 1.414213562373095? To: Algebraic Real Field Defn: a |--> -1.414213562373095?) @@ -182,12 +188,12 @@ def has_rational_point(self, point=False, obstruction=False, sage: d = [] sage: c = [] sage: c = [Conic(a) for a in m if a != [0,0,0]] - sage: d = [C.has_rational_point(algorithm = 'rnfisnorm', point = True) for C in c] # long time: 3.3 seconds + sage: d = [C.has_rational_point(algorithm='rnfisnorm', point=True) for C in c] # long time: 3.3 seconds sage: all(c[k].defining_polynomial()(Sequence(d[k][1])) == 0 for k in range(len(d)) if d[k][0]) True sage: [C.has_rational_point(algorithm='local', read_cache=False) for C in c] == [o[0] for o in d] # long time: 5 seconds True - sage: [C.has_rational_point(algorithm = 'magma', read_cache=False) for C in c] == [o[0] for o in d] # long time: 3 seconds, optional - magma + sage: [C.has_rational_point(algorithm='magma', read_cache=False) for C in c] == [o[0] for o in d] # long time: 3 seconds, optional - magma True Create a bunch of conics that are known to have rational points @@ -200,8 +206,8 @@ def has_rational_point(self, point=False, obstruction=False, sage: M. = NumberField(x^5+3*x+1) sage: m = [[F(b) for b in a] for a in l for F in [K, L, M]] sage: c = [Conic(a) for a in m if a != [0,0,0] and a != [1,1,1] and a != [-1,-1,-1]] - sage: assert all(C.has_rational_point(algorithm = 'rnfisnorm') for C in c) - sage: assert all(C.defining_polynomial()(Sequence(C.has_rational_point(point = True)[1])) == 0 for C in c) + sage: assert all(C.has_rational_point(algorithm='rnfisnorm') for C in c) + sage: assert all(C.defining_polynomial()(Sequence(C.has_rational_point(point=True)[1])) == 0 for C in c) sage: assert all(C.has_rational_point(algorithm='local', read_cache=False) for C in c) # long time: 1 second """ if read_cache: @@ -403,10 +409,12 @@ def local_obstructions(self, finite=True, infinite=True, read_cache=True): sage: L. = QuadraticField(5) sage: Conic(L, [1, 2, 3]).local_obstructions() [Ring morphism: - From: Number Field in a with defining polynomial x^2 - 5 with a = 2.236067977499790? + From: Number Field in a with defining polynomial x^2 - 5 + with a = 2.236067977499790? To: Algebraic Real Field Defn: a |--> -2.236067977499790?, Ring morphism: - From: Number Field in a with defining polynomial x^2 - 5 with a = 2.236067977499790? + From: Number Field in a with defining polynomial x^2 - 5 + with a = 2.236067977499790? To: Algebraic Real Field Defn: a |--> 2.236067977499790?] """ diff --git a/src/sage/schemes/plane_conics/con_rational_field.py b/src/sage/schemes/plane_conics/con_rational_field.py index 8e14d1e2ba7..a929ba3d780 100644 --- a/src/sage/schemes/plane_conics/con_rational_field.py +++ b/src/sage/schemes/plane_conics/con_rational_field.py @@ -116,26 +116,27 @@ def has_rational_point(self, point=False, obstruction=False, EXAMPLES:: sage: C = Conic(QQ, [1, 2, -3]) - sage: C.has_rational_point(point = True) + sage: C.has_rational_point(point=True) (True, (1 : 1 : 1)) sage: D = Conic(QQ, [1, 3, -5]) - sage: D.has_rational_point(point = True) + sage: D.has_rational_point(point=True) (False, 3) sage: P. = QQ[] sage: E = Curve(X^2 + Y^2 + Z^2); E Projective Conic Curve over Rational Field defined by X^2 + Y^2 + Z^2 - sage: E.has_rational_point(obstruction = True) + sage: E.has_rational_point(obstruction=True) (False, -1) The following would not terminate quickly with ``algorithm = 'rnfisnorm'`` :: sage: C = Conic(QQ, [1, 113922743, -310146482690273725409]) - sage: C.has_rational_point(point = True) + sage: C.has_rational_point(point=True) (True, (-76842858034579/5424 : -5316144401/5424 : 1)) - sage: C.has_rational_point(algorithm = 'local', read_cache = False) + sage: C.has_rational_point(algorithm='local', read_cache=False) True - sage: C.has_rational_point(point=True, algorithm='magma', read_cache=False) # optional - magma + sage: C.has_rational_point(point=True, algorithm='magma', # optional - magma + ....: read_cache=False) (True, (30106379962113/7913 : 12747947692/7913 : 1)) TESTS: @@ -146,7 +147,7 @@ def has_rational_point(self, point=False, obstruction=False, sage: l = Sequence(cartesian_product_iterator([[-1, 0, 1] for i in range(6)])) sage: c = [Conic(QQ, a) for a in l if a != [0,0,0] and a != (0,0,0,0,0,0)] sage: d = [] - sage: d = [[C]+[C.has_rational_point(algorithm = algorithm, read_cache = False, obstruction = (algorithm != 'rnfisnorm'), point = (algorithm != 'local')) for algorithm in ['local', 'qfsolve', 'rnfisnorm']] for C in c[::10]] # long time: 7 seconds + sage: d = [[C] + [C.has_rational_point(algorithm=algorithm, read_cache=False, obstruction=(algorithm != 'rnfisnorm'), point=(algorithm != 'local')) for algorithm in ['local', 'qfsolve', 'rnfisnorm']] for C in c[::10]] # long time: 7 seconds sage: assert all(e[1][0] == e[2][0] and e[1][0] == e[3][0] for e in d) sage: assert all(e[0].defining_polynomial()(Sequence(e[i][1])) == 0 for e in d for i in [2,3] if e[1][0]) """ @@ -342,7 +343,7 @@ def parametrization(self, point=None, morphism=True): sage: R. = QQ[] sage: C = Curve(7*x^2 + 2*y*z + z^2) - sage: (p, i) = C.parametrization(morphism = False); (p, i) + sage: (p, i) = C.parametrization(morphism=False); (p, i) ([-2*x*y, x^2 + 7*y^2, -2*x^2], [-1/2*x, 1/7*y + 1/14*z]) sage: C.defining_polynomial()(p) 0 diff --git a/src/sage/schemes/plane_conics/con_rational_function_field.py b/src/sage/schemes/plane_conics/con_rational_function_field.py index d90909145e3..4b38bc47db1 100644 --- a/src/sage/schemes/plane_conics/con_rational_function_field.py +++ b/src/sage/schemes/plane_conics/con_rational_function_field.py @@ -25,7 +25,7 @@ sage: K. = FractionField(QQ['t']) sage: C = Conic([1,-t,t]) - sage: C.has_rational_point(point = True) + sage: C.has_rational_point(point=True) (True, (0 : 1 : 1)) """ @@ -127,19 +127,19 @@ def has_rational_point(self, point=False, algorithm='default', and finite fields:: sage: K. = FractionField(PolynomialRing(QQ, 't')) - sage: C = Conic(K, [t^2-2, 2*t^3, -2*t^3-13*t^2-2*t+18]) + sage: C = Conic(K, [t^2 - 2, 2*t^3, -2*t^3 - 13*t^2 - 2*t + 18]) sage: C.has_rational_point(point=True) (True, (-3 : (t + 1)/t : 1)) - sage: R. = FiniteField(23)[] - sage: C = Conic([2, t^2+1, t^2+5]) - sage: C.has_rational_point() + sage: R. = FiniteField(23)[] # optional - sage.rings.finite_rings + sage: C = Conic([2, t^2 + 1, t^2 + 5]) # optional - sage.rings.finite_rings + sage: C.has_rational_point() # optional - sage.rings.finite_rings True - sage: C.has_rational_point(point=True) + sage: C.has_rational_point(point=True) # optional - sage.rings.finite_rings (True, (5*t : 8 : 1)) - sage: F. = QuadraticField(-1) - sage: R. = F[] - sage: C = Conic([1,i*t,-t^2+4]) - sage: C.has_rational_point(point=True) + sage: F. = QuadraticField(-1) # optional - sage.rings.number_field + sage: R. = F[] # optional - sage.rings.number_field + sage: C = Conic([1, i*t, -t^2 + 4]) # optional - sage.rings.number_field + sage: C.has_rational_point(point=True) # optional - sage.rings.number_field (True, (-t - 2*i : -2*i : 1)) It works on non-diagonal conics as well:: @@ -165,8 +165,8 @@ def has_rational_point(self, point=False, algorithm='default', sage: F. = FractionField(QQ['t1']) sage: K. = FractionField(F['t2']) sage: a = K(1) - sage: b = 2*t2^2+2*t1*t2-t1^2 - sage: c = -3*t2^4-4*t1*t2^3+8*t1^2*t2^2+16*t1^3-t2-48*t1^4 + sage: b = 2*t2^2 + 2*t1*t2 - t1^2 + sage: c = -3*t2^4 - 4*t1*t2^3 + 8*t1^2*t2^2 + 16*t1^3 - t2 - 48*t1^4 sage: C = Conic([a,b,c]) sage: C.has_rational_point() Traceback (most recent call last): @@ -183,11 +183,11 @@ def has_rational_point(self, point=False, algorithm='default', sage: P. = QQ[] sage: E = P.fraction_field() sage: Q. = E[] - sage: F. = E.extension(Y^2 - u^3 - 1) - sage: R. = F[] - sage: K = R.fraction_field() - sage: C = Conic(K, [u, v, 1]) - sage: C.has_rational_point() + sage: F. = E.extension(Y^2 - u^3 - 1) # optional - sage.rings.function_field + sage: R. = F[] # optional - sage.rings.function_field + sage: K = R.fraction_field() # optional - sage.rings.function_field + sage: C = Conic(K, [u, v, 1]) # optional - sage.rings.function_field + sage: C.has_rational_point() # optional - sage.rings.function_field Traceback (most recent call last): ... NotImplementedError: has_rational_point not implemented for conics @@ -198,9 +198,10 @@ def has_rational_point(self, point=False, algorithm='default', ``has_rational_point`` fails for some conics over function fields over finite fields, due to :trac:`20003`:: - sage: K. = PolynomialRing(GF(7)) - sage: C = Conic([5*t^2+4, t^2+3*t+3, 6*t^2+3*t+2, 5*t^2+5, 4*t+3, 4*t^2+t+5]) - sage: C.has_rational_point() + sage: K. = PolynomialRing(GF(7)) # optional - sage.rings.finite_rings + sage: C = Conic([5*t^2 + 4, t^2 + 3*t + 3, 6*t^2 + 3*t + 2, # optional - sage.rings.finite_rings + ....: 5*t^2 + 5, 4*t + 3, 4*t^2 + t + 5]) + sage: C.has_rational_point() # optional - sage.rings.finite_rings Traceback (most recent call last): ... TypeError: self (=Scheme morphism: @@ -362,7 +363,7 @@ def _reduce_conic(self): EXAMPLES:: sage: K. = FractionField(PolynomialRing(QQ, 't')) - sage: C = Conic(K, [t^2-2, 2*t^3, -2*t^3-13*t^2-2*t+18]) + sage: C = Conic(K, [t^2 - 2, 2*t^3, -2*t^3 - 13*t^2 - 2*t + 18]) sage: C._reduce_conic() ([t^2 - 2, 2*t, -2*t^3 - 13*t^2 - 2*t + 18], [t, 1, t]) """ @@ -459,14 +460,14 @@ def find_point(self, supports, roots, case, solution=0): EXAMPLES:: sage: K. = FractionField(QQ['t']) - sage: C = Conic(K, [t^2-2, 2*t^3, -2*t^3-13*t^2-2*t+18]) + sage: C = Conic(K, [t^2 - 2, 2*t^3, -2*t^3 - 13*t^2 - 2*t + 18]) sage: C.has_rational_point(point=True) # indirect test (True, (-3 : (t + 1)/t : 1)) Different solubility certificates give different points:: sage: K. = PolynomialRing(QQ, 't') - sage: C = Conic(K, [t^2-2, 2*t, -2*t^3-13*t^2-2*t+18]) + sage: C = Conic(K, [t^2 - 2, 2*t, -2*t^3 - 13*t^2 - 2*t + 18]) sage: supp = [[t^2 - 2], [t], [t^3 + 13/2*t^2 + t - 9]] sage: tbar1 = QQ.extension(supp[0][0], 'tbar').gens()[0] sage: tbar2 = QQ.extension(supp[1][0], 'tbar').gens()[0] diff --git a/src/sage/schemes/plane_conics/constructor.py b/src/sage/schemes/plane_conics/constructor.py index f36c078b459..5cb1399be6d 100644 --- a/src/sage/schemes/plane_conics/constructor.py +++ b/src/sage/schemes/plane_conics/constructor.py @@ -126,12 +126,14 @@ def Conic(base_field, F=None, names=None, unique=True): sage: Conic(QQ, [1,2,3]) Projective Conic Curve over Rational Field defined by x^2 + 2*y^2 + 3*z^2 sage: Conic(GF(7), [1,2,3,4,5,6], 'X') - Projective Conic Curve over Finite Field of size 7 defined by X0^2 + 2*X0*X1 - 3*X1^2 + 3*X0*X2 - 2*X1*X2 - X2^2 + Projective Conic Curve over Finite Field of size 7 + defined by X0^2 + 2*X0*X1 - 3*X1^2 + 3*X0*X2 - 2*X1*X2 - X2^2 The conic through a set of points :: sage: C = Conic(QQ, [[10,2],[3,4],[-7,6],[7,8],[9,10]]); C - Projective Conic Curve over Rational Field defined by x^2 + 13/4*x*y - 17/4*y^2 - 35/2*x*z + 91/4*y*z - 37/2*z^2 + Projective Conic Curve over Rational Field + defined by x^2 + 13/4*x*y - 17/4*y^2 - 35/2*x*z + 91/4*y*z - 37/2*z^2 sage: C.rational_point() (10 : 2 : 1) sage: C.point([3,4]) diff --git a/src/sage/schemes/plane_quartics/quartic_constructor.py b/src/sage/schemes/plane_quartics/quartic_constructor.py index 274eaf049b6..421c8d2bad8 100644 --- a/src/sage/schemes/plane_quartics/quartic_constructor.py +++ b/src/sage/schemes/plane_quartics/quartic_constructor.py @@ -27,24 +27,24 @@ def QuarticCurve(F, PP=None, check=False): EXAMPLES:: - sage: x,y,z=PolynomialRing(QQ,['x','y','z']).gens() - sage: QuarticCurve(x**4+y**4+z**4) + sage: x,y,z = PolynomialRing(QQ, ['x','y','z']).gens() + sage: QuarticCurve(x**4 + y**4 + z**4) Quartic Curve over Rational Field defined by x^4 + y^4 + z^4 TESTS:: - sage: QuarticCurve(x**3+y**3) + sage: QuarticCurve(x**3 + y**3) Traceback (most recent call last): ... ValueError: Argument F (=x^3 + y^3) must be a homogeneous polynomial of degree 4 - sage: QuarticCurve(x**4+y**4+z**3) + sage: QuarticCurve(x**4 + y**4 + z**3) Traceback (most recent call last): ... ValueError: Argument F (=x^4 + y^4 + z^3) must be a homogeneous polynomial of degree 4 sage: x,y=PolynomialRing(QQ,['x','y']).gens() - sage: QuarticCurve(x**4+y**4) + sage: QuarticCurve(x**4 + y**4) Traceback (most recent call last): ... ValueError: Argument F (=x^4 + y^4) must be a polynomial in 3 variables diff --git a/src/sage/schemes/plane_quartics/quartic_generic.py b/src/sage/schemes/plane_quartics/quartic_generic.py index e5e546ad724..8f2046f2b4a 100644 --- a/src/sage/schemes/plane_quartics/quartic_generic.py +++ b/src/sage/schemes/plane_quartics/quartic_generic.py @@ -8,7 +8,8 @@ sage: PP. = ProjectiveSpace(2, QQ) sage: f = X^4 + Y^4 + Z^4 - 3*X*Y*Z*(X+Y+Z) sage: C = QuarticCurve(f); C - Quartic Curve over Rational Field defined by X^4 + Y^4 - 3*X^2*Y*Z - 3*X*Y^2*Z - 3*X*Y*Z^2 + Z^4 + Quartic Curve over Rational Field + defined by X^4 + Y^4 - 3*X^2*Y*Z - 3*X*Y^2*Z - 3*X*Y*Z^2 + Z^4 """ #***************************************************************************** @@ -27,8 +28,8 @@ def is_QuarticCurve(C): EXAMPLES:: sage: from sage.schemes.plane_quartics.quartic_generic import is_QuarticCurve - sage: x,y,z=PolynomialRing(QQ,['x','y','z']).gens() - sage: Q = QuarticCurve(x**4+y**4+z**4) + sage: x,y,z = PolynomialRing(QQ, ['x','y','z']).gens() + sage: Q = QuarticCurve(x**4 + y**4 + z**4) sage: is_QuarticCurve(Q) True @@ -44,8 +45,8 @@ def _repr_type(self): EXAMPLES:: - sage: x,y,z=PolynomialRing(QQ,['x','y','z']).gens() - sage: Q = QuarticCurve(x**4+y**4+z**4) + sage: x,y,z = PolynomialRing(QQ, ['x','y','z']).gens() + sage: Q = QuarticCurve(x**4 + y**4 + z**4) sage: Q._repr_type() 'Quartic' """ @@ -57,8 +58,8 @@ def genus(self): EXAMPLES:: - sage: x,y,z=PolynomialRing(QQ,['x','y','z']).gens() - sage: Q = QuarticCurve(x**4+y**4+z**4) + sage: x,y,z = PolynomialRing(QQ, ['x','y','z']).gens() + sage: Q = QuarticCurve(x**4 + y**4 + z**4) sage: Q.genus() 3 """ From 47bca766d12beae05241d7b452dfdafbfe95299c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 22 Mar 2023 19:31:58 -0700 Subject: [PATCH 084/135] sage.schemes: More # optional and cosmetic doctest changes (fixup) --- src/sage/schemes/elliptic_curves/ell_curve_isogeny.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index 98c6f7ec224..3464c9c2a51 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -2595,8 +2595,8 @@ def __compute_omega_general(self, E, psi, psi_pr, phi, phi_pr): sage: a = F.gen() # optional - sage.rings.finite_rings sage: E = EllipticCurve([1,0,0,0,(a**6+a**4+a**2+a)]) # optional - sage.rings.finite_rings sage: x = polygen(F) # optional - sage.rings.finite_rings - sage: ker = x^6 + (a^6 + a^5 + a^4 + a^3 + a^2 + a)*x^5 + (a^6 + a^5 + a^2 + 1)*x^4 - ....: + (a^6 + a^5 + a^4 + a^3 + a^2 + 1)*x^3 + (a^6 + a^3 + a)*x^2 + (a^4 + a^3 + 1)*x + a^5 + a^4 + a # optional - sage.rings.finite_rings + sage: ker = (x^6 + (a^6 + a^5 + a^4 + a^3 + a^2 + a)*x^5 + (a^6 + a^5 + a^2 + 1)*x^4 # optional - sage.rings.finite_rings + ....: + (a^6 + a^5 + a^4 + a^3 + a^2 + 1)*x^3 + (a^6 + a^3 + a)*x^2 + (a^4 + a^3 + 1)*x + a^5 + a^4 + a) sage: E.isogeny(ker) # optional - sage.rings.finite_rings Isogeny of degree 13 from Elliptic Curve defined by y^2 + x*y = x^3 + (a^6+a^4+a^2+a) over Finite Field in a of size 2^7 From d97da6fbc3cab878a2388e1bba47d8ad4f878680 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 23 Mar 2023 01:44:46 -0700 Subject: [PATCH 085/135] sage.schemes: More cosmetic doctest changes --- src/sage/schemes/affine/affine_morphism.py | 7 +- src/sage/schemes/affine/affine_space.py | 18 +-- src/sage/schemes/generic/algebraic_scheme.py | 84 ++++++------- src/sage/schemes/generic/hypersurface.py | 18 ++- src/sage/schemes/generic/morphism.py | 111 ++++++++---------- .../schemes/product_projective/morphism.py | 10 +- .../schemes/product_projective/subscheme.py | 12 +- .../schemes/projective/projective_morphism.py | 54 +++------ .../projective/projective_subscheme.py | 8 +- src/sage/schemes/toric/divisor.py | 36 +++--- src/sage/schemes/toric/fano_variety.py | 82 +++++-------- src/sage/schemes/toric/homset.py | 9 +- src/sage/schemes/toric/morphism.py | 35 ++---- src/sage/schemes/toric/toric_subscheme.py | 24 ++-- src/sage/schemes/toric/variety.py | 65 ++++------ .../schemes/toric/weierstrass_covering.py | 4 +- 16 files changed, 234 insertions(+), 343 deletions(-) diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py index 00ebc5f910e..0ffa144fca9 100644 --- a/src/sage/schemes/affine/affine_morphism.py +++ b/src/sage/schemes/affine/affine_morphism.py @@ -1376,8 +1376,7 @@ def representatives(self): From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: 0 To: Affine Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x, y) to - (x, x/y)] + Defn: Defined on coordinates by sending (x, y) to (x, x/y)] :: @@ -1390,8 +1389,8 @@ def representatives(self): From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x^2 - y^2 - y To: Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x, y) to - (x/y), Scheme morphism: + Defn: Defined on coordinates by sending (x, y) to (x/y), + Scheme morphism: From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x^2 - y^2 - y To: Affine Space of dimension 1 over Rational Field diff --git a/src/sage/schemes/affine/affine_space.py b/src/sage/schemes/affine/affine_space.py index 2b348f58554..dc58eba4e96 100644 --- a/src/sage/schemes/affine/affine_space.py +++ b/src/sage/schemes/affine/affine_space.py @@ -716,8 +716,7 @@ def projective_embedding(self, i=None, PP=None): Scheme morphism: From: Affine Space of dimension 2 over Rational Field To: Projective Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x0, x1) to - (1 : x0 : x1) + Defn: Defined on coordinates by sending (x0, x1) to (1 : x0 : x1) sage: z = AA(3, 4) sage: pi(z) (1/4 : 3/4 : 1) @@ -727,8 +726,7 @@ def projective_embedding(self, i=None, PP=None): Scheme morphism: From: Affine Space of dimension 2 over Rational Field To: Projective Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x0, x1) to - (x0 : 1 : x1) + Defn: Defined on coordinates by sending (x0, x1) to (x0 : 1 : x1) sage: pi(z) (3/4 : 1/4 : 1) sage: pi = AA.projective_embedding(2) @@ -886,16 +884,14 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): sage: A. = AffineSpace(QQ, 1) sage: A.chebyshev_polynomial(5, 'first') Dynamical System of Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x) to - (16*x^5 - 20*x^3 + 5*x) + Defn: Defined on coordinates by sending (x) to (16*x^5 - 20*x^3 + 5*x) :: sage: A. = AffineSpace(QQ, 1) sage: A.chebyshev_polynomial(3, 'second') Dynamical System of Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x) to - (8*x^3 - 4*x) + Defn: Defined on coordinates by sending (x) to (8*x^3 - 4*x) :: @@ -926,8 +922,7 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): sage: A. = AffineSpace(QQ, 1) sage: A.chebyshev_polynomial(7, monic=True) Dynamical System of Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x) to - (x^7 - 7*x^5 + 14*x^3 - 7*x) + Defn: Defined on coordinates by sending (x) to (x^7 - 7*x^5 + 14*x^3 - 7*x) :: @@ -936,8 +931,7 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): sage: A.chebyshev_polynomial(4, monic=True) Dynamical System of Affine Space of dimension 1 over Rational function field in t over Rational Field - Defn: Defined on coordinates by sending (x) to - (x^4 + (-4)*x^2 + 2) + Defn: Defined on coordinates by sending (x) to (x^4 + (-4)*x^2 + 2) """ if self.dimension_relative() != 1: raise TypeError("affine space must be of dimension 1") diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index 05b04d0f08d..cb7433c77c5 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -77,25 +77,17 @@ sage: patch = twisted_cubic.affine_patch(0) sage: patch - Closed subscheme of Affine Space of dimension 3 - over Rational Field defined by: + Closed subscheme of Affine Space of dimension 3 over Rational Field defined by: -x1^2 + x2, -x1*x2 + x3, -x2^2 + x1*x3 sage: patch.embedding_morphism() Scheme morphism: - From: Closed subscheme of Affine Space of dimension 3 - over Rational Field defined by: - -x1^2 + x2, - -x1*x2 + x3, - -x2^2 + x1*x3 - To: Closed subscheme of Projective Space of dimension 3 - over Rational Field defined by: - x1^2 - x0*x2, - x1*x2 - x0*x3, - x2^2 - x1*x3 - Defn: Defined on coordinates by sending (x1, x2, x3) to - (1 : x1 : x2 : x3) + From: Closed subscheme of Affine Space of dimension 3 over Rational Field + defined by: -x1^2 + x2, -x1*x2 + x3, -x2^2 + x1*x3 + To: Closed subscheme of Projective Space of dimension 3 over Rational Field + defined by: x1^2 - x0*x2, x1*x2 - x0*x3, x2^2 - x1*x3 + Defn: Defined on coordinates by sending (x1, x2, x3) to (1 : x1 : x2 : x3) AUTHORS: @@ -193,7 +185,7 @@ def is_AlgebraicScheme(x): sage: A,x = AffineSpace(10, QQ).objgens() sage: X = A.subscheme([sum(x)]); X Closed subscheme of Affine Space of dimension 10 over Rational Field defined by: - x0 + x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x0 + x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 sage: is_AlgebraicScheme(X) True @@ -312,7 +304,8 @@ def coordinate_ring(self): sage: P. = ProjectiveSpace(2, ZZ) sage: S = P.subscheme([x - y, x - z]) sage: S.coordinate_ring() - Quotient of Multivariate Polynomial Ring in x, y, z over Integer Ring by the ideal (x - y, x - z) + Quotient of Multivariate Polynomial Ring in x, y, z over Integer Ring + by the ideal (x - y, x - z) """ try: return self._coordinate_ring @@ -393,21 +386,18 @@ def embedding_morphism(self): sage: C = A2.subscheme(x^2 + y^2 - 1) sage: C.embedding_morphism() Scheme morphism: - From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - x^2 + y^2 - 1 + From: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: x^2 + y^2 - 1 To: Affine Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x, y) to - (x, y) + Defn: Defined on coordinates by sending (x, y) to (x, y) sage: P1xP1. = toric_varieties.P1xP1() sage: P1 = P1xP1.subscheme(x - y) sage: P1.embedding_morphism() Scheme morphism: - From: Closed subscheme of 2-d CPR-Fano toric variety covered - by 4 affine patches defined by: - x - y - To: 2-d CPR-Fano toric variety covered by 4 affine patches - Defn: Defined on coordinates by sending [x : y : u : v] to - [y : y : u : v] + From: Closed subscheme of 2-d CPR-Fano toric variety covered + by 4 affine patches defined by: x - y + To: 2-d CPR-Fano toric variety covered by 4 affine patches + Defn: Defined on coordinates by sending [x : y : u : v] to [y : y : u : v] So far, the embedding was just in the own ambient space. Now a bit more interesting examples:: @@ -434,12 +424,11 @@ def embedding_morphism(self): sage: nbhd.embedding_morphism() Scheme morphism: - From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - -y^2*z - 2*y*z - To: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - x^2*z - y^2*z - Defn: Defined on coordinates by sending (y, z) to - (1 : y + 1 : z) + From: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: -y^2*z - 2*y*z + To: Closed subscheme of Projective Space of dimension 2 over Rational Field + defined by: x^2*z - y^2*z + Defn: Defined on coordinates by sending (y, z) to (1 : y + 1 : z) A couple more examples:: @@ -447,7 +436,7 @@ def embedding_morphism(self): sage: patch1 2-d affine toric variety sage: patch1.embedding_morphism() - Scheme morphism: + Scheme morphism: From: 2-d affine toric variety To: 2-d CPR-Fano toric variety covered by 4 affine patches Defn: Defined on coordinates by sending [y : u] to @@ -458,13 +447,10 @@ def embedding_morphism(self): -y + 1 sage: subpatch.embedding_morphism() Scheme morphism: - From: Closed subscheme of 2-d affine toric variety defined by: - -y + 1 + From: Closed subscheme of 2-d affine toric variety defined by: -y + 1 To: Closed subscheme of 2-d CPR-Fano toric variety covered - by 4 affine patches defined by: - x - y - Defn: Defined on coordinates by sending [y : u] to - [1 : y : u : 1] + by 4 affine patches defined by: x - y + Defn: Defined on coordinates by sending [y : u] to [1 : y : u : 1] """ if '_embedding_morphism' in self.__dict__: hom = self._embedding_morphism @@ -505,11 +491,11 @@ def embedding_center(self): (1/4 : -1/4 : 3/4 : 1) sage: nbhd.embedding_morphism() Scheme morphism: - From: Closed subscheme of Affine Space of dimension 3 over Rational Field defined by: - w^2*y^2 - x^2*y^2 + 6*w^2*y - 6*x^2*y + 2*w*y^2 + - 2*x*y^2 - 7*w^2 + 7*x^2 + 12*w*y + 12*x*y - 14*w - 14*x - To: Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: - w^2*y^2 - x^2*y^2 - w^2*z^2 + x^2*z^2 + From: Closed subscheme of Affine Space of dimension 3 over Rational Field + defined by: w^2*y^2 - x^2*y^2 + 6*w^2*y - 6*x^2*y + 2*w*y^2 + 2*x*y^2 + - 7*w^2 + 7*x^2 + 12*w*y + 12*x*y - 14*w - 14*x + To: Closed subscheme of Projective Space of dimension 3 over Rational Field + defined by: w^2*y^2 - x^2*y^2 - w^2*z^2 + x^2*z^2 Defn: Defined on coordinates by sending (w, x, y) to (w + 1 : x - 1 : y + 3 : 4) """ @@ -1014,8 +1000,8 @@ def base_extend(self, R): sage: P. = ProjectiveSpace(2, GF(11)) # optional - sage.rings.finite_rings sage: S = P.subscheme([x^2 - y*z]) # optional - sage.rings.finite_rings sage: S.base_extend(GF(11^2, 'b')) # optional - sage.rings.finite_rings - Closed subscheme of Projective Space of dimension 2 over Finite Field in b of size 11^2 defined by: - x^2 - y*z + Closed subscheme of Projective Space of dimension 2 over Finite Field in b + of size 11^2 defined by: x^2 - y*z sage: S.base_extend(ZZ) # optional - sage.rings.finite_rings Traceback (most recent call last): ... @@ -1859,10 +1845,10 @@ def change_ring(self, R): sage: P. = ProjectiveSpace(QQ, 1) sage: X = P.subscheme([3*x^2 - y^2]) - sage: H = Hom(X,X) + sage: H = Hom(X, X) sage: X.change_ring(GF(3)) - Closed subscheme of Projective Space of dimension 1 over Finite Field of size 3 defined by: - -y^2 + Closed subscheme of Projective Space of dimension 1 over Finite Field of size 3 + defined by: -y^2 :: diff --git a/src/sage/schemes/generic/hypersurface.py b/src/sage/schemes/generic/hypersurface.py index 94349a1b92c..4804a63ad03 100644 --- a/src/sage/schemes/generic/hypersurface.py +++ b/src/sage/schemes/generic/hypersurface.py @@ -57,13 +57,15 @@ class ProjectiveHypersurface(AlgebraicScheme_subscheme_projective): sage: P. = ProjectiveSpace(ZZ, 2) sage: ProjectiveHypersurface(x - y, P) - Projective hypersurface defined by x - y in Projective Space of dimension 2 over Integer Ring + Projective hypersurface defined by x - y + in Projective Space of dimension 2 over Integer Ring :: sage: R. = QQ[] sage: ProjectiveHypersurface(x - y) - Projective hypersurface defined by x - y in Projective Space of dimension 2 over Rational Field + Projective hypersurface defined by x - y + in Projective Space of dimension 2 over Rational Field """ def __init__(self, poly, ambient=None): @@ -113,7 +115,8 @@ def _repr_(self): sage: R. = ZZ[] sage: H = ProjectiveHypersurface(x*z + y^2) sage: H - Projective hypersurface defined by y^2 + x*z in Projective Space of dimension 2 over Integer Ring + Projective hypersurface defined by y^2 + x*z + in Projective Space of dimension 2 over Integer Ring sage: H._repr_() 'Projective hypersurface defined by y^2 + x*z in Projective Space of dimension 2 over Integer Ring' """ @@ -163,13 +166,15 @@ def __init__(self, poly, ambient=None): sage: A. = AffineSpace(ZZ, 3) sage: AffineHypersurface(x*y - z^3, A) - Affine hypersurface defined by -z^3 + x*y in Affine Space of dimension 3 over Integer Ring + Affine hypersurface defined by -z^3 + x*y + in Affine Space of dimension 3 over Integer Ring :: sage: A. = QQ[] sage: AffineHypersurface(x*y - z^3) - Affine hypersurface defined by -z^3 + x*y in Affine Space of dimension 3 over Rational Field + Affine hypersurface defined by -z^3 + x*y + in Affine Space of dimension 3 over Rational Field TESTS:: @@ -196,7 +201,8 @@ def _repr_(self): sage: R. = ZZ[] sage: H = AffineHypersurface(x*z + y^2) sage: H - Affine hypersurface defined by y^2 + x*z in Affine Space of dimension 3 over Integer Ring + Affine hypersurface defined by y^2 + x*z + in Affine Space of dimension 3 over Integer Ring sage: H._repr_() 'Affine hypersurface defined by y^2 + x*z in Affine Space of dimension 3 over Integer Ring' """ diff --git a/src/sage/schemes/generic/morphism.py b/src/sage/schemes/generic/morphism.py index bff4d5442d4..2c2ec94afd4 100644 --- a/src/sage/schemes/generic/morphism.py +++ b/src/sage/schemes/generic/morphism.py @@ -369,7 +369,7 @@ def __mul__(self, right): sage: Y = Spec(QQ) sage: g = Y.structure_morphism() sage: g * f # indirect doctest - Composite map: + Composite map: From: Affine Space of dimension 2 over Rational Field To: Spectrum of Integer Ring Defn: Generic morphism: @@ -554,7 +554,8 @@ def _composition(self, right): TypeError: self (=Scheme morphism: From: Affine Space of dimension 2 over Rational Field To: Spectrum of Rational Field - Defn: Structure map) domain must equal right (=Scheme morphism: + Defn: Structure map) domain + must equal right (=Scheme morphism: From: Spectrum of Rational Field To: Spectrum of Integer Ring Defn: Structure map) codomain @@ -587,7 +588,7 @@ def _composition_(self, right, homset): sage: Y = Spec(QQ) sage: g = Y.structure_morphism() sage: g * f # indirect doctest - Composite map: + Composite map: From: Affine Space of dimension 2 over Rational Field To: Spectrum of Integer Ring Defn: Generic morphism: @@ -640,13 +641,13 @@ def glue_along_domains(self, other): X: Spectrum of Univariate Polynomial Ring in x over Rational Field Y: Spectrum of Univariate Polynomial Ring in y over Rational Field U: Spectrum of Quotient of Multivariate Polynomial Ring in x, y - over Rational Field by the ideal (x*y - 1) + over Rational Field by the ideal (x*y - 1) sage: a, b = P1.gluing_maps() sage: a Affine Scheme morphism: - From: Spectrum of Quotient of Multivariate Polynomial Ring in x, y - over Rational Field by the ideal (x*y - 1) + From: Spectrum of Quotient of Multivariate Polynomial Ring in x, y + over Rational Field by the ideal (x*y - 1) To: Spectrum of Univariate Polynomial Ring in x over Rational Field Defn: Ring morphism: From: Univariate Polynomial Ring in x over Rational Field @@ -1090,12 +1091,11 @@ def _call_(self, x): sage: f = Hom_XY([y,0]) # (0,y) |-> (y,0) sage: f Scheme morphism: - From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - x - To: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - y - Defn: Defined on coordinates by sending (x, y) to - (y, 0) + From: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: x + To: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: y + Defn: Defined on coordinates by sending (x, y) to (y, 0) sage: f([0,3]) (3, 0) @@ -1168,12 +1168,11 @@ def _call_with_args(self, x, args, kwds): sage: f = Hom_XY([y,0]) # (0,y) |-> (y,0) sage: f Scheme morphism: - From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - x - To: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - y - Defn: Defined on coordinates by sending (x, y) to - (y, 0) + From: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: x + To: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: y + Defn: Defined on coordinates by sending (x, y) to (y, 0) sage: f([0,3]) (3, 0) @@ -1358,8 +1357,7 @@ def change_ring(self, R, check=True): sage: f.change_ring(phi) # optional - sage.rings.number_field Dynamical System of Projective Space of dimension 1 over Number Field in w with defining polynomial t^4 - 2 - Defn: Defined on coordinates by sending (x : y) to - (x^2 + 3*y^2 : y^2) + Defn: Defined on coordinates by sending (x : y) to (x^2 + 3*y^2 : y^2) :: @@ -1383,8 +1381,7 @@ def change_ring(self, R, check=True): sage: f = H([3*x^2, y^2]) sage: f.change_ring(GF(3)) # optional - sage.rings.finite_rings Scheme endomorphism of Projective Space of dimension 1 over Finite Field of size 3 - Defn: Defined on coordinates by sending (x : y) to - (0 : y^2) + Defn: Defined on coordinates by sending (x : y) to (0 : y^2) :: @@ -1393,7 +1390,7 @@ def change_ring(self, R, check=True): sage: f = H([5/2*x^3 + 3*x*y^2 - y^3, 3*z^3 + y*x^2, x^3 - z^3]) sage: f.change_ring(GF(3)) # optional - sage.rings.finite_rings Scheme endomorphism of Projective Space of dimension 2 over Finite Field of size 3 - Defn: Defined on coordinates by sending (x : y : z) to + Defn: Defined on coordinates by sending (x : y : z) to (x^3 - y^3 : x^2*y : x^3 - z^3) :: @@ -1403,11 +1400,9 @@ def change_ring(self, R, check=True): sage: H = Hom(X, X) sage: f = H([x, y]) sage: f.change_ring(GF(3)) # optional - sage.rings.finite_rings - Scheme endomorphism of Closed subscheme of Projective Space of dimension - 1 over Finite Field of size 3 defined by: - -x^2 - y^2 - Defn: Defined on coordinates by sending (x : y) to - (x : y) + Scheme endomorphism of Closed subscheme of Projective Space of dimension 1 + over Finite Field of size 3 defined by: -x^2 - y^2 + Defn: Defined on coordinates by sending (x : y) to (x : y) Check that :trac:`16834` is fixed:: @@ -1417,8 +1412,8 @@ def change_ring(self, R, check=True): sage: f = h([x^2 + 1.5, y^3, z^5 - 2.0]) sage: f.change_ring(CC) Scheme endomorphism of Affine Space of dimension 3 over Complex Field with 53 bits of precision - Defn: Defined on coordinates by sending (x, y, z) to - (x^2 + 1.50000000000000, y^3, z^5 - 2.00000000000000) + Defn: Defined on coordinates by sending (x, y, z) to + (x^2 + 1.50000000000000, y^3, z^5 - 2.00000000000000) :: @@ -1430,8 +1425,7 @@ def change_ring(self, R, check=True): Scheme morphism: From: Affine Space of dimension 2 over Rational Field To: Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x, y) to - (x^2 : y^2) + Defn: Defined on coordinates by sending (x, y) to (x^2 : y^2) :: @@ -1441,7 +1435,7 @@ def change_ring(self, R, check=True): sage: f.change_ring(RR) Scheme endomorphism of Affine Space of dimension 2 over Real Field with 53 bits of precision - Defn: Defined on coordinates by sending (x, y) to + Defn: Defined on coordinates by sending (x, y) to (3.00000000000000*x^2/y, y^2/x) :: @@ -1453,16 +1447,16 @@ def change_ring(self, R, check=True): sage: f = H([x^2 + a*x*y + a^2*y^2, y^2]) # optional - sage.rings.number_field sage: emb = K.embeddings(QQbar) # optional - sage.rings.number_field sage: f.change_ring(emb[0]) # optional - sage.rings.number_field - Scheme endomorphism of Projective Space of dimension 1 over Algebraic - Field + Scheme endomorphism of Projective Space of dimension 1 + over Algebraic Field Defn: Defined on coordinates by sending (x : y) to (x^2 + (-1.324717957244746?)*x*y + 1.754877666246693?*y^2 : y^2) sage: f.change_ring(emb[1]) # optional - sage.rings.number_field - Scheme endomorphism of Projective Space of dimension 1 over Algebraic - Field + Scheme endomorphism of Projective Space of dimension 1 + over Algebraic Field Defn: Defined on coordinates by sending (x : y) to - (x^2 + (0.6623589786223730? - 0.5622795120623013?*I)*x*y + - (0.1225611668766537? - 0.744861766619745?*I)*y^2 : y^2) + (x^2 + (0.6623589786223730? - 0.5622795120623013?*I)*x*y + + (0.1225611668766537? - 0.744861766619745?*I)*y^2 : y^2) :: @@ -1471,8 +1465,8 @@ def change_ring(self, R, check=True): sage: H = End(P) # optional - sage.rings.number_field sage.symbolic sage: f = H([x^2 + v*y^2, y^2]) # optional - sage.rings.number_field sage.symbolic sage: f.change_ring(QQbar) # optional - sage.rings.number_field sage.symbolic - Scheme endomorphism of Projective Space of dimension 1 over Algebraic - Field + Scheme endomorphism of Projective Space of dimension 1 + over Algebraic Field Defn: Defined on coordinates by sending (x : y) to (x^2 + 1.414213562373095?*y^2 : y^2) @@ -1486,11 +1480,10 @@ def change_ring(self, R, check=True): sage: H = End(X) # optional - sage.rings.number_field sage.symbolic sage: f = H([6*x^2 + 2*x*y + 16*y^2, -w*x^2 - 4*x*y - 4*y^2]) # optional - sage.rings.number_field sage.symbolic sage: f.change_ring(QQbar) # optional - sage.rings.number_field sage.symbolic - Scheme endomorphism of Closed subscheme of Projective Space of dimension - 1 over Algebraic Field defined by: - x - y + Scheme endomorphism of Closed subscheme of Projective Space of dimension 1 + over Algebraic Field defined by: x - y Defn: Defined on coordinates by sending (x : y) to - (6*x^2 + 2*x*y + 16*y^2 : 1.414213562373095?*x^2 + (-4)*x*y + (-4)*y^2) + (6*x^2 + 2*x*y + 16*y^2 : 1.414213562373095?*x^2 + (-4)*x*y + (-4)*y^2) :: @@ -1514,8 +1507,7 @@ def change_ring(self, R, check=True): sage: emb = K.embeddings(QQbar)[0] # optional - sage.rings.number_field sage: phi.change_ring(emb) # optional - sage.rings.number_field Scheme endomorphism of Affine Space of dimension 2 over Algebraic Field - Defn: Defined on coordinates by sending (x, y) to - (x/y, y) + Defn: Defined on coordinates by sending (x, y) to (x/y, y) """ T = self.domain().change_ring(R) if self.is_endomorphism(): @@ -1585,8 +1577,7 @@ def specialization(self, D=None, phi=None, homset=None): sage: f = H([x^2 + c*y^2, y^2]) sage: f.specialization({c: 1}) Scheme endomorphism of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x^2 + y^2 : y^2) + Defn: Defined on coordinates by sending (x : y) to (x^2 + y^2 : y^2) :: @@ -1598,8 +1589,8 @@ def specialization(self, D=None, phi=None, homset=None): sage: phi = SpecializationMorphism(P.coordinate_ring(), {a: 2, b: -1}) sage: F = f.specialization(phi=phi); F Scheme endomorphism of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x^3 + 2*x*y^2 - y^3 : y^3) + Defn: Defined on coordinates by sending (x : y) to + (x^3 + 2*x*y^2 - y^3 : y^3) sage: g = H([x^2 + a*y^2, y^2]) sage: G = g.specialization(phi=phi) sage: G.parent() is F.parent() @@ -1617,10 +1608,8 @@ def specialization(self, D=None, phi=None, homset=None): sage: f = H([x^2, c*y^2]) sage: f.specialization({c: 2}) Scheme endomorphism of Closed subscheme of Projective Space of dimension 1 - over Rational Field defined by: - x - 2*y - Defn: Defined on coordinates by sending (x : y) to - (x^2 : 2*y^2) + over Rational Field defined by: x - 2*y + Defn: Defined on coordinates by sending (x : y) to (x^2 : 2*y^2) :: @@ -1686,8 +1675,7 @@ def _composition_(self, other, homset): sage: g = H([y, x + y]) sage: h = f*g sage: h - Scheme endomorphism of Projective Space of dimension 1 over Rational - Field + Scheme endomorphism of Projective Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x : y) to (-29/16*x^2 - 29/8*x*y - 13/16*y^2 : x^2 + 2*x*y + y^2) sage: p = P((1,3)) @@ -1723,7 +1711,8 @@ def _composition_(self, other, homset): ... TypeError: self (=Scheme endomorphism of Affine Space of dimension 2 over Rational Field Defn: Defined on coordinates by sending (x, y) to - (x^2 + y^2, y^2/x)) domain must equal right (=Scheme morphism: + (x^2 + y^2, y^2/x)) domain + must equal right (=Scheme morphism: From: Affine Space of dimension 2 over Rational Field To: Affine Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x, y) to @@ -1745,9 +1734,11 @@ def _composition_(self, other, homset): with defining polynomial x^2 - 2 To: Affine Space of dimension 2 over Number Field in a with defining polynomial x^2 - 2 - Defn: Generic endomorphism of Affine Space of dimension 2 over Number Field in a with defining polynomial x^2 - 2 + Defn: Generic endomorphism of Affine Space of dimension 2 + over Number Field in a with defining polynomial x^2 - 2 then - Generic endomorphism of Affine Space of dimension 2 over Number Field in a with defining polynomial x^2 - 2 + Generic endomorphism of Affine Space of dimension 2 + over Number Field in a with defining polynomial x^2 - 2 """ try: opolys = tuple(other._polys) diff --git a/src/sage/schemes/product_projective/morphism.py b/src/sage/schemes/product_projective/morphism.py index 82fa13405c1..4f7aac00259 100644 --- a/src/sage/schemes/product_projective/morphism.py +++ b/src/sage/schemes/product_projective/morphism.py @@ -9,8 +9,7 @@ sage: H = End(P1xP1) sage: H([x^2*u, y^2*v, x*v^2, y*u^2]) Scheme endomorphism of Product of projective spaces P^1 x P^1 over Rational Field - Defn: Defined by sending (x : y , u : v) to - (x^2*u : y^2*v , x*v^2 : y*u^2). + Defn: Defined by sending (x : y , u : v) to (x^2*u : y^2*v , x*v^2 : y*u^2). """ # **************************************************************************** # Copyright (C) 2014 Ben Hutz @@ -41,8 +40,7 @@ class ProductProjectiveSpaces_morphism_ring(SchemeMorphism_polynomial): sage: H = T.Hom(T) sage: H([x^2, y^2, z^2, w^2, u^2]) Scheme endomorphism of Product of projective spaces P^2 x P^1 over Rational Field - Defn: Defined by sending (x : y : z , w : u) to - (x^2 : y^2 : z^2 , w^2 : u^2). + Defn: Defined by sending (x : y : z , w : u) to (x^2 : y^2 : z^2 , w^2 : u^2). """ def __init__(self, parent, polys, check=True): @@ -402,11 +400,11 @@ def is_morphism(self): def as_dynamical_system(self): """ - Return this endomorphism as a :class:`DynamicalSystem_producte_projective`. + Return this endomorphism as a :class:`~sage.dynamics.arithmetic_dynamics.product_projective_ds.DynamicalSystem_product_projective`. OUTPUT: - - :class:`DynamicalSystem_produce_projective` + - :class:`~sage.dynamics.arithmetic_dynamics.product_projective_ds.DynamicalSystem_product_projective` EXAMPLES:: diff --git a/src/sage/schemes/product_projective/subscheme.py b/src/sage/schemes/product_projective/subscheme.py index dee45b41ae3..6faa499cee2 100644 --- a/src/sage/schemes/product_projective/subscheme.py +++ b/src/sage/schemes/product_projective/subscheme.py @@ -81,8 +81,8 @@ def segre_embedding(self, PP=None): sage: X. = ProductProjectiveSpaces([2, 2], QQ) sage: P = ProjectiveSpace(QQ, 8, 't') sage: L = (-w - v)*x + (-w*y - u*z) - sage: Q = (-u*w - v^2)*x^2 + ((-w^2 - u*w + (-u*v - u^2))*y + (-w^2 - u*v)*z)*x + \ - ((-w^2 - u*w - u^2)*y^2 + (-u*w - v^2)*z*y + (-w^2 + (-v - u)*w)*z^2) + sage: Q = ((-u*w - v^2)*x^2 + ((-w^2 - u*w + (-u*v - u^2))*y + (-w^2 - u*v)*z)*x + ....: + ((-w^2 - u*w - u^2)*y^2 + (-u*w - v^2)*z*y + (-w^2 + (-v - u)*w)*z^2)) sage: W = X.subscheme([L,Q]) sage: phi = W.segre_embedding(P) sage: phi.codomain().ambient_space() == P @@ -213,8 +213,8 @@ def dimension(self): sage: X. = ProductProjectiveSpaces([2, 2], QQ) sage: L = (-w - v)*x + (-w*y - u*z) - sage: Q = (-u*w - v^2)*x^2 + ((-w^2 - u*w + (-u*v - u^2))*y + (-w^2 - u*v)*z)*x + \ - ((-w^2 - u*w - u^2)*y^2 + (-u*w - v^2)*z*y + (-w^2 + (-v - u)*w)*z^2) + sage: Q = ((-u*w - v^2)*x^2 + ((-w^2 - u*w + (-u*v - u^2))*y + (-w^2 - u*v)*z)*x + ....: + ((-w^2 - u*w - u^2)*y^2 + (-u*w - v^2)*z*y + (-w^2 + (-v - u)*w)*z^2)) sage: W = X.subscheme([L, Q]) sage: W.dimension() 2 @@ -272,8 +272,8 @@ def is_smooth(self, point=None): sage: X. = ProductProjectiveSpaces([2, 2],QQ) sage: L = (-w - v)*x + (-w*y - u*z) - sage: Q = (-u*w - v^2)*x^2 + ((-w^2 - u*w + (-u*v - u^2))*y + (-w^2 - u*v)*z)*x + \ - ((-w^2 - u*w - u^2)*y^2 + (-u*w - v^2)*z*y + (-w^2 + (-v - u)*w)*z^2) + sage: Q = ((-u*w - v^2)*x^2 + ((-w^2 - u*w + (-u*v - u^2))*y + (-w^2 - u*v)*z)*x + ....: + ((-w^2 - u*w - u^2)*y^2 + (-u*w - v^2)*z*y + (-w^2 + (-v - u)*w)*z^2)) sage: W = X.subscheme([L, Q]) sage: W.is_smooth() Traceback (most recent call last): diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 0a9abd631ff..49933f8a413 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -15,14 +15,12 @@ sage: A2. = AffineSpace(QQ, 2) sage: P2.hom([x0, x1, x1 + x2], P2) Scheme endomorphism of Projective Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x0 : x1 : x2) to - (x0 : x1 : x1 + x2) + Defn: Defined on coordinates by sending (x0 : x1 : x2) to (x0 : x1 : x1 + x2) sage: P2.hom([x1/x0, (x1 + x2)/x0], A2) Scheme morphism: From: Projective Space of dimension 2 over Rational Field To: Affine Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x0 : x1 : x2) to - (x1/x0, (x1 + x2)/x0) + Defn: Defined on coordinates by sending (x0 : x1 : x2) to (x1/x0, (x1 + x2)/x0) AUTHORS: @@ -755,10 +753,8 @@ def scale_by(self, t): sage: f = H([x^3 - 2*x*y^2, x^2*y]) sage: f.scale_by(1/x) sage: f - Scheme endomorphism of Projective Space of dimension 1 over Rational - Field - Defn: Defined on coordinates by sending (x : y) to - (x^2 - 2*y^2 : x*y) + Scheme endomorphism of Projective Space of dimension 1 over Rational Field + Defn: Defined on coordinates by sending (x : y) to (x^2 - 2*y^2 : x*y) :: @@ -769,8 +765,7 @@ def scale_by(self, t): sage: f.scale_by(5/3*t); f Scheme endomorphism of Projective Space of dimension 1 over Univariate Polynomial Ring in t over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (t*x^2 : 10*t*y^2) + Defn: Defined on coordinates by sending (x : y) to (t*x^2 : 10*t*y^2) :: @@ -779,9 +774,8 @@ def scale_by(self, t): sage: H = Hom(X, X) # optional - sage.rings.finite_rings sage: f = H([x^2, y^2, z^2]) # optional - sage.rings.finite_rings sage: f.scale_by(x - y); f # optional - sage.rings.finite_rings - Scheme endomorphism of Closed subscheme of Projective Space of dimension - 2 over Finite Field of size 7 defined by: - x^2 - y^2 + Scheme endomorphism of Closed subscheme of Projective Space of dimension 2 + over Finite Field of size 7 defined by: x^2 - y^2 Defn: Defined on coordinates by sending (x : y : z) to (x*y^2 - y^3 : x*y^2 - y^3 : x*z^2 - y*z^2) """ @@ -836,8 +830,7 @@ def normalize_coordinates(self, **kwds): sage: f = H([5/4*x^3, 5*x*y^2]) sage: f.normalize_coordinates(); f Scheme endomorphism of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x^2 : 4*y^2) + Defn: Defined on coordinates by sending (x : y) to (x^2 : 4*y^2) :: @@ -848,8 +841,7 @@ def normalize_coordinates(self, **kwds): sage: f.normalize_coordinates(); f # optional - sage.rings.finite_rings Scheme endomorphism of Closed subscheme of Projective Space of dimension 2 over Finite Field of size 7 defined by: x^2 - y^2 - Defn: Defined on coordinates by sending (x : y : z) to - (2*y^2 : y^2 : z^2) + Defn: Defined on coordinates by sending (x : y : z) to (2*y^2 : y^2 : z^2) :: @@ -860,8 +852,7 @@ def normalize_coordinates(self, **kwds): sage: f.normalize_coordinates(); f Scheme endomorphism of Projective Space of dimension 2 over Multivariate Polynomial Ring in a, b over Rational Field - Defn: Defined on coordinates by sending (x : y : z) to - (x^2 : b*y^2 : z^2) + Defn: Defined on coordinates by sending (x : y : z) to (x^2 : b*y^2 : z^2) :: @@ -871,8 +862,7 @@ def normalize_coordinates(self, **kwds): sage: f.normalize_coordinates(); f # optional - sage.rings.number_field Dynamical System of Projective Space of dimension 1 over Number Field in w with defining polynomial x^2 - 5 with w = 2.236067977499790? - Defn: Defined on coordinates by sending (x : y) to - (5*x^2 + y^2 : 5*y^2) + Defn: Defined on coordinates by sending (x : y) to (5*x^2 + y^2 : 5*y^2) :: @@ -1096,8 +1086,7 @@ def dehomogenize(self, n): sage: f = H([x^2 + y^2, y^2]) sage: f.dehomogenize(0) Scheme endomorphism of Affine Space of dimension 1 over Integer Ring - Defn: Defined on coordinates by sending (y) to - (y^2/(y^2 + 1)) + Defn: Defined on coordinates by sending (y) to (y^2/(y^2 + 1)) :: @@ -1108,8 +1097,7 @@ def dehomogenize(self, n): Scheme morphism: From: Affine Space of dimension 1 over Rational Field To: Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (y) to - ((-y^2 + 1)/y^2) + Defn: Defined on coordinates by sending (y) to ((-y^2 + 1)/y^2) :: @@ -2037,22 +2025,19 @@ def reduce_base_field(self): sage: f.reduce_base_field() # optional - sage.rings.finite_rings Scheme endomorphism of Projective Space of dimension 1 over Finite Field in t2 of size 3^2 - Defn: Defined on coordinates by sending (x : y) to - (x^2 + t2*y^2 : y^2) + Defn: Defined on coordinates by sending (x : y) to (x^2 + t2*y^2 : y^2) sage: f2 = H2([x^2 + 5*y^2, y^2, 2*x*y]) # optional - sage.rings.finite_rings sage: f2.reduce_base_field() # optional - sage.rings.finite_rings Scheme morphism: From: Projective Space of dimension 1 over Finite Field of size 3 To: Projective Space of dimension 2 over Finite Field of size 3 - Defn: Defined on coordinates by sending (x : y) to - (x^2 - y^2 : y^2 : -x*y) + Defn: Defined on coordinates by sending (x : y) to (x^2 - y^2 : y^2 : -x*y) sage: f3 = H3([a^2 + t*b^2, c^2]) # optional - sage.rings.finite_rings sage: f3.reduce_base_field() # optional - sage.rings.finite_rings Scheme morphism: From: Projective Space of dimension 2 over Finite Field in t of size 3^4 To: Projective Space of dimension 1 over Finite Field in t of size 3^4 - Defn: Defined on coordinates by sending (a : b : c) to - (a^2 + t*b^2 : c^2) + Defn: Defined on coordinates by sending (a : b : c) to (a^2 + t*b^2 : c^2) :: @@ -2062,8 +2047,7 @@ def reduce_base_field(self): sage: f = H([x^2 + 2*y^2, y^2]) # optional - sage.rings.number_field sage: f.reduce_base_field() # optional - sage.rings.number_field Scheme endomorphism of Projective Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x^2 + 2*y^2 : y^2) + Defn: Defined on coordinates by sending (x : y) to (x^2 + 2*y^2 : y^2) :: @@ -2351,7 +2335,7 @@ def representatives(self): over Rational Field defined by: x^2 - y^2 - y*z To: Projective Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x : y : z) to (y + z : x), - Scheme morphism: + Scheme morphism: From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x^2 - y^2 - y*z To: Projective Space of dimension 1 over Rational Field @@ -2363,7 +2347,7 @@ def representatives(self): over Rational Field defined by: x^2 - y^2 - y*z To: Projective Space of dimension 1 over Rational Field Defn: Defined on coordinates by sending (x : y : z) to (y + z : x), - Scheme morphism: + Scheme morphism: From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x^2 - y^2 - y*z To: Projective Space of dimension 1 over Rational Field diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index 8e665291246..c37d2b1b8d8 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -236,8 +236,7 @@ def affine_patch(self, i, AA=None): defined by: Y^3*Z + Z^3 + Y To: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: X^3*Y + Y^3*Z + X*Z^3 - Defn: Defined on coordinates by sending (Y, Z) to - (1 : Y : Z) + Defn: Defined on coordinates by sending (Y, Z) to (1 : Y : Z) sage: U.projective_embedding() is U.embedding_morphism() True @@ -370,8 +369,7 @@ def neighborhood(self, point): defined by: x + 3*z To: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: x + 2*y + 3*z - Defn: Defined on coordinates by sending (x, z) to - (x : -3/2 : z + 1) + Defn: Defined on coordinates by sending (x, z) to (x : -3/2 : z + 1) sage: patch.embedding_center() (0, 0) sage: patch.embedding_morphism()([0,0]) @@ -960,7 +958,7 @@ def dual(self): sage: X.dual() # optional - sage.rings.finite_rings Closed subscheme of Projective Space of dimension 2 over Finite Field of size 61 defined by: - y0^2 - 30*y1^2 - 20*y2^2 + y0^2 - 30*y1^2 - 20*y2^2 TESTS:: diff --git a/src/sage/schemes/toric/divisor.py b/src/sage/schemes/toric/divisor.py index 823c64968af..99dde801895 100644 --- a/src/sage/schemes/toric/divisor.py +++ b/src/sage/schemes/toric/divisor.py @@ -45,7 +45,7 @@ types:: sage: F = Fan(cones=[(0,1,2,3), (0,1,4)], - ....: rays=[(1,1,1), (1,-1,1), (1,-1,-1), (1,1,-1), (0,0,1)]) + ....: rays=[(1,1,1), (1,-1,1), (1,-1,-1), (1,1,-1), (0,0,1)]) sage: X = ToricVariety(F) sage: QQ_Cartier = X.divisor([2,2,1,1,1]) sage: Cartier = 2 * QQ_Cartier @@ -959,8 +959,7 @@ def is_ample(self): [(1, 1), (1, 2), (2, 1), (2, 2)] sage: [ (a,b) for a,b in product(range(-3,3), repeat=2) ....: if D(a,b).is_nef() ] - [(0, 0), (0, 1), (0, 2), (1, 0), - (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)] + [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)] A (worse than orbifold) singular Fano threefold:: @@ -1037,8 +1036,7 @@ def is_nef(self): [(1, 1), (1, 2), (2, 1), (2, 2)] sage: [ (a,b) for a,b in product(range(-3,3), repeat=2) ....: if D(a,b).is_nef() ] - [(0, 0), (0, 1), (0, 2), (1, 0), - (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)] + [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)] """ try: return self._is_nef @@ -1278,10 +1276,8 @@ def Kodaira_map(self, names='z'): Scheme morphism: From: 1-d CPR-Fano toric variety covered by 2 affine patches To: Closed subscheme of Projective Space of dimension 2 - over Rational Field defined by: - -z1^2 + z0*z2 - Defn: Defined on coordinates by sending [u : v] to - (v^2 : u*v : u^2) + over Rational Field defined by: -z1^2 + z0*z2 + Defn: Defined on coordinates by sending [u : v] to (v^2 : u*v : u^2) sage: dP6 = toric_varieties.dP6() sage: D = -dP6.K() @@ -1290,17 +1286,17 @@ def Kodaira_map(self, names='z'): From: 2-d CPR-Fano toric variety covered by 6 affine patches To: Closed subscheme of Projective Space of dimension 6 over Rational Field defined by: - -x1*x5 + x0*x6, - -x2*x3 + x0*x5, - -x1*x3 + x0*x4, - x4*x5 - x3*x6, - -x1*x2 + x0*x3, - x3*x5 - x2*x6, - x3*x4 - x1*x6, - x3^2 - x1*x5, - x2*x4 - x1*x5, - -x1*x5^2 + x2*x3*x6, - -x1*x5^3 + x2^2*x6^2 + -x1*x5 + x0*x6, + -x2*x3 + x0*x5, + -x1*x3 + x0*x4, + x4*x5 - x3*x6, + -x1*x2 + x0*x3, + x3*x5 - x2*x6, + x3*x4 - x1*x6, + x3^2 - x1*x5, + x2*x4 - x1*x5, + -x1*x5^2 + x2*x3*x6, + -x1*x5^3 + x2^2*x6^2 Defn: Defined on coordinates by sending [x : u : y : v : z : w] to (x*u^2*y^2*v : x^2*u^2*y*w : u*y^2*v^2*z : x*u*y*v*z*w : x^2*u*z*w^2 : y*v^2*z^2*w : x*v*z^2*w^2) diff --git a/src/sage/schemes/toric/fano_variety.py b/src/sage/schemes/toric/fano_variety.py index 1b319b75476..05a074d55c4 100644 --- a/src/sage/schemes/toric/fano_variety.py +++ b/src/sage/schemes/toric/fano_variety.py @@ -57,10 +57,8 @@ ....: monomial_points="all") Closed subscheme of 2-d CPR-Fano toric variety covered by 3 affine patches defined by: - a0*z0^3 + a9*z0^2*z1 + a7*z0*z1^2 - + a1*z1^3 + a8*z0^2*z2 + a6*z0*z1*z2 - + a4*z1^2*z2 + a5*z0*z2^2 - + a3*z1*z2^2 + a2*z2^3 + a0*z0^3 + a9*z0^2*z1 + a7*z0*z1^2 + a1*z1^3 + a8*z0^2*z2 + a6*z0*z1*z2 + + a4*z1^2*z2 + a5*z0*z2^2 + a3*z1*z2^2 + a2*z2^3 In many cases it is sufficient to work with the "simplified polynomial moduli space" of anticanonical hypersurfaces:: @@ -80,10 +78,8 @@ ....: monomial_points="simplified") Closed subscheme of 2-d CPR-Fano toric variety covered by 9 affine patches defined by: - a2*z2^3*z3^2*z4*z5^2*z8 - + a1*z1^3*z3*z4^2*z7^2*z9 - + a3*z0*z1*z2*z3*z4*z5*z7*z8*z9 - + a0*z0^3*z5*z7*z8^2*z9^2 + a2*z2^3*z3^2*z4*z5^2*z8 + a1*z1^3*z3*z4^2*z7^2*z9 + + a3*z0*z1*z2*z3*z4*z5*z7*z8*z9 + a0*z0^3*z5*z7*z8^2*z9^2 Here we have taken the resolved version of the ambient space for the mirror family, but in fact we don't have to resolve singularities @@ -110,8 +106,7 @@ sage: FTV.anticanonical_hypersurface() Closed subscheme of 3-d CPR-Fano toric variety covered by 4 affine patches defined by: - a0*z2^12 + a4*z2^6*z3^6 + a3*z3^12 - + a8*z0*z1*z2*z3 + a2*z1^3 + a1*z0^2 + a0*z2^12 + a4*z2^6*z3^6 + a3*z3^12 + a8*z0*z1*z2*z3 + a2*z1^3 + a1*z0^2 Below you will find detailed descriptions of available functions. Current functionality of this module is very basic, but it is under active @@ -181,8 +176,7 @@ def is_CPRFanoToricVariety(x): EXAMPLES:: - sage: from sage.schemes.toric.fano_variety import ( - ....: is_CPRFanoToricVariety) + sage: from sage.schemes.toric.fano_variety import is_CPRFanoToricVariety sage: is_CPRFanoToricVariety(1) False sage: FTV = toric_varieties.P2() @@ -461,8 +455,7 @@ def CPRFanoToricVariety(Delta=None, Traceback (most recent call last): ... ValueError: you have provided 5 cones, but only 4 of them are maximal! - Use discard_faces=True if you indeed need to construct a fan from - these cones. + Use discard_faces=True if you indeed need to construct a fan from these cones. These charts are technically correct, they just happened to list one of them twice, but it is assumed that such a situation will not happen. It is @@ -504,24 +497,21 @@ def CPRFanoToricVariety(Delta=None, ....: coordinate_points=[1,2,3,4]) Traceback (most recent call last): ... - ValueError: all 4 vertices of Delta_polar - must be used for coordinates! + ValueError: all 4 vertices of Delta_polar must be used for coordinates! Got: [1, 2, 3, 4] sage: FTV = CPRFanoToricVariety(Delta_polar=square, ....: coordinate_points=[0,0,1,2,3,4]) Traceback (most recent call last): ... - ValueError: no repetitions are - allowed for coordinate points! + ValueError: no repetitions are allowed for coordinate points! Got: [0, 0, 1, 2, 3, 4] sage: FTV = CPRFanoToricVariety(Delta_polar=square, ....: coordinate_points=[0,1,2,3,6]) Traceback (most recent call last): ... - ValueError: the origin (point #6) - cannot be used for a coordinate! + ValueError: the origin (point #6) cannot be used for a coordinate! Got: [0, 1, 2, 3, 6] Here is a shorthand for defining the toric variety and homogeneous @@ -804,20 +794,16 @@ def anticanonical_hypersurface(self, **kwds): Its anticanonical "hypersurface" is a one-dimensional Calabi-Yau manifold:: - sage: P2.anticanonical_hypersurface( - ....: monomial_points="all") + sage: P2.anticanonical_hypersurface(monomial_points="all") Closed subscheme of 2-d CPR-Fano toric variety covered by 3 affine patches defined by: - a0*z0^3 + a9*z0^2*z1 + a7*z0*z1^2 - + a1*z1^3 + a8*z0^2*z2 + a6*z0*z1*z2 - + a4*z1^2*z2 + a5*z0*z2^2 - + a3*z1*z2^2 + a2*z2^3 + a0*z0^3 + a9*z0^2*z1 + a7*z0*z1^2 + a1*z1^3 + a8*z0^2*z2 + a6*z0*z1*z2 + + a4*z1^2*z2 + a5*z0*z2^2 + a3*z1*z2^2 + a2*z2^3 In many cases it is sufficient to work with the "simplified polynomial moduli space" of anticanonical hypersurfaces:: - sage: P2.anticanonical_hypersurface( - ....: monomial_points="simplified") + sage: P2.anticanonical_hypersurface(monomial_points="simplified") Closed subscheme of 2-d CPR-Fano toric variety covered by 3 affine patches defined by: a0*z0^3 + a1*z1^3 + a6*z0*z1*z2 + a2*z2^3 @@ -827,15 +813,12 @@ def anticanonical_hypersurface(self, **kwds): ``Delta_polar``:: sage: FTV = CPRFanoToricVariety(Delta=simplex, - ....: coordinate_points="all") - sage: FTV.anticanonical_hypersurface( - ....: monomial_points="simplified") + ....: coordinate_points="all") + sage: FTV.anticanonical_hypersurface(monomial_points="simplified") Closed subscheme of 2-d CPR-Fano toric variety covered by 9 affine patches defined by: - a2*z2^3*z3^2*z4*z5^2*z8 - + a1*z1^3*z3*z4^2*z7^2*z9 - + a3*z0*z1*z2*z3*z4*z5*z7*z8*z9 - + a0*z0^3*z5*z7*z8^2*z9^2 + a2*z2^3*z3^2*z4*z5^2*z8 + a1*z1^3*z3*z4^2*z7^2*z9 + + a3*z0*z1*z2*z3*z4*z5*z7*z8*z9 + a0*z0^3*z5*z7*z8^2*z9^2 Here we have taken the resolved version of the ambient space for the mirror family, but in fact we don't have to resolve singularities @@ -843,9 +826,8 @@ def anticanonical_hypersurface(self, **kwds): points which do not lie on a generic anticanonical hypersurface:: sage: FTV = CPRFanoToricVariety(Delta=simplex, - ....: coordinate_points="all but facets") - sage: FTV.anticanonical_hypersurface( - ....: monomial_points="simplified") + ....: coordinate_points="all but facets") + sage: FTV.anticanonical_hypersurface(monomial_points="simplified") Closed subscheme of 2-d CPR-Fano toric variety covered by 3 affine patches defined by: a0*z0^3 + a1*z1^3 + a3*z0*z1*z2 + a2*z2^3 @@ -858,16 +840,14 @@ def anticanonical_hypersurface(self, **kwds): automatically generated coefficients. If you want, you can specify your own names :: - sage: FTV.anticanonical_hypersurface( - ....: coefficient_names="a b c d") + sage: FTV.anticanonical_hypersurface(coefficient_names="a b c d") Closed subscheme of 2-d CPR-Fano toric variety covered by 3 affine patches defined by: a*z0^3 + b*z1^3 + d*z0*z1*z2 + c*z2^3 or give concrete coefficients :: - sage: FTV.anticanonical_hypersurface( - ....: coefficients=[1, 2, 3, 4]) + sage: FTV.anticanonical_hypersurface(coefficients=[1, 2, 3, 4]) Closed subscheme of 2-d CPR-Fano toric variety covered by 3 affine patches defined by: z0^3 + 2*z1^3 + 4*z0*z1*z2 + 3*z2^3 @@ -883,8 +863,7 @@ def anticanonical_hypersurface(self, **kwds): sage: R = H.ambient_space().base_ring() sage: R Fraction Field of - Multivariate Polynomial Ring in phi, psi, t - over Rational Field + Multivariate Polynomial Ring in phi, psi, t over Rational Field """ # The example above is also copied to the tutorial section in the # main documentation of the module. @@ -925,8 +904,7 @@ def change_ring(self, F): Traceback (most recent call last): ... ValueError: no natural map from the base ring - (=Real Field with 53 bits of precision) - to R (=Rational Field)! + (=Real Field with 53 bits of precision) to R (=Rational Field)! sage: R = PolynomialRing(QQ, 2, 'a') sage: P1xP1.change_ring(R) Traceback (most recent call last): @@ -985,14 +963,14 @@ def coordinate_points(self): sage: diamond = lattice_polytope.cross_polytope(2) sage: square = diamond.polar() sage: FTV = CPRFanoToricVariety(Delta_polar=square, - ....: coordinate_points=[0,1,2,3,8]) + ....: coordinate_points=[0,1,2,3,8]) sage: FTV.coordinate_points() (0, 1, 2, 3, 8) sage: FTV.gens() (z0, z1, z2, z3, z8) sage: FTV = CPRFanoToricVariety(Delta_polar=square, - ....: coordinate_points="all") + ....: coordinate_points="all") sage: FTV.coordinate_points() (0, 1, 2, 3, 4, 5, 7, 8) sage: FTV.gens() @@ -1387,7 +1365,7 @@ def __init__(self, P_Delta, monomial_points=None, coefficient_names=None, Closed subscheme of 2-d CPR-Fano toric variety covered by 4 affine patches defined by: s^2*x^2 + s*t*x^2 + t^2*x^2 + s^2*x*y + s*t*x*y - + t^2*x*y + s^2*y^2 + s*t*y^2 + t^2*y^2 + + t^2*x*y + s^2*y^2 + s*t*y^2 + t^2*y^2 """ if not is_CPRFanoToricVariety(P_Delta): raise TypeError("anticanonical hypersurfaces can only be " @@ -1667,11 +1645,9 @@ def add_variables(field, variables): sage: F = add_variables(QQ, []); F # No extension Rational Field sage: F = add_variables(QQ, ["a"]); F - Fraction Field of Univariate Polynomial Ring - in a over Rational Field + Fraction Field of Univariate Polynomial Ring in a over Rational Field sage: F = add_variables(F, ["a"]); F - Fraction Field of Univariate Polynomial Ring - in a over Rational Field + Fraction Field of Univariate Polynomial Ring in a over Rational Field sage: F = add_variables(F, ["b", "c"]); F Fraction Field of Multivariate Polynomial Ring in a, b, c over Rational Field diff --git a/src/sage/schemes/toric/homset.py b/src/sage/schemes/toric/homset.py index 6ecc4990d15..d61de988170 100644 --- a/src/sage/schemes/toric/homset.py +++ b/src/sage/schemes/toric/homset.py @@ -48,8 +48,7 @@ Scheme morphism: From: 2-d CPR-Fano toric variety covered by 4 affine patches To: 1-d CPR-Fano toric variety covered by 2 affine patches - Defn: Defined on coordinates by sending [s : t : x : y] to - [s : t] + Defn: Defined on coordinates by sending [s : t : x : y] to [s : t] In the case of toric algebraic schemes (defined by polynomials in toric varieties), this module defines the underlying morphism of the @@ -76,8 +75,7 @@ Scheme morphism: From: 2-d CPR-Fano toric variety covered by 3 affine patches To: Projective Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending [x : y : z] to - (x^2 : y^2 : z^2) + Defn: Defined on coordinates by sending [x : y : z] to (x^2 : y^2 : z^2) sage: native_to_toric = P2_native.Hom(P2_toric); native_to_toric Set of morphisms @@ -89,8 +87,7 @@ Scheme morphism: From: Projective Space of dimension 2 over Rational Field To: 2-d CPR-Fano toric variety covered by 3 affine patches - Defn: Defined on coordinates by sending (u : v : w) to - [u^2 : v^2 : w^2] + Defn: Defined on coordinates by sending (u : v : w) to [u^2 : v^2 : w^2] """ # **************************************************************************** diff --git a/src/sage/schemes/toric/morphism.py b/src/sage/schemes/toric/morphism.py index 5bfd8f55821..3f11cf8cd21 100644 --- a/src/sage/schemes/toric/morphism.py +++ b/src/sage/schemes/toric/morphism.py @@ -52,8 +52,7 @@ Scheme morphism: From: 1-d CPR-Fano toric variety covered by 2 affine patches To: 2-d CPR-Fano toric variety covered by 3 affine patches - Defn: Defined on coordinates by sending [u : v] to - [0 : u^2 + v^2 : u*v] + Defn: Defined on coordinates by sending [u : v] to [0 : u^2 + v^2 : u*v] This is a well-defined morphism of algebraic varieties because homogeneously rescaled coordinates of a point of `\mathbb{P}^1` map to the same @@ -78,8 +77,7 @@ Scheme morphism: From: 1-d CPR-Fano toric variety covered by 2 affine patches To: 2-d CPR-Fano toric variety covered by 3 affine patches - Defn: Defined on coordinates by sending [u : v] to - [0 : u : v] + Defn: Defined on coordinates by sending [u : v] to [0 : u : v] This map is actually the embedding of the :meth:`~sage.schemes.toric.variety.ToricVariety_field.orbit_closure` @@ -114,8 +112,7 @@ Scheme morphism: From: 1-d CPR-Fano toric variety covered by 2 affine patches To: 2-d CPR-Fano toric variety covered by 3 affine patches - Defn: Defined on coordinates by sending [u : v] to - [u : v : v] + Defn: Defined on coordinates by sending [u : v] to [u : v : v] Finally, here is an example of a fan morphism that cannot be written using homogeneous polynomials. Consider the blowup `O_{\mathbb{P}^1}(2) @@ -174,8 +171,7 @@ Scheme morphism: From: 0-d affine toric variety To: 2-d affine toric variety - Defn: Defined on coordinates by sending [] to - [1 : 1] + Defn: Defined on coordinates by sending [] to [1 : 1] The fibers are labeled by torus orbits in the base, that is, cones of the codomain fan. In this case, the fibers over lower-dimensional @@ -226,8 +222,7 @@ Scheme morphism: From: 1-d affine toric variety To: 2-d affine toric variety - Defn: Defined on coordinates by sending [z0] to - [z0 : 0] + Defn: Defined on coordinates by sending [z0] to [z0 : 0] So we see that the fiber over this point is an affine line. Together with another affine line in the other coordinate patch, this covers @@ -711,8 +706,7 @@ def as_polynomial_map(self): Scheme morphism: From: 1-d toric variety covered by 2 affine patches To: 2-d CPR-Fano toric variety covered by 3 affine patches - Defn: Defined on coordinates by sending [z0 : z1] to - [0 : z1 : z0] + Defn: Defined on coordinates by sending [z0 : z1] to [0 : z1 : z0] If the toric variety is singular, then some orbit closure embeddings cannot be written with homogeneous polynomials:: @@ -840,7 +834,7 @@ class SchemeMorphism_fan_toric_variety(SchemeMorphism, Morphism): From: 2-d CPR-Fano toric variety covered by 4 affine patches To: 1-d CPR-Fano toric variety covered by 2 affine patches Defn: Defined by sending Rational polyhedral fan in 2-d lattice N - to Rational polyhedral fan in 1-d lattice N. + to Rational polyhedral fan in 1-d lattice N. sage: P1xP1.hom(fm, P1) Scheme morphism: @@ -1035,8 +1029,7 @@ def factor(self): Scheme morphism: From: 2-d affine toric variety To: 2-d affine toric variety - Defn: Defined on coordinates by sending [x : y] to - [x^2 : y] + Defn: Defined on coordinates by sending [x : y] to [x^2 : y] Blowup chart (birational):: @@ -1044,8 +1037,7 @@ def factor(self): Scheme morphism: From: 2-d affine toric variety To: 2-d toric variety covered by 3 affine patches - Defn: Defined on coordinates by sending [z0 : z1] to - [1 : z1 : z0*z1] + Defn: Defined on coordinates by sending [z0 : z1] to [1 : z1 : z0*z1] Coordinate plane inclusion (injective):: @@ -1102,8 +1094,7 @@ def as_polynomial_map(self): sage: square = A1.hom(matrix([[2]]), A1) sage: square.as_polynomial_map() Scheme endomorphism of 1-d affine toric variety - Defn: Defined on coordinates by sending [z] to - [z^2] + Defn: Defined on coordinates by sending [z] to [z^2] sage: P1 = toric_varieties.P1() sage: patch = A1.hom(matrix([[1]]), P1) @@ -1111,8 +1102,7 @@ def as_polynomial_map(self): Scheme morphism: From: 1-d affine toric variety To: 1-d CPR-Fano toric variety covered by 2 affine patches - Defn: Defined on coordinates by sending [z] to - [z : 1] + Defn: Defined on coordinates by sending [z] to [z : 1] """ R = self.domain().coordinate_ring() phi = self.fan_morphism() @@ -1420,8 +1410,7 @@ def fiber_generic(self): Scheme morphism: From: 1-d toric variety covered by 2 affine patches To: 2-d CPR-Fano toric variety covered by 4 affine patches - Defn: Defined on coordinates by sending [z0 : z1] to - [1 : 1 : z0 : z1] + Defn: Defined on coordinates by sending [z0 : z1] to [1 : 1 : z0 : z1] sage: A1 = toric_varieties.A1() sage: fan = Fan([(0,1,2)], [(1,1,0), (1,0,1), (1,-1,-1)]) diff --git a/src/sage/schemes/toric/toric_subscheme.py b/src/sage/schemes/toric/toric_subscheme.py index 99d9f5c975c..8dcb292e692 100644 --- a/src/sage/schemes/toric/toric_subscheme.py +++ b/src/sage/schemes/toric/toric_subscheme.py @@ -214,8 +214,7 @@ def affine_patch(self, i): Scheme morphism: From: 2-d affine toric variety To: 2-d CPR-Fano toric variety covered by 4 affine patches - Defn: Defined on coordinates by sending [t : x] to - [1 : t : x : 1] + Defn: Defined on coordinates by sending [t : x] to [1 : t : x : 1] sage: P1xP1.inject_variables() Defining s, t, x, y sage: P1 = P1xP1.subscheme(x - y) @@ -442,12 +441,10 @@ def neighborhood(self, point): x + 2*y + 6 sage: patch.embedding_morphism() Scheme morphism: - From: Closed subscheme of 2-d affine toric variety defined by: - x + 2*y + 6 - To: Closed subscheme of 2-d CPR-Fano toric variety covered by 3 affine patches defined by: - x + 2*y + 3*z - Defn: Defined on coordinates by sending [x : y] to - [-2*y - 6 : y : 2] + From: Closed subscheme of 2-d affine toric variety defined by: x + 2*y + 6 + To: Closed subscheme of 2-d CPR-Fano toric variety + covered by 3 affine patches defined by: x + 2*y + 3*z + Defn: Defined on coordinates by sending [x : y] to [-2*y - 6 : y : 2] sage: patch.embedding_center() [0 : -3] sage: patch.embedding_morphism()(patch.embedding_center()) @@ -462,10 +459,9 @@ def neighborhood(self, point): 3*x0 sage: patch.embedding_morphism() Scheme morphism: - From: Closed subscheme of 2-d affine toric variety defined by: - 3*x0 - To: Closed subscheme of 2-d CPR-Fano toric variety covered by 6 affine patches defined by: - x0*x3 + From: Closed subscheme of 2-d affine toric variety defined by: 3*x0 + To: Closed subscheme of 2-d CPR-Fano toric variety + covered by 6 affine patches defined by: x0*x3 Defn: Defined on coordinates by sending [x0 : x1] to [0 : x1 : 2 : 3 : 4 : 5] sage: patch.embedding_center() @@ -643,8 +639,8 @@ def is_nondegenerate(self): sage: Y.is_nondegenerate() True - This example is from Hamm, :arxiv:`1106.1826v1`. It addresses - an issue raised at :trac:`15239`:: + This example is from Hamm, :arxiv:`1106.1826v1`. It addresses + an issue raised at :trac:`15239`:: sage: X = toric_varieties.WP([1,4,2,3], names='z0 z1 z2 z3') sage: X.inject_variables() diff --git a/src/sage/schemes/toric/variety.py b/src/sage/schemes/toric/variety.py index 1fc08dff5e5..84666ebe9ef 100644 --- a/src/sage/schemes/toric/variety.py +++ b/src/sage/schemes/toric/variety.py @@ -117,12 +117,10 @@ sage: P1xP1.inject_variables() Defining x, s, y, t sage: P1xP1.subscheme(x) - Closed subscheme of 2-d toric variety - covered by 4 affine patches defined by: + Closed subscheme of 2-d toric variety covered by 4 affine patches defined by: x sage: P1xP1.subscheme(x^2 + y^2) - Closed subscheme of 2-d toric variety - covered by 4 affine patches defined by: + Closed subscheme of 2-d toric variety covered by 4 affine patches defined by: x^2 + y^2 sage: P1xP1.subscheme(x^2 + s^2) Traceback (most recent call last): @@ -130,8 +128,7 @@ ValueError: x^2 + s^2 is not homogeneous on 2-d toric variety covered by 4 affine patches sage: P1xP1.subscheme([x^2*s^2 + x*y*t^2 + y^2*t^2, s^3 + t^3]) - Closed subscheme of 2-d toric variety - covered by 4 affine patches defined by: + Closed subscheme of 2-d toric variety covered by 4 affine patches defined by: x^2*s^2 + x*y*t^2 + y^2*t^2, s^3 + t^3 @@ -149,8 +146,7 @@ Scheme morphism: From: 2-d affine toric variety To: 2-d toric variety covered by 4 affine patches - Defn: Defined on coordinates by sending [x : s] to - [x : s : 1 : 1] + Defn: Defined on coordinates by sending [x : s] to [x : s : 1 : 1] The patch above was specifically chosen to coincide with our representation of the affine plane before, but you can get the other three patches as well. @@ -439,8 +435,7 @@ def ToricVariety(fan, sage: P1xP1(0,1,0,1) Traceback (most recent call last): ... - TypeError: coordinates (0, 1, 0, 1) - are in the exceptional set + TypeError: coordinates (0, 1, 0, 1) are in the exceptional set We cannot set to zero both coordinates of the same projective line! @@ -456,8 +451,7 @@ def ToricVariety(fan, sage: P1xP1.inject_variables() Defining x, s, y, t sage: P1xP1.subscheme(x*s - y*t) - Closed subscheme of 2-d toric variety - covered by 4 affine patches defined by: + Closed subscheme of 2-d toric variety covered by 4 affine patches defined by: x*s - y*t Here is a shorthand for defining the toric variety and homogeneous @@ -1010,15 +1004,13 @@ def affine_patch(self, i): Scheme morphism: From: 2-d affine toric variety To: 2-d toric variety covered by 4 affine patches - Defn: Defined on coordinates by sending [y : t] to - [1 : 1 : y : t] + Defn: Defined on coordinates by sending [y : t] to [1 : 1 : y : t] sage: patch1 = P1xP1.affine_patch(1) sage: patch1.embedding_morphism() Scheme morphism: From: 2-d affine toric variety To: 2-d toric variety covered by 4 affine patches - Defn: Defined on coordinates by sending [s : y] to - [1 : s : y : 1] + Defn: Defined on coordinates by sending [s : y] to [1 : s : y : 1] sage: patch1 is P1xP1.affine_patch(1) True """ @@ -1080,8 +1072,7 @@ def change_ring(self, F): Traceback (most recent call last): ... ValueError: no natural map from the base ring - (=Real Field with 53 bits of precision) - to R (=Rational Field)! + (=Real Field with 53 bits of precision) to R (=Rational Field)! sage: R = PolynomialRing(QQ, 2, 'a') sage: P1xA1.change_ring(R) Traceback (most recent call last): @@ -1113,8 +1104,7 @@ def coordinate_ring(self): sage: P1xP1 = toric_varieties.P1xP1() sage: P1xP1.coordinate_ring() - Multivariate Polynomial Ring in s, t, x, y - over Rational Field + Multivariate Polynomial Ring in s, t, x, y over Rational Field TESTS:: @@ -1149,8 +1139,7 @@ def embedding_morphism(self): sage: P1xP1.embedding_morphism() Traceback (most recent call last): ... - ValueError: no default embedding was - defined for this toric variety + ValueError: no default embedding was defined for this toric variety sage: patch = P1xP1.affine_patch(0) sage: patch 2-d affine toric variety @@ -1158,8 +1147,7 @@ def embedding_morphism(self): Scheme morphism: From: 2-d affine toric variety To: 2-d toric variety covered by 4 affine patches - Defn: Defined on coordinates by sending [y : t] to - [1 : 1 : y : t] + Defn: Defined on coordinates by sending [y : t] to [1 : 1 : y : t] """ try: return self._embedding_morphism @@ -1376,8 +1364,7 @@ def is_isomorphic(self, another): sage: TV1.is_isomorphic(TV2) Traceback (most recent call last): ... - NotImplementedError: - isomorphism check is not yet implemented + NotImplementedError: isomorphism check is not yet implemented """ if self is another: return True @@ -1558,8 +1545,7 @@ def Mori_cone(self): sage: P4_11169.Mori_cone().rays() (3, 2, 0, 0, 0, 1, -6), (0, 0, 1, 1, 1, -3, 0) - in Ambient free module of rank 7 - over the principal ideal domain Integer Ring + in Ambient free module of rank 7 over the principal ideal domain Integer Ring """ # Ideally, self.Kaehler_cone().dual() should be it, but # so far this is not the case. @@ -1883,8 +1869,7 @@ def subscheme(self, polynomials): sage: X.defining_polynomials() (x*s + y*t, x^3 + y^3) sage: X.defining_ideal() - Ideal (x*s + y*t, x^3 + y^3) - of Multivariate Polynomial Ring in x, y, s, t + Ideal (x*s + y*t, x^3 + y^3) of Multivariate Polynomial Ring in x, y, s, t over Rational Field sage: X.base_ring() Rational Field @@ -1893,9 +1878,7 @@ def subscheme(self, polynomials): sage: X.structure_morphism() Scheme morphism: From: Closed subscheme of 2-d CPR-Fano toric variety - covered by 4 affine patches defined by: - x*s + y*t, - x^3 + y^3 + covered by 4 affine patches defined by: x*s + y*t, x^3 + y^3 To: Spectrum of Rational Field Defn: Structure map """ @@ -1984,8 +1967,8 @@ def cohomology_ring(self): sage: X.cohomology_ring() Rational cohomology ring of a 2-d CPR-Fano toric variety covered by 6 affine patches sage: X.cohomology_ring().defining_ideal() - Ideal (-u - y + z + w, x - y - v + w, x*y, x*v, x*z, u*v, u*z, u*w, y*z, y*w, v*w) of - Multivariate Polynomial Ring in x, u, y, v, z, w over Rational Field + Ideal (-u - y + z + w, x - y - v + w, x*y, x*v, x*z, u*v, u*z, u*w, y*z, y*w, v*w) + of Multivariate Polynomial Ring in x, u, y, v, z, w over Rational Field sage: X.cohomology_ring().defining_ideal().ring() Multivariate Polynomial Ring in x, u, y, v, z, w over Rational Field sage: X.variable_names() @@ -2412,8 +2395,7 @@ def divisor(self, arg, base_ring=None, check=True, reduce=True): sage: dP6 = toric_varieties.dP6() sage: dP6.coordinate_ring() - Multivariate Polynomial Ring in x, u, y, v, z, w - over Rational Field + Multivariate Polynomial Ring in x, u, y, v, z, w over Rational Field sage: dP6.divisor(list(range(6))) V(u) + 2*V(y) + 3*V(v) + 4*V(z) + 5*V(w) sage: dP6.inject_variables() @@ -2481,8 +2463,7 @@ def divisor_group(self, base_ring=ZZ): sage: dP6 = toric_varieties.dP6() sage: Div = dP6.divisor_group(); Div - Group of ZZ-Divisors on 2-d CPR-Fano toric variety - covered by 6 affine patches + Group of ZZ-Divisors on 2-d CPR-Fano toric variety covered by 6 affine patches sage: Div(x) V(x) """ @@ -2773,8 +2754,7 @@ def orbit_closure(self, cone): Scheme morphism: From: 1-d toric variety covered by 2 affine patches To: 2-d CPR-Fano toric variety covered by 4 affine patches - Defn: Defined on coordinates by sending [z0 : z1] to - [0 : 1 : z1 : z0] + Defn: Defined on coordinates by sending [z0 : z1] to [0 : 1 : z1 : z0] TESTS:: @@ -2848,7 +2828,8 @@ def Demazure_roots(self): sage: Hs.Demazure_roots() (M(-1, 0), M(1, 0), M(0, 1), M(1, 1), M(2, 1), M(3, 1)) - sage: P11s = ToricVariety(Fan(rays=[(1,0), (0,-1), (-1,s)], cones=[(0,1), (1,2), (2,0)])) + sage: P11s = ToricVariety(Fan(rays=[(1,0), (0,-1), (-1,s)], + ....: cones=[(0,1), (1,2), (2,0)])) sage: P11s.Demazure_roots() (M(-1, 0), M(1, 0), M(0, 1), M(1, 1), M(2, 1), M(3, 1)) sage: P11s.Demazure_roots() == Hs.Demazure_roots() diff --git a/src/sage/schemes/toric/weierstrass_covering.py b/src/sage/schemes/toric/weierstrass_covering.py index 7a625fac211..9a01f1a2ed1 100644 --- a/src/sage/schemes/toric/weierstrass_covering.py +++ b/src/sage/schemes/toric/weierstrass_covering.py @@ -192,8 +192,8 @@ def WeierstrassMap(polynomial, variables=None): - 1/27*t^4*z^6 - 4/81*t^2*x^4*y^2 - 4/81*t^2*x^3*y^2*z - 4/81*t^2*x*y^2*z^3 - 4/81*t^2*y^2*z^4 - 2/81*x^2*y^4 - 4/81*x*y^4*z - 2/81*y^4*z^2, - 0, - 1/3*t^2*x^2*z + 1/3*t^2*x*z^2 - 1/9*x*y^2 - 1/9*y^2*z) + 0, + 1/3*t^2*x^2*z + 1/3*t^2*x*z^2 - 1/9*x*y^2 - 1/9*y^2*z) sage: WeierstrassForm(x*y^2 + y^2 + x^3 + 1, transformation=True) (-1/27*x^6 - 4/81*x^4*y^2 - 2/81*x^2*y^4 - 2/27*x^5 - 4/81*x^3*y^2 - 4/81*x*y^4 - 5/27*x^4 - 2/81*y^4 - 8/27*x^3 From 0eaf7b1b85ccd9d2623953f7df4a862eb67753d5 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 23 Mar 2023 16:13:01 -0700 Subject: [PATCH 086/135] sage.schemes: More cosmetic doctest changes --- src/sage/schemes/affine/affine_homset.py | 8 +- .../schemes/affine/affine_rational_point.py | 69 ++++----- src/sage/schemes/affine/affine_subscheme.py | 3 +- src/sage/schemes/berkovich/berkovich_space.py | 6 +- .../cyclic_covers/charpoly_frobenius.py | 18 +-- src/sage/schemes/cyclic_covers/constructor.py | 12 +- .../cyclic_covers/cycliccover_finite_field.py | 61 +++++--- .../cyclic_covers/cycliccover_generic.py | 9 +- src/sage/schemes/generic/algebraic_scheme.py | 49 ++++--- src/sage/schemes/generic/hypersurface.py | 6 +- src/sage/schemes/generic/morphism.py | 13 +- src/sage/schemes/generic/point.py | 7 +- src/sage/schemes/generic/scheme.py | 3 +- src/sage/schemes/generic/spec.py | 3 +- src/sage/schemes/product_projective/homset.py | 40 +++--- src/sage/schemes/product_projective/space.py | 131 ++++++++---------- .../schemes/projective/projective_homset.py | 71 +++++----- .../schemes/projective/projective_morphism.py | 84 +++++------ .../schemes/projective/projective_point.py | 4 +- .../projective/projective_rational_point.py | 32 ++--- .../schemes/projective/projective_space.py | 26 ++-- 21 files changed, 339 insertions(+), 316 deletions(-) diff --git a/src/sage/schemes/affine/affine_homset.py b/src/sage/schemes/affine/affine_homset.py index 052c9f64fb3..0aeb032c40e 100644 --- a/src/sage/schemes/affine/affine_homset.py +++ b/src/sage/schemes/affine/affine_homset.py @@ -244,7 +244,9 @@ def points(self, **kwds): sage: A. = AffineSpace(CC, 2) sage: E = A.subscheme([y^3 - x^3 - x^2, x*y]) sage: E(A.base_ring()).points() - verbose 0 (...: affine_homset.py, points) Warning: computations in the numerical fields are inexact;points may be computed partially or incorrectly. + verbose 0 (...: affine_homset.py, points) + Warning: computations in the numerical fields are inexact;points + may be computed partially or incorrectly. [(-1.00000000000000, 0.000000000000000), (0.000000000000000, 0.000000000000000)] @@ -253,7 +255,9 @@ def points(self, **kwds): sage: A. = AffineSpace(CDF, 2) sage: E = A.subscheme([x1^2 + x2^2 + x1*x2, x1 + x2]) sage: E(A.base_ring()).points() - verbose 0 (...: affine_homset.py, points) Warning: computations in the numerical fields are inexact;points may be computed partially or incorrectly. + verbose 0 (...: affine_homset.py, points) + Warning: computations in the numerical fields are inexact;points + may be computed partially or incorrectly. [(0.0, 0.0)] """ from sage.schemes.affine.affine_space import is_AffineSpace diff --git a/src/sage/schemes/affine/affine_rational_point.py b/src/sage/schemes/affine/affine_rational_point.py index 023b80f3bf1..84ff522cc98 100644 --- a/src/sage/schemes/affine/affine_rational_point.py +++ b/src/sage/schemes/affine/affine_rational_point.py @@ -183,31 +183,32 @@ def enum_affine_number_field(X, **kwds): OUTPUT: - - a list containing the affine points of ``X`` of absolute height up to ``B``, - sorted. + - a list containing the affine points of ``X`` of absolute height up to ``B``, + sorted. EXAMPLES:: sage: from sage.schemes.affine.affine_rational_point import enum_affine_number_field sage: u = QQ['u'].0 - sage: K = NumberField(u^2 + 2, 'v') # optional - sage.rings.number_field - sage: A. = AffineSpace(K, 3) # optional - sage.rings.number_field - sage: X = A.subscheme([y^2 - x]) # optional - sage.rings.number_field - sage: enum_affine_number_field(X(K), bound=2**0.5) # optional - sage.rings.number_field - [(0, 0, -1), (0, 0, -v), (0, 0, -1/2*v), (0, 0, 0), (0, 0, 1/2*v), (0, 0, v), (0, 0, 1), - (1, -1, -1), (1, -1, -v), (1, -1, -1/2*v), (1, -1, 0), (1, -1, 1/2*v), (1, -1, v), (1, -1, 1), - (1, 1, -1), (1, 1, -v), (1, 1, -1/2*v), (1, 1, 0), (1, 1, 1/2*v), (1, 1, v), (1, 1, 1)] + sage: K = NumberField(u^2 + 2, 'v') # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 3) # optional - sage.rings.number_field + sage: X = A.subscheme([y^2 - x]) # optional - sage.rings.number_field + sage: enum_affine_number_field(X(K), bound=2**0.5) # optional - sage.rings.number_field + [(0, 0, -1), (0, 0, -v), (0, 0, -1/2*v), (0, 0, 0), (0, 0, 1/2*v), + (0, 0, v), (0, 0, 1), (1, -1, -1), (1, -1, -v), (1, -1, -1/2*v), + (1, -1, 0), (1, -1, 1/2*v), (1, -1, v), (1, -1, 1), (1, 1, -1), + (1, 1, -v), (1, 1, -1/2*v), (1, 1, 0), (1, 1, 1/2*v), (1, 1, v), (1, 1, 1)] :: + sage: from sage.schemes.affine.affine_rational_point import enum_affine_number_field sage: u = QQ['u'].0 - sage: K = NumberField(u^2 + 3, 'v') # optional - sage.rings.number_field - sage: A. = AffineSpace(K, 2) # optional - sage.rings.number_field - sage: X=A.subscheme(x - y) # optional - sage.rings.number_field - sage: from sage.schemes.affine.affine_rational_point import enum_affine_number_field # optional - sage.rings.number_field - sage: enum_affine_number_field(X, bound=3**0.25) # optional - sage.rings.number_field - [(-1, -1), (-1/2*v - 1/2, -1/2*v - 1/2), (1/2*v - 1/2, 1/2*v - 1/2), (0, 0), (-1/2*v + 1/2, -1/2*v + 1/2), - (1/2*v + 1/2, 1/2*v + 1/2), (1, 1)] + sage: K = NumberField(u^2 + 3, 'v') # optional - sage.rings.number_field + sage: A. = AffineSpace(K, 2) # optional - sage.rings.number_field + sage: X = A.subscheme(x - y) # optional - sage.rings.number_field + sage: enum_affine_number_field(X, bound=3**0.25) # optional - sage.rings.number_field + [(-1, -1), (-1/2*v - 1/2, -1/2*v - 1/2), (1/2*v - 1/2, 1/2*v - 1/2), + (0, 0), (-1/2*v + 1/2, -1/2*v + 1/2), (1/2*v + 1/2, 1/2*v + 1/2), (1, 1)] """ B = kwds.pop('bound') tol = kwds.pop('tolerance', 1e-2) @@ -248,31 +249,31 @@ def enum_affine_finite_field(X): EXAMPLES:: - sage: F = GF(7) # optional - sage.rings.finite_rings - sage: A. = AffineSpace(4, F) # optional - sage.rings.finite_rings - sage: C = A.subscheme([w^2 + x + 4, y*z*x - 6, z*y + w*x]) # optional - sage.rings.finite_rings sage: from sage.schemes.affine.affine_rational_point import enum_affine_finite_field - sage: enum_affine_finite_field(C(F)) # optional - sage.rings.finite_rings + sage: F = GF(7) # optional - sage.rings.finite_rings + sage: A. = AffineSpace(4, F) # optional - sage.rings.finite_rings + sage: C = A.subscheme([w^2 + x + 4, y*z*x - 6, z*y + w*x]) # optional - sage.rings.finite_rings + sage: enum_affine_finite_field(C(F)) # optional - sage.rings.finite_rings [] - sage: C = A.subscheme([w^2 + x + 4, y*z*x - 6]) # optional - sage.rings.finite_rings - sage: enum_affine_finite_field(C(F)) # optional - sage.rings.finite_rings + sage: C = A.subscheme([w^2 + x + 4, y*z*x - 6]) # optional - sage.rings.finite_rings + sage: enum_affine_finite_field(C(F)) # optional - sage.rings.finite_rings [(0, 3, 1, 2), (0, 3, 2, 1), (0, 3, 3, 3), (0, 3, 4, 4), (0, 3, 5, 6), - (0, 3, 6, 5), (1, 2, 1, 3), (1, 2, 2, 5), (1, 2, 3, 1), (1, 2, 4, 6), - (1, 2, 5, 2), (1, 2, 6, 4), (2, 6, 1, 1), (2, 6, 2, 4), (2, 6, 3, 5), - (2, 6, 4, 2), (2, 6, 5, 3), (2, 6, 6, 6), (3, 1, 1, 6), (3, 1, 2, 3), - (3, 1, 3, 2), (3, 1, 4, 5), (3, 1, 5, 4), (3, 1, 6, 1), (4, 1, 1, 6), - (4, 1, 2, 3), (4, 1, 3, 2), (4, 1, 4, 5), (4, 1, 5, 4), (4, 1, 6, 1), - (5, 6, 1, 1), (5, 6, 2, 4), (5, 6, 3, 5), (5, 6, 4, 2), (5, 6, 5, 3), - (5, 6, 6, 6), (6, 2, 1, 3), (6, 2, 2, 5), (6, 2, 3, 1), (6, 2, 4, 6), - (6, 2, 5, 2), (6, 2, 6, 4)] + (0, 3, 6, 5), (1, 2, 1, 3), (1, 2, 2, 5), (1, 2, 3, 1), (1, 2, 4, 6), + (1, 2, 5, 2), (1, 2, 6, 4), (2, 6, 1, 1), (2, 6, 2, 4), (2, 6, 3, 5), + (2, 6, 4, 2), (2, 6, 5, 3), (2, 6, 6, 6), (3, 1, 1, 6), (3, 1, 2, 3), + (3, 1, 3, 2), (3, 1, 4, 5), (3, 1, 5, 4), (3, 1, 6, 1), (4, 1, 1, 6), + (4, 1, 2, 3), (4, 1, 3, 2), (4, 1, 4, 5), (4, 1, 5, 4), (4, 1, 6, 1), + (5, 6, 1, 1), (5, 6, 2, 4), (5, 6, 3, 5), (5, 6, 4, 2), (5, 6, 5, 3), + (5, 6, 6, 6), (6, 2, 1, 3), (6, 2, 2, 5), (6, 2, 3, 1), (6, 2, 4, 6), + (6, 2, 5, 2), (6, 2, 6, 4)] :: - sage: A. = AffineSpace(3, GF(3)) # optional - sage.rings.finite_rings - sage: S = A.subscheme(x + y) # optional - sage.rings.finite_rings - sage: enum_affine_finite_field(S) # optional - sage.rings.finite_rings + sage: A. = AffineSpace(3, GF(3)) # optional - sage.rings.finite_rings + sage: S = A.subscheme(x + y) # optional - sage.rings.finite_rings + sage: enum_affine_finite_field(S) # optional - sage.rings.finite_rings [(0, 0, 0), (0, 0, 1), (0, 0, 2), (1, 2, 0), (1, 2, 1), (1, 2, 2), - (2, 1, 0), (2, 1, 1), (2, 1, 2)] + (2, 1, 0), (2, 1, 1), (2, 1, 2)] ALGORITHM: diff --git a/src/sage/schemes/affine/affine_subscheme.py b/src/sage/schemes/affine/affine_subscheme.py index 44962fccc83..476c6b4be20 100644 --- a/src/sage/schemes/affine/affine_subscheme.py +++ b/src/sage/schemes/affine/affine_subscheme.py @@ -369,7 +369,8 @@ def intersection_multiplicity(self, X, P): sage: Y = A.subscheme([x - z^3 + z + 1]) # optional - sage.rings.number_field sage: Q = A([0, # optional - sage.rings.number_field ....: -7*b^5 + 21*b^4 - 28*b^3 + 21*b^2 - 21*b + 14, - ....: -b^5 + 2*b^4 - 3*b^3 + 2*b^2 - 2*b, 0]) + ....: -b^5 + 2*b^4 - 3*b^3 + 2*b^2 - 2*b, + ....: 0]) sage: X.intersection_multiplicity(Y, Q) # optional - sage.rings.number_field 3 diff --git a/src/sage/schemes/berkovich/berkovich_space.py b/src/sage/schemes/berkovich/berkovich_space.py index 002cb5c6589..2b0c792c7e2 100644 --- a/src/sage/schemes/berkovich/berkovich_space.py +++ b/src/sage/schemes/berkovich/berkovich_space.py @@ -129,7 +129,7 @@ def is_padic_base(self): sage: B.is_padic_base() # optional - sage.rings.padics True - :: + :: sage: B = Berkovich_Cp_Affine(QQ, 3) sage: B.is_padic_base() @@ -365,8 +365,8 @@ class Berkovich_Cp_Affine(Berkovich_Cp): sage: A. = NumberField(x^3 + 20) # optional - sage.rings.number_field sage: ideal = A.prime_above(3) # optional - sage.rings.number_field sage: B = Berkovich_Cp_Affine(A, ideal); B # optional - sage.rings.number_field - Affine Berkovich line over Cp(3), with base Number - Field in a with defining polynomial x^3 + 20 + Affine Berkovich line over Cp(3), with base + Number Field in a with defining polynomial x^3 + 20 Number fields have a major advantage of exact computation. diff --git a/src/sage/schemes/cyclic_covers/charpoly_frobenius.py b/src/sage/schemes/cyclic_covers/charpoly_frobenius.py index fd5abe0899d..f2aabe5ad4e 100644 --- a/src/sage/schemes/cyclic_covers/charpoly_frobenius.py +++ b/src/sage/schemes/cyclic_covers/charpoly_frobenius.py @@ -55,19 +55,19 @@ def charpoly_frobenius(frob_matrix, charpoly_prec, p, weight, a=1, known_factor= [961, 0, 46, 0, 1] sage: M = Matrix([(4*43^2 + O(43^3), 17*43 + 11*43^2 + O(43^3), O(43^3), O(43^3), 17 + 37*43 + O(43^3), O(43^3)), - ....: (30*43 + 23*43^2 + O(43^3), 5*43 + O(43^3), O(43^3), O(43^3), 3 + 38*43 + O(43^3), O(43^3)), - ....: (O(43^3), O(43^3), 9*43 + 32*43^2 + O(43^3), 13 + 25*43 + O(43^3), O(43^3), 17 + 18*43 + O(43^3)), - ....: (O(43^3), O(43^3), 22*43 + 25*43^2 + O(43^3), 11 + 24*43 + O(43^3), O(43^3), 36 + 5*43 + O(43^3)), - ....: (42*43 + 15*43^2 + O(43^3), 22*43 + 8*43^2 + O(43^3), O(43^3), O(43^3), 29 + 4*43 + O(43^3), O(43^3)), - ....: (O(43^3), O(43^3), 6*43 + 19*43^2 + O(43^3), 8 + 24*43 + O(43^3), O(43^3), 31 + 42*43 + O(43^3))]) + ....: (30*43 + 23*43^2 + O(43^3), 5*43 + O(43^3), O(43^3), O(43^3), 3 + 38*43 + O(43^3), O(43^3)), + ....: (O(43^3), O(43^3), 9*43 + 32*43^2 + O(43^3), 13 + 25*43 + O(43^3), O(43^3), 17 + 18*43 + O(43^3)), + ....: (O(43^3), O(43^3), 22*43 + 25*43^2 + O(43^3), 11 + 24*43 + O(43^3), O(43^3), 36 + 5*43 + O(43^3)), + ....: (42*43 + 15*43^2 + O(43^3), 22*43 + 8*43^2 + O(43^3), O(43^3), O(43^3), 29 + 4*43 + O(43^3), O(43^3)), + ....: (O(43^3), O(43^3), 6*43 + 19*43^2 + O(43^3), 8 + 24*43 + O(43^3), O(43^3), 31 + 42*43 + O(43^3))]) sage: charpoly_frobenius(M, [5, 4, 3, 2, 2, 2, 2], 43, 1, 1) [79507, 27735, 6579, 1258, 153, 15, 1] sage: M = Matrix([(1 + O(4999), O(4999), 0, 0), - ....: (O(4999), 4860 + O(4999), 0, 0), - ....: (0, 0, O(4999), O(4999)), - ....: (0, 0, O(4999), 1 + O(4999))]) - sage: charpoly_frobenius(M, [2, 1, 1], 4999, 1, 1, [1, -2 ,1 ]) + ....: (O(4999), 4860 + O(4999), 0, 0), + ....: (0, 0, O(4999), O(4999)), + ....: (0, 0, O(4999), 1 + O(4999))]) + sage: charpoly_frobenius(M, [2, 1, 1], 4999, 1, 1, [1, -2, 1]) [4999, 139, 1] TESTS:: diff --git a/src/sage/schemes/cyclic_covers/constructor.py b/src/sage/schemes/cyclic_covers/constructor.py index 555eee376bb..9229cfea545 100644 --- a/src/sage/schemes/cyclic_covers/constructor.py +++ b/src/sage/schemes/cyclic_covers/constructor.py @@ -28,7 +28,7 @@ def CyclicCover(r, f, names=None, check_smooth=True): - ``f`` - univariate polynomial if not given, then it defaults to 0. - ``names`` (default: ``["x","y"]``) - names for the - coordinate functions + coordinate functions - ``check_squarefree`` (default: ``True``) - test if the input defines a unramified cover of the projective line. @@ -66,12 +66,13 @@ def CyclicCover(r, f, names=None, check_smooth=True): sage: k. = GF(9); R. = k[] # optional - sage.rings.finite_rings sage: CyclicCover(5, x^9 + x + 1) # optional - sage.rings.finite_rings - Cyclic Cover of P^1 over Finite Field in a of size 3^2 # optional - sage.rings.finite_rings + Cyclic Cover of P^1 over Finite Field in a of size 3^2 defined by y^5 = x^9 + x + 1 sage: CyclicCover(15, x^9 + x + 1) # optional - sage.rings.finite_rings Traceback (most recent call last): ... - ValueError: As the characteristic divides the order of the cover, this model is not smooth. + ValueError: As the characteristic divides the order of the cover, + this model is not smooth. We can change the names of the variables in the output:: @@ -97,12 +98,11 @@ def CyclicCover(r, f, names=None, check_smooth=True): Input with integer coefficients creates objects with the integers as base ring, but only checks smoothness over `\QQ`, not over Spec(`\ZZ`). In other words, it is checked that the discriminant is non-zero, but it is - not checked whether the discriminant is a unit in `\ZZ^*`.:: + not checked whether the discriminant is a unit in `\ZZ^*`:: sage: R. = ZZ[] sage: CyclicCover(5, (x^3-x+2)*(x^6-1)) - Cyclic Cover of P^1 over Integer Ring - defined by y^5 = x^9 - x^7 + 2*x^6 - x^3 + x - 2 + Cyclic Cover of P^1 over Integer Ring defined by y^5 = x^9 - x^7 + 2*x^6 - x^3 + x - 2 """ diff --git a/src/sage/schemes/cyclic_covers/cycliccover_finite_field.py b/src/sage/schemes/cyclic_covers/cycliccover_finite_field.py index d6d8f2176ee..54c1519a90b 100644 --- a/src/sage/schemes/cyclic_covers/cycliccover_finite_field.py +++ b/src/sage/schemes/cyclic_covers/cycliccover_finite_field.py @@ -26,10 +26,12 @@ sage: p = 49999 sage: x = PolynomialRing(GF(p),"x").gen() - sage: CyclicCover(5, x^5 + x).frobenius_polynomial() # long time - x^12 + 299994*x^10 + 37498500015*x^8 + 2499850002999980*x^6 + 93742500224997000015*x^4 + 1874812507499850001499994*x^2 + 15623125093747500037499700001 - sage: CyclicCover(5, 2*x^5 + x).frobenius_polynomial() # long time - x^12 + 299994*x^10 + 37498500015*x^8 + 2499850002999980*x^6 + 93742500224997000015*x^4 + 1874812507499850001499994*x^2 + 15623125093747500037499700001 + sage: CyclicCover(5, x^5 + x).frobenius_polynomial() # long time + x^12 + 299994*x^10 + 37498500015*x^8 + 2499850002999980*x^6 + 93742500224997000015*x^4 + + 1874812507499850001499994*x^2 + 15623125093747500037499700001 + sage: CyclicCover(5, 2*x^5 + x).frobenius_polynomial() # long time + x^12 + 299994*x^10 + 37498500015*x^8 + 2499850002999980*x^6 + 93742500224997000015*x^4 + + 1874812507499850001499994*x^2 + 15623125093747500037499700001 sage: p = 107 sage: x = PolynomialRing(GF(p),"x").gen() @@ -1135,14 +1137,21 @@ def frobenius_polynomial(self): True sage: CyclicCover(3, x^4 + 4*x^3 + 9*x^2 + 3*x + 1).frobenius_polynomial() x^6 + 180*x^5 + 20988*x^4 + 1854349*x^3 + 104919012*x^2 + 4498200180*x + 124925014999 - sage: CyclicCover(4,x^5 + x + 1).frobenius_polynomial() - x^12 - 64*x^11 + 5018*x^10 - 488640*x^9 + 28119583*x^8 - 641791616*x^7 + 124245485932*x^6 - 3208316288384*x^5 + 702708407289583*x^4 - 61043359329111360*x^3 + 3133741752599645018*x^2 - 199800079984001599936*x + 15606259372500374970001 + sage: CyclicCover(4, x^5 + x + 1).frobenius_polynomial() + x^12 - 64*x^11 + 5018*x^10 - 488640*x^9 + 28119583*x^8 - 641791616*x^7 + + 124245485932*x^6 - 3208316288384*x^5 + 702708407289583*x^4 - 61043359329111360*x^3 + + 3133741752599645018*x^2 - 199800079984001599936*x + 15606259372500374970001 - sage: CyclicCover(11, PolynomialRing(GF(1129), 'x')([-1] + [0]*(5-1) + [1])).frobenius_polynomial() # long time - x^40 + 7337188909826596*x^30 + 20187877911930897108199045855206*x^20 + 24687045654725446027864774006541463602997309796*x^10 + 11320844849639649951608809973589776933203136765026963553258401 + sage: h = PolynomialRing(GF(1129), 'x')([-1] + [0]*(5-1) + [1]) + sage: CyclicCover(11, h).frobenius_polynomial() # long time + x^40 + 7337188909826596*x^30 + 20187877911930897108199045855206*x^20 + + 24687045654725446027864774006541463602997309796*x^10 + + 11320844849639649951608809973589776933203136765026963553258401 - sage: CyclicCover(3, PolynomialRing(GF(1009^2), 'x')([-1] + [0]*(5-1) + [1])).frobenius_polynomial() # long time - x^8 + 532*x^7 - 2877542*x^6 - 242628176*x^5 + 4390163797795*x^4 - 247015136050256*x^3 - 2982540407204025062*x^2 + 561382189105547134612*x + 1074309286591662654798721 + sage; h = PolynomialRing(GF(1009^2), 'x')([-1] + [0]*(5-1) + [1]) + sage: CyclicCover(3, h).frobenius_polynomial() # long time + x^8 + 532*x^7 - 2877542*x^6 - 242628176*x^5 + 4390163797795*x^4 - 247015136050256*x^3 + - 2982540407204025062*x^2 + 561382189105547134612*x + 1074309286591662654798721 A non-monic example checking that :trac:`29015` is fixed:: @@ -1169,11 +1178,14 @@ def frobenius_polynomial(self): 1 + 8*t + 102*t^2 + 1384*t^3 + 18089*t^4 + O(t^5) sage: x = PolynomialRing(GF(11), "x").gen() - sage: CyclicCover(4, x^6 - 11*x^3 + 70*x^2 - x + 961).frobenius_polynomial() # long time + sage: CyclicCover(4, x^6 - 11*x^3 + 70*x^2 - x + 961).frobenius_polynomial() # long time x^14 + 14*x^12 + 287*x^10 + 3025*x^8 + 33275*x^6 + 381997*x^4 + 2254714*x^2 + 19487171 sage: x = PolynomialRing(GF(4999), "x").gen() - sage: CyclicCover(4, x^6 - 11*x^3 + 70*x^2 - x + 961).frobenius_polynomial() # long time - x^14 - 4*x^13 - 2822*x^12 - 30032*x^11 + 37164411*x^10 - 152369520*x^9 + 54217349361*x^8 - 1021791160888*x^7 + 271032529455639*x^6 - 3807714457169520*x^5 + 4642764601604000589*x^4 - 18754988504199390032*x^3 - 8809934776794570547178*x^2 - 62425037490001499880004*x + 78015690603129374475034999 + sage: CyclicCover(4, x^6 - 11*x^3 + 70*x^2 - x + 961).frobenius_polynomial() # long time + x^14 - 4*x^13 - 2822*x^12 - 30032*x^11 + 37164411*x^10 - 152369520*x^9 + + 54217349361*x^8 - 1021791160888*x^7 + 271032529455639*x^6 - 3807714457169520*x^5 + + 4642764601604000589*x^4 - 18754988504199390032*x^3 - 8809934776794570547178*x^2 + - 62425037490001499880004*x + 78015690603129374475034999 sage: p = 11 sage: x = PolynomialRing(GF(p), "x").gen() @@ -1186,20 +1198,27 @@ def frobenius_polynomial(self): sage: CyclicCover(3, 5*x^3 - 5*x + 13).frobenius_polynomial() x^2 - 47*x + 4999 sage: CyclicCover(3, x^6 + x^4 - x^3 + 2*x^2 - x - 1).frobenius_polynomial() - x^8 + 122*x^7 + 4594*x^6 - 639110*x^5 - 82959649*x^4 - 3194910890*x^3 + 114804064594*x^2 + 15240851829878*x + 624500149980001 + x^8 + 122*x^7 + 4594*x^6 - 639110*x^5 - 82959649*x^4 - 3194910890*x^3 + + 114804064594*x^2 + 15240851829878*x + 624500149980001 sage: p = 11 sage: x = PolynomialRing(GF(p), "x").gen() - sage: CyclicCover(5, x^5 + x).frobenius_polynomial() # long time - x^12 + 4*x^11 + 22*x^10 + 108*x^9 + 503*x^8 + 1848*x^7 + 5588*x^6 + 20328*x^5 + 60863*x^4 + 143748*x^3 + 322102*x^2 + 644204*x + 1771561 - sage: CyclicCover(5, 2*x^5 + x).frobenius_polynomial() # long time - x^12 - 9*x^11 + 42*x^10 - 108*x^9 - 47*x^8 + 1782*x^7 - 8327*x^6 + 19602*x^5 - 5687*x^4 - 143748*x^3 + 614922*x^2 - 1449459*x + 1771561 + sage: CyclicCover(5, x^5 + x).frobenius_polynomial() # long time + x^12 + 4*x^11 + 22*x^10 + 108*x^9 + 503*x^8 + 1848*x^7 + 5588*x^6 + 20328*x^5 + + 60863*x^4 + 143748*x^3 + 322102*x^2 + 644204*x + 1771561 + sage: CyclicCover(5, 2*x^5 + x).frobenius_polynomial() # long time + x^12 - 9*x^11 + 42*x^10 - 108*x^9 - 47*x^8 + 1782*x^7 - 8327*x^6 + 19602*x^5 + - 5687*x^4 - 143748*x^3 + 614922*x^2 - 1449459*x + 1771561 sage: p = 49999 sage: x = PolynomialRing(GF(p), "x").gen() - sage: CyclicCover(5, x^5 + x ).frobenius_polynomial() # long time - x^12 + 299994*x^10 + 37498500015*x^8 + 2499850002999980*x^6 + 93742500224997000015*x^4 + 1874812507499850001499994*x^2 + 15623125093747500037499700001 + sage: CyclicCover(5, x^5 + x).frobenius_polynomial() # long time + x^12 + 299994*x^10 + 37498500015*x^8 + 2499850002999980*x^6 + + 93742500224997000015*x^4 + 1874812507499850001499994*x^2 + + 15623125093747500037499700001 sage: CyclicCover(5, 2*x^5 + x).frobenius_polynomial() # long time - x^12 + 299994*x^10 + 37498500015*x^8 + 2499850002999980*x^6 + 93742500224997000015*x^4 + 1874812507499850001499994*x^2 + 15623125093747500037499700001 + x^12 + 299994*x^10 + 37498500015*x^8 + 2499850002999980*x^6 + + 93742500224997000015*x^4 + 1874812507499850001499994*x^2 + + 15623125093747500037499700001 TESTS:: diff --git a/src/sage/schemes/cyclic_covers/cycliccover_generic.py b/src/sage/schemes/cyclic_covers/cycliccover_generic.py index 8d80d94c569..dde1234f344 100644 --- a/src/sage/schemes/cyclic_covers/cycliccover_generic.py +++ b/src/sage/schemes/cyclic_covers/cycliccover_generic.py @@ -76,7 +76,8 @@ def __init__(self, AA, r, f, names=None): sage: C.change_ring(GF(5)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... - ValueError: As the characteristic divides the order of the cover, this model is not smooth. + ValueError: As the characteristic divides the order of the cover, + this model is not smooth. sage: GF7x. = GF(7)[] # optional - sage.rings.finite_rings @@ -119,11 +120,13 @@ def change_ring(self, R): sage: C.change_ring(GF(5)) Traceback (most recent call last): ... - ValueError: As the characteristic divides the order of the cover, this model is not smooth. + ValueError: As the characteristic divides the order of the cover, + this model is not smooth. sage: C.change_ring(GF(3)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... - ValueError: Not a smooth Cyclic Cover of P^1: singularity in the provided affine patch. + ValueError: Not a smooth Cyclic Cover of P^1: singularity in the + provided affine patch. sage: C.change_ring(GF(17)) # optional - sage.rings.finite_rings Cyclic Cover of P^1 over Finite Field of size 17 defined by y^5 = x^5 + x + 1 """ diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index cb7433c77c5..653033b7878 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -853,16 +853,18 @@ def rational_points(self, **kwds): sage: U.rational_points() # optional - sage.rings.finite_rings [(2, 4), (3, 2), (4, 2), (5, 4), (6, 1)] sage: U.rational_points(F=GF(7^2, 'b')) # optional - sage.rings.finite_rings - [(2, 4), (3, 2), (4, 2), (5, 4), (6, 1), (b, b + 4), (b + 1, 3*b + 5), (b + 2, 5*b + 1), - (b + 3, 6), (b + 4, 2*b + 6), (b + 5, 4*b + 1), (b + 6, 6*b + 5), (2*b, 4*b + 2), - (2*b + 1, b + 3), (2*b + 2, 5*b + 6), (2*b + 3, 2*b + 4), (2*b + 4, 6*b + 4), - (2*b + 5, 3*b + 6), (2*b + 6, 3), (3*b, 2*b + 1), (3*b + 1, b + 2), (3*b + 2, 5), - (3*b + 3, 6*b + 3), (3*b + 4, 5*b + 3), (3*b + 5, 4*b + 5), (3*b + 6, 3*b + 2), - (4*b, 2*b + 1), (4*b + 1, 3*b + 2), (4*b + 2, 4*b + 5), (4*b + 3, 5*b + 3), - (4*b + 4, 6*b + 3), (4*b + 5, 5), (4*b + 6, b + 2), (5*b, 4*b + 2), (5*b + 1, 3), - (5*b + 2, 3*b + 6), (5*b + 3, 6*b + 4), (5*b + 4, 2*b + 4), (5*b + 5, 5*b + 6), - (5*b + 6, b + 3), (6*b, b + 4), (6*b + 1, 6*b + 5), (6*b + 2, 4*b + 1), (6*b + 3, 2*b + 6), - (6*b + 4, 6), (6*b + 5, 5*b + 1), (6*b + 6, 3*b + 5)] + [(2, 4), (3, 2), (4, 2), (5, 4), (6, 1), (b, b + 4), (b + 1, 3*b + 5), + (b + 2, 5*b + 1), (b + 3, 6), (b + 4, 2*b + 6), (b + 5, 4*b + 1), + (b + 6, 6*b + 5), (2*b, 4*b + 2), (2*b + 1, b + 3), (2*b + 2, 5*b + 6), + (2*b + 3, 2*b + 4), (2*b + 4, 6*b + 4), (2*b + 5, 3*b + 6), (2*b + 6, 3), + (3*b, 2*b + 1), (3*b + 1, b + 2), (3*b + 2, 5), (3*b + 3, 6*b + 3), + (3*b + 4, 5*b + 3), (3*b + 5, 4*b + 5), (3*b + 6, 3*b + 2), + (4*b, 2*b + 1), (4*b + 1, 3*b + 2), (4*b + 2, 4*b + 5), + (4*b + 3, 5*b + 3), (4*b + 4, 6*b + 3), (4*b + 5, 5), (4*b + 6, b + 2), + (5*b, 4*b + 2), (5*b + 1, 3), (5*b + 2, 3*b + 6), (5*b + 3, 6*b + 4), + (5*b + 4, 2*b + 4), (5*b + 5, 5*b + 6), (5*b + 6, b + 3), (6*b, b + 4), + (6*b + 1, 6*b + 5), (6*b + 2, 4*b + 1), (6*b + 3, 2*b + 6), (6*b + 4, 6), + (6*b + 5, 5*b + 1), (6*b + 6, 3*b + 5)] """ F = kwds.get('F', None) bound = kwds.get('bound', 0) @@ -1005,7 +1007,8 @@ def base_extend(self, R): sage: S.base_extend(ZZ) # optional - sage.rings.finite_rings Traceback (most recent call last): ... - ValueError: no natural map from the base ring (=Finite Field of size 11) to R (=Integer Ring)! + ValueError: no natural map from the base ring (=Finite Field of size 11) + to R (=Integer Ring)! """ A = self.ambient_space().base_extend(R) return A.subscheme(self.__polys) @@ -1158,7 +1161,8 @@ def defining_ideal(self): sage: P. = ProjectiveSpace(2, ZZ) sage: S = P.subscheme([x^2 - y*z, x^3 + z^3]) sage: S.defining_ideal() - Ideal (x^2 - y*z, x^3 + z^3) of Multivariate Polynomial Ring in x, y, z over Integer Ring + Ideal (x^2 - y*z, x^3 + z^3) of Multivariate Polynomial Ring in x, y, z + over Integer Ring """ try: return self.__I @@ -1437,16 +1441,16 @@ def union(self, other): sage: L = A.subscheme([y - 1]) sage: S = L.union(P); S Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - y^4 - y^3, - x*y^3 - x*y^2, - x^2*y^2 - x^2*y, - x^3*y - x^3 + y^4 - y^3, + x*y^3 - x*y^2, + x^2*y^2 - x^2*y, + x^3*y - x^3 sage: S.dimension() 1 sage: S.reduce() Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - y^2 - y, - x*y - x + y^2 - y, + x*y - x We can also use the notation "+" for the union:: @@ -1766,8 +1770,9 @@ def rational_points(self, **kwds): sage: E = EllipticCurve('37a') sage: E.rational_points(bound=8) - [(-1 : -1 : 1), (-1 : 0 : 1), (0 : -1 : 1), (0 : 0 : 1), (0 : 1 : 0), (1/4 : -5/8 : 1), - (1/4 : -3/8 : 1), (1 : -1 : 1), (1 : 0 : 1), (2 : -3 : 1), (2 : 2 : 1)] + [(-1 : -1 : 1), (-1 : 0 : 1), (0 : -1 : 1), (0 : 0 : 1), (0 : 1 : 0), + (1/4 : -5/8 : 1), (1/4 : -3/8 : 1), (1 : -1 : 1), (1 : 0 : 1), + (2 : -3 : 1), (2 : 2 : 1)] For a small finite field, the complete set of points can be enumerated. :: @@ -2045,7 +2050,7 @@ def specialization(self, D=None, phi=None): sage: X = P.subscheme([x^2 + c*y^2]) sage: X.specialization(dict({c:2})) Closed subscheme of Projective Space of dimension 1 over Rational Field defined by: - x^2 + 2*y^2 + x^2 + 2*y^2 :: @@ -2057,7 +2062,7 @@ def specialization(self, D=None, phi=None): sage: phi = SpecializationMorphism(P.coordinate_ring(),dict({c:2,a:1})) sage: X.specialization(phi=phi) Closed subscheme of Affine Space of dimension 3 over Univariate Polynomial Ring in b over Rational Field defined by: - x^2 + 2*y^2 + (-b)*z^2 + x^2 + 2*y^2 + (-b)*z^2 """ if D is None: if phi is None: diff --git a/src/sage/schemes/generic/hypersurface.py b/src/sage/schemes/generic/hypersurface.py index 4804a63ad03..1b100bb29eb 100644 --- a/src/sage/schemes/generic/hypersurface.py +++ b/src/sage/schemes/generic/hypersurface.py @@ -146,13 +146,15 @@ class AffineHypersurface(AlgebraicScheme_subscheme_affine): sage: A. = AffineSpace(ZZ, 3) sage: AffineHypersurface(x*y - z^3, A) - Affine hypersurface defined by -z^3 + x*y in Affine Space of dimension 3 over Integer Ring + Affine hypersurface defined by -z^3 + x*y in Affine Space of dimension 3 + over Integer Ring :: sage: A. = QQ[] sage: AffineHypersurface(x*y - z^3) - Affine hypersurface defined by -z^3 + x*y in Affine Space of dimension 3 over Rational Field + Affine hypersurface defined by -z^3 + x*y in Affine Space of dimension 3 + over Rational Field """ def __init__(self, poly, ambient=None): """ diff --git a/src/sage/schemes/generic/morphism.py b/src/sage/schemes/generic/morphism.py index 2c2ec94afd4..7aac451f1ab 100644 --- a/src/sage/schemes/generic/morphism.py +++ b/src/sage/schemes/generic/morphism.py @@ -108,8 +108,7 @@ def is_SchemeMorphism(f): sage: A. = AffineSpace(QQ, 2); H = A.Hom(A) sage: f = H([y, x^2 + y]); f Scheme endomorphism of Affine Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x, y) to - (y, x^2 + y) + Defn: Defined on coordinates by sending (x, y) to (y, x^2 + y) sage: from sage.schemes.generic.morphism import is_SchemeMorphism sage: is_SchemeMorphism(f) True @@ -992,8 +991,7 @@ def __init__(self, parent, polys, check=True): sage: H = A2.Hom(A2) sage: H([x - y, x*y]) Scheme endomorphism of Affine Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x, y) to - (x - y, x*y) + Defn: Defined on coordinates by sending (x, y) to (x - y, x*y) """ if check: if not isinstance(polys, (list, tuple)): @@ -1242,8 +1240,7 @@ def _repr_defn(self): sage: H = A.Hom(A) sage: f = H([y, x^2 + y]) sage: print(f._repr_defn()) - Defined on coordinates by sending (x, y) to - (y, x^2 + y) + Defined on coordinates by sending (x, y) to (y, x^2 + y) """ i = self.domain().ambient_space()._repr_generic_point() o = self._codomain.ambient_space()._repr_generic_point(self.defining_polynomials()) @@ -1690,7 +1687,9 @@ def _composition_(self, other, homset): From: Projective Space of dimension 1 over Rational Field To: Projective Space of dimension 2 over Rational Field Defn: Defined on coordinates by sending (x : y) to - (x^4 - 29/8*x^2*y^2 + 1097/256*y^4 : x^4 - 29/8*x^2*y^2 + 841/256*y^4 : 2*x^4 - 29/4*x^2*y^2 + 969/128*y^4) + (x^4 - 29/8*x^2*y^2 + 1097/256*y^4 + : x^4 - 29/8*x^2*y^2 + 841/256*y^4 + : 2*x^4 - 29/4*x^2*y^2 + 969/128*y^4) :: diff --git a/src/sage/schemes/generic/point.py b/src/sage/schemes/generic/point.py index 601862993c7..6bd3599d943 100644 --- a/src/sage/schemes/generic/point.py +++ b/src/sage/schemes/generic/point.py @@ -120,20 +120,19 @@ def _repr_(self): def point_on_affine(self): """ - Return the scheme point on the affine open U. + Return the scheme point on the affine open `U`. """ return self.__x def affine_open(self): """ - Return the affine open subset U. + Return the affine open subset `U`. """ return self.__u.domain() def embedding_of_affine_open(self): """ - Return the embedding from the affine open subset U into this - scheme. + Return the embedding from the affine open subset `U` into this scheme. """ return self.__u diff --git a/src/sage/schemes/generic/scheme.py b/src/sage/schemes/generic/scheme.py index 13bce6084e2..451b9da335d 100644 --- a/src/sage/schemes/generic/scheme.py +++ b/src/sage/schemes/generic/scheme.py @@ -506,7 +506,8 @@ def coordinate_ring(self): sage: I = (x^2 - y^2)*R sage: X = Spec(R.quotient(I)) sage: X.coordinate_ring() - Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2 - y^2) + Quotient of Multivariate Polynomial Ring in x, y over Rational Field + by the ideal (x^2 - y^2) """ try: return self._coordinate_ring diff --git a/src/sage/schemes/generic/spec.py b/src/sage/schemes/generic/spec.py index ec7a6e1728c..60f46664e31 100644 --- a/src/sage/schemes/generic/spec.py +++ b/src/sage/schemes/generic/spec.py @@ -63,7 +63,8 @@ def Spec(R, S=None): sage: Spec(FreeAlgebra(QQ, 2, 'x')) Traceback (most recent call last): ... - TypeError: x (=Free Algebra on 2 generators (x0, x1) over Rational Field) is not in Category of commutative rings + TypeError: x (=Free Algebra on 2 generators (x0, x1) over Rational Field) + is not in Category of commutative rings TESTS:: diff --git a/src/sage/schemes/product_projective/homset.py b/src/sage/schemes/product_projective/homset.py index 67387a936aa..17aa83c4bcd 100644 --- a/src/sage/schemes/product_projective/homset.py +++ b/src/sage/schemes/product_projective/homset.py @@ -127,32 +127,32 @@ def points(self, **kwds): sage: P. = ProductProjectiveSpaces([1, 1], K) # optional - sage.rings.number_field sage: P(K).points(bound=1) # optional - sage.rings.number_field [(-1 : 1 , -1 : 1), (-1 : 1 , -v : 1), (-1 : 1 , 0 : 1), (-1 : 1 , v : 1), - (-1 : 1 , 1 : 0), (-1 : 1 , 1 : 1), (-v : 1 , -1 : 1), (-v : 1 , -v : 1), - (-v : 1 , 0 : 1), (-v : 1 , v : 1), (-v : 1 , 1 : 0), (-v : 1 , 1 : 1), - (0 : 1 , -1 : 1), (0 : 1 , -v : 1), (0 : 1 , 0 : 1), (0 : 1 , v : 1), - (0 : 1 , 1 : 0), (0 : 1 , 1 : 1), (v : 1 , -1 : 1), (v : 1 , -v : 1), - (v : 1 , 0 : 1), (v : 1 , v : 1), (v : 1 , 1 : 0), (v : 1 , 1 : 1), - (1 : 0 , -1 : 1), (1 : 0 , -v : 1), (1 : 0 , 0 : 1), (1 : 0 , v : 1), - (1 : 0 , 1 : 0), (1 : 0 , 1 : 1), (1 : 1 , -1 : 1), (1 : 1 , -v : 1), - (1 : 1 , 0 : 1), (1 : 1 , v : 1), (1 : 1 , 1 : 0), (1 : 1 , 1 : 1)] + (-1 : 1 , 1 : 0), (-1 : 1 , 1 : 1), (-v : 1 , -1 : 1), (-v : 1 , -v : 1), + (-v : 1 , 0 : 1), (-v : 1 , v : 1), (-v : 1 , 1 : 0), (-v : 1 , 1 : 1), + (0 : 1 , -1 : 1), (0 : 1 , -v : 1), (0 : 1 , 0 : 1), (0 : 1 , v : 1), + (0 : 1 , 1 : 0), (0 : 1 , 1 : 1), (v : 1 , -1 : 1), (v : 1 , -v : 1), + (v : 1 , 0 : 1), (v : 1 , v : 1), (v : 1 , 1 : 0), (v : 1 , 1 : 1), + (1 : 0 , -1 : 1), (1 : 0 , -v : 1), (1 : 0 , 0 : 1), (1 : 0 , v : 1), + (1 : 0 , 1 : 0), (1 : 0 , 1 : 1), (1 : 1 , -1 : 1), (1 : 1 , -v : 1), + (1 : 1 , 0 : 1), (1 : 1 , v : 1), (1 : 1 , 1 : 0), (1 : 1 , 1 : 1)] :: sage: P. = ProductProjectiveSpaces([2, 1], GF(3)) # optional - sage.rings.finite_rings sage: P(P.base_ring()).points() # optional - sage.rings.finite_rings [(0 : 0 : 1 , 0 : 1), (0 : 0 : 1 , 1 : 0), (0 : 0 : 1 , 1 : 1), (0 : 0 : 1 , 2 : 1), - (0 : 1 : 0 , 0 : 1), (0 : 1 : 0 , 1 : 0), (0 : 1 : 0 , 1 : 1), (0 : 1 : 0 , 2 : 1), - (0 : 1 : 1 , 0 : 1), (0 : 1 : 1 , 1 : 0), (0 : 1 : 1 , 1 : 1), (0 : 1 : 1 , 2 : 1), - (0 : 2 : 1 , 0 : 1), (0 : 2 : 1 , 1 : 0), (0 : 2 : 1 , 1 : 1), (0 : 2 : 1 , 2 : 1), - (1 : 0 : 0 , 0 : 1), (1 : 0 : 0 , 1 : 0), (1 : 0 : 0 , 1 : 1), (1 : 0 : 0 , 2 : 1), - (1 : 0 : 1 , 0 : 1), (1 : 0 : 1 , 1 : 0), (1 : 0 : 1 , 1 : 1), (1 : 0 : 1 , 2 : 1), - (1 : 1 : 0 , 0 : 1), (1 : 1 : 0 , 1 : 0), (1 : 1 : 0 , 1 : 1), (1 : 1 : 0 , 2 : 1), - (1 : 1 : 1 , 0 : 1), (1 : 1 : 1 , 1 : 0), (1 : 1 : 1 , 1 : 1), (1 : 1 : 1 , 2 : 1), - (1 : 2 : 1 , 0 : 1), (1 : 2 : 1 , 1 : 0), (1 : 2 : 1 , 1 : 1), (1 : 2 : 1 , 2 : 1), - (2 : 0 : 1 , 0 : 1), (2 : 0 : 1 , 1 : 0), (2 : 0 : 1 , 1 : 1), (2 : 0 : 1 , 2 : 1), - (2 : 1 : 0 , 0 : 1), (2 : 1 : 0 , 1 : 0), (2 : 1 : 0 , 1 : 1), (2 : 1 : 0 , 2 : 1), - (2 : 1 : 1 , 0 : 1), (2 : 1 : 1 , 1 : 0), (2 : 1 : 1 , 1 : 1), (2 : 1 : 1 , 2 : 1), - (2 : 2 : 1 , 0 : 1), (2 : 2 : 1 , 1 : 0), (2 : 2 : 1 , 1 : 1), (2 : 2 : 1 , 2 : 1)] + (0 : 1 : 0 , 0 : 1), (0 : 1 : 0 , 1 : 0), (0 : 1 : 0 , 1 : 1), (0 : 1 : 0 , 2 : 1), + (0 : 1 : 1 , 0 : 1), (0 : 1 : 1 , 1 : 0), (0 : 1 : 1 , 1 : 1), (0 : 1 : 1 , 2 : 1), + (0 : 2 : 1 , 0 : 1), (0 : 2 : 1 , 1 : 0), (0 : 2 : 1 , 1 : 1), (0 : 2 : 1 , 2 : 1), + (1 : 0 : 0 , 0 : 1), (1 : 0 : 0 , 1 : 0), (1 : 0 : 0 , 1 : 1), (1 : 0 : 0 , 2 : 1), + (1 : 0 : 1 , 0 : 1), (1 : 0 : 1 , 1 : 0), (1 : 0 : 1 , 1 : 1), (1 : 0 : 1 , 2 : 1), + (1 : 1 : 0 , 0 : 1), (1 : 1 : 0 , 1 : 0), (1 : 1 : 0 , 1 : 1), (1 : 1 : 0 , 2 : 1), + (1 : 1 : 1 , 0 : 1), (1 : 1 : 1 , 1 : 0), (1 : 1 : 1 , 1 : 1), (1 : 1 : 1 , 2 : 1), + (1 : 2 : 1 , 0 : 1), (1 : 2 : 1 , 1 : 0), (1 : 2 : 1 , 1 : 1), (1 : 2 : 1 , 2 : 1), + (2 : 0 : 1 , 0 : 1), (2 : 0 : 1 , 1 : 0), (2 : 0 : 1 , 1 : 1), (2 : 0 : 1 , 2 : 1), + (2 : 1 : 0 , 0 : 1), (2 : 1 : 0 , 1 : 0), (2 : 1 : 0 , 1 : 1), (2 : 1 : 0 , 2 : 1), + (2 : 1 : 1 , 0 : 1), (2 : 1 : 1 , 1 : 0), (2 : 1 : 1 , 1 : 1), (2 : 1 : 1 , 2 : 1), + (2 : 2 : 1 , 0 : 1), (2 : 2 : 1 , 1 : 0), (2 : 2 : 1 , 1 : 1), (2 : 2 : 1 , 2 : 1)] :: diff --git a/src/sage/schemes/product_projective/space.py b/src/sage/schemes/product_projective/space.py index eb335337bb0..6625c809fc9 100644 --- a/src/sage/schemes/product_projective/space.py +++ b/src/sage/schemes/product_projective/space.py @@ -982,15 +982,9 @@ def segre_embedding(self, PP=None, var='u'): From: Product of projective spaces P^2 x P^2 over Integer Ring To: Closed subscheme of Projective Space of dimension 8 over Integer Ring defined by: - -u5*u7 + u4*u8, - -u5*u6 + u3*u8, - -u4*u6 + u3*u7, - -u2*u7 + u1*u8, - -u2*u4 + u1*u5, - -u2*u6 + u0*u8, - -u1*u6 + u0*u7, - -u2*u3 + u0*u5, - -u1*u3 + u0*u4 + -u5*u7 + u4*u8, -u5*u6 + u3*u8, -u4*u6 + u3*u7, + -u2*u7 + u1*u8, -u2*u4 + u1*u5, -u2*u6 + u0*u8, + -u1*u6 + u0*u7, -u2*u3 + u0*u5, -u1*u3 + u0*u4 Defn: Defined by sending (y0 : y1 : y2 , y3 : y4 : y5) to (y0*y3 : y0*y4 : y0*y5 : y1*y3 : y1*y4 : y1*y5 : y2*y3 : y2*y4 : y2*y5). @@ -1003,9 +997,7 @@ def segre_embedding(self, PP=None, var='u'): over Complex Field with 53 bits of precision To: Closed subscheme of Projective Space of dimension 5 over Complex Field with 53 bits of precision defined by: - -u2*u4 + u1*u5, - -u2*u3 + u0*u5, - -u1*u3 + u0*u4 + -u2*u4 + u1*u5, -u2*u3 + u0*u5, -u1*u3 + u0*u4 Defn: Defined by sending (z0 : z1 , z2 : z3 : z4) to (z0*z2 : z0*z3 : z0*z4 : z1*z2 : z1*z3 : z1*z4). @@ -1017,30 +1009,14 @@ def segre_embedding(self, PP=None, var='u'): From: Product of projective spaces P^1 x P^2 x P^1 over Rational Field To: Closed subscheme of Projective Space of dimension 11 over Rational Field defined by: - -u9*u10 + u8*u11, - -u7*u10 + u6*u11, - -u7*u8 + u6*u9, - -u5*u10 + u4*u11, - -u5*u8 + u4*u9, - -u5*u6 + u4*u7, - -u5*u9 + u3*u11, - -u5*u8 + u3*u10, - -u5*u8 + u2*u11, - -u4*u8 + u2*u10, - -u3*u8 + u2*u9, - -u3*u6 + u2*u7, - -u3*u4 + u2*u5, - -u5*u7 + u1*u11, - -u5*u6 + u1*u10, - -u3*u7 + u1*u9, - -u3*u6 + u1*u8, - -u5*u6 + u0*u11, - -u4*u6 + u0*u10, - -u3*u6 + u0*u9, - -u2*u6 + u0*u8, - -u1*u6 + u0*u7, - -u1*u4 + u0*u5, - -u1*u2 + u0*u3 + -u9*u10 + u8*u11, -u7*u10 + u6*u11, -u7*u8 + u6*u9, + -u5*u10 + u4*u11, -u5*u8 + u4*u9, -u5*u6 + u4*u7, + -u5*u9 + u3*u11, -u5*u8 + u3*u10, -u5*u8 + u2*u11, + -u4*u8 + u2*u10, -u3*u8 + u2*u9, -u3*u6 + u2*u7, + -u3*u4 + u2*u5, -u5*u7 + u1*u11, -u5*u6 + u1*u10, + -u3*u7 + u1*u9, -u3*u6 + u1*u8, -u5*u6 + u0*u11, + -u4*u6 + u0*u10, -u3*u6 + u0*u9, -u2*u6 + u0*u8, + -u1*u6 + u0*u7, -u1*u4 + u0*u5, -u1*u2 + u0*u3 Defn: Defined by sending (z0 : z1 , z2 : z3 : z4 , z5 : z6) to (z0*z2*z5 : z0*z2*z6 : z0*z3*z5 : z0*z3*z6 : z0*z4*z5 : z0*z4*z6 : z1*z2*z5 : z1*z2*z6 : z1*z3*z5 : z1*z3*z6 : z1*z4*z5 : z1*z4*z6). @@ -1165,38 +1141,47 @@ def points_of_bounded_height(self, **kwds): sage: PP = ProductProjectiveSpaces(QQ, [1, 2]) sage: sorted(list(PP.points_of_bounded_height(bound=1))) - [(-1 : 1 , -1 : -1 : 1), (-1 : 1 , -1 : 0 : 1), (-1 : 1 , -1 : 1 : 0), (-1 : 1 , -1 : 1 : 1), - (-1 : 1 , 0 : -1 : 1), (-1 : 1 , 0 : 0 : 1), (-1 : 1 , 0 : 1 : 0), (-1 : 1 , 0 : 1 : 1), - (-1 : 1 , 1 : -1 : 1), (-1 : 1 , 1 : 0 : 0), (-1 : 1 , 1 : 0 : 1), (-1 : 1 , 1 : 1 : 0), - (-1 : 1 , 1 : 1 : 1), (0 : 1 , -1 : -1 : 1), (0 : 1 , -1 : 0 : 1), (0 : 1 , -1 : 1 : 0), - (0 : 1 , -1 : 1 : 1), (0 : 1 , 0 : -1 : 1), (0 : 1 , 0 : 0 : 1), (0 : 1 , 0 : 1 : 0), - (0 : 1 , 0 : 1 : 1), (0 : 1 , 1 : -1 : 1), (0 : 1 , 1 : 0 : 0), (0 : 1 , 1 : 0 : 1), - (0 : 1 , 1 : 1 : 0), (0 : 1 , 1 : 1 : 1), (1 : 0 , -1 : -1 : 1), (1 : 0 , -1 : 0 : 1), - (1 : 0 , -1 : 1 : 0), (1 : 0 , -1 : 1 : 1), (1 : 0 , 0 : -1 : 1), (1 : 0 , 0 : 0 : 1), - (1 : 0 , 0 : 1 : 0), (1 : 0 , 0 : 1 : 1), (1 : 0 , 1 : -1 : 1), (1 : 0 , 1 : 0 : 0), - (1 : 0 , 1 : 0 : 1), (1 : 0 , 1 : 1 : 0), (1 : 0 , 1 : 1 : 1), (1 : 1 , -1 : -1 : 1), - (1 : 1 , -1 : 0 : 1), (1 : 1 , -1 : 1 : 0), (1 : 1 , -1 : 1 : 1), (1 : 1 , 0 : -1 : 1), - (1 : 1 , 0 : 0 : 1), (1 : 1 , 0 : 1 : 0), (1 : 1 , 0 : 1 : 1), (1 : 1 , 1 : -1 : 1), - (1 : 1 , 1 : 0 : 0), (1 : 1 , 1 : 0 : 1), (1 : 1 , 1 : 1 : 0), (1 : 1 , 1 : 1 : 1)] + [(-1 : 1 , -1 : -1 : 1), (-1 : 1 , -1 : 0 : 1), (-1 : 1 , -1 : 1 : 0), + (-1 : 1 , -1 : 1 : 1), (-1 : 1 , 0 : -1 : 1), (-1 : 1 , 0 : 0 : 1), + (-1 : 1 , 0 : 1 : 0), (-1 : 1 , 0 : 1 : 1), (-1 : 1 , 1 : -1 : 1), + (-1 : 1 , 1 : 0 : 0), (-1 : 1 , 1 : 0 : 1), (-1 : 1 , 1 : 1 : 0), + (-1 : 1 , 1 : 1 : 1), (0 : 1 , -1 : -1 : 1), (0 : 1 , -1 : 0 : 1), + (0 : 1 , -1 : 1 : 0), (0 : 1 , -1 : 1 : 1), (0 : 1 , 0 : -1 : 1), + (0 : 1 , 0 : 0 : 1), (0 : 1 , 0 : 1 : 0), (0 : 1 , 0 : 1 : 1), + (0 : 1 , 1 : -1 : 1), (0 : 1 , 1 : 0 : 0), (0 : 1 , 1 : 0 : 1), + (0 : 1 , 1 : 1 : 0), (0 : 1 , 1 : 1 : 1), (1 : 0 , -1 : -1 : 1), + (1 : 0 , -1 : 0 : 1), (1 : 0 , -1 : 1 : 0), (1 : 0 , -1 : 1 : 1), + (1 : 0 , 0 : -1 : 1), (1 : 0 , 0 : 0 : 1), (1 : 0 , 0 : 1 : 0), + (1 : 0 , 0 : 1 : 1), (1 : 0 , 1 : -1 : 1), (1 : 0 , 1 : 0 : 0), + (1 : 0 , 1 : 0 : 1), (1 : 0 , 1 : 1 : 0), (1 : 0 , 1 : 1 : 1), + (1 : 1 , -1 : -1 : 1), (1 : 1 , -1 : 0 : 1), (1 : 1 , -1 : 1 : 0), + (1 : 1 , -1 : 1 : 1), (1 : 1 , 0 : -1 : 1), (1 : 1 , 0 : 0 : 1), + (1 : 1 , 0 : 1 : 0), (1 : 1 , 0 : 1 : 1), (1 : 1 , 1 : -1 : 1), + (1 : 1 , 1 : 0 : 0), (1 : 1 , 1 : 0 : 1), (1 : 1 , 1 : 1 : 0), + (1 : 1 , 1 : 1 : 1)] :: sage: u = QQ['u'].0 sage: P = ProductProjectiveSpaces([1, 1], NumberField(u^2 - 2, 'v')) # optional - sage.rings.number_field sage: sorted(list(P.points_of_bounded_height(bound=1.5))) # optional - sage.rings.number_field - [(-v : 1 , -v : 1), (-v : 1 , -1 : 1), (-v : 1 , -1/2*v : 1), (-v : 1 , 0 : 1), (-v : 1 , 1/2*v : 1), - (-v : 1 , 1 : 0), (-v : 1 , 1 : 1), (-v : 1 , v : 1), (-1 : 1 , -v : 1), (-1 : 1 , -1 : 1), - (-1 : 1 , -1/2*v : 1), (-1 : 1 , 0 : 1), (-1 : 1 , 1/2*v : 1), (-1 : 1 , 1 : 0), (-1 : 1 , 1 : 1), - (-1 : 1 , v : 1), (-1/2*v : 1 , -v : 1), (-1/2*v : 1 , -1 : 1), (-1/2*v : 1 , -1/2*v : 1), (-1/2*v : 1 , 0 : 1), - (-1/2*v : 1 , 1/2*v : 1), (-1/2*v : 1 , 1 : 0), (-1/2*v : 1 , 1 : 1), (-1/2*v : 1 , v : 1), (0 : 1 , -v : 1), - (0 : 1 , -1 : 1), (0 : 1 , -1/2*v : 1), (0 : 1 , 0 : 1), (0 : 1 , 1/2*v : 1), (0 : 1 , 1 : 0), - (0 : 1 , 1 : 1), (0 : 1 , v : 1), (1/2*v : 1 , -v : 1), (1/2*v : 1 , -1 : 1), (1/2*v : 1 , -1/2*v : 1), - (1/2*v : 1 , 0 : 1), (1/2*v : 1 , 1/2*v : 1), (1/2*v : 1 , 1 : 0), (1/2*v : 1 , 1 : 1), (1/2*v : 1 , v : 1), - (1 : 0 , -v : 1), (1 : 0 , -1 : 1), (1 : 0 , -1/2*v : 1), (1 : 0 , 0 : 1), (1 : 0 , 1/2*v : 1), - (1 : 0 , 1 : 0), (1 : 0 , 1 : 1), (1 : 0 , v : 1), (1 : 1 , -v : 1), (1 : 1 , -1 : 1), - (1 : 1 , -1/2*v : 1), (1 : 1 , 0 : 1), (1 : 1 , 1/2*v : 1), (1 : 1 , 1 : 0), (1 : 1 , 1 : 1), - (1 : 1 , v : 1), (v : 1 , -v : 1), (v : 1 , -1 : 1), (v : 1 , -1/2*v : 1), (v : 1 , 0 : 1), - (v : 1 , 1/2*v : 1), (v : 1 , 1 : 0), (v : 1 , 1 : 1), (v : 1 , v : 1)] + [(-v : 1 , -v : 1), (-v : 1 , -1 : 1), (-v : 1 , -1/2*v : 1), (-v : 1 , 0 : 1), + (-v : 1 , 1/2*v : 1), (-v : 1 , 1 : 0), (-v : 1 , 1 : 1), (-v : 1 , v : 1), + (-1 : 1 , -v : 1), (-1 : 1 , -1 : 1), (-1 : 1 , -1/2*v : 1), (-1 : 1 , 0 : 1), + (-1 : 1 , 1/2*v : 1), (-1 : 1 , 1 : 0), (-1 : 1 , 1 : 1), (-1 : 1 , v : 1), + (-1/2*v : 1 , -v : 1), (-1/2*v : 1 , -1 : 1), (-1/2*v : 1 , -1/2*v : 1), + (-1/2*v : 1 , 0 : 1), (-1/2*v : 1 , 1/2*v : 1), (-1/2*v : 1 , 1 : 0), + (-1/2*v : 1 , 1 : 1), (-1/2*v : 1 , v : 1), (0 : 1 , -v : 1), (0 : 1 , -1 : 1), + (0 : 1 , -1/2*v : 1), (0 : 1 , 0 : 1), (0 : 1 , 1/2*v : 1), (0 : 1 , 1 : 0), + (0 : 1 , 1 : 1), (0 : 1 , v : 1), (1/2*v : 1 , -v : 1), (1/2*v : 1 , -1 : 1), + (1/2*v : 1 , -1/2*v : 1), (1/2*v : 1 , 0 : 1), (1/2*v : 1 , 1/2*v : 1), + (1/2*v : 1 , 1 : 0), (1/2*v : 1 , 1 : 1), (1/2*v : 1 , v : 1), (1 : 0 , -v : 1), + (1 : 0 , -1 : 1), (1 : 0 , -1/2*v : 1), (1 : 0 , 0 : 1), (1 : 0 , 1/2*v : 1), + (1 : 0 , 1 : 0), (1 : 0 , 1 : 1), (1 : 0 , v : 1), (1 : 1 , -v : 1), + (1 : 1 , -1 : 1), (1 : 1 , -1/2*v : 1), (1 : 1 , 0 : 1), (1 : 1 , 1/2*v : 1), + (1 : 1 , 1 : 0), (1 : 1 , 1 : 1), (1 : 1 , v : 1), (v : 1 , -v : 1), + (v : 1 , -1 : 1), (v : 1 , -1/2*v : 1), (v : 1 , 0 : 1), (v : 1 , 1/2*v : 1), + (v : 1 , 1 : 0), (v : 1 , 1 : 1), (v : 1 , v : 1)] """ B = kwds.pop('bound') tol = kwds.pop('tolerance', 1e-2) @@ -1288,21 +1273,23 @@ def rational_points(self, F=None): sage: P = ProductProjectiveSpaces([1, 1], GF(5)) # optional - sage.rings.finite_rings sage: P.rational_points() # optional - sage.rings.finite_rings [(0 : 1 , 0 : 1), (1 : 1 , 0 : 1), (2 : 1 , 0 : 1), (3 : 1 , 0 : 1), (4 : 1 , 0 : 1), (1 : 0 , 0 : 1), - (0 : 1 , 1 : 1), (1 : 1 , 1 : 1), (2 : 1 , 1 : 1), (3 : 1 , 1 : 1), (4 : 1 , 1 : 1), (1 : 0 , 1 : 1), - (0 : 1 , 2 : 1), (1 : 1 , 2 : 1), (2 : 1 , 2 : 1), (3 : 1 , 2 : 1), (4 : 1 , 2 : 1), (1 : 0 , 2 : 1), - (0 : 1 , 3 : 1), (1 : 1 , 3 : 1), (2 : 1 , 3 : 1), (3 : 1 , 3 : 1), (4 : 1 , 3 : 1), (1 : 0 , 3 : 1), - (0 : 1 , 4 : 1), (1 : 1 , 4 : 1), (2 : 1 , 4 : 1), (3 : 1 , 4 : 1), (4 : 1 , 4 : 1), (1 : 0 , 4 : 1), - (0 : 1 , 1 : 0), (1 : 1 , 1 : 0), (2 : 1 , 1 : 0), (3 : 1 , 1 : 0), (4 : 1 , 1 : 0), (1 : 0 , 1 : 0)] + (0 : 1 , 1 : 1), (1 : 1 , 1 : 1), (2 : 1 , 1 : 1), (3 : 1 , 1 : 1), (4 : 1 , 1 : 1), (1 : 0 , 1 : 1), + (0 : 1 , 2 : 1), (1 : 1 , 2 : 1), (2 : 1 , 2 : 1), (3 : 1 , 2 : 1), (4 : 1 , 2 : 1), (1 : 0 , 2 : 1), + (0 : 1 , 3 : 1), (1 : 1 , 3 : 1), (2 : 1 , 3 : 1), (3 : 1 , 3 : 1), (4 : 1 , 3 : 1), (1 : 0 , 3 : 1), + (0 : 1 , 4 : 1), (1 : 1 , 4 : 1), (2 : 1 , 4 : 1), (3 : 1 , 4 : 1), (4 : 1 , 4 : 1), (1 : 0 , 4 : 1), + (0 : 1 , 1 : 0), (1 : 1 , 1 : 0), (2 : 1 , 1 : 0), (3 : 1 , 1 : 0), (4 : 1 , 1 : 0), (1 : 0 , 1 : 0)] :: sage: P = ProductProjectiveSpaces([1, 1], GF(2)) # optional - sage.rings.finite_rings sage: P.rational_points(GF(2^2, 'a')) # optional - sage.rings.finite_rings - [(0 : 1 , 0 : 1), (a : 1 , 0 : 1), (a + 1 : 1 , 0 : 1), (1 : 1 , 0 : 1), (1 : 0 , 0 : 1), (0 : 1 , a : 1), - (a : 1 , a : 1), (a + 1 : 1 , a : 1), (1 : 1 , a : 1), (1 : 0 , a : 1), (0 : 1 , a + 1 : 1), (a : 1 , a + 1 : 1), - (a + 1 : 1 , a + 1 : 1), (1 : 1 , a + 1 : 1), (1 : 0 , a + 1 : 1), (0 : 1 , 1 : 1), (a : 1 , 1 : 1), - (a + 1 : 1 , 1 : 1), (1 : 1 , 1 : 1), (1 : 0 , 1 : 1), (0 : 1 , 1 : 0), (a : 1 , 1 : 0), (a + 1 : 1 , 1 : 0), - (1 : 1 , 1 : 0), (1 : 0 , 1 : 0)] + [(0 : 1 , 0 : 1), (a : 1 , 0 : 1), (a + 1 : 1 , 0 : 1), (1 : 1 , 0 : 1), + (1 : 0 , 0 : 1), (0 : 1 , a : 1), (a : 1 , a : 1), (a + 1 : 1 , a : 1), + (1 : 1 , a : 1), (1 : 0 , a : 1), (0 : 1 , a + 1 : 1), (a : 1 , a + 1 : 1), + (a + 1 : 1 , a + 1 : 1), (1 : 1 , a + 1 : 1), (1 : 0 , a + 1 : 1), + (0 : 1 , 1 : 1), (a : 1 , 1 : 1), (a + 1 : 1 , 1 : 1), (1 : 1 , 1 : 1), + (1 : 0 , 1 : 1), (0 : 1 , 1 : 0), (a : 1 , 1 : 0), (a + 1 : 1 , 1 : 0), + (1 : 1 , 1 : 0), (1 : 0 , 1 : 0)] """ if F is None: return list(self) diff --git a/src/sage/schemes/projective/projective_homset.py b/src/sage/schemes/projective/projective_homset.py index 9a8f41a929a..16cd4fd42a1 100644 --- a/src/sage/schemes/projective/projective_homset.py +++ b/src/sage/schemes/projective/projective_homset.py @@ -115,9 +115,9 @@ def points(self, **kwds): sage: P. = ProjectiveSpace(QQ, 1) sage: P(QQ).points(bound=4) [(-4 : 1), (-3 : 1), (-2 : 1), (-3/2 : 1), (-4/3 : 1), (-1 : 1), - (-3/4 : 1), (-2/3 : 1), (-1/2 : 1), (-1/3 : 1), (-1/4 : 1), (0 : 1), - (1/4 : 1), (1/3 : 1), (1/2 : 1), (2/3 : 1), (3/4 : 1), (1 : 0), (1 : 1), - (4/3 : 1), (3/2 : 1), (2 : 1), (3 : 1), (4 : 1)] + (-3/4 : 1), (-2/3 : 1), (-1/2 : 1), (-1/3 : 1), (-1/4 : 1), (0 : 1), + (1/4 : 1), (1/3 : 1), (1/2 : 1), (2/3 : 1), (3/4 : 1), (1 : 0), (1 : 1), + (4/3 : 1), (3/2 : 1), (2 : 1), (3 : 1), (4 : 1)] :: @@ -139,15 +139,16 @@ def points(self, **kwds): sage: P. = ProjectiveSpace(QQ, 2) sage: E = P.subscheme([(y^3-y*z^2) - (x^3-x*z^2), (y^3-y*z^2) + (x^3-x*z^2)]) sage: E(P.base_ring()).points() - [(-1 : -1 : 1), (-1 : 0 : 1), (-1 : 1 : 1), (0 : -1 : 1), (0 : 0 : 1), (0 : 1 : 1), - (1 : -1 : 1), (1 : 0 : 1), (1 : 1 : 1)] + [(-1 : -1 : 1), (-1 : 0 : 1), (-1 : 1 : 1), (0 : -1 : 1), (0 : 0 : 1), + (0 : 1 : 1), (1 : -1 : 1), (1 : 0 : 1), (1 : 1 : 1)] :: sage: P. = ProjectiveSpace(CC, 2) sage: E = P.subscheme([y^3 - x^3 - x*z^2, x*y*z]) sage: L = E(P.base_ring()).points(); sorted(L, key=str) - verbose 0 (...: projective_homset.py, points) Warning: computations in the numerical fields are inexact;points may be computed partially or incorrectly. + verbose 0 (...: projective_homset.py, points) Warning: computations in + the numerical fields are inexact;points may be computed partially or incorrectly. [(-0.500000000000000 + 0.866025403784439*I : 1.00000000000000 : 0.000000000000000), (-0.500000000000000 - 0.866025403784439*I : 1.00000000000000 : 0.000000000000000), (-1.00000000000000*I : 0.000000000000000 : 1.00000000000000), @@ -162,7 +163,8 @@ def points(self, **kwds): sage: P. = ProjectiveSpace(CDF, 2) sage: E = P.subscheme([y^2 + x^2 + z^2, x*y*z]) sage: len(E(P.base_ring()).points()) - verbose 0 (...: projective_homset.py, points) Warning: computations in the numerical fields are inexact;points may be computed partially or incorrectly. + verbose 0 (...: projective_homset.py, points) Warning: computations in + the numerical fields are inexact;points may be computed partially or incorrectly. 6 """ from sage.schemes.projective.projective_space import is_ProjectiveSpace @@ -490,34 +492,33 @@ def points(self, B=0): sage: from sage.schemes.projective.projective_homset import SchemeHomset_points_projective_ring sage: H = SchemeHomset_points_projective_ring(Spec(ZZ), ProjectiveSpace(ZZ, 2)) sage: H.points(3) - [(0 : 0 : 1), (0 : 1 : -3), (0 : 1 : -2), (0 : 1 : -1), (0 : 1 : 0), (0 - : 1 : 1), (0 : 1 : 2), (0 : 1 : 3), (0 : 2 : -3), (0 : 2 : -1), (0 : 2 : - 1), (0 : 2 : 3), (0 : 3 : -2), (0 : 3 : -1), (0 : 3 : 1), (0 : 3 : 2), - (1 : -3 : -3), (1 : -3 : -2), (1 : -3 : -1), (1 : -3 : 0), (1 : -3 : 1), - (1 : -3 : 2), (1 : -3 : 3), (1 : -2 : -3), (1 : -2 : -2), (1 : -2 : -1), - (1 : -2 : 0), (1 : -2 : 1), (1 : -2 : 2), (1 : -2 : 3), (1 : -1 : -3), - (1 : -1 : -2), (1 : -1 : -1), (1 : -1 : 0), (1 : -1 : 1), (1 : -1 : 2), - (1 : -1 : 3), (1 : 0 : -3), (1 : 0 : -2), (1 : 0 : -1), (1 : 0 : 0), (1 - : 0 : 1), (1 : 0 : 2), (1 : 0 : 3), (1 : 1 : -3), (1 : 1 : -2), (1 : 1 : - -1), (1 : 1 : 0), (1 : 1 : 1), (1 : 1 : 2), (1 : 1 : 3), (1 : 2 : -3), - (1 : 2 : -2), (1 : 2 : -1), (1 : 2 : 0), (1 : 2 : 1), (1 : 2 : 2), (1 : - 2 : 3), (1 : 3 : -3), (1 : 3 : -2), (1 : 3 : -1), (1 : 3 : 0), (1 : 3 : - 1), (1 : 3 : 2), (1 : 3 : 3), (2 : -3 : -3), (2 : -3 : -2), (2 : -3 : - -1), (2 : -3 : 0), (2 : -3 : 1), (2 : -3 : 2), (2 : -3 : 3), (2 : -2 : - -3), (2 : -2 : -1), (2 : -2 : 1), (2 : -2 : 3), (2 : -1 : -3), (2 : -1 : - -2), (2 : -1 : -1), (2 : -1 : 0), (2 : -1 : 1), (2 : -1 : 2), (2 : -1 : - 3), (2 : 0 : -3), (2 : 0 : -1), (2 : 0 : 1), (2 : 0 : 3), (2 : 1 : -3), - (2 : 1 : -2), (2 : 1 : -1), (2 : 1 : 0), (2 : 1 : 1), (2 : 1 : 2), (2 : - 1 : 3), (2 : 2 : -3), (2 : 2 : -1), (2 : 2 : 1), (2 : 2 : 3), (2 : 3 : - -3), (2 : 3 : -2), (2 : 3 : -1), (2 : 3 : 0), (2 : 3 : 1), (2 : 3 : 2), - (2 : 3 : 3), (3 : -3 : -2), (3 : -3 : -1), (3 : -3 : 1), (3 : -3 : 2), - (3 : -2 : -3), (3 : -2 : -2), (3 : -2 : -1), (3 : -2 : 0), (3 : -2 : 1), - (3 : -2 : 2), (3 : -2 : 3), (3 : -1 : -3), (3 : -1 : -2), (3 : -1 : -1), - (3 : -1 : 0), (3 : -1 : 1), (3 : -1 : 2), (3 : -1 : 3), (3 : 0 : -2), (3 - : 0 : -1), (3 : 0 : 1), (3 : 0 : 2), (3 : 1 : -3), (3 : 1 : -2), (3 : 1 - : -1), (3 : 1 : 0), (3 : 1 : 1), (3 : 1 : 2), (3 : 1 : 3), (3 : 2 : -3), - (3 : 2 : -2), (3 : 2 : -1), (3 : 2 : 0), (3 : 2 : 1), (3 : 2 : 2), (3 : - 2 : 3), (3 : 3 : -2), (3 : 3 : -1), (3 : 3 : 1), (3 : 3 : 2)] + [(0 : 0 : 1), (0 : 1 : -3), (0 : 1 : -2), (0 : 1 : -1), (0 : 1 : 0), (0 : 1 : 1), + (0 : 1 : 2), (0 : 1 : 3), (0 : 2 : -3), (0 : 2 : -1), (0 : 2 : 1), (0 : 2 : 3), + (0 : 3 : -2), (0 : 3 : -1), (0 : 3 : 1), (0 : 3 : 2), (1 : -3 : -3), + (1 : -3 : -2), (1 : -3 : -1), (1 : -3 : 0), (1 : -3 : 1), (1 : -3 : 2), + (1 : -3 : 3), (1 : -2 : -3), (1 : -2 : -2), (1 : -2 : -1), (1 : -2 : 0), + (1 : -2 : 1), (1 : -2 : 2), (1 : -2 : 3), (1 : -1 : -3), (1 : -1 : -2), + (1 : -1 : -1), (1 : -1 : 0), (1 : -1 : 1), (1 : -1 : 2), (1 : -1 : 3), + (1 : 0 : -3), (1 : 0 : -2), (1 : 0 : -1), (1 : 0 : 0), (1 : 0 : 1), (1 : 0 : 2), + (1 : 0 : 3), (1 : 1 : -3), (1 : 1 : -2), (1 : 1 : -1), (1 : 1 : 0), (1 : 1 : 1), + (1 : 1 : 2), (1 : 1 : 3), (1 : 2 : -3), (1 : 2 : -2), (1 : 2 : -1), (1 : 2 : 0), + (1 : 2 : 1), (1 : 2 : 2), (1 : 2 : 3), (1 : 3 : -3), (1 : 3 : -2), (1 : 3 : -1), + (1 : 3 : 0), (1 : 3 : 1), (1 : 3 : 2), (1 : 3 : 3), (2 : -3 : -3), + (2 : -3 : -2), (2 : -3 : -1), (2 : -3 : 0), (2 : -3 : 1), (2 : -3 : 2), + (2 : -3 : 3), (2 : -2 : -3), (2 : -2 : -1), (2 : -2 : 1), (2 : -2 : 3), + (2 : -1 : -3), (2 : -1 : -2), (2 : -1 : -1), (2 : -1 : 0), (2 : -1 : 1), + (2 : -1 : 2), (2 : -1 : 3), (2 : 0 : -3), (2 : 0 : -1), (2 : 0 : 1), + (2 : 0 : 3), (2 : 1 : -3), (2 : 1 : -2), (2 : 1 : -1), (2 : 1 : 0), (2 : 1 : 1), + (2 : 1 : 2), (2 : 1 : 3), (2 : 2 : -3), (2 : 2 : -1), (2 : 2 : 1), (2 : 2 : 3), + (2 : 3 : -3), (2 : 3 : -2), (2 : 3 : -1), (2 : 3 : 0), (2 : 3 : 1), (2 : 3 : 2), + (2 : 3 : 3), (3 : -3 : -2), (3 : -3 : -1), (3 : -3 : 1), (3 : -3 : 2), + (3 : -2 : -3), (3 : -2 : -2), (3 : -2 : -1), (3 : -2 : 0), (3 : -2 : 1), + (3 : -2 : 2), (3 : -2 : 3), (3 : -1 : -3), (3 : -1 : -2), (3 : -1 : -1), + (3 : -1 : 0), (3 : -1 : 1), (3 : -1 : 2), (3 : -1 : 3), (3 : 0 : -2), + (3 : 0 : -1), (3 : 0 : 1), (3 : 0 : 2), (3 : 1 : -3), (3 : 1 : -2), + (3 : 1 : -1), (3 : 1 : 0), (3 : 1 : 1), (3 : 1 : 2), (3 : 1 : 3), (3 : 2 : -3), + (3 : 2 : -2), (3 : 2 : -1), (3 : 2 : 0), (3 : 2 : 1), (3 : 2 : 2), (3 : 2 : 3), + (3 : 3 : -2), (3 : 3 : -1), (3 : 3 : 1), (3 : 3 : 2)] """ R = self.value_ring() if R == ZZ: diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 49933f8a413..7d2b540adde 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -1388,7 +1388,7 @@ def local_height(self, v, prec=None): sage: P. = ProjectiveSpace(QQ, 1) sage: H = Hom(P, P) - sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]); + sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]) sage: f.local_height(1331) 7.19368581839511 @@ -1396,7 +1396,7 @@ def local_height(self, v, prec=None): sage: P. = ProjectiveSpace(QQ, 1) sage: H = Hom(P, P) - sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]); + sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]) sage: f.local_height(1331, prec=2) 8.0 @@ -1404,7 +1404,7 @@ def local_height(self, v, prec=None): sage: P. = ProjectiveSpace(QQ, 2) sage: H = Hom(P, P) - sage: f = H([4*x^2 + 3/100*y^2, 8/210*x*y, 1/10000*z^2]); + sage: f = H([4*x^2 + 3/100*y^2, 8/210*x*y, 1/10000*z^2]) sage: f.local_height(2) 2.77258872223978 sage: f.normalize_coordinates() @@ -1446,7 +1446,7 @@ def local_height_arch(self, i, prec=None): sage: P. = ProjectiveSpace(QQ, 1) sage: H = Hom(P, P) - sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]); + sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]) sage: f.local_height_arch(0) 5.34710753071747 @@ -1454,7 +1454,7 @@ def local_height_arch(self, i, prec=None): sage: P. = ProjectiveSpace(QQ, 1) sage: H = Hom(P, P) - sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]); + sage: f = H([1/1331*x^2 + 1/4000*y^2, 210*x*y]) sage: f.local_height_arch(0, prec=5) 5.2 @@ -1493,8 +1493,8 @@ def wronskian_ideal(self): sage: H = End(P) # optional - sage.rings.number_field sage: f = H([x^2 - w*y^2, w*y^2]) # optional - sage.rings.number_field sage: f.wronskian_ideal() # optional - sage.rings.number_field - Ideal ((4*w)*x*y) of Multivariate Polynomial Ring in x, y over Number - Field in w with defining polynomial x^2 + 11 + Ideal ((4*w)*x*y) of Multivariate Polynomial Ring in x, y + over Number Field in w with defining polynomial x^2 + 11 :: @@ -1503,8 +1503,8 @@ def wronskian_ideal(self): sage: H = Hom(P,P2) sage: f = H([x^2 - 2*y^2, y^2, x*y]) sage: f.wronskian_ideal() - Ideal (4*x*y, 2*x^2 + 4*y^2, -2*y^2) of Multivariate Polynomial Ring in - x, y over Rational Field + Ideal (4*x*y, 2*x^2 + 4*y^2, -2*y^2) of Multivariate Polynomial Ring + in x, y over Rational Field """ dom = self.domain() from sage.schemes.projective.projective_space import is_ProjectiveSpace @@ -1551,8 +1551,9 @@ def rational_preimages(self, Q, k=1): sage: P. = ProjectiveSpace(QQ, 2) sage: H = End(P) - sage: f = H([76*x^2 - 180*x*y + 45*y^2 + 14*x*z + 45*y*z\ - - 90*z^2, 67*x^2 - 180*x*y - 157*x*z + 90*y*z, -90*z^2]) + sage: f = H([76*x^2 - 180*x*y + 45*y^2 + 14*x*z + 45*y*z - 90*z^2, + ....: 67*x^2 - 180*x*y - 157*x*z + 90*y*z, + ....: -90*z^2]) sage: f.rational_preimages(P(-9, -4, 1)) [(0 : 4 : 1)] @@ -1568,8 +1569,9 @@ def rational_preimages(self, Q, k=1): sage: P. = ProjectiveSpace(QQ, 3) sage: H = End(P) - sage: f = H([x^2 - 2*y*w - 3*w^2, -2*x^2 + y^2 - 2*x*z\ - + 4*y*w + 3*w^2, x^2 - y^2 + 2*x*z + z^2 - 2*y*w - w^2, w^2]) + sage: f = H([x^2 - 2*y*w - 3*w^2, -2*x^2 + y^2 - 2*x*z + 4*y*w + 3*w^2, + ....: x^2 - y^2 + 2*x*z + z^2 - 2*y*w - w^2, + ....: w^2]) sage: f.rational_preimages(P(0, -1, 0, 1)) [] @@ -1612,10 +1614,10 @@ def rational_preimages(self, Q, k=1): sage: f = H([x^2-z^2, y^2, z^2-x^2]) sage: f.rational_preimages(X([0, 1, 0])) Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - x^2 - z^2, - -x^2 + z^2, - 0, - -x^2 + z^2 + x^2 - z^2, + -x^2 + z^2, + 0, + -x^2 + z^2 :: @@ -1800,9 +1802,9 @@ def base_indeterminacy_locus(self): sage: f = H([x*z - y*z, x^2 - y^2, z^2]) sage: f.base_indeterminacy_locus() Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - x*z - y*z, - x^2 - y^2, - z^2 + x*z - y*z, + x^2 - y^2, + z^2 :: @@ -1812,9 +1814,9 @@ def base_indeterminacy_locus(self): sage: f.base_indeterminacy_locus() Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - x^2, - y^2, - z^2 + x^2, + y^2, + z^2 :: @@ -1861,8 +1863,8 @@ def indeterminacy_locus(self): sage: H = End(P) sage: f = H([x^2, y^2, z^2]) sage: f.indeterminacy_locus() - ... DeprecationWarning: The meaning of indeterminacy_locus() has changed. Read the docstring. - See /~https://github.com/sagemath/sage/issues/29145 for details. + ... DeprecationWarning: The meaning of indeterminacy_locus() has changed. + Read the docstring. See /~https://github.com/sagemath/sage/issues/29145 for details. Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: z, y, @@ -1918,8 +1920,8 @@ def indeterminacy_points(self, F=None, base=False): sage: H = End(P) sage: f = H([x*z - y*z, x^2 - y^2, z^2]) sage: f.indeterminacy_points() - ... DeprecationWarning: The meaning of indeterminacy_locus() has changed. Read the docstring. - See /~https://github.com/sagemath/sage/issues/29145 for details. + ... DeprecationWarning: The meaning of indeterminacy_locus() has changed. + Read the docstring. See /~https://github.com/sagemath/sage/issues/29145 for details. [(-1 : 1 : 0), (1 : 1 : 0)] :: @@ -1969,21 +1971,19 @@ def indeterminacy_points(self, F=None, base=False): sage: H = End(P) # optional - sage.rings.padics sage: f = H([x^2 - 7*y^2, y^2 - z^2, x^2 - 7*z^2]) # optional - sage.rings.padics sage: f.indeterminacy_points(base=True) # optional - sage.rings.padics - [(2 + 3 + 3^2 + 2*3^3 + 2*3^5 + 2*3^6 + 3^8 + 3^9 + 2*3^11 + 3^15 + - 2*3^16 + 3^18 + O(3^20) : 1 + O(3^20) : 1 + O(3^20)), - (2 + 3 + 3^2 + 2*3^3 + 2*3^5 + 2*3^6 + 3^8 + 3^9 + 2*3^11 + 3^15 + - 2*3^16 + 3^18 + O(3^20) : 2 + 2*3 + 2*3^2 + 2*3^3 + 2*3^4 + 2*3^5 + - 2*3^6 + 2*3^7 + 2*3^8 + 2*3^9 + 2*3^10 + 2*3^11 + 2*3^12 + 2*3^13 + - 2*3^14 + 2*3^15 + 2*3^16 + 2*3^17 + 2*3^18 + 2*3^19 + O(3^20) : 1 + - O(3^20)), - (1 + 3 + 3^2 + 2*3^4 + 2*3^7 + 3^8 + 3^9 + 2*3^10 + 2*3^12 + 2*3^13 + - 2*3^14 + 3^15 + 2*3^17 + 3^18 + 2*3^19 + O(3^20) : 1 + O(3^20) : 1 + - O(3^20)), - (1 + 3 + 3^2 + 2*3^4 + 2*3^7 + 3^8 + 3^9 + 2*3^10 + 2*3^12 + 2*3^13 + - 2*3^14 + 3^15 + 2*3^17 + 3^18 + 2*3^19 + O(3^20) : 2 + 2*3 + 2*3^2 + - 2*3^3 + 2*3^4 + 2*3^5 + 2*3^6 + 2*3^7 + 2*3^8 + 2*3^9 + 2*3^10 + 2*3^11 - + 2*3^12 + 2*3^13 + 2*3^14 + 2*3^15 + 2*3^16 + 2*3^17 + 2*3^18 + 2*3^19 - + O(3^20) : 1 + O(3^20))] + [(2 + 3 + 3^2 + 2*3^3 + 2*3^5 + 2*3^6 + 3^8 + + 3^9 + 2*3^11 + 3^15 + 2*3^16 + 3^18 + O(3^20) : 1 + O(3^20) : 1 + O(3^20)), + (2 + 3 + 3^2 + 2*3^3 + 2*3^5 + 2*3^6 + 3^8 + 3^9 + 2*3^11 + 3^15 + + 2*3^16 + 3^18 + O(3^20) : 2 + 2*3 + 2*3^2 + 2*3^3 + 2*3^4 + 2*3^5 + + 2*3^6 + 2*3^7 + 2*3^8 + 2*3^9 + 2*3^10 + 2*3^11 + 2*3^12 + 2*3^13 + + 2*3^14 + 2*3^15 + 2*3^16 + 2*3^17 + 2*3^18 + 2*3^19 + O(3^20) : 1 + O(3^20)), + (1 + 3 + 3^2 + 2*3^4 + 2*3^7 + 3^8 + 3^9 + 2*3^10 + 2*3^12 + 2*3^13 + + 2*3^14 + 3^15 + 2*3^17 + 3^18 + 2*3^19 + O(3^20) : 1 + O(3^20) : 1 + O(3^20)), + (1 + 3 + 3^2 + 2*3^4 + 2*3^7 + 3^8 + 3^9 + 2*3^10 + 2*3^12 + 2*3^13 + + 2*3^14 + 3^15 + 2*3^17 + 3^18 + 2*3^19 + O(3^20) : 2 + 2*3 + 2*3^2 + + 2*3^3 + 2*3^4 + 2*3^5 + 2*3^6 + 2*3^7 + 2*3^8 + 2*3^9 + 2*3^10 + 2*3^11 + + 2*3^12 + 2*3^13 + 2*3^14 + 2*3^15 + 2*3^16 + 2*3^17 + 2*3^18 + 2*3^19 + + O(3^20) : 1 + O(3^20))] """ if F is None: fcn = self diff --git a/src/sage/schemes/projective/projective_point.py b/src/sage/schemes/projective/projective_point.py index c1da28f1748..4bb8ab345b2 100644 --- a/src/sage/schemes/projective/projective_point.py +++ b/src/sage/schemes/projective/projective_point.py @@ -911,8 +911,8 @@ def is_preperiodic(self, f, err=0.1, return_period=False): - boolean -- ``True`` if preperiodic. - - if return_period is ``True``, then ``(0,0)`` if wandering, and ``(m,n)`` - if preperiod ``m`` and period ``n``. + - if ``return_period`` is ``True``, then ``(0,0)`` if wandering, and ``(m,n)`` + if preperiod ``m`` and period ``n``. EXAMPLES:: diff --git a/src/sage/schemes/projective/projective_rational_point.py b/src/sage/schemes/projective/projective_rational_point.py index 9702ec87d32..ddef9a14d26 100644 --- a/src/sage/schemes/projective/projective_rational_point.py +++ b/src/sage/schemes/projective/projective_rational_point.py @@ -110,15 +110,15 @@ def enum_projective_rational_field(X, B): sage: P3. = ProjectiveSpace(3, QQ) sage: enum_projective_rational_field(P3, 1) [(-1 : -1 : -1 : 1), (-1 : -1 : 0 : 1), (-1 : -1 : 1 : 0), (-1 : -1 : 1 : 1), - (-1 : 0 : -1 : 1), (-1 : 0 : 0 : 1), (-1 : 0 : 1 : 0), (-1 : 0 : 1 : 1), - (-1 : 1 : -1 : 1), (-1 : 1 : 0 : 0), (-1 : 1 : 0 : 1), (-1 : 1 : 1 : 0), - (-1 : 1 : 1 : 1), (0 : -1 : -1 : 1), (0 : -1 : 0 : 1), (0 : -1 : 1 : 0), - (0 : -1 : 1 : 1), (0 : 0 : -1 : 1), (0 : 0 : 0 : 1), (0 : 0 : 1 : 0), - (0 : 0 : 1 : 1), (0 : 1 : -1 : 1), (0 : 1 : 0 : 0), (0 : 1 : 0 : 1), - (0 : 1 : 1 : 0), (0 : 1 : 1 : 1), (1 : -1 : -1 : 1), (1 : -1 : 0 : 1), - (1 : -1 : 1 : 0), (1 : -1 : 1 : 1), (1 : 0 : -1 : 1), (1 : 0 : 0 : 0), - (1 : 0 : 0 : 1), (1 : 0 : 1 : 0), (1 : 0 : 1 : 1), (1 : 1 : -1 : 1), - (1 : 1 : 0 : 0), (1 : 1 : 0 : 1), (1 : 1 : 1 : 0), (1 : 1 : 1 : 1)] + (-1 : 0 : -1 : 1), (-1 : 0 : 0 : 1), (-1 : 0 : 1 : 0), (-1 : 0 : 1 : 1), + (-1 : 1 : -1 : 1), (-1 : 1 : 0 : 0), (-1 : 1 : 0 : 1), (-1 : 1 : 1 : 0), + (-1 : 1 : 1 : 1), (0 : -1 : -1 : 1), (0 : -1 : 0 : 1), (0 : -1 : 1 : 0), + (0 : -1 : 1 : 1), (0 : 0 : -1 : 1), (0 : 0 : 0 : 1), (0 : 0 : 1 : 0), + (0 : 0 : 1 : 1), (0 : 1 : -1 : 1), (0 : 1 : 0 : 0), (0 : 1 : 0 : 1), + (0 : 1 : 1 : 0), (0 : 1 : 1 : 1), (1 : -1 : -1 : 1), (1 : -1 : 0 : 1), + (1 : -1 : 1 : 0), (1 : -1 : 1 : 1), (1 : 0 : -1 : 1), (1 : 0 : 0 : 0), + (1 : 0 : 0 : 1), (1 : 0 : 1 : 0), (1 : 0 : 1 : 1), (1 : 1 : -1 : 1), + (1 : 1 : 0 : 0), (1 : 1 : 0 : 1), (1 : 1 : 1 : 0), (1 : 1 : 1 : 1)] ALGORITHM: @@ -259,8 +259,8 @@ def enum_projective_finite_field(X): sage: C = Curve(X^3 - Y^3 + Z^2*Y) # optional - sage.rings.finite_rings sage: enum_projective_finite_field(C(F)) # optional - sage.rings.finite_rings [(0 : 0 : 1), (0 : 1 : 1), (0 : 2 : 1), (1 : 1 : 0), (a + 1 : 2*a : 1), - (a + 1 : 2*a + 1 : 1), (a + 1 : 2*a + 2 : 1), (2*a + 2 : a : 1), - (2*a + 2 : a + 1 : 1), (2*a + 2 : a + 2 : 1)] + (a + 1 : 2*a + 1 : 1), (a + 1 : 2*a + 2 : 1), (2*a + 2 : a : 1), + (2*a + 2 : a + 1 : 1), (2*a + 2 : a + 2 : 1)] :: @@ -268,11 +268,11 @@ def enum_projective_finite_field(X): sage: P2F. = ProjectiveSpace(2, F) # optional - sage.rings.finite_rings sage: enum_projective_finite_field(P2F) # optional - sage.rings.finite_rings [(0 : 0 : 1), (0 : 1 : 0), (0 : 1 : 1), (0 : 2 : 1), (0 : 3 : 1), (0 : 4 : 1), - (1 : 0 : 0), (1 : 0 : 1), (1 : 1 : 0), (1 : 1 : 1), (1 : 2 : 1), (1 : 3 : 1), - (1 : 4 : 1), (2 : 0 : 1), (2 : 1 : 0), (2 : 1 : 1), (2 : 2 : 1), (2 : 3 : 1), - (2 : 4 : 1), (3 : 0 : 1), (3 : 1 : 0), (3 : 1 : 1), (3 : 2 : 1), (3 : 3 : 1), - (3 : 4 : 1), (4 : 0 : 1), (4 : 1 : 0), (4 : 1 : 1), (4 : 2 : 1), (4 : 3 : 1), - (4 : 4 : 1)] + (1 : 0 : 0), (1 : 0 : 1), (1 : 1 : 0), (1 : 1 : 1), (1 : 2 : 1), (1 : 3 : 1), + (1 : 4 : 1), (2 : 0 : 1), (2 : 1 : 0), (2 : 1 : 1), (2 : 2 : 1), (2 : 3 : 1), + (2 : 4 : 1), (3 : 0 : 1), (3 : 1 : 0), (3 : 1 : 1), (3 : 2 : 1), (3 : 3 : 1), + (3 : 4 : 1), (4 : 0 : 1), (4 : 1 : 0), (4 : 1 : 1), (4 : 2 : 1), (4 : 3 : 1), + (4 : 4 : 1)] ALGORITHM: diff --git a/src/sage/schemes/projective/projective_space.py b/src/sage/schemes/projective/projective_space.py index 227c5eb50ed..b81b45ab3b0 100644 --- a/src/sage/schemes/projective/projective_space.py +++ b/src/sage/schemes/projective/projective_space.py @@ -1232,7 +1232,8 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): sage: F. = FunctionField(QQ) sage: P. = ProjectiveSpace(F, 1) sage: P.chebyshev_polynomial(4, monic=True) - Dynamical System of Projective Space of dimension 1 over Rational function field in t over Rational Field + Dynamical System of Projective Space of dimension 1 + over Rational function field in t over Rational Field Defn: Defined on coordinates by sending (y : z) to (y^4 + (-4)*y^2*z^2 + 2*z^4 : z^4) """ @@ -2055,8 +2056,8 @@ def subscheme_from_Chow_form(self, Ch, dim): x0^2 - 2*x0*x2 + x2^2 sage: I = Y.defining_ideal() # optional - sage.rings.finite_rings sage: I.saturation(I.ring().ideal(list(I.ring().gens())))[0] # optional - sage.rings.finite_rings - Ideal (x0 - x2, x1*x2 + x3^2) of Multivariate Polynomial Ring in x0, x1, - x2, x3 over Finite Field of size 7 + Ideal (x0 - x2, x1*x2 + x3^2) of Multivariate Polynomial Ring + in x0, x1, x2, x3 over Finite Field of size 7 """ if not Ch.is_homogeneous(): raise ValueError("Chow form must be a homogeneous polynomial") @@ -2343,16 +2344,15 @@ def rational_points(self, bound=0): sage: PP = ProjectiveSpace(2, QQ) sage: PP.rational_points(2) [(-2 : -2 : 1), (-1 : -2 : 1), (0 : -2 : 1), (1 : -2 : 1), (2 : -2 : 1), - (-2 : -1 : 1), (-1 : -1 : 1), (0 : -1 : 1), (1 : -1 : 1), (2 : -1 : 1), - (-2 : 0 : 1), (-1 : 0 : 1), (0 : 0 : 1), (1 : 0 : 1), (2 : 0 : 1), (-2 : - 1 : 1), (-1 : 1 : 1), (0 : 1 : 1), (1 : 1 : 1), (2 : 1 : 1), (-2 : 2 : - 1), (-1 : 2 : 1), (0 : 2 : 1), (1 : 2 : 1), (2 : 2 : 1), (-1/2 : -1 : - 1), (1/2 : -1 : 1), (-1 : -1/2 : 1), (-1/2 : -1/2 : 1), (0 : -1/2 : 1), - (1/2 : -1/2 : 1), (1 : -1/2 : 1), (-1/2 : 0 : 1), (1/2 : 0 : 1), (-1 : - 1/2 : 1), (-1/2 : 1/2 : 1), (0 : 1/2 : 1), (1/2 : 1/2 : 1), (1 : 1/2 : - 1), (-1/2 : 1 : 1), (1/2 : 1 : 1), (-2 : 1 : 0), (-1 : 1 : 0), (0 : 1 : - 0), (1 : 1 : 0), (2 : 1 : 0), (-1/2 : 1 : 0), (1/2 : 1 : 0), (1 : 0 : - 0)] + (-2 : -1 : 1), (-1 : -1 : 1), (0 : -1 : 1), (1 : -1 : 1), (2 : -1 : 1), + (-2 : 0 : 1), (-1 : 0 : 1), (0 : 0 : 1), (1 : 0 : 1), (2 : 0 : 1), (-2 : 1 : 1), + (-1 : 1 : 1), (0 : 1 : 1), (1 : 1 : 1), (2 : 1 : 1), (-2 : 2 : 1), + (-1 : 2 : 1), (0 : 2 : 1), (1 : 2 : 1), (2 : 2 : 1), (-1/2 : -1 : 1), + (1/2 : -1 : 1), (-1 : -1/2 : 1), (-1/2 : -1/2 : 1), (0 : -1/2 : 1), + (1/2 : -1/2 : 1), (1 : -1/2 : 1), (-1/2 : 0 : 1), (1/2 : 0 : 1), (-1 : 1/2 : 1), + (-1/2 : 1/2 : 1), (0 : 1/2 : 1), (1/2 : 1/2 : 1), (1 : 1/2 : 1), (-1/2 : 1 : 1), + (1/2 : 1 : 1), (-2 : 1 : 0), (-1 : 1 : 0), (0 : 1 : 0), (1 : 1 : 0), + (2 : 1 : 0), (-1/2 : 1 : 0), (1/2 : 1 : 0), (1 : 0 : 0)] AUTHORS: From 6d21c17007b05234ad4737333dbc002f8de29b32 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 23 Mar 2023 22:54:05 -0700 Subject: [PATCH 087/135] sage.schemes: More # optional and cosmetic doctest changes --- .../cyclic_covers/cycliccover_generic.py | 4 +- .../schemes/elliptic_curves/constructor.py | 8 +- src/sage/schemes/elliptic_curves/ell_field.py | 277 ++-- .../schemes/elliptic_curves/ell_generic.py | 761 ++++++----- .../elliptic_curves/ell_modular_symbols.py | 57 +- src/sage/schemes/elliptic_curves/ell_point.py | 1139 +++++++++-------- .../elliptic_curves/ell_rational_field.py | 199 +-- src/sage/schemes/elliptic_curves/ell_wp.py | 64 +- .../schemes/elliptic_curves/formal_group.py | 31 +- src/sage/schemes/elliptic_curves/heegner.py | 222 ++-- .../schemes/elliptic_curves/saturation.py | 122 +- .../elliptic_curves/weierstrass_morphism.py | 134 +- src/sage/schemes/generic/algebraic_scheme.py | 2 +- src/sage/schemes/generic/divisor_group.py | 2 +- src/sage/schemes/generic/homset.py | 6 +- src/sage/schemes/generic/morphism.py | 4 +- .../hyperelliptic_curves/constructor.py | 80 +- .../hyperelliptic_finite_field.py | 92 +- .../hyperelliptic_generic.py | 151 ++- .../hyperelliptic_curves/invariants.py | 57 +- .../hyperelliptic_curves/jacobian_generic.py | 110 +- .../hyperelliptic_curves/jacobian_homset.py | 53 +- .../hyperelliptic_curves/jacobian_morphism.py | 276 ++-- .../schemes/hyperelliptic_curves/mestre.py | 66 +- src/sage/schemes/plane_conics/con_field.py | 53 +- src/sage/schemes/plane_conics/constructor.py | 19 +- .../schemes/projective/projective_space.py | 2 +- src/sage/schemes/toric/homset.py | 8 +- src/sage/schemes/toric/library.py | 2 +- 29 files changed, 2191 insertions(+), 1810 deletions(-) diff --git a/src/sage/schemes/cyclic_covers/cycliccover_generic.py b/src/sage/schemes/cyclic_covers/cycliccover_generic.py index dde1234f344..ff5d492b41f 100644 --- a/src/sage/schemes/cyclic_covers/cycliccover_generic.py +++ b/src/sage/schemes/cyclic_covers/cycliccover_generic.py @@ -12,7 +12,7 @@ Projective Plane Curve over Integer Ring defined by x0^5 + x0^4*x1 + x1^5 - x2^5 sage: D.change_ring(QQ).genus() 6 - sage: C.change_ring(GF(5)) + sage: C.change_ring(GF(5)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: As the characteristic divides the order of the cover, this model is not smooth. @@ -117,7 +117,7 @@ def change_ring(self, R): sage: ZZx. = ZZ[] sage: C = CyclicCover(5, x^5 + x + 1) - sage: C.change_ring(GF(5)) + sage: C.change_ring(GF(5)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: As the characteristic divides the order of the cover, diff --git a/src/sage/schemes/elliptic_curves/constructor.py b/src/sage/schemes/elliptic_curves/constructor.py index dc58f557744..e8c71899c19 100644 --- a/src/sage/schemes/elliptic_curves/constructor.py +++ b/src/sage/schemes/elliptic_curves/constructor.py @@ -460,8 +460,8 @@ def create_object(self, version, key, **kwds): EXAMPLES:: - sage: E = EllipticCurve.create_object(0, (GF(3), (1, 2, 0, 1, 2))) - sage: type(E) + sage: E = EllipticCurve.create_object(0, (GF(3), (1, 2, 0, 1, 2))) # optional - sage.rings.finite_rings + sage: type(E) # optional - sage.rings.finite_rings .. NOTE:: @@ -1370,8 +1370,8 @@ def projective_point(p): sage: from sage.schemes.elliptic_curves.constructor import projective_point sage: projective_point([4/5, 6/5, 8/5]) [2, 3, 4] - sage: F = GF(11) - sage: projective_point([F(4), F(8), F(2)]) + sage: F = GF(11) # optional - sage.rings.finite_rings + sage: projective_point([F(4), F(8), F(2)]) # optional - sage.rings.finite_rings [4, 8, 2] """ from sage.rings.integer import GCD_list diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py index a974fbe3729..322058415c1 100644 --- a/src/sage/schemes/elliptic_curves/ell_field.py +++ b/src/sage/schemes/elliptic_curves/ell_field.py @@ -249,9 +249,9 @@ def quartic_twist(self, D): EXAMPLES:: sage: E = EllipticCurve_from_j(GF(13)(1728)); E # optional - sage.rings.finite_rings - Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 13 + Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 13 sage: E1 = E.quartic_twist(2); E1 # optional - sage.rings.finite_rings - Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 13 + Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 13 sage: E.is_isomorphic(E1) # optional - sage.rings.finite_rings False sage: E.is_isomorphic(E1, GF(13^2,'a')) # optional - sage.rings.finite_rings @@ -1334,8 +1334,8 @@ def isogenies_prime_degree(self, l=None, max_l=31): Examples over finite fields:: - sage: E = EllipticCurve(GF(next_prime(1000000)), [7,8]) - sage: E.isogenies_prime_degree(2) + sage: E = EllipticCurve(GF(next_prime(1000000)), [7,8]) # optional - sage.rings.finite_rings + sage: E.isogenies_prime_degree(2) # optional - sage.rings.finite_rings [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 970389*x + 794257 over Finite Field of size 1000003, @@ -1345,22 +1345,22 @@ def isogenies_prime_degree(self, l=None, max_l=31): Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 999960*x + 78 over Finite Field of size 1000003] - sage: E.isogenies_prime_degree(3) + sage: E.isogenies_prime_degree(3) # optional - sage.rings.finite_rings [] - sage: E.isogenies_prime_degree(5) + sage: E.isogenies_prime_degree(5) # optional - sage.rings.finite_rings [] - sage: E.isogenies_prime_degree(7) + sage: E.isogenies_prime_degree(7) # optional - sage.rings.finite_rings [] - sage: E.isogenies_prime_degree(11) + sage: E.isogenies_prime_degree(11) # optional - sage.rings.finite_rings [] - sage: E.isogenies_prime_degree(13) + sage: E.isogenies_prime_degree(13) # optional - sage.rings.finite_rings [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 878063*x + 845666 over Finite Field of size 1000003, Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 375648*x + 342776 over Finite Field of size 1000003] - sage: E.isogenies_prime_degree(max_l=13) + sage: E.isogenies_prime_degree(max_l=13) # optional - sage.rings.finite_rings [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 970389*x + 794257 over Finite Field of size 1000003, @@ -1376,7 +1376,7 @@ def isogenies_prime_degree(self, l=None, max_l=31): Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 375648*x + 342776 over Finite Field of size 1000003] - sage: E.isogenies_prime_degree() # Default limit of 31 + sage: E.isogenies_prime_degree() # Default limit of 31 # optional - sage.rings.finite_rings [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 970389*x + 794257 over Finite Field of size 1000003, @@ -1402,10 +1402,10 @@ def isogenies_prime_degree(self, l=None, max_l=31): from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 to Elliptic Curve defined by y^2 = x^3 + 390065*x + 605596 over Finite Field of size 1000003] - sage: E = EllipticCurve(GF(17), [2,0]) - sage: E.isogenies_prime_degree(3) + sage: E = EllipticCurve(GF(17), [2,0]) # optional - sage.rings.finite_rings + sage: E.isogenies_prime_degree(3) # optional - sage.rings.finite_rings [] - sage: E.isogenies_prime_degree(2) + sage: E.isogenies_prime_degree(2) # optional - sage.rings.finite_rings [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 2*x over Finite Field of size 17 to Elliptic Curve defined by y^2 = x^3 + 9*x over Finite Field of size 17, @@ -1419,119 +1419,138 @@ def isogenies_prime_degree(self, l=None, max_l=31): The base field matters, over a field extension we find more isogenies:: - sage: E = EllipticCurve(GF(13), [2,8]) - sage: E.isogenies_prime_degree(max_l=3) + sage: E = EllipticCurve(GF(13), [2,8]) # optional - sage.rings.finite_rings + sage: E.isogenies_prime_degree(max_l=3) # optional - sage.rings.finite_rings [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field of size 13 - to Elliptic Curve defined by y^2 = x^3 + 7*x + 4 over Finite Field of size 13, + to Elliptic Curve defined by y^2 = x^3 + 7*x + 4 over Finite Field of size 13, Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field of size 13 - to Elliptic Curve defined by y^2 = x^3 + 9*x + 11 over Finite Field of size 13] - sage: E = EllipticCurve(GF(13^6), [2,8]) - sage: E.isogenies_prime_degree(max_l=3) + to Elliptic Curve defined by y^2 = x^3 + 9*x + 11 over Finite Field of size 13] + sage: E = EllipticCurve(GF(13^6), [2,8]) # optional - sage.rings.finite_rings + sage: E.isogenies_prime_degree(max_l=3) # optional - sage.rings.finite_rings [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 - to Elliptic Curve defined by y^2 = x^3 + 7*x + 4 over Finite Field in z6 of size 13^6, + to Elliptic Curve defined by y^2 = x^3 + 7*x + 4 over Finite Field in z6 of size 13^6, Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 - to Elliptic Curve defined by y^2 = x^3 + (2*z6^5+6*z6^4+9*z6^3+8*z6+7)*x + (3*z6^5+9*z6^4+7*z6^3+12*z6+7) over Finite Field in z6 of size 13^6, + to Elliptic Curve defined by y^2 = x^3 + (2*z6^5+6*z6^4+9*z6^3+8*z6+7)*x + (3*z6^5+9*z6^4+7*z6^3+12*z6+7) over Finite Field in z6 of size 13^6, Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 - to Elliptic Curve defined by y^2 = x^3 + (11*z6^5+7*z6^4+4*z6^3+5*z6+9)*x + (10*z6^5+4*z6^4+6*z6^3+z6+10) over Finite Field in z6 of size 13^6, + to Elliptic Curve defined by y^2 = x^3 + (11*z6^5+7*z6^4+4*z6^3+5*z6+9)*x + (10*z6^5+4*z6^4+6*z6^3+z6+10) over Finite Field in z6 of size 13^6, Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 - to Elliptic Curve defined by y^2 = x^3 + 9*x + 11 over Finite Field in z6 of size 13^6, + to Elliptic Curve defined by y^2 = x^3 + 9*x + 11 over Finite Field in z6 of size 13^6, Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 - to Elliptic Curve defined by y^2 = x^3 + (3*z6^5+5*z6^4+8*z6^3+11*z6^2+5*z6+12)*x + (12*z6^5+6*z6^4+8*z6^3+4*z6^2+7*z6+6) over Finite Field in z6 of size 13^6, + to Elliptic Curve defined by y^2 = x^3 + (3*z6^5+5*z6^4+8*z6^3+11*z6^2+5*z6+12)*x + (12*z6^5+6*z6^4+8*z6^3+4*z6^2+7*z6+6) over Finite Field in z6 of size 13^6, Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 - to Elliptic Curve defined by y^2 = x^3 + (7*z6^4+12*z6^3+7*z6^2+4)*x + (6*z6^5+10*z6^3+12*z6^2+10*z6+8) over Finite Field in z6 of size 13^6, + to Elliptic Curve defined by y^2 = x^3 + (7*z6^4+12*z6^3+7*z6^2+4)*x + (6*z6^5+10*z6^3+12*z6^2+10*z6+8) over Finite Field in z6 of size 13^6, Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 - to Elliptic Curve defined by y^2 = x^3 + (10*z6^5+z6^4+6*z6^3+8*z6^2+8*z6)*x + (8*z6^5+7*z6^4+8*z6^3+10*z6^2+9*z6+7) over Finite Field in z6 of size 13^6] + to Elliptic Curve defined by y^2 = x^3 + (10*z6^5+z6^4+6*z6^3+8*z6^2+8*z6)*x + (8*z6^5+7*z6^4+8*z6^3+10*z6^2+9*z6+7) over Finite Field in z6 of size 13^6] If the degree equals the characteristic, we find only separable isogenies:: - sage: E = EllipticCurve(GF(13), [2,8]) - sage: E.isogenies_prime_degree(13) + sage: E = EllipticCurve(GF(13), [2,8]) # optional - sage.rings.finite_rings + sage: E.isogenies_prime_degree(13) # optional - sage.rings.finite_rings [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field of size 13 to Elliptic Curve defined by y^2 = x^3 + 6*x + 5 over Finite Field of size 13] - sage: E = EllipticCurve(GF(5), [1,1]) - sage: E.isogenies_prime_degree(5) + sage: E = EllipticCurve(GF(5), [1,1]) # optional - sage.rings.finite_rings + sage: E.isogenies_prime_degree(5) # optional - sage.rings.finite_rings [Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 5 to Elliptic Curve defined by y^2 = x^3 + x + 4 over Finite Field of size 5] - sage: k. = GF(3^4) - sage: E = EllipticCurve(k, [0,1,0,0,a]) - sage: E.isogenies_prime_degree(3) + sage: k. = GF(3^4) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(k, [0,1,0,0,a]) # optional - sage.rings.finite_rings + sage: E.isogenies_prime_degree(3) # optional - sage.rings.finite_rings [Isogeny of degree 3 - from Elliptic Curve defined by y^2 = x^3 + x^2 + a over Finite Field in a of size 3^4 - to Elliptic Curve defined by y^2 = x^3 + x^2 + (2*a^3+a^2+2)*x + (a^2+2) over Finite Field in a of size 3^4] + from Elliptic Curve defined by y^2 = x^3 + x^2 + a + over Finite Field in a of size 3^4 + to Elliptic Curve defined by y^2 = x^3 + x^2 + (2*a^3+a^2+2)*x + (a^2+2) + over Finite Field in a of size 3^4] In the supersingular case, there are no separable isogenies of degree equal to the characteristic:: - sage: E = EllipticCurve(GF(5), [0,1]) - sage: E.isogenies_prime_degree(5) + sage: E = EllipticCurve(GF(5), [0,1]) # optional - sage.rings.finite_rings + sage: E.isogenies_prime_degree(5) # optional - sage.rings.finite_rings [] An example over a rational function field:: - sage: R. = GF(5)[] - sage: K = R.fraction_field() - sage: E = EllipticCurve(K, [1, t^5]) - sage: E.isogenies_prime_degree(5) + sage: R. = GF(5)[] # optional - sage.rings.finite_rings + sage: K = R.fraction_field() # optional - sage.rings.finite_rings + sage: E = EllipticCurve(K, [1, t^5]) # optional - sage.rings.finite_rings + sage: E.isogenies_prime_degree(5) # optional - sage.rings.finite_rings [Isogeny of degree 5 - from Elliptic Curve defined by y^2 = x^3 + x + t^5 over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5 - to Elliptic Curve defined by y^2 = x^3 + x + 4*t over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5] + from Elliptic Curve defined by y^2 = x^3 + x + t^5 over Fraction Field + of Univariate Polynomial Ring in t over Finite Field of size 5 + to Elliptic Curve defined by y^2 = x^3 + x + 4*t over Fraction Field + of Univariate Polynomial Ring in t over Finite Field of size 5] Examples over number fields (other than QQ):: - sage: QQroot2. = NumberField(x^2-2) - sage: E = EllipticCurve(QQroot2, j=8000) - sage: E.isogenies_prime_degree() + sage: QQroot2. = NumberField(x^2 - 2) # optional - sage.rings.number_field + sage: E = EllipticCurve(QQroot2, j=8000) # optional - sage.rings.number_field + sage: E.isogenies_prime_degree() # optional - sage.rings.number_field [Isogeny of degree 2 - from Elliptic Curve defined by y^2 = x^3 + (-150528000)*x + (-629407744000) over Number Field in e with defining polynomial x^2 - 2 - to Elliptic Curve defined by y^2 = x^3 + (-36750)*x + 2401000 over Number Field in e with defining polynomial x^2 - 2, + from Elliptic Curve defined by y^2 = x^3 + (-150528000)*x + (-629407744000) + over Number Field in e with defining polynomial x^2 - 2 + to Elliptic Curve defined by y^2 = x^3 + (-36750)*x + 2401000 + over Number Field in e with defining polynomial x^2 - 2, Isogeny of degree 2 - from Elliptic Curve defined by y^2 = x^3 + (-150528000)*x + (-629407744000) over Number Field in e with defining polynomial x^2 - 2 - to Elliptic Curve defined by y^2 = x^3 + (220500*e-257250)*x + (54022500*e-88837000) over Number Field in e with defining polynomial x^2 - 2, + from Elliptic Curve defined by y^2 = x^3 + (-150528000)*x + (-629407744000) + over Number Field in e with defining polynomial x^2 - 2 + to Elliptic Curve defined by y^2 = x^3 + (220500*e-257250)*x + (54022500*e-88837000) + over Number Field in e with defining polynomial x^2 - 2, Isogeny of degree 2 - from Elliptic Curve defined by y^2 = x^3 + (-150528000)*x + (-629407744000) over Number Field in e with defining polynomial x^2 - 2 - to Elliptic Curve defined by y^2 = x^3 + (-220500*e-257250)*x + (-54022500*e-88837000) over Number Field in e with defining polynomial x^2 - 2] - - sage: E = EllipticCurve(QQroot2, [1,0,1,4, -6]); E - Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + (-6) over Number Field in e with defining polynomial x^2 - 2 - sage: E.isogenies_prime_degree(2) + from Elliptic Curve defined by y^2 = x^3 + (-150528000)*x + (-629407744000) + over Number Field in e with defining polynomial x^2 - 2 + to Elliptic Curve defined by y^2 = x^3 + (-220500*e-257250)*x + (-54022500*e-88837000) + over Number Field in e with defining polynomial x^2 - 2] + + sage: E = EllipticCurve(QQroot2, [1,0,1,4, -6]); E # optional - sage.rings.number_field + Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + (-6) + over Number Field in e with defining polynomial x^2 - 2 + sage: E.isogenies_prime_degree(2) # optional - sage.rings.number_field [Isogeny of degree 2 - from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + (-6) over Number Field in e with defining polynomial x^2 - 2 - to Elliptic Curve defined by y^2 + x*y + y = x^3 + (-36)*x + (-70) over Number Field in e with defining polynomial x^2 - 2] - sage: E.isogenies_prime_degree(3) + from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + (-6) + over Number Field in e with defining polynomial x^2 - 2 + to Elliptic Curve defined by y^2 + x*y + y = x^3 + (-36)*x + (-70) + over Number Field in e with defining polynomial x^2 - 2] + sage: E.isogenies_prime_degree(3) # optional - sage.rings.number_field [Isogeny of degree 3 - from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + (-6) over Number Field in e with defining polynomial x^2 - 2 - to Elliptic Curve defined by y^2 + x*y + y = x^3 + (-1)*x over Number Field in e with defining polynomial x^2 - 2, - Isogeny of degree 3 - from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + (-6) over Number Field in e with defining polynomial x^2 - 2 - to Elliptic Curve defined by y^2 + x*y + y = x^3 + (-171)*x + (-874) over Number Field in e with defining polynomial x^2 - 2] + from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + (-6) + over Number Field in e with defining polynomial x^2 - 2 + to Elliptic Curve defined by y^2 + x*y + y = x^3 + (-1)*x + over Number Field in e with defining polynomial x^2 - 2, + Isogeny of degree 3 + from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + (-6) + over Number Field in e with defining polynomial x^2 - 2 + to Elliptic Curve defined by y^2 + x*y + y = x^3 + (-171)*x + (-874) + over Number Field in e with defining polynomial x^2 - 2] These are not implemented yet:: - sage: E = EllipticCurve(QQbar, [1,18]); E + sage: E = EllipticCurve(QQbar, [1,18]); E # optional - sage.rings.number_field Elliptic Curve defined by y^2 = x^3 + x + 18 over Algebraic Field - sage: E.isogenies_prime_degree() + sage: E.isogenies_prime_degree() # optional - sage.rings.number_field Traceback (most recent call last): ... NotImplementedError: This code could be implemented for QQbar, but has not been yet. sage: E = EllipticCurve(CC, [1,18]); E - Elliptic Curve defined by y^2 = x^3 + 1.00000000000000*x + 18.0000000000000 over Complex Field with 53 bits of precision + Elliptic Curve defined by y^2 = x^3 + 1.00000000000000*x + 18.0000000000000 + over Complex Field with 53 bits of precision sage: E.isogenies_prime_degree(11) Traceback (most recent call last): ... - NotImplementedError: This code could be implemented for general complex fields, but has not been yet. + NotImplementedError: This code could be implemented for general complex fields, + but has not been yet. TESTS:: @@ -1610,7 +1629,7 @@ def is_isogenous(self, other, field=None): over Fraction Field of Univariate Polynomial Ring in t over Integer Ring sage: E2 = EllipticCurve(CC, [23,4]); E2 Elliptic Curve defined by y^2 = x^3 + 23.0000000000000*x + 4.00000000000000 - over Complex Field with 53 bits of precision + over Complex Field with 53 bits of precision sage: E1.is_isogenous(E2) Traceback (most recent call last): ... @@ -1654,11 +1673,17 @@ def weierstrass_p(self, prec=20, algorithm=None): sage: Esh.weierstrass_p(prec=8) z^-2 + 13392/5*z^2 + 1080432/7*z^4 + 59781888/25*z^6 + O(z^8) sage: E.weierstrass_p(prec=20, algorithm='fast') - z^-2 + 31/15*z^2 + 2501/756*z^4 + 961/675*z^6 + 77531/41580*z^8 + 1202285717/928746000*z^10 + 2403461/2806650*z^12 + 30211462703/43418875500*z^14 + 3539374016033/7723451736000*z^16 + 413306031683977/1289540602350000*z^18 + O(z^20) + z^-2 + 31/15*z^2 + 2501/756*z^4 + 961/675*z^6 + 77531/41580*z^8 + + 1202285717/928746000*z^10 + 2403461/2806650*z^12 + 30211462703/43418875500*z^14 + + 3539374016033/7723451736000*z^16 + 413306031683977/1289540602350000*z^18 + O(z^20) sage: E.weierstrass_p(prec=20, algorithm='pari') - z^-2 + 31/15*z^2 + 2501/756*z^4 + 961/675*z^6 + 77531/41580*z^8 + 1202285717/928746000*z^10 + 2403461/2806650*z^12 + 30211462703/43418875500*z^14 + 3539374016033/7723451736000*z^16 + 413306031683977/1289540602350000*z^18 + O(z^20) + z^-2 + 31/15*z^2 + 2501/756*z^4 + 961/675*z^6 + 77531/41580*z^8 + + 1202285717/928746000*z^10 + 2403461/2806650*z^12 + 30211462703/43418875500*z^14 + + 3539374016033/7723451736000*z^16 + 413306031683977/1289540602350000*z^18 + O(z^20) sage: E.weierstrass_p(prec=20, algorithm='quadratic') - z^-2 + 31/15*z^2 + 2501/756*z^4 + 961/675*z^6 + 77531/41580*z^8 + 1202285717/928746000*z^10 + 2403461/2806650*z^12 + 30211462703/43418875500*z^14 + 3539374016033/7723451736000*z^16 + 413306031683977/1289540602350000*z^18 + O(z^20) + z^-2 + 31/15*z^2 + 2501/756*z^4 + 961/675*z^6 + 77531/41580*z^8 + + 1202285717/928746000*z^10 + 2403461/2806650*z^12 + 30211462703/43418875500*z^14 + + 3539374016033/7723451736000*z^16 + 413306031683977/1289540602350000*z^18 + O(z^20) """ from .ell_wp import weierstrass_p return weierstrass_p(self, prec=prec, algorithm=algorithm) @@ -1678,33 +1703,33 @@ def hasse_invariant(self): EXAMPLES:: - sage: E = EllipticCurve([Mod(1,2),Mod(1,2),0,0,Mod(1,2)]) + sage: E = EllipticCurve([Mod(1,2), Mod(1,2), 0, 0, Mod(1,2)]) sage: E.hasse_invariant() 1 - sage: E = EllipticCurve([0,0,Mod(1,3),Mod(1,3),Mod(1,3)]) + sage: E = EllipticCurve([0, 0, Mod(1,3), Mod(1,3), Mod(1,3)]) sage: E.hasse_invariant() 0 - sage: E = EllipticCurve([0,0,Mod(1,5),0,Mod(2,5)]) + sage: E = EllipticCurve([0, 0, Mod(1,5), 0, Mod(2,5)]) sage: E.hasse_invariant() 0 - sage: E = EllipticCurve([0,0,Mod(1,5),Mod(1,5),Mod(2,5)]) + sage: E = EllipticCurve([0, 0, Mod(1,5), Mod(1,5), Mod(2,5)]) sage: E.hasse_invariant() 2 Some examples over larger fields:: - sage: EllipticCurve(GF(101),[0,0,0,0,1]).hasse_invariant() + sage: EllipticCurve(GF(101), [0,0,0,0,1]).hasse_invariant() # optional - sage.rings.finite_rings 0 - sage: EllipticCurve(GF(101),[0,0,0,1,1]).hasse_invariant() + sage: EllipticCurve(GF(101), [0,0,0,1,1]).hasse_invariant() # optional - sage.rings.finite_rings 98 - sage: EllipticCurve(GF(103),[0,0,0,0,1]).hasse_invariant() + sage: EllipticCurve(GF(103), [0,0,0,0,1]).hasse_invariant() # optional - sage.rings.finite_rings 20 - sage: EllipticCurve(GF(103),[0,0,0,1,1]).hasse_invariant() + sage: EllipticCurve(GF(103), [0,0,0,1,1]).hasse_invariant() # optional - sage.rings.finite_rings 17 - sage: F. = GF(107^2) - sage: EllipticCurve(F,[0,0,0,a,1]).hasse_invariant() + sage: F. = GF(107^2) # optional - sage.rings.finite_rings + sage: EllipticCurve(F, [0,0,0,a,1]).hasse_invariant() # optional - sage.rings.finite_rings 62*a + 75 - sage: EllipticCurve(F,[0,0,0,0,a]).hasse_invariant() + sage: EllipticCurve(F, [0,0,0,0,a]).hasse_invariant() # optional - sage.rings.finite_rings 0 Over fields of characteristic zero, the Hasse invariant is @@ -1766,16 +1791,16 @@ class of curves. If the j-invariant is not unique in the isogeny Ordinary curve over finite extension field of degree 2:: - sage: E = EllipticCurve(GF(59^2, "i", x^2 + 1), j=5) - sage: G = E.isogeny_ell_graph(5, directed=False, label_by_j=True) - sage: G + sage: E = EllipticCurve(GF(59^2, "i", x^2 + 1), j=5) # optional - sage.rings.finite_rings + sage: G = E.isogeny_ell_graph(5, directed=False, label_by_j=True) # optional - sage.graphs sage.rings.finite_rings + sage: G # optional - sage.graphs sage.rings.finite_rings Graph on 20 vertices - sage: G.vertices(sort=True) + sage: G.vertices(sort=True) # optional - sage.graphs sage.rings.finite_rings ['1', '12', ... 'i + 55'] - sage: G.edges(sort=True) + sage: G.edges(sort=True) # optional - sage.graphs sage.rings.finite_rings [('1', '28*i + 11', None), ('1', '31*i + 11', None), ... @@ -1783,26 +1808,26 @@ class of curves. If the j-invariant is not unique in the isogeny Supersingular curve over prime field:: - sage: E = EllipticCurve(GF(419), j=1728) - sage: G3 = E.isogeny_ell_graph(3, directed=False, label_by_j=True) - sage: G3 + sage: E = EllipticCurve(GF(419), j=1728) # optional - sage.rings.finite_rings + sage: G3 = E.isogeny_ell_graph(3, directed=False, label_by_j=True) # optional - sage.graphs sage.rings.finite_rings + sage: G3 # optional - sage.graphs sage.rings.finite_rings Graph on 27 vertices - sage: G3.vertices(sort=True) + sage: G3.vertices(sort=True) # optional - sage.graphs sage.rings.finite_rings ['0', '0*', ... '98*'] - sage: G3.edges(sort=True) + sage: G3.edges(sort=True) # optional - sage.graphs sage.rings.finite_rings [('0', '0*', None), ('0', '13', None), ... ('48*', '98*', None)] - sage: G5 = E.isogeny_ell_graph(5, directed=False, label_by_j=True) - sage: G5 + sage: G5 = E.isogeny_ell_graph(5, directed=False, label_by_j=True) # optional - sage.graphs sage.rings.finite_rings + sage: G5 # optional - sage.graphs sage.rings.finite_rings Graph on 9 vertices - sage: G5.vertices(sort=True) + sage: G5.vertices(sort=True) # optional - sage.graphs sage.rings.finite_rings ['13', '13*', '407', '407*', '52', '62', '62*', '98', '98*'] - sage: G5.edges(sort=True) + sage: G5.edges(sort=True) # optional - sage.graphs sage.rings.finite_rings [('13', '52', None), ('13', '98', None), ... @@ -1810,32 +1835,32 @@ class of curves. If the j-invariant is not unique in the isogeny Supersingular curve over finite extension field of degree 2:: - sage: K = GF(431^2, "i", x^2 + 1) - sage: E = EllipticCurve(K, j=0) - sage: E.is_supersingular() + sage: K = GF(431^2, "i", x^2 + 1) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(K, j=0) # optional - sage.rings.finite_rings + sage: E.is_supersingular() # optional - sage.rings.finite_rings True - sage: G = E.isogeny_ell_graph(2, directed=True, label_by_j=True) - sage: G + sage: G = E.isogeny_ell_graph(2, directed=True, label_by_j=True) # optional - sage.graphs sage.rings.finite_rings + sage: G # optional - sage.graphs sage.rings.finite_rings Looped multi-digraph on 37 vertices - sage: G.vertices(sort=True) + sage: G.vertices(sort=True) # optional - sage.graphs sage.rings.finite_rings ['0', '102', ... '87*i + 190'] - sage: G.edges(sort=True) + sage: G.edges(sort=True) # optional - sage.graphs sage.rings.finite_rings [('0', '125', None), ('0', '125', None), ... '81*i + 65', None)] - sage: H = E.isogeny_ell_graph(2, directed=False, label_by_j=True) - sage: H + sage: H = E.isogeny_ell_graph(2, directed=False, label_by_j=True) # optional - sage.graphs sage.rings.finite_rings + sage: H # optional - sage.graphs sage.rings.finite_rings Looped multi-graph on 37 vertices - sage: H.vertices(sort=True) + sage: H.vertices(sort=True) # optional - sage.graphs sage.rings.finite_rings ['0', '102', ... '87*i + 190'] - sage: H.edges(sort=True) + sage: H.edges(sort=True) # optional - sage.graphs sage.rings.finite_rings [('0', '125', None), ('102', '125', None), ... @@ -1843,27 +1868,27 @@ class of curves. If the j-invariant is not unique in the isogeny Curve over a quadratic number field:: - sage: K. = NumberField(x^2 - 2) - sage: E = EllipticCurve(K, [1,0,1,4, -6]) - sage: G2 = E.isogeny_ell_graph(2, directed=False) - sage: G2.vertices(sort=True) + sage: K. = NumberField(x^2 - 2) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [1, 0, 1, 4, -6]) # optional - sage.rings.number_field + sage: G2 = E.isogeny_ell_graph(2, directed=False) # optional - sage.graphs sage.rings.number_field + sage: G2.vertices(sort=True) # optional - sage.graphs sage.rings.number_field ['y^2 + x*y + y = x^3 + (-130*e-356)*x + (-2000*e-2038)', 'y^2 + x*y + y = x^3 + (-36)*x + (-70)', 'y^2 + x*y + y = x^3 + (130*e-356)*x + (2000*e-2038)', 'y^2 + x*y + y = x^3 + 4*x + (-6)'] - sage: G2.edges(sort=True) + sage: G2.edges(sort=True) # optional - sage.graphs sage.rings.number_field [('y^2 + x*y + y = x^3 + (-130*e-356)*x + (-2000*e-2038)', 'y^2 + x*y + y = x^3 + (-36)*x + (-70)', None), ('y^2 + x*y + y = x^3 + (-36)*x + (-70)', 'y^2 + x*y + y = x^3 + (130*e-356)*x + (2000*e-2038)', None), ('y^2 + x*y + y = x^3 + (-36)*x + (-70)', 'y^2 + x*y + y = x^3 + 4*x + (-6)', None)] - sage: G3 = E.isogeny_ell_graph(3, directed=False) - sage: G3.vertices(sort=True) + sage: G3 = E.isogeny_ell_graph(3, directed=False) # optional - sage.graphs sage.rings.number_field + sage: G3.vertices(sort=True) # optional - sage.graphs sage.rings.number_field ['y^2 + x*y + y = x^3 + (-1)*x', 'y^2 + x*y + y = x^3 + (-171)*x + (-874)', 'y^2 + x*y + y = x^3 + 4*x + (-6)'] - sage: G3.edges(sort=True) + sage: G3.edges(sort=True) # optional - sage.graphs sage.rings.number_field [('y^2 + x*y + y = x^3 + (-1)*x', 'y^2 + x*y + y = x^3 + 4*x + (-6)', None), ('y^2 + x*y + y = x^3 + (-171)*x + (-874)', @@ -1871,21 +1896,21 @@ class of curves. If the j-invariant is not unique in the isogeny TESTS:: - sage: E = EllipticCurve(GF(11), j=0) - sage: G0 = E.isogeny_ell_graph(2, directed=False) - sage: G0.is_directed() + sage: E = EllipticCurve(GF(11), j=0) # optional - sage.rings.finite_rings + sage: G0 = E.isogeny_ell_graph(2, directed=False) # optional - sage.graphs sage.rings.finite_rings + sage: G0.is_directed() # optional - sage.graphs sage.rings.finite_rings False - sage: G1 = E.isogeny_ell_graph(2, directed=True) - sage: G1.is_directed() + sage: G1 = E.isogeny_ell_graph(2, directed=True) # optional - sage.graphs sage.rings.finite_rings + sage: G1.is_directed() # optional - sage.graphs sage.rings.finite_rings True - sage: G2 = E.isogeny_ell_graph(2, label_by_j=False) - sage: G2.vertices(sort=True) + sage: G2 = E.isogeny_ell_graph(2, label_by_j=False) # optional - sage.graphs sage.rings.finite_rings + sage: G2.vertices(sort=True) # optional - sage.graphs sage.rings.finite_rings ['y^2 = x^3 + 1', 'y^2 = x^3 + 2', 'y^2 = x^3 + 5*x', 'y^2 = x^3 + 7*x'] - sage: G3 = E.isogeny_ell_graph(2, label_by_j=True) - sage: G3.vertices(sort=True) + sage: G3 = E.isogeny_ell_graph(2, label_by_j=True) # optional - sage.graphs sage.rings.finite_rings + sage: G3.vertices(sort=True) # optional - sage.graphs sage.rings.finite_rings ['0', '0*', '1', '1*'] """ diff --git a/src/sage/schemes/elliptic_curves/ell_generic.py b/src/sage/schemes/elliptic_curves/ell_generic.py index e9d42c7e487..be1e4714b5e 100644 --- a/src/sage/schemes/elliptic_curves/ell_generic.py +++ b/src/sage/schemes/elliptic_curves/ell_generic.py @@ -19,12 +19,13 @@ We construct an elliptic curve over an elaborate base ring:: sage: p, a, b = 97, 1, 3 - sage: R. = GF(p)[] - sage: S. = R[] - sage: T = S.fraction_field() - sage: E = EllipticCurve(T, [a, b]); E - Elliptic Curve defined by y^2 = x^3 + x + 3 over Fraction Field of Univariate Polynomial Ring in v over Univariate Polynomial Ring in u over Finite Field of size 97 - sage: latex(E) + sage: R. = GF(p)[] # optional - sage.rings.finite_rings + sage: S. = R[] # optional - sage.rings.finite_rings + sage: T = S.fraction_field() # optional - sage.rings.finite_rings + sage: E = EllipticCurve(T, [a, b]); E # optional - sage.rings.finite_rings + Elliptic Curve defined by y^2 = x^3 + x + 3 over Fraction Field of Univariate + Polynomial Ring in v over Univariate Polynomial Ring in u over Finite Field of size 97 + sage: latex(E) # optional - sage.rings.finite_rings y^2 = x^{3} + x + 3 AUTHORS: @@ -136,9 +137,11 @@ def __init__(self, K, ainvs): EXAMPLES:: sage: E = EllipticCurve([1,2,3,4,5]); E - Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Rational Field - sage: E = EllipticCurve(GF(7),[1,2,3,4,5]); E - Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Finite Field of size 7 + Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 + over Rational Field + sage: E = EllipticCurve(GF(7), [1,2,3,4,5]); E # optional - sage.rings.finite_rings + Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 + over Finite Field of size 7 Constructor from `[a_4,a_6]` sets `a_1=a_2=a_3=0`:: @@ -147,8 +150,9 @@ def __init__(self, K, ainvs): The base ring need not be a field:: - sage: EllipticCurve(IntegerModRing(91),[1,2,3,4,5]) - Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Ring of integers modulo 91 + sage: EllipticCurve(IntegerModRing(91), [1,2,3,4,5]) + Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 + over Ring of integers modulo 91 """ self.__base_ring = K self.__ainvs = tuple(K(a) for a in ainvs) @@ -245,9 +249,10 @@ def _repr_(self): :: sage: R. = QQ['x'] - sage: K. = NumberField(x^3-17) - sage: EllipticCurve([a^2-3, -2/3*a + 3]) - Elliptic Curve defined by y^2 = x^3 + (a^2-3)*x + (-2/3*a+3) over Number Field in a + sage: K. = NumberField(x^3 - 17) # optional - sage.rings.number_field + sage: EllipticCurve([a^2 - 3, -2/3*a + 3]) # optional - sage.rings.number_field + Elliptic Curve defined by y^2 = x^3 + (a^2-3)*x + (-2/3*a+3) + over Number Field in a with defining polynomial x^3 - 17 """ s = "Elliptic Curve defined by " @@ -273,9 +278,9 @@ def _latex_(self): Check that :trac:`12524` is solved:: - sage: K. = NumberField(x^2-x-1) - sage: E = EllipticCurve([0,0,phi,27*phi-43,-80*phi+128]) - sage: E._latex_() + sage: K. = NumberField(x^2 - x - 1) # optional - sage.rings.number_field + sage: E = EllipticCurve([0, 0, phi, 27*phi - 43, -80*phi + 128]) # optional - sage.rings.number_field + sage: E._latex_() # optional - sage.rings.number_field 'y^2 + \\phi y = x^{3} + \\left(27 \\phi - 43\\right) x - 80 \\phi + 128 ' """ from sage.rings.polynomial.polynomial_ring import polygen @@ -311,20 +316,21 @@ def _magma_init_(self, magma): EXAMPLES:: - sage: E = EllipticCurve(QQ,[1,1]) - sage: E._magma_init_(magma) # optional - magma + sage: E = EllipticCurve(QQ, [1,1]) + sage: E._magma_init_(magma) # optional - magma 'EllipticCurve([_sage_ref...|0/1,0/1,0/1,1/1,1/1])' - sage: E = EllipticCurve(GF(41),[2,5]) # optional - magma - sage: E._magma_init_(magma) # optional - magma + sage: E = EllipticCurve(GF(41), [2,5]) # optional - sage.rings.finite_rings + sage: E._magma_init_(magma) # optional - magma # optional - sage.rings.finite_rings 'EllipticCurve([_sage_ref...|GF(41)!0,GF(41)!0,GF(41)!0,GF(41)!2,GF(41)!5])' - sage: E = EllipticCurve(GF(25,'a'), [0,0,1,4,0]) - sage: magma(E) # optional - magma + sage: E = EllipticCurve(GF(25,'a'), [0,0,1,4,0]) # optional - sage.rings.finite_rings + sage: magma(E) # optional - magma # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 + y = x^3 + 4*x over GF(5^2) - sage: magma(EllipticCurve([1/2,2/3,-4/5,6/7,8/9])) # optional - magma + sage: magma(EllipticCurve([1/2,2/3,-4/5,6/7,8/9])) # optional - magma Elliptic Curve defined by y^2 + 1/2*x*y - 4/5*y = x^3 + 2/3*x^2 + 6/7*x + 8/9 over Rational Field sage: R. = Frac(QQ['x']) - sage: magma(EllipticCurve([x,1+x])) # optional - magma - Elliptic Curve defined by y^2 = x^3 + x*x + (x + 1) over Univariate rational function field over Rational Field + sage: magma(EllipticCurve([x, 1 + x])) # optional - magma + Elliptic Curve defined by y^2 = x^3 + x*x + (x + 1) + over Univariate rational function field over Rational Field """ kmn = magma(self.base_ring())._ref() return 'EllipticCurve([%s|%s])' % (kmn,','.join(x._magma_init_(magma) @@ -340,29 +346,29 @@ def _symbolic_(self, SR): :: sage: E = EllipticCurve('11a') - sage: E._symbolic_(SR) + sage: E._symbolic_(SR) # optional - sage.symbolic y^2 + y == x^3 - x^2 - 10*x - 20 - sage: E.torsion_subgroup().gens() + sage: E.torsion_subgroup().gens() # optional - sage.symbolic ((5 : 5 : 1),) We find the corresponding symbolic equality:: - sage: eqn = symbolic_expression(E); eqn + sage: eqn = symbolic_expression(E); eqn # optional - sage.symbolic y^2 + y == x^3 - x^2 - 10*x - 20 We verify that the given point is on the curve:: - sage: eqn(x=5,y=5) + sage: eqn(x=5, y=5) # optional - sage.symbolic 30 == 30 - sage: bool(eqn(x=5,y=5)) + sage: bool(eqn(x=5, y=5)) # optional - sage.symbolic True We create a single expression:: - sage: F = eqn.lhs() - eqn.rhs(); F + sage: F = eqn.lhs() - eqn.rhs(); F # optional - sage.symbolic -x^3 + x^2 + y^2 + 10*x + y + 20 - sage: y = var('y') - sage: F.solve(y) + sage: y = var('y') # optional - sage.symbolic + sage: F.solve(y) # optional - sage.symbolic [y == -1/2*sqrt(4*x^3 - 4*x^2 - 40*x - 79) - 1/2, y == 1/2*sqrt(4*x^3 - 4*x^2 - 40*x - 79) - 1/2] @@ -370,43 +376,44 @@ def _symbolic_(self, SR): horrendous. Continuing with the above example, we can explicitly find points over random fields by substituting in values for x:: - sage: v = F.solve(y)[0].rhs(); v + sage: v = F.solve(y)[0].rhs(); v # optional - sage.symbolic -1/2*sqrt(4*x^3 - 4*x^2 - 40*x - 79) - 1/2 - sage: v = v.function(x) - sage: v(3) + sage: v = v.function(x) # optional - sage.symbolic + sage: v(3) # optional - sage.symbolic -1/2*sqrt(-127) - 1/2 - sage: v(7) + sage: v(7) # optional - sage.symbolic -1/2*sqrt(817) - 1/2 - sage: v(-7) + sage: v(-7) # optional - sage.symbolic -1/2*sqrt(-1367) - 1/2 - sage: v(sqrt(2)) + sage: v(sqrt(2)) # optional - sage.symbolic -1/2*sqrt(-32*sqrt(2) - 87) - 1/2 We can even do arithmetic with them, as follows:: - sage: E2 = E.change_ring(SR); E2 - Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Symbolic Ring - sage: P = E2.point((3, v(3), 1), check=False) # the check=False option doesn't verify that y^2 = f(x) - sage: P + sage: E2 = E.change_ring(SR); E2 # optional - sage.symbolic + Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) + over Symbolic Ring + sage: P = E2.point((3, v(3), 1), check=False) # the check=False option doesn't verify that y^2 = f(x) # optional - sage.symbolic + sage: P # optional - sage.symbolic (3 : -1/2*sqrt(-127) - 1/2 : 1) - sage: P + P + sage: P + P # optional - sage.symbolic (-756/127 : 41143/32258*sqrt(-127) - 1/2 : 1) We can even throw in a transcendental:: - sage: w = E2.point((pi,v(pi),1), check=False); w + sage: w = E2.point((pi,v(pi),1), check=False); w # optional - sage.symbolic (pi : -1/2*sqrt(-40*pi + 4*pi^3 - 4*pi^2 - 79) - 1/2 : 1) - sage: x, y, z = w; ((y^2 + y) - (x^3 - x^2 - 10*x - 20)).expand() + sage: x, y, z = w; ((y^2 + y) - (x^3 - x^2 - 10*x - 20)).expand() # optional - sage.symbolic 0 - sage: 2*w + sage: 2*w # optional - sage.symbolic (-2*pi - (2*pi - 3*pi^2 + 10)^2/(40*pi - 4*pi^3 + 4*pi^2 + 79) + 1 : (3*pi + (2*pi - 3*pi^2 + 10)^2/(40*pi - 4*pi^3 + 4*pi^2 + 79) - 1)*(2*pi - 3*pi^2 + 10)/sqrt(-40*pi + 4*pi^3 - 4*pi^2 - 79) + 1/2*sqrt(-40*pi + 4*pi^3 - 4*pi^2 - 79) - 1/2 : 1) - sage: x, y, z = 2*w; temp = ((y^2 + y) - (x^3 - x^2 - 10*x - 20)) + sage: x, y, z = 2*w; temp = ((y^2 + y) - (x^3 - x^2 - 10*x - 20)) # optional - sage.symbolic This is a point on the curve:: - sage: bool(temp == 0) + sage: bool(temp == 0) # optional - sage.symbolic True """ a = [SR(x) for x in self.a_invariants()] @@ -426,15 +433,15 @@ def __contains__(self, P): True sage: (1,3) in E False - sage: E = EllipticCurve([GF(7)(0), 1]) - sage: [0,0] in E + sage: E = EllipticCurve([GF(7)(0), 1]) # optional - sage.rings.finite_rings + sage: [0,0] in E # optional - sage.rings.finite_rings False - sage: [0,8] in E + sage: [0,8] in E # optional - sage.rings.finite_rings True - sage: P = E(0,8) - sage: P + sage: P = E(0,8) # optional - sage.rings.finite_rings + sage: P # optional - sage.rings.finite_rings (0 : 1 : 1) - sage: P in E + sage: P in E # optional - sage.rings.finite_rings True """ if not isinstance(P, ell_point.EllipticCurvePoint): @@ -484,28 +491,31 @@ def __call__(self, *args, **kwds): We create points on an elliptic curve over a prime finite field:: - sage: E = EllipticCurve([GF(7)(0), 1]) - sage: E([2,3]) + sage: E = EllipticCurve([GF(7)(0), 1]) # optional - sage.rings.finite_rings + sage: E([2,3]) # optional - sage.rings.finite_rings (2 : 3 : 1) - sage: E([0,0]) + sage: E([0,0]) # optional - sage.rings.finite_rings Traceback (most recent call last): ... - TypeError: Coordinates [0, 0, 1] do not define a point on Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 7 + TypeError: Coordinates [0, 0, 1] do not define a point + on Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 7 We create a point on an elliptic curve over a number field:: sage: x = polygen(RationalField()) - sage: K = NumberField(x**3 + x + 1, 'a'); a = K.gen() - sage: E = EllipticCurve([a,a]) - sage: E - Elliptic Curve defined by y^2 = x^3 + a*x + a over Number Field in a with defining polynomial x^3 + x + 1 - sage: E = EllipticCurve([K(1),1]) - sage: E - Elliptic Curve defined by y^2 = x^3 + x + 1 over Number Field in a with defining polynomial x^3 + x + 1 - sage: P = E([a,0,1]) - sage: P + sage: K = NumberField(x**3 + x + 1, 'a'); a = K.gen() # optional - sage.rings.number_field + sage: E = EllipticCurve([a, a]) # optional - sage.rings.number_field + sage: E # optional - sage.rings.number_field + Elliptic Curve defined by y^2 = x^3 + a*x + a + over Number Field in a with defining polynomial x^3 + x + 1 + sage: E = EllipticCurve([K(1), 1]) # optional - sage.rings.number_field + sage: E # optional - sage.rings.number_field + Elliptic Curve defined by y^2 = x^3 + x + 1 + over Number Field in a with defining polynomial x^3 + x + 1 + sage: P = E([a,0,1]) # optional - sage.rings.number_field + sage: P # optional - sage.rings.number_field (a : 0 : 1) - sage: P+P + sage: P + P # optional - sage.rings.number_field (0 : 1 : 0) Another example involving p-adics:: @@ -513,9 +523,11 @@ def __call__(self, *args, **kwds): sage: E = EllipticCurve('37a1') sage: P = E([0,0]); P (0 : 0 : 1) - sage: R = pAdicField(3,20) - sage: Ep = E.base_extend(R); Ep - Elliptic Curve defined by y^2 + (1+O(3^20))*y = x^3 + (2+2*3+2*3^2+2*3^3+2*3^4+2*3^5+2*3^6+2*3^7+2*3^8+2*3^9+2*3^10+2*3^11+2*3^12+2*3^13+2*3^14+2*3^15+2*3^16+2*3^17+2*3^18+2*3^19+O(3^20))*x over 3-adic Field with capped relative precision 20 + sage: R = pAdicField(3, 20) # optional - sage.rings.padics + sage: Ep = E.base_extend(R); Ep # optional - sage.rings.padics + Elliptic Curve defined by + y^2 + (1+O(3^20))*y = x^3 + (2+2*3+2*3^2+2*3^3+2*3^4+2*3^5+2*3^6+2*3^7+2*3^8+2*3^9+2*3^10+2*3^11+2*3^12+2*3^13+2*3^14+2*3^15+2*3^16+2*3^17+2*3^18+2*3^19+O(3^20))*x + over 3-adic Field with capped relative precision 20 sage: Ep(P) (0 : 0 : 1 + O(3^20)) @@ -605,14 +617,14 @@ def _reduce_point(self, R, p): point at infinity on the same curve but reduced modulo 11. The reduce function tells us this:: - sage: E11 = E.change_ring(GF(11)) - sage: S = E11._reduce_point(R, 11) - sage: E11(S) + sage: E11 = E.change_ring(GF(11)) # optional - sage.rings.finite_rings + sage: S = E11._reduce_point(R, 11) # optional - sage.rings.finite_rings + sage: E11(S) # optional - sage.rings.finite_rings (0 : 1 : 0) The 0 point reduces as expected:: - sage: E11._reduce_point(E(0), 11) + sage: E11._reduce_point(E(0), 11) # optional - sage.rings.finite_rings (0 : 1 : 0) Note that one need not explicitly call @@ -673,8 +685,8 @@ def is_x_coord(self, x): :: - sage: F = GF(32,'a') - sage: E = EllipticCurve(F,[1,0,0,0,1]) + sage: F = GF(32,'a') # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F,[1,0,0,0,1]) # optional - sage.rings.finite_rings sage: set(P[0] for P in E.points() if P!=E(0)) == set(x for x in F if E.is_x_coord(x)) True """ @@ -744,17 +756,19 @@ def lift_x(self, x, all=False, extend=False): sage: E.lift_x(3) Traceback (most recent call last): ... - ValueError: No point with x-coordinate 3 on Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field + ValueError: No point with x-coordinate 3 + on Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field We can use the ``extend`` parameter to make the necessary quadratic extension. Note that in such cases the returned point is a point on a new curve object, the result of changing the base ring to the parent of `x`:: - sage: P = E.lift_x(3, extend=True); P + sage: P = E.lift_x(3, extend=True); P # optional - sage.rings.number_field (3 : y : 1) - sage: P.curve() - Elliptic Curve defined by y^2 + y = x^3 + (-1)*x over Number Field in y with defining polynomial y^2 + y - 24 + sage: P.curve() # optional - sage.rings.number_field + Elliptic Curve defined by y^2 + y = x^3 + (-1)*x + over Number Field in y with defining polynomial y^2 + y - 24 Or we can extend scalars. There are two such points in `E(\RR)`:: @@ -776,26 +790,28 @@ def lift_x(self, x, all=False, extend=False): sage: E = EllipticCurve([0,0,0,0,2]); E Elliptic Curve defined by y^2 = x^3 + 2 over Rational Field - sage: P = E.lift_x(0, extend=True); P + sage: P = E.lift_x(0, extend=True); P # optional - sage.rings.number_field (0 : y : 1) - sage: P.curve() - Elliptic Curve defined by y^2 = x^3 + 2 over Number Field in y with defining polynomial y^2 - 2 + sage: P.curve() # optional - sage.rings.number_field + Elliptic Curve defined by y^2 = x^3 + 2 + over Number Field in y with defining polynomial y^2 - 2 We can perform these operations over finite fields too:: - sage: E = EllipticCurve('37a').change_ring(GF(17)); E + sage: E = EllipticCurve('37a').change_ring(GF(17)); E # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 + y = x^3 + 16*x over Finite Field of size 17 - sage: E.lift_x(7) + sage: E.lift_x(7) # optional - sage.rings.finite_rings (7 : 11 : 1) - sage: E.lift_x(3) + sage: E.lift_x(3) # optional - sage.rings.finite_rings Traceback (most recent call last): ... - ValueError: No point with x-coordinate 3 on Elliptic Curve defined by y^2 + y = x^3 + 16*x over Finite Field of size 17 + ValueError: No point with x-coordinate 3 on + Elliptic Curve defined by y^2 + y = x^3 + 16*x over Finite Field of size 17 Note that there is only one lift with `x`-coordinate 10 in `E(\GF{17})`:: - sage: E.lift_x(10, all=True) + sage: E.lift_x(10, all=True) # optional - sage.rings.finite_rings [(10 : 8 : 1)] We can lift over more exotic rings too. If the supplied x @@ -803,17 +819,19 @@ def lift_x(self, x, all=False, extend=False): returned is on the base-extended curve:: sage: E = EllipticCurve('37a') - sage: P = E.lift_x(pAdicField(17, 5)(6)); P + sage: P = E.lift_x(pAdicField(17, 5)(6)); P # optional - sage.rings.padics (6 + O(17^5) : 2 + 16*17 + 16*17^2 + 16*17^3 + 16*17^4 + O(17^5) : 1 + O(17^5)) - sage: P.curve() - Elliptic Curve defined by y^2 + (1+O(17^5))*y = x^3 + (16+16*17+16*17^2+16*17^3+16*17^4+O(17^5))*x over 17-adic Field with capped relative precision 5 + sage: P.curve() # optional - sage.rings.padics + Elliptic Curve defined by + y^2 + (1+O(17^5))*y = x^3 + (16+16*17+16*17^2+16*17^3+16*17^4+O(17^5))*x + over 17-adic Field with capped relative precision 5 sage: K. = PowerSeriesRing(QQ, 't', 5) - sage: P = E.lift_x(1+t); P + sage: P = E.lift_x(1 + t); P (1 + t : 2*t - t^2 + 5*t^3 - 21*t^4 + O(t^5) : 1) - sage: K. = GF(16) - sage: P = E.change_ring(K).lift_x(a^3); P + sage: K. = GF(16) # optional - sage.rings.finite_rings + sage: P = E.change_ring(K).lift_x(a^3); P # optional - sage.rings.finite_rings (a^3 : a^3 + a : 1) - sage: P.curve() + sage: P.curve() # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 + y = x^3 + x over Finite Field in a of size 2^4 We can extend the base field to include the associated `y` value(s):: @@ -827,7 +845,10 @@ def lift_x(self, x, all=False, extend=False): This point is a generic point on E:: sage: P.curve() - Elliptic Curve defined by y^2 = x^3 + 2 over Univariate Quotient Polynomial Ring in y over Fraction Field of Univariate Polynomial Ring in x over Rational Field with modulus y^2 - x^3 - 2 + Elliptic Curve defined by y^2 = x^3 + 2 + over Univariate Quotient Polynomial Ring in y + over Fraction Field of Univariate Polynomial Ring in x over Rational Field + with modulus y^2 - x^3 - 2 sage: -P (x : -y : 1) sage: 2*P @@ -835,9 +856,9 @@ def lift_x(self, x, all=False, extend=False): Check that :trac:`30297` is fixed:: - sage: K = Qp(5) - sage: E = EllipticCurve([K(0), K(1)]) - sage: E.lift_x(1, extend=True) + sage: K = Qp(5) # optional - sage.rings.padics + sage: E = EllipticCurve([K(0), K(1)]) # optional - sage.rings.padics + sage: E.lift_x(1, extend=True) # optional - sage.rings.padics (1 + O(5^20) : y + O(5^20) : 1 + O(5^20)) AUTHORS: @@ -847,10 +868,10 @@ def lift_x(self, x, all=False, extend=False): TESTS:: - sage: E = EllipticCurve('37a').short_weierstrass_model().change_ring(GF(17)) - sage: E.lift_x(3, all=True) + sage: E = EllipticCurve('37a').short_weierstrass_model().change_ring(GF(17)) # optional - sage.rings.finite_rings + sage: E.lift_x(3, all=True) # optional - sage.rings.finite_rings [] - sage: E.lift_x(7, all=True) + sage: E.lift_x(7, all=True) # optional - sage.rings.finite_rings [(7 : 3 : 1), (7 : 14 : 1)] """ K = self.base_ring() @@ -931,8 +952,8 @@ def _point_homset(self, *args, **kwds): EXAMPLES:: - sage: E = EllipticCurve(GF(5),[1,1]) - sage: E._point_homset(Spec(GF(5^10,'a'),GF(5)), E) + sage: E = EllipticCurve(GF(5),[1,1]) # optional - sage.rings.finite_rings + sage: E._point_homset(Spec(GF(5^10,'a'), GF(5)), E) # optional - sage.rings.finite_rings Abelian group of points on Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field in a of size 5^10 @@ -977,7 +998,7 @@ def __is_over_RationalField(self): sage: E = EllipticCurve(QQ,[1,1]) sage: E._EllipticCurve_generic__is_over_RationalField() True - sage: E = EllipticCurve(GF(5),[1,1]) + sage: E = EllipticCurve(GF(5),[1,1]) # optional - sage.rings.finite_rings sage: E._EllipticCurve_generic__is_over_RationalField() False """ @@ -1021,8 +1042,8 @@ def a_invariants(self): sage: E.a_invariants() (0, 0, 0, 0, 1) - sage: E = EllipticCurve([GF(7)(3),5]) - sage: E.a_invariants() + sage: E = EllipticCurve([GF(7)(3),5]) # optional - sage.rings.finite_rings + sage: E.a_invariants() # optional - sage.rings.finite_rings (0, 0, 0, 3, 5) TESTS:: @@ -1267,8 +1288,8 @@ def discriminant(self): sage: E.discriminant() -161051 - sage: E = EllipticCurve([GF(7)(2),1]) - sage: E.discriminant() + sage: E = EllipticCurve([GF(7)(2),1]) # optional - sage.rings.finite_rings + sage: E.discriminant() # optional - sage.rings.finite_rings 1 """ b2, b4, b6, b8 = self.b_invariants() @@ -1295,8 +1316,8 @@ def j_invariant(self): sage: E.j_invariant() 1728 - sage: E = EllipticCurve([GF(7)(2),1]) - sage: E.j_invariant() + sage: E = EllipticCurve([GF(7)(2),1]) # optional - sage.rings.finite_rings + sage: E.j_invariant() # optional - sage.rings.finite_rings 1 """ c4, _ = self.c_invariants() @@ -1319,9 +1340,9 @@ def base_extend(self, R): EXAMPLES:: - sage: E = EllipticCurve(GF(5),[1,1]); E + sage: E = EllipticCurve(GF(5), [1,1]); E # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 5 - sage: E1 = E.base_extend(GF(125,'a')); E1 + sage: E1 = E.base_extend(GF(125,'a')); E1 # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field in a of size 5^3 TESTS: @@ -1329,24 +1350,24 @@ def base_extend(self, R): Check that we are correctly keeping track of known cardinalities when extending the base field:: - sage: E = EllipticCurve(j=GF(7)(5)) - sage: E.cardinality() + sage: E = EllipticCurve(j=GF(7)(5)) # optional - sage.rings.finite_rings + sage: E.cardinality() # optional - sage.rings.finite_rings 10 - sage: EE = E.base_extend(GF(7^2)) - sage: EE._order + sage: EE = E.base_extend(GF(7^2)) # optional - sage.rings.finite_rings + sage: EE._order # optional - sage.rings.finite_rings 60 Changing to a smaller field should not cache orders:: - sage: EE = EllipticCurve(j=GF(7^3)(6)) - sage: hasattr(EE.change_ring(GF(7)), '_order') + sage: EE = EllipticCurve(j=GF(7^3)(6)) # optional - sage.rings.finite_rings + sage: hasattr(EE.change_ring(GF(7)), '_order') # optional - sage.rings.finite_rings False Changing to a field of different characteristic should not cache orders:: - sage: Elift = E.change_ring(QQ) - sage: hasattr(Elift, '_order') + sage: Elift = E.change_ring(QQ) # optional - sage.rings.finite_rings + sage: hasattr(Elift, '_order') # optional - sage.rings.finite_rings False """ E = constructor.EllipticCurve([R(a) for a in self.a_invariants()]) @@ -1367,13 +1388,16 @@ def change_ring(self, R): EXAMPLES:: - sage: F2 = GF(5^2,'a'); a = F2.gen() - sage: F4 = GF(5^4,'b'); b = F4.gen() - sage: h = F2.hom([a.charpoly().roots(ring=F4,multiplicities=False)[0]],F4) - sage: E = EllipticCurve(F2,[1,a]); E - Elliptic Curve defined by y^2 = x^3 + x + a over Finite Field in a of size 5^2 - sage: E.change_ring(h) - Elliptic Curve defined by y^2 = x^3 + x + (4*b^3+4*b^2+4*b+3) over Finite Field in b of size 5^4 + sage: F2 = GF(5^2,'a'); a = F2.gen() # optional - sage.rings.finite_rings + sage: F4 = GF(5^4,'b'); b = F4.gen() # optional - sage.rings.finite_rings + sage: roots = a.charpoly().roots(ring=F4, multiplicities=False) # optional - sage.rings.finite_rings + sage: h = F2.hom([a[0]], F4) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F2, [1,a]); E # optional - sage.rings.finite_rings + Elliptic Curve defined by y^2 = x^3 + x + a + over Finite Field in a of size 5^2 + sage: E.change_ring(h) # optional - sage.rings.finite_rings + Elliptic Curve defined by y^2 = x^3 + x + (4*b^3+4*b^2+4*b+3) + over Finite Field in b of size 5^4 """ return self.base_extend(R) @@ -1383,8 +1407,8 @@ def base_ring(self): EXAMPLES:: - sage: E = EllipticCurve(GF(49, 'a'), [3,5]) - sage: E.base_ring() + sage: E = EllipticCurve(GF(49, 'a'), [3,5]) # optional - sage.rings.finite_rings + sage: E.base_ring() # optional - sage.rings.finite_rings Finite Field in a of size 7^2 :: @@ -1412,13 +1436,13 @@ def gens(self): EXAMPLES:: - sage: R.=QQ[] + sage: R. = QQ[] sage: E = EllipticCurve([a1,a2,a3,a4,a6]) sage: E.gens() Traceback (most recent call last): ... NotImplementedError: not implemented. - sage: E = EllipticCurve(QQ,[1,1]) + sage: E = EllipticCurve(QQ, [1,1]) sage: E.gens() [(0 : 1 : 1)] """ @@ -1434,7 +1458,7 @@ def gen(self, i): EXAMPLES:: - sage: R.=QQ[] + sage: R. = QQ[] sage: E = EllipticCurve([a1,a2,a3,a4,a6]) sage: E.gen(0) Traceback (most recent call last): @@ -1463,10 +1487,13 @@ def rst_transform(self, r, s, t): EXAMPLES:: - sage: R.=QQ[] + sage: R. = QQ[] sage: E = EllipticCurve([1,2,3,4,5]) - sage: E.rst_transform(r,s,t) - Elliptic Curve defined by y^2 + (2*s+1)*x*y + (r+2*t+3)*y = x^3 + (-s^2+3*r-s+2)*x^2 + (3*r^2-r*s-2*s*t+4*r-3*s-t+4)*x + (r^3+2*r^2-r*t-t^2+4*r-3*t+5) over Multivariate Polynomial Ring in r, s, t over Rational Field + sage: E.rst_transform(r, s, t) + Elliptic Curve defined by y^2 + (2*s+1)*x*y + (r+2*t+3)*y + = x^3 + (-s^2+3*r-s+2)*x^2 + (3*r^2-r*s-2*s*t+4*r-3*s-t+4)*x + + (r^3+2*r^2-r*t-t^2+4*r-3*t+5) + over Multivariate Polynomial Ring in r, s, t over Rational Field """ return self.change_weierstrass_model(1, r, s, t) @@ -1490,11 +1517,13 @@ def scale_curve(self, u): EXAMPLES:: - sage: K = Frac(PolynomialRing(QQ,'u')) + sage: K = Frac(PolynomialRing(QQ, 'u')) sage: u = K.gen() sage: E = EllipticCurve([1,2,3,4,5]) sage: E.scale_curve(u) - Elliptic Curve defined by y^2 + u*x*y + 3*u^3*y = x^3 + 2*u^2*x^2 + 4*u^4*x + 5*u^6 over Fraction Field of Univariate Polynomial Ring in u over Rational Field + Elliptic Curve defined by + y^2 + u*x*y + 3*u^3*y = x^3 + 2*u^2*x^2 + 4*u^4*x + 5*u^6 + over Fraction Field of Univariate Polynomial Ring in u over Rational Field """ if isinstance(u, int): u = self.base_ring()(u) # because otherwise 1/u would round! @@ -1611,22 +1640,23 @@ def division_polynomial_0(self, n, x=None): An example to illustrate the relationship with torsion points:: - sage: F = GF(11) - sage: E = EllipticCurve(F, [0, 2]); E + sage: F = GF(11) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F, [0, 2]); E # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + 2 over Finite Field of size 11 - sage: f = E.division_polynomial_0(5); f + sage: f = E.division_polynomial_0(5); f # optional - sage.rings.finite_rings 5*x^12 + x^9 + 8*x^6 + 4*x^3 + 7 - sage: f.factor() - (5) * (x^2 + 5) * (x^2 + 2*x + 5) * (x^2 + 5*x + 7) * (x^2 + 7*x + 7) * (x^2 + 9*x + 5) * (x^2 + 10*x + 7) + sage: f.factor() # optional - sage.rings.finite_rings + (5) * (x^2 + 5) * (x^2 + 2*x + 5) * (x^2 + 5*x + 7) + * (x^2 + 7*x + 7) * (x^2 + 9*x + 5) * (x^2 + 10*x + 7) This indicates that the `x`-coordinates of all the 5-torsion points of `E` are in `\GF{11^2}`, and therefore the `y`-coordinates are in `\GF{11^4}`:: - sage: K = GF(11^4, 'a') - sage: X = E.change_ring(K) - sage: f = X.division_polynomial_0(5) - sage: x_coords = f.roots(multiplicities=False); x_coords + sage: K = GF(11^4, 'a') # optional - sage.rings.finite_rings + sage: X = E.change_ring(K) # optional - sage.rings.finite_rings + sage: f = X.division_polynomial_0(5) # optional - sage.rings.finite_rings + sage: x_coords = f.roots(multiplicities=False); x_coords # optional - sage.rings.finite_rings [10*a^3 + 4*a^2 + 5*a + 6, 9*a^3 + 8*a^2 + 10*a + 8, 8*a^3 + a^2 + 4*a + 10, @@ -1643,7 +1673,7 @@ def division_polynomial_0(self, n, x=None): Now we check that these are exactly the `x`-coordinates of the 5-torsion points of `E`:: - sage: for x in x_coords: + sage: for x in x_coords: # optional - sage.rings.finite_rings ....: assert X.lift_x(x).order() == 5 The roots of the polynomial are the `x`-coordinates of the points `P` @@ -1733,10 +1763,10 @@ def two_division_polynomial(self, x=None): sage: E = EllipticCurve('5077a1') sage: E.two_division_polynomial() 4*x^3 - 28*x + 25 - sage: E = EllipticCurve(GF(3^2,'a'),[1,1,1,1,1]) - sage: E.two_division_polynomial() + sage: E = EllipticCurve(GF(3^2,'a'), [1,1,1,1,1]) # optional - sage.rings.finite_rings + sage: E.two_division_polynomial() # optional - sage.rings.finite_rings x^3 + 2*x^2 + 2 - sage: E.two_division_polynomial().roots() + sage: E.two_division_polynomial().roots() # optional - sage.rings.finite_rings [(2, 1), (2*a, 1), (a + 2, 1)] """ return self.division_polynomial_0(-1,x) @@ -1825,11 +1855,12 @@ def division_polynomial(self, m, x=None, two_torsion_multiplicity=2, force_evalu :: sage: E = EllipticCurve([0, -1, 1, -10, -20]) - sage: R.=PolynomialRing(QQ) - sage: E.division_polynomial(4,z,0) + sage: R. = PolynomialRing(QQ) + sage: E.division_polynomial(4, z, 0) 2*z^6 - 4*z^5 - 100*z^4 - 790*z^3 - 210*z^2 - 1496*z - 5821 - sage: E.division_polynomial(4,z) - 8*z^9 - 24*z^8 - 464*z^7 - 2758*z^6 + 6636*z^5 + 34356*z^4 + 53510*z^3 + 99714*z^2 + 351024*z + 459859 + sage: E.division_polynomial(4, z) + 8*z^9 - 24*z^8 - 464*z^7 - 2758*z^6 + 6636*z^5 + 34356*z^4 + + 53510*z^3 + 99714*z^2 + 351024*z + 459859 This does not work, since when two_torsion_multiplicity is 1, we compute a bivariate polynomial, and must evaluate at a tuple of @@ -1838,9 +1869,10 @@ def division_polynomial(self, m, x=None, two_torsion_multiplicity=2, force_evalu sage: E.division_polynomial(4,z,1) Traceback (most recent call last): ... - ValueError: x should be a tuple of length 2 (or None) when two_torsion_multiplicity is 1 - sage: R.=PolynomialRing(QQ,2) - sage: E.division_polynomial(4,(z,w),1).factor() + ValueError: x should be a tuple of length 2 (or None) + when two_torsion_multiplicity is 1 + sage: R. = PolynomialRing(QQ, 2) + sage: E.division_polynomial(4, (z,w), 1).factor() (2*w + 1) * (2*z^6 - 4*z^5 - 100*z^4 - 790*z^3 - 210*z^2 - 1496*z - 5821) We can also evaluate this bivariate polynomial at a point:: @@ -2044,11 +2076,11 @@ def _multiple_x_numerator(self, n, x=None): Check for :trac:`33156`:: - sage: E = EllipticCurve(GF(65537), [5,5]) - sage: R. = E.base_field()[] - sage: E._multiple_x_numerator(5, x=R.quotient(x^2).gen()) + sage: E = EllipticCurve(GF(65537), [5,5]) # optional - sage.rings.finite_rings + sage: R. = E.base_field()[] # optional - sage.rings.finite_rings + sage: E._multiple_x_numerator(5, x=R.quotient(x^2).gen()) # optional - sage.rings.finite_rings 10220*xbar + 42539 - sage: E._multiple_x_numerator(5) + sage: E._multiple_x_numerator(5) # optional - sage.rings.finite_rings x^25 + 65037*x^23 + 55137*x^22 + ... + 813*x^2 + 10220*x + 42539 """ n = rings.Integer(n).abs() @@ -2140,11 +2172,11 @@ def _multiple_x_denominator(self, n, x=None): Check for :trac:`33156`:: - sage: E = EllipticCurve(GF(65537), [5,5]) - sage: R. = E.base_field()[] - sage: E._multiple_x_denominator(5, x=R.quotient(x^2).gen()) + sage: E = EllipticCurve(GF(65537), [5,5]) # optional - sage.rings.finite_rings + sage: R. = E.base_field()[] # optional - sage.rings.finite_rings + sage: E._multiple_x_denominator(5, x=R.quotient(x^2).gen()) # optional - sage.rings.finite_rings 52039*xbar + 56726 - sage: E._multiple_x_denominator(5) + sage: E._multiple_x_denominator(5) # optional - sage.rings.finite_rings 25*x^24 + 3100*x^22 + 19000*x^21 + ... + 24111*x^2 + 52039*x + 56726 """ n = rings.Integer(n).abs() @@ -2213,7 +2245,8 @@ def multiplication_by_m(self, m, x_only=False): sage: f = E.multiplication_by_m(2) sage: f - ((x^4 + 2*x^2 - 24*x + 1)/(4*x^3 - 4*x + 12), (8*x^6*y - 40*x^4*y + 480*x^3*y - 40*x^2*y + 96*x*y - 568*y)/(64*x^6 - 128*x^4 + 384*x^3 + 64*x^2 - 384*x + 576)) + ((x^4 + 2*x^2 - 24*x + 1)/(4*x^3 - 4*x + 12), + (8*x^6*y - 40*x^4*y + 480*x^3*y - 40*x^2*y + 96*x*y - 568*y)/(64*x^6 - 128*x^4 + 384*x^3 + 64*x^2 - 384*x + 576)) Grab only the x-coordinate (less work):: @@ -2262,14 +2295,14 @@ def multiplication_by_m(self, m, x_only=False): The following test shows that :trac:`4364` is indeed fixed:: - sage: p = next_prime(2^30-41) - sage: a = GF(p)(1) - sage: b = GF(p)(1) - sage: E = EllipticCurve([a, b]) - sage: P = E.random_point() - sage: my_eval = lambda f,P: [fi(P[0],P[1]) for fi in f] - sage: f = E.multiplication_by_m(2) - sage: assert(E(eval(f,P)) == 2*P) + sage: p = next_prime(2^30-41) # optional - sage.rings.finite_rings + sage: a = GF(p)(1) # optional - sage.rings.finite_rings + sage: b = GF(p)(1) # optional - sage.rings.finite_rings + sage: E = EllipticCurve([a, b]) # optional - sage.rings.finite_rings + sage: P = E.random_point() # optional - sage.rings.finite_rings + sage: my_eval = lambda f,P: [fi(P[0],P[1]) for fi in f] # optional - sage.rings.finite_rings + sage: f = E.multiplication_by_m(2) # optional - sage.rings.finite_rings + sage: assert(E(eval(f,P)) == 2*P) # optional - sage.rings.finite_rings """ # Coerce the input m to be an integer m = rings.Integer(m) @@ -2344,21 +2377,25 @@ def multiplication_by_m_isogeny(self, m): sage: E = EllipticCurve('11a1') sage: E.multiplication_by_m_isogeny(7) doctest:warning ... DeprecationWarning: ... - Isogeny of degree 49 from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Isogeny of degree 49 + from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 + over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 + over Rational Field TESTS: Tests for :trac:`32490`:: - sage: E = EllipticCurve(QQbar, [1,0]) - sage: E.multiplication_by_m_isogeny(1).rational_maps() + sage: E = EllipticCurve(QQbar, [1,0]) # optional - sage.rings.number_field + sage: E.multiplication_by_m_isogeny(1).rational_maps() # optional - sage.rings.number_field (x, y) :: - sage: E = EllipticCurve_from_j(GF(31337).random_element()) - sage: P = E.random_point() - sage: [E.multiplication_by_m_isogeny(m)(P) == m*P for m in (1,2,3,5,7,9)] + sage: E = EllipticCurve_from_j(GF(31337).random_element()) # optional - sage.rings.finite_rings + sage: P = E.random_point() # optional - sage.rings.finite_rings + sage: [E.multiplication_by_m_isogeny(m)(P) == m*P for m in (1,2,3,5,7,9)] # optional - sage.rings.finite_rings [True, True, True, True, True, True] :: @@ -2374,11 +2411,17 @@ def multiplication_by_m_isogeny(self, m): sage: E = EllipticCurve([5,5]) sage: E.multiplication_by_m_isogeny(-1) - Isogeny of degree 1 from Elliptic Curve defined by y^2 = x^3 + 5*x + 5 over Rational Field to Elliptic Curve defined by y^2 = x^3 + 5*x + 5 over Rational Field + Isogeny of degree 1 + from Elliptic Curve defined by y^2 = x^3 + 5*x + 5 over Rational Field + to Elliptic Curve defined by y^2 = x^3 + 5*x + 5 over Rational Field sage: E.multiplication_by_m_isogeny(-2) - Isogeny of degree 4 from Elliptic Curve defined by y^2 = x^3 + 5*x + 5 over Rational Field to Elliptic Curve defined by y^2 = x^3 + 5*x + 5 over Rational Field + Isogeny of degree 4 + from Elliptic Curve defined by y^2 = x^3 + 5*x + 5 over Rational Field + to Elliptic Curve defined by y^2 = x^3 + 5*x + 5 over Rational Field sage: E.multiplication_by_m_isogeny(-3) - Isogeny of degree 9 from Elliptic Curve defined by y^2 = x^3 + 5*x + 5 over Rational Field to Elliptic Curve defined by y^2 = x^3 + 5*x + 5 over Rational Field + Isogeny of degree 9 + from Elliptic Curve defined by y^2 = x^3 + 5*x + 5 over Rational Field + to Elliptic Curve defined by y^2 = x^3 + 5*x + 5 over Rational Field sage: mu = E.multiplication_by_m_isogeny sage: all(mu(-m) == -mu(m) for m in (1,2,3,5,7)) True @@ -2411,7 +2454,8 @@ def scalar_multiplication(self, m): sage: E = EllipticCurve('77a1') sage: m = E.scalar_multiplication(-7); m - Scalar-multiplication endomorphism [-7] of Elliptic Curve defined by y^2 + y = x^3 + 2*x over Rational Field + Scalar-multiplication endomorphism [-7] + of Elliptic Curve defined by y^2 + y = x^3 + 2*x over Rational Field sage: m.degree() 49 sage: P = E(2,3) @@ -2437,16 +2481,20 @@ def frobenius_isogeny(self, n=1): EXAMPLES:: - sage: z3, = GF(13^3).gens() - sage: E = EllipticCurve([z3,z3^2]) - sage: E.frobenius_isogeny() + sage: z3, = GF(13^3).gens() # optional - sage.rings.finite_rings + sage: E = EllipticCurve([z3, z3^2]) # optional - sage.rings.finite_rings + sage: E.frobenius_isogeny() # optional - sage.rings.finite_rings Frobenius isogeny of degree 13: - From: Elliptic Curve defined by y^2 = x^3 + z3*x + z3^2 over Finite Field in z3 of size 13^3 - To: Elliptic Curve defined by y^2 = x^3 + (5*z3^2+7*z3+11)*x + (5*z3^2+12*z3+1) over Finite Field in z3 of size 13^3 + From: Elliptic Curve defined by y^2 = x^3 + z3*x + z3^2 + over Finite Field in z3 of size 13^3 + To: Elliptic Curve defined by y^2 = x^3 + (5*z3^2+7*z3+11)*x + (5*z3^2+12*z3+1) + over Finite Field in z3 of size 13^3 sage: E.frobenius_isogeny(3) Frobenius endomorphism of degree 2197 = 13^3: - From: Elliptic Curve defined by y^2 = x^3 + z3*x + z3^2 over Finite Field in z3 of size 13^3 - To: Elliptic Curve defined by y^2 = x^3 + z3*x + z3^2 over Finite Field in z3 of size 13^3 + From: Elliptic Curve defined by y^2 = x^3 + z3*x + z3^2 + over Finite Field in z3 of size 13^3 + To: Elliptic Curve defined by y^2 = x^3 + z3*x + z3^2 + over Finite Field in z3 of size 13^3 """ p = self.base_ring().characteristic() if not p: @@ -2478,9 +2526,9 @@ def isomorphism_to(self, other): sage: F = E.short_weierstrass_model() sage: w = E.isomorphism_to(F); w Elliptic-curve morphism: - From: Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field - To: Elliptic Curve defined by y^2 = x^3 - 16*x + 16 over Rational Field - Via: (u,r,s,t) = (1/2, 0, 0, -1/2) + From: Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field + To: Elliptic Curve defined by y^2 = x^3 - 16*x + 16 over Rational Field + Via: (u,r,s,t) = (1/2, 0, 0, -1/2) sage: P = E(0,-1,1) sage: w(P) (0 : -4 : 1) @@ -2493,11 +2541,12 @@ def isomorphism_to(self, other): We can also handle injections to different base rings:: - sage: K. = NumberField(x^3-7) - sage: E.isomorphism_to(E.change_ring(K)) + sage: K. = NumberField(x^3 - 7) # optional - sage.rings.number_field + sage: E.isomorphism_to(E.change_ring(K)) # optional - sage.rings.number_field Elliptic-curve morphism: From: Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field - To: Elliptic Curve defined by y^2 + y = x^3 + (-1)*x over Number Field in a with defining polynomial x^3 - 7 + To: Elliptic Curve defined by y^2 + y = x^3 + (-1)*x + over Number Field in a with defining polynomial x^3 - 7 Via: (u,r,s,t) = (1, 0, 0, 0) """ return wm.WeierstrassIsomorphism(self, None, other) @@ -2525,31 +2574,40 @@ def automorphisms(self, field=None): sage: E = EllipticCurve_from_j(QQ(0)) # a curve with j=0 over QQ sage: E.automorphisms() - [Elliptic-curve endomorphism of Elliptic Curve defined by y^2 + y = x^3 over Rational Field + [Elliptic-curve endomorphism of Elliptic Curve defined by y^2 + y = x^3 + over Rational Field Via: (u,r,s,t) = (1, 0, 0, 0), - Elliptic-curve endomorphism of Elliptic Curve defined by y^2 + y = x^3 over Rational Field + Elliptic-curve endomorphism of Elliptic Curve defined by y^2 + y = x^3 + over Rational Field Via: (u,r,s,t) = (-1, 0, 0, -1)] We can also find automorphisms defined over extension fields:: - sage: K. = NumberField(x^2+3) # adjoin roots of unity - sage: E.automorphisms(K) - [Elliptic-curve endomorphism of Elliptic Curve defined by y^2 + y = x^3 over Number Field in a with defining polynomial x^2 + 3 + sage: K. = NumberField(x^2 + 3) # adjoin roots of unity # optional - sage.rings.number_field + sage: E.automorphisms(K) # optional - sage.rings.number_field + [Elliptic-curve endomorphism of Elliptic Curve defined by y^2 + y = x^3 + over Number Field in a with defining polynomial x^2 + 3 Via: (u,r,s,t) = (1, 0, 0, 0), - Elliptic-curve endomorphism of Elliptic Curve defined by y^2 + y = x^3 over Number Field in a with defining polynomial x^2 + 3 + Elliptic-curve endomorphism of Elliptic Curve defined by y^2 + y = x^3 + over Number Field in a with defining polynomial x^2 + 3 Via: (u,r,s,t) = (-1, 0, 0, -1), - Elliptic-curve endomorphism of Elliptic Curve defined by y^2 + y = x^3 over Number Field in a with defining polynomial x^2 + 3 + Elliptic-curve endomorphism of Elliptic Curve defined by y^2 + y = x^3 + over Number Field in a with defining polynomial x^2 + 3 Via: (u,r,s,t) = (-1/2*a - 1/2, 0, 0, 0), - Elliptic-curve endomorphism of Elliptic Curve defined by y^2 + y = x^3 over Number Field in a with defining polynomial x^2 + 3 + Elliptic-curve endomorphism of Elliptic Curve defined by y^2 + y = x^3 + over Number Field in a with defining polynomial x^2 + 3 Via: (u,r,s,t) = (1/2*a + 1/2, 0, 0, -1), - Elliptic-curve endomorphism of Elliptic Curve defined by y^2 + y = x^3 over Number Field in a with defining polynomial x^2 + 3 + Elliptic-curve endomorphism of Elliptic Curve defined by y^2 + y = x^3 + over Number Field in a with defining polynomial x^2 + 3 Via: (u,r,s,t) = (1/2*a - 1/2, 0, 0, 0), - Elliptic-curve endomorphism of Elliptic Curve defined by y^2 + y = x^3 over Number Field in a with defining polynomial x^2 + 3 + Elliptic-curve endomorphism of Elliptic Curve defined by y^2 + y = x^3 + over Number Field in a with defining polynomial x^2 + 3 Via: (u,r,s,t) = (-1/2*a + 1/2, 0, 0, -1)] :: - sage: [len(EllipticCurve_from_j(GF(q,'a')(0)).automorphisms()) for q in [2,4,3,9,5,25,7,49]] + sage: [len(EllipticCurve_from_j(GF(q,'a')(0)).automorphisms()) # optional - sage.rings.finite_rings + ....: for q in [2,4,3,9,5,25,7,49]] [2, 24, 2, 12, 2, 6, 6, 6] TESTS: @@ -2558,19 +2616,19 @@ def automorphisms(self, field=None): sage: p = random_prime(100) sage: k = randrange(1,30) - sage: F. = GF((p,k)) - sage: while True: + sage: F. = GF((p,k)) # optional - sage.rings.finite_rings + sage: while True: # optional - sage.rings.finite_rings ....: try: ....: E = EllipticCurve(list((F^5).random_element())) ....: except ArithmeticError: ....: continue ....: break - sage: Aut = E.automorphisms() - sage: Aut[0] == E.scalar_multiplication(1) + sage: Aut = E.automorphisms() # optional - sage.rings.finite_rings + sage: Aut[0] == E.scalar_multiplication(1) # optional - sage.rings.finite_rings True - sage: Aut[1] == E.scalar_multiplication(-1) + sage: Aut[1] == E.scalar_multiplication(-1) # optional - sage.rings.finite_rings True - sage: sorted(Aut) == Aut + sage: sorted(Aut) == Aut # optional - sage.rings.finite_rings True """ if field is not None: @@ -2600,25 +2658,32 @@ def isomorphisms(self, other, field=None): sage: E = EllipticCurve_from_j(QQ(0)) # a curve with j=0 over QQ sage: F = EllipticCurve('27a3') # should be the same one sage: E.isomorphisms(F) - [Elliptic-curve endomorphism of Elliptic Curve defined by y^2 + y = x^3 over Rational Field + [Elliptic-curve endomorphism of Elliptic Curve defined by y^2 + y = x^3 + over Rational Field Via: (u,r,s,t) = (1, 0, 0, 0), - Elliptic-curve endomorphism of Elliptic Curve defined by y^2 + y = x^3 over Rational Field + Elliptic-curve endomorphism of Elliptic Curve defined by y^2 + y = x^3 + over Rational Field Via: (u,r,s,t) = (-1, 0, 0, -1)] We can also find isomorphisms defined over extension fields:: - sage: E = EllipticCurve(GF(7),[0,0,0,1,1]) - sage: F = EllipticCurve(GF(7),[0,0,0,1,-1]) - sage: E.isomorphisms(F) + sage: E = EllipticCurve(GF(7), [0,0,0,1,1]) # optional - sage.rings.finite_rings + sage: F = EllipticCurve(GF(7), [0,0,0,1,-1]) # optional - sage.rings.finite_rings + sage: E.isomorphisms(F) # optional - sage.rings.finite_rings [] - sage: E.isomorphisms(F,GF(49,'a')) + sage: E.isomorphisms(F, GF(49,'a')) # optional - sage.rings.finite_rings [Elliptic-curve morphism: - From: Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field in a of size 7^2 - To: Elliptic Curve defined by y^2 = x^3 + x + 6 over Finite Field in a of size 7^2 - Via: (u,r,s,t) = (a + 3, 0, 0, 0), Elliptic-curve morphism: - From: Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field in a of size 7^2 - To: Elliptic Curve defined by y^2 = x^3 + x + 6 over Finite Field in a of size 7^2 - Via: (u,r,s,t) = (6*a + 4, 0, 0, 0)] + From: Elliptic Curve defined by y^2 = x^3 + x + 1 + over Finite Field in a of size 7^2 + To: Elliptic Curve defined by y^2 = x^3 + x + 6 + over Finite Field in a of size 7^2 + Via: (u,r,s,t) = (a + 3, 0, 0, 0), + Elliptic-curve morphism: + From: Elliptic Curve defined by y^2 = x^3 + x + 1 + over Finite Field in a of size 7^2 + To: Elliptic Curve defined by y^2 = x^3 + x + 6 + over Finite Field in a of size 7^2 + Via: (u,r,s,t) = (6*a + 4, 0, 0, 0)] """ if field is not None: self = self.change_ring(field) @@ -2647,7 +2712,8 @@ def is_isomorphic(self, other, field=None): sage: E = EllipticCurve('389a') sage: F = E.change_weierstrass_model([2,3,4,5]); F - Elliptic Curve defined by y^2 + 4*x*y + 11/8*y = x^3 - 3/2*x^2 - 13/16*x over Rational Field + Elliptic Curve defined by y^2 + 4*x*y + 11/8*y = x^3 - 3/2*x^2 - 13/16*x + over Rational Field sage: E.is_isomorphic(F) True sage: E.is_isomorphic(F.change_ring(CC)) @@ -2681,9 +2747,12 @@ def change_weierstrass_model(self, *urst): sage: E = EllipticCurve('15a') sage: F1 = E.change_weierstrass_model([1/2,0,0,0]); F1 - Elliptic Curve defined by y^2 + 2*x*y + 8*y = x^3 + 4*x^2 - 160*x - 640 over Rational Field + Elliptic Curve defined by y^2 + 2*x*y + 8*y = x^3 + 4*x^2 - 160*x - 640 + over Rational Field sage: F2 = E.change_weierstrass_model([7,2,1/3,5]); F2 - Elliptic Curve defined by y^2 + 5/21*x*y + 13/343*y = x^3 + 59/441*x^2 - 10/7203*x - 58/117649 over Rational Field + Elliptic Curve defined by + y^2 + 5/21*x*y + 13/343*y = x^3 + 59/441*x^2 - 10/7203*x - 58/117649 + over Rational Field sage: F1.is_isomorphic(F2) True """ @@ -2730,25 +2799,28 @@ def short_weierstrass_model(self, complete_cube=True): :: - sage: E = EllipticCurve(GF(3),[1,2,3,4,5]) - sage: E.short_weierstrass_model(complete_cube=False) + sage: E = EllipticCurve(GF(3), [1,2,3,4,5]) # optional - sage.rings.finite_rings + sage: E.short_weierstrass_model(complete_cube=False) # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + x + 2 over Finite Field of size 3 This used to be different see :trac:`3973`:: - sage: E.short_weierstrass_model() + sage: E.short_weierstrass_model() # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + x + 2 over Finite Field of size 3 More tests in characteristic 3:: - sage: E = EllipticCurve(GF(3),[0,2,1,2,1]) - sage: E.short_weierstrass_model() + sage: E = EllipticCurve(GF(3), [0,2,1,2,1]) # optional - sage.rings.finite_rings + sage: E.short_weierstrass_model() # optional - sage.rings.finite_rings Traceback (most recent call last): ... - ValueError: short_weierstrass_model(): no short model for Elliptic Curve defined by y^2 + y = x^3 + 2*x^2 + 2*x + 1 over Finite Field of size 3 (characteristic is 3) - sage: E.short_weierstrass_model(complete_cube=False) - Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2*x + 2 over Finite Field of size 3 - sage: E.short_weierstrass_model(complete_cube=False).is_isomorphic(E) + ValueError: short_weierstrass_model(): no short model for Elliptic Curve + defined by y^2 + y = x^3 + 2*x^2 + 2*x + 1 over Finite Field of size 3 + (characteristic is 3) + sage: E.short_weierstrass_model(complete_cube=False) # optional - sage.rings.finite_rings + Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2*x + 2 + over Finite Field of size 3 + sage: E.short_weierstrass_model(complete_cube=False).is_isomorphic(E) # optional - sage.rings.finite_rings True """ from . import constructor @@ -2821,49 +2893,57 @@ def montgomery_model(self, twisted=False, morphism=False): EXAMPLES:: - sage: E = EllipticCurve(QQbar, '11a1') - sage: E.montgomery_model() - Elliptic Curve defined by y^2 = x^3 + (-1.953522420987248?)*x^2 + x over Algebraic Field + sage: E = EllipticCurve(QQbar, '11a1') # optional - sage.rings.number_field + sage: E.montgomery_model() # optional - sage.rings.number_field + Elliptic Curve defined by y^2 = x^3 + (-1.953522420987248?)*x^2 + x + over Algebraic Field :: - sage: E = EllipticCurve(GF(431^2), [7,7]) - sage: E.montgomery_model() - Elliptic Curve defined by y^2 = x^3 + (51*z2+190)*x^2 + x over Finite Field in z2 of size 431^2 + sage: E = EllipticCurve(GF(431^2), [7,7]) # optional - sage.rings.finite_rings + sage: E.montgomery_model() # optional - sage.rings.finite_rings + Elliptic Curve defined by y^2 = x^3 + (51*z2+190)*x^2 + x + over Finite Field in z2 of size 431^2 An isomorphism between the Montgomery and Weierstrass form can be obtained using the ``morphism`` parameter:: - sage: E.montgomery_model(morphism=True) - (Elliptic Curve defined by y^2 = x^3 + (51*z2+190)*x^2 + x over Finite Field in z2 of size 431^2, + sage: E.montgomery_model(morphism=True) # optional - sage.rings.finite_rings + (Elliptic Curve defined by y^2 = x^3 + (51*z2+190)*x^2 + x + over Finite Field in z2 of size 431^2, Elliptic-curve morphism: - From: Elliptic Curve defined by y^2 = x^3 + 7*x + 7 over Finite Field in z2 of size 431^2 - To: Elliptic Curve defined by y^2 = x^3 + (51*z2+190)*x^2 + x over Finite Field in z2 of size 431^2 + From: Elliptic Curve defined by y^2 = x^3 + 7*x + 7 + over Finite Field in z2 of size 431^2 + To: Elliptic Curve defined by y^2 = x^3 + (51*z2+190)*x^2 + x + over Finite Field in z2 of size 431^2 Via: (u,r,s,t) = (64*z2 + 407, 159, 0, 0)) Not all elliptic curves have a Montgomery model over their field of definition:: - sage: E = EllipticCurve(GF(257), [1,1]) - sage: E.montgomery_model() + sage: E = EllipticCurve(GF(257), [1,1]) # optional - sage.rings.finite_rings + sage: E.montgomery_model() # optional - sage.rings.finite_rings Traceback (most recent call last): ... - ValueError: Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 257 has no Montgomery model + ValueError: Elliptic Curve defined by y^2 = x^3 + x + 1 + over Finite Field of size 257 has no Montgomery model :: - sage: E = EllipticCurve(GF(257), [10,10]) - sage: E.montgomery_model() + sage: E = EllipticCurve(GF(257), [10,10]) # optional - sage.rings.finite_rings + sage: E.montgomery_model() # optional - sage.rings.finite_rings Traceback (most recent call last): ... - ValueError: Elliptic Curve defined by y^2 = x^3 + 10*x + 10 over Finite Field of size 257 has no untwisted Montgomery model + ValueError: Elliptic Curve defined by y^2 = x^3 + 10*x + 10 + over Finite Field of size 257 has no untwisted Montgomery model However, as hinted by the error message, the latter curve does admit a *twisted* Montgomery model, which can be computed by passing ``twisted=True``:: - sage: E.montgomery_model(twisted=True) - Projective Plane Curve over Finite Field of size 257 defined by -x^3 + 8*x^2*z - 127*y^2*z - x*z^2 + sage: E.montgomery_model(twisted=True) # optional - sage.rings.finite_rings + Projective Plane Curve over Finite Field of size 257 + defined by -x^3 + 8*x^2*z - 127*y^2*z - x*z^2 Since Sage internally represents elliptic curves as (long) Weierstrass curves, which do not feature the Montgomery `B` coefficient, the @@ -2875,51 +2955,56 @@ def montgomery_model(self, twisted=False, morphism=False): but can easily be emulated by mapping back and forth to the corresponding Weierstrass curve:: - sage: C, f = E.montgomery_model(twisted=True, morphism=True) - sage: f + sage: C, f = E.montgomery_model(twisted=True, morphism=True) # optional - sage.rings.finite_rings + sage: f # optional - sage.rings.finite_rings Scheme morphism: - From: Elliptic Curve defined by y^2 = x^3 + 10*x + 10 over Finite Field of size 257 - To: Projective Plane Curve over Finite Field of size 257 defined by -x^3 + 8*x^2*z - 127*y^2*z - x*z^2 + From: Elliptic Curve defined by y^2 = x^3 + 10*x + 10 + over Finite Field of size 257 + To: Projective Plane Curve over Finite Field of size 257 + defined by -x^3 + 8*x^2*z - 127*y^2*z - x*z^2 Defn: Defined on coordinates by sending (x : y : z) to (x + 116*z : -y : -85*z) - sage: g = f.inverse(); g + sage: g = f.inverse(); g # optional - sage.rings.finite_rings Scheme morphism: - From: Projective Plane Curve over Finite Field of size 257 defined by -x^3 + 8*x^2*z - 127*y^2*z - x*z^2 - To: Elliptic Curve defined by y^2 = x^3 + 10*x + 10 over Finite Field of size 257 + From: Projective Plane Curve over Finite Field of size 257 + defined by -x^3 + 8*x^2*z - 127*y^2*z - x*z^2 + To: Elliptic Curve defined by y^2 = x^3 + 10*x + 10 + over Finite Field of size 257 Defn: Defined on coordinates by sending (x : y : z) to (-85*x - 116*z : 85*y : z) - sage: P = C(70, 8) - sage: Q = C(17, 17) - sage: P + Q # this doesn't work... + sage: P = C(70, 8) # optional - sage.rings.finite_rings + sage: Q = C(17, 17) # optional - sage.rings.finite_rings + sage: P + Q # this doesn't work... # optional - sage.rings.finite_rings Traceback (most recent call last): ... TypeError: unsupported operand parent(s) for +: ... - sage: f(g(P) + g(Q)) # ...but this does + sage: f(g(P) + g(Q)) # ...but this does # optional - sage.rings.finite_rings (107 : 168 : 1) Using the fact that the Weil pairing satisfies `e(\psi(P),\psi(Q)) = e(P,Q)^{\deg\psi}`, even pairings can be emulated in this way (note that isomorphisms have degree `1`):: - sage: F. = GF(257^2) - sage: C_ = C.change_ring(F) - sage: g_ = g.change_ring(F) - sage: g_(P).order() + sage: F. = GF(257^2) # optional - sage.rings.finite_rings + sage: C_ = C.change_ring(F) # optional - sage.rings.finite_rings + sage: g_ = g.change_ring(F) # optional - sage.rings.finite_rings + sage: g_(P).order() # optional - sage.rings.finite_rings 12 - sage: T = C_(-7 * z2 - 57, 31 * z2 - 52, 1) - sage: g_(T).order() + sage: T = C_(-7 * z2 - 57, 31 * z2 - 52, 1) # optional - sage.rings.finite_rings + sage: g_(T).order() # optional - sage.rings.finite_rings 12 - sage: g_(P).weil_pairing(g_(T), 12) + sage: g_(P).weil_pairing(g_(T), 12) # optional - sage.rings.finite_rings 15*z2 + 204 Another alternative is to simply extend the base field enough for the curve to have an untwisted Montgomery model:: - sage: C_ = E.change_ring(F).montgomery_model(); C_ - Elliptic Curve defined by y^2 = x^3 + 249*x^2 + x over Finite Field in z2 of size 257^2 - sage: h = C.defining_polynomial().change_ring(F); h + sage: C_ = E.change_ring(F).montgomery_model(); C_ # optional - sage.rings.finite_rings + Elliptic Curve defined by y^2 = x^3 + 249*x^2 + x + over Finite Field in z2 of size 257^2 + sage: h = C.defining_polynomial().change_ring(F); h # optional - sage.rings.finite_rings -x^3 + 8*x^2*z - 127*y^2*z - x*z^2 - sage: C_.is_isomorphic(EllipticCurve_from_cubic(h).codomain()) + sage: C_.is_isomorphic(EllipticCurve_from_cubic(h).codomain()) # optional - sage.rings.finite_rings True .. SEEALSO:: @@ -3029,29 +3114,29 @@ def plot(self, xmin=None, xmax=None, components='both', **args): EXAMPLES:: - sage: E = EllipticCurve([0,-1]) - sage: plot(E, rgbcolor=hue(0.7)) + sage: E = EllipticCurve([0, -1]) + sage: plot(E, rgbcolor=hue(0.7)) # optional - sage.plot Graphics object consisting of 1 graphics primitive sage: E = EllipticCurve('37a') - sage: plot(E) + sage: plot(E) # optional - sage.plot Graphics object consisting of 2 graphics primitives - sage: plot(E, xmin=25,xmax=26) + sage: plot(E, xmin=25, xmax=26) # optional - sage.plot Graphics object consisting of 2 graphics primitives With :trac:`12766` we added the components keyword:: sage: E.real_components() 2 - sage: E.plot(components='bounded') + sage: E.plot(components='bounded') # optional - sage.plot Graphics object consisting of 1 graphics primitive - sage: E.plot(components='unbounded') + sage: E.plot(components='unbounded') # optional - sage.plot Graphics object consisting of 1 graphics primitive If there is only one component then specifying components='bounded' raises a ValueError:: sage: E = EllipticCurve('9990be2') - sage: E.plot(components='bounded') + sage: E.plot(components='bounded') # optional - sage.plot Traceback (most recent call last): ... ValueError: no bounded component for this curve @@ -3059,10 +3144,11 @@ def plot(self, xmin=None, xmax=None, components='both', **args): An elliptic curve defined over the Complex Field can not be plotted:: sage: E = EllipticCurve(CC, [0,0,1,-1,0]) - sage: E.plot() + sage: E.plot() # optional - sage.plot Traceback (most recent call last): ... - NotImplementedError: plotting of curves over Complex Field with 53 bits of precision is not implemented yet + NotImplementedError: plotting of curves over Complex Field + with 53 bits of precision is not implemented yet """ RR = rings.RealField() K = self.base_ring() @@ -3202,7 +3288,8 @@ def formal_group(self): sage: E = EllipticCurve("37a") sage: E.formal_group() - Formal Group associated to the Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field + Formal Group associated to the Elliptic Curve + defined by y^2 + y = x^3 - x over Rational Field """ return formal_group.EllipticCurveFormalGroup(self) @@ -3241,28 +3328,29 @@ def _p_primary_torsion_basis(self, p, m=None): sage: E = EllipticCurve('11a1') sage: E._p_primary_torsion_basis(5) [[(5 : -6 : 1), 1]] - sage: K. = NumberField(x^4 + x^3 + 11*x^2 + 41*x + 101) - sage: EK = E.base_extend(K) - sage: EK._p_primary_torsion_basis(5) # long time (2s on sage.math, 2011) + sage: K. = NumberField(x^4 + x^3 + 11*x^2 + 41*x + 101) # optional - sage.rings.number_field + sage: EK = E.base_extend(K) # optional - sage.rings.number_field + sage: EK._p_primary_torsion_basis(5) # long time (2s on sage.math, 2011) # optional - sage.rings.number_field [[(16 : 60 : 1), 1], [(t : 1/11*t^3 + 6/11*t^2 + 19/11*t + 48/11 : 1), 1]] - sage: EF = E.change_ring(GF(101)) - sage: EF._p_primary_torsion_basis(5) + sage: EF = E.change_ring(GF(101)) # optional - sage.rings.finite_rings + sage: EF._p_primary_torsion_basis(5) # optional - sage.rings.finite_rings [[(0 : 13 : 1), 1], [(5 : 5 : 1), 1]] - sage: F. = CyclotomicField(21) - sage: E = EllipticCurve([2,-z^7,-z^7,0,0]) - sage: E._p_primary_torsion_basis(7,2) # long time (8s on sage.math, 2011) + sage: F. = CyclotomicField(21) # optional - sage.rings.number_field + sage: E = EllipticCurve([2, -z^7, -z^7, 0, 0]) # optional - sage.rings.number_field + sage: E._p_primary_torsion_basis(7,2) # long time (8s on sage.math, 2011) # optional - sage.rings.number_field [[(0 : z^7 : 1), 1], - [(z^7 - z^6 + z^4 - z^3 + z^2 - 1 : z^8 - 2*z^7 + z^6 + 2*z^5 - 3*z^4 + 2*z^3 - 2*z + 2 : 1), 1]] + [(z^7 - z^6 + z^4 - z^3 + z^2 - 1 + : z^8 - 2*z^7 + z^6 + 2*z^5 - 3*z^4 + 2*z^3 - 2*z + 2 : 1), 1]] TESTS: This shows that the bug at :trac:`4937` is fixed:: - sage: a=804515977734860566494239770982282063895480484302363715494873 - sage: b=584772221603632866665682322899297141793188252000674256662071 - sage: E = EllipticCurve(GF(10^60+3201),[0,a,0,b,0]) - sage: [t[1] for t in E._p_primary_torsion_basis(2)] # long time (3s on sage.math, 2011) + sage: a = 804515977734860566494239770982282063895480484302363715494873 + sage: b = 584772221603632866665682322899297141793188252000674256662071 + sage: E = EllipticCurve(GF(10^60+3201), [0,a,0,b,0]) # optional - sage.rings.finite_rings + sage: [t[1] for t in E._p_primary_torsion_basis(2)] # long time (3s on sage.math, 2011) # optional - sage.rings.finite_rings [16, 1] """ p = rings.Integer(p) @@ -3416,50 +3504,57 @@ def pari_curve(self): EXAMPLES:: sage: E = EllipticCurve([RR(0), RR(0), RR(1), RR(-1), RR(0)]) - sage: e = E.pari_curve() - sage: type(e) + sage: e = E.pari_curve() # optional - sage.libs.pari + sage: type(e) # optional - sage.libs.pari <... 'cypari2.gen.Gen'> - sage: e.type() + sage: e.type() # optional - sage.libs.pari 't_VEC' - sage: e.disc() + sage: e.disc() # optional - sage.libs.pari 37.0000000000000 Over a finite field:: - sage: EllipticCurve(GF(41),[2,5]).pari_curve() - [Mod(0, 41), Mod(0, 41), Mod(0, 41), Mod(2, 41), Mod(5, 41), Mod(0, 41), Mod(4, 41), Mod(20, 41), Mod(37, 41), Mod(27, 41), Mod(26, 41), Mod(4, 41), Mod(11, 41), Vecsmall([3]), [41, [9, 31, [6, 0, 0, 0]]], [0, 0, 0, 0]] + sage: EllipticCurve(GF(41), [2,5]).pari_curve() # optional - sage.libs.pari sage.rings.finite_rings + [Mod(0, 41), Mod(0, 41), Mod(0, 41), Mod(2, 41), Mod(5, 41), + Mod(0, 41), Mod(4, 41), Mod(20, 41), Mod(37, 41), Mod(27, 41), + Mod(26, 41), Mod(4, 41), Mod(11, 41), + Vecsmall([3]), + [41, [9, 31, [6, 0, 0, 0]]], [0, 0, 0, 0]] Over a `p`-adic field:: - sage: Qp = pAdicField(5, prec=3) - sage: E = EllipticCurve(Qp,[3, 4]) - sage: E.pari_curve() - [0, 0, 0, 3, 4, 0, 6, 16, -9, -144, -3456, -8640, 1728/5, Vecsmall([2]), [O(5^3)], [0, 0]] - sage: E.j_invariant() + sage: Qp = pAdicField(5, prec=3) # optional - sage.libs.pari sage.rings.padics + sage: E = EllipticCurve(Qp, [3, 4]) # optional - sage.libs.pari sage.rings.padics + sage: E.pari_curve() # optional - sage.libs.pari sage.rings.padics + [0, 0, 0, 3, 4, 0, 6, 16, -9, -144, -3456, -8640, 1728/5, + Vecsmall([2]), [O(5^3)], [0, 0]] + sage: E.j_invariant() # optional - sage.libs.pari sage.rings.padics 3*5^-1 + O(5) Over a number field:: - sage: K. = QuadraticField(2) - sage: E = EllipticCurve([1,a]) - sage: E.pari_curve() + sage: K. = QuadraticField(2) # optional - sage.libs.pari sage.rings.number_field + sage: E = EllipticCurve([1,a]) # optional - sage.libs.pari sage.rings.number_field + sage: E.pari_curve() # optional - sage.libs.pari sage.rings.number_field [0, 0, 0, Mod(1, y^2 - 2), - Mod(y, y^2 - 2), 0, Mod(2, y^2 - 2), Mod(4*y, y^2 - 2), - Mod(-1, y^2 - 2), Mod(-48, y^2 - 2), Mod(-864*y, y^2 - 2), - Mod(-928, y^2 - 2), Mod(3456/29, y^2 - 2), Vecsmall([5]), - [[y^2 - 2, [2, 0], 8, 1, [[1, -1.41421356237310; - 1, 1.41421356237310], [1, -1.41421356237310; 1, 1.41421356237310], - [16, -23; 16, 23], [2, 0; 0, 4], [4, 0; 0, 2], [2, 0; 0, 1], - [2, [0, 2; 1, 0]], [2]], [-1.41421356237310, 1.41421356237310], - [1, y], [1, 0; 0, 1], [1, 0, 0, 2; 0, 1, 1, 0]]], [0, 0, 0, 0, 0]] + Mod(y, y^2 - 2), 0, Mod(2, y^2 - 2), Mod(4*y, y^2 - 2), + Mod(-1, y^2 - 2), Mod(-48, y^2 - 2), Mod(-864*y, y^2 - 2), + Mod(-928, y^2 - 2), Mod(3456/29, y^2 - 2), + Vecsmall([5]), + [[y^2 - 2, [2, 0], 8, 1, [[1, -1.41421356237310; 1, 1.41421356237310], + [1, -1.41421356237310; 1, 1.41421356237310], + [16, -23; 16, 23], [2, 0; 0, 4], [4, 0; 0, 2], [2, 0; 0, 1], + [2, [0, 2; 1, 0]], [2]], [-1.41421356237310, 1.41421356237310], + [1, y], [1, 0; 0, 1], [1, 0, 0, 2; 0, 1, 1, 0]]], [0, 0, 0, 0, 0]] PARI no longer requires that the `j`-invariant has negative `p`-adic valuation:: - sage: E = EllipticCurve(Qp,[1, 1]) - sage: E.j_invariant() # the j-invariant is a p-adic integer + sage: E = EllipticCurve(Qp,[1, 1]) # optional - sage.libs.pari sage.rings.padics + sage: E.j_invariant() # the j-invariant is a p-adic integer # optional - sage.libs.pari sage.rings.padics 2 + 4*5^2 + O(5^3) - sage: E.pari_curve() - [0, 0, 0, 1, 1, 0, 2, 4, -1, -48, -864, -496, 6912/31, Vecsmall([2]), [O(5^3)], [0, 0]] + sage: E.pari_curve() # optional - sage.libs.pari sage.rings.padics + [0, 0, 0, 1, 1, 0, 2, 4, -1, -48, -864, -496, 6912/31, + Vecsmall([2]), [O(5^3)], [0, 0]] """ from sage.categories.number_fields import NumberFields from sage.libs.pari import pari @@ -3478,12 +3573,12 @@ def __pari__(self): EXAMPLES:: sage: E = EllipticCurve('11a1') - sage: pari(E) + sage: pari(E) # optional - sage.libs.pari [0, -1, 1, -10, -20, -4, -20, -79, -21, 496, 20008, -161051, -122023936/161051, Vecsmall([1]), [Vecsmall([64, -1])], [0, 0, 0, 0, 0, 0, 0, 0]] Over a finite field:: - sage: EllipticCurve(GF(2), [0,0,1,1,1]).__pari__() + sage: EllipticCurve(GF(2), [0,0,1,1,1]).__pari__() # optional - sage.libs.pari sage.rings.finite_rings [0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, Vecsmall([4]), [1, [[Vecsmall([0, 1]), Vecsmall([0, 1]), Vecsmall([0, 1])], Vecsmall([0, 1]), [Vecsmall([0, 1]), Vecsmall([0]), Vecsmall([0]), Vecsmall([0])]]], [0, 0, 0, 0]] """ return self.pari_curve() diff --git a/src/sage/schemes/elliptic_curves/ell_modular_symbols.py b/src/sage/schemes/elliptic_curves/ell_modular_symbols.py index b31f7dfe46c..73497225511 100644 --- a/src/sage/schemes/elliptic_curves/ell_modular_symbols.py +++ b/src/sage/schemes/elliptic_curves/ell_modular_symbols.py @@ -125,11 +125,12 @@ def modular_symbol_space(E, sign, base_ring, bound=None): EXAMPLES:: - sage: import sage.schemes.elliptic_curves.ell_modular_symbols + sage: from sage.schemes.elliptic_curves.ell_modular_symbols import modular_symbol_space sage: E = EllipticCurve('11a1') - sage: M = sage.schemes.elliptic_curves.ell_modular_symbols.modular_symbol_space(E,-1,GF(37)) - sage: M - Modular Symbols space of dimension 1 for Gamma_0(11) of weight 2 with sign -1 over Finite Field of size 37 + sage: M = modular_symbol_space(E, -1, GF(37)) # optional - sage.rings.finite_rings + sage: M # optional - sage.rings.finite_rings + Modular Symbols space of dimension 1 for Gamma_0(11) of weight 2 with sign -1 + over Finite Field of size 37 """ if sign not in [-1, 0, 1]: raise TypeError('sign must -1, 0 or 1') @@ -209,10 +210,12 @@ def _repr_(self): sage: m = EllipticCurve('11a1').modular_symbol() sage: m - Modular symbol with sign 1 over Rational Field attached to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Modular symbol with sign 1 over Rational Field attached to + Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: m = EllipticCurve('43a1').modular_symbol(sign=-1, implementation="sage") sage: m - Modular symbol with sign -1 over Rational Field attached to Elliptic Curve defined by y^2 + y = x^3 + x^2 over Rational Field + Modular symbol with sign -1 over Rational Field attached to + Elliptic Curve defined by y^2 + y = x^3 + x^2 over Rational Field """ return "Modular symbol with sign %s over %s attached to %s"%( self._sign, self._base_ring, self._E) @@ -240,22 +243,23 @@ def __init__(self, E, sign, nap=1000): EXAMPLES:: - sage: import sage.schemes.elliptic_curves.ell_modular_symbols + sage: from sage.schemes.elliptic_curves.ell_modular_symbols import ModularSymbolECLIB sage: E = EllipticCurve('11a1') - sage: M = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolECLIB(E,+1) + sage: M = ModularSymbolECLIB(E,+1) sage: M - Modular symbol with sign 1 over Rational Field attached to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Modular symbol with sign 1 over Rational Field attached to + Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: M(0) 1/5 sage: E = EllipticCurve('11a2') - sage: M = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolECLIB(E,+1) + sage: M = ModularSymbolECLIB(E,+1) sage: M(0) 1 This is a rank 1 case with vanishing positive twists:: sage: E = EllipticCurve('121b1') - sage: M = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolECLIB(E,+1) + sage: M = ModularSymbolECLIB(E,+1) sage: M(0) 0 sage: M(1/7) @@ -273,11 +277,13 @@ def __init__(self, E, sign, nap=1000): sage: E = EllipticCurve('11a1') sage: Mplus = E.modular_symbol(+1); Mplus - Modular symbol with sign 1 over Rational Field attached to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Modular symbol with sign 1 over Rational Field attached to + Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: [Mplus(1/i) for i in [1..11]] [1/5, -4/5, -3/10, 7/10, 6/5, 6/5, 7/10, -3/10, -4/5, 1/5, 0] sage: Mminus = E.modular_symbol(-1); Mminus - Modular symbol with sign -1 over Rational Field attached to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Modular symbol with sign -1 over Rational Field attached to + Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: [Mminus(1/i) for i in [1..11]] [0, 0, 1/2, 1/2, 0, 0, -1/2, -1/2, 0, 0, 0] @@ -393,17 +399,18 @@ def __init__(self, E, sign, normalize="L_ratio"): EXAMPLES:: sage: E = EllipticCurve('11a1') - sage: import sage.schemes.elliptic_curves.ell_modular_symbols - sage: M = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,+1) + sage: from sage.schemes.elliptic_curves.ell_modular_symbols import ModularSymbolSage + sage: M = ModularSymbolSage(E, +1) sage: M - Modular symbol with sign 1 over Rational Field attached to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Modular symbol with sign 1 over Rational Field attached to + Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: M(0) 1/5 sage: E = EllipticCurve('11a2') - sage: M = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,+1) + sage: M = ModularSymbolSage(E, +1) sage: M(0) 1 - sage: M = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,-1) + sage: M = ModularSymbolSage(E, -1) sage: M(1/3) 1/2 @@ -411,7 +418,7 @@ def __init__(self, E, sign, normalize="L_ratio"): The modular symbol is adjusted by -2:: sage: E = EllipticCurve('121b1') - sage: M = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,-1,normalize='L_ratio') + sage: M = ModularSymbolSage(E, -1, normalize='L_ratio') sage: M(1/3) 1 sage: M._scaling @@ -420,16 +427,20 @@ def __init__(self, E, sign, normalize="L_ratio"): sage: M = EllipticCurve('121d1').modular_symbol(implementation="sage") sage: M(0) 2 - sage: M = EllipticCurve('121d1').modular_symbol(implementation="sage", normalize='none') + sage: M = EllipticCurve('121d1').modular_symbol(implementation="sage", + ....: normalize='none') sage: M(0) 1 sage: E = EllipticCurve('15a1') - sage: [C.modular_symbol(implementation="sage", normalize='L_ratio')(0) for C in E.isogeny_class()] + sage: [C.modular_symbol(implementation="sage", normalize='L_ratio')(0) + ....: for C in E.isogeny_class()] [1/4, 1/8, 1/4, 1/2, 1/8, 1/16, 1/2, 1] - sage: [C.modular_symbol(implementation="sage", normalize='period')(0) for C in E.isogeny_class()] + sage: [C.modular_symbol(implementation="sage", normalize='period')(0) + ....: for C in E.isogeny_class()] [1/8, 1/16, 1/8, 1/4, 1/16, 1/32, 1/4, 1/2] - sage: [C.modular_symbol(implementation="sage", normalize='none')(0) for C in E.isogeny_class()] + sage: [C.modular_symbol(implementation="sage", normalize='none')(0) + ....: for C in E.isogeny_class()] [1, 1, 1, 1, 1, 1, 1, 1] """ if sign not in [-1, 1]: diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py index d49bcccd279..952a4cbc61b 100644 --- a/src/sage/schemes/elliptic_curves/ell_point.py +++ b/src/sage/schemes/elliptic_curves/ell_point.py @@ -32,42 +32,42 @@ An example over a number field:: - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve(K,[1,0,0,0,-1]) - sage: P = E(0,i); P + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [1,0,0,0,-1]) # optional - sage.rings.number_field + sage: P = E(0,i); P # optional - sage.rings.number_field (0 : i : 1) - sage: P.order() + sage: P.order() # optional - sage.rings.number_field +Infinity - sage: 101*P-100*P == P + sage: 101*P - 100*P == P # optional - sage.rings.number_field True An example over a finite field:: - sage: K. = GF((101,3)) - sage: E = EllipticCurve(K,[1,0,0,0,-1]) - sage: P = E(40*a^2 + 69*a + 84 , 58*a^2 + 73*a + 45) - sage: P.order() + sage: K. = GF((101,3)) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(K, [1,0,0,0,-1]) # optional - sage.rings.finite_rings + sage: P = E(40*a^2 + 69*a + 84 , 58*a^2 + 73*a + 45) # optional - sage.rings.finite_rings + sage: P.order() # optional - sage.rings.finite_rings 1032210 - sage: E.cardinality() + sage: E.cardinality() # optional - sage.rings.finite_rings 1032210 Arithmetic with a point over an extension of a finite field:: - sage: k. = GF((5,2)) - sage: E = EllipticCurve(k,[1,0]); E + sage: k. = GF((5,2)) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(k,[1,0]); E # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + x over Finite Field in a of size 5^2 - sage: P = E([a,2*a+4]) - sage: 5*P + sage: P = E([a,2*a+4]) # optional - sage.rings.finite_rings + sage: 5*P # optional - sage.rings.finite_rings (2*a + 3 : 2*a : 1) - sage: P*5 + sage: P*5 # optional - sage.rings.finite_rings (2*a + 3 : 2*a : 1) - sage: P + P + P + P + P + sage: P + P + P + P + P # optional - sage.rings.finite_rings (2*a + 3 : 2*a : 1) :: sage: F = Zmod(3) - sage: E = EllipticCurve(F,[1,0]); + sage: E = EllipticCurve(F, [1,0]); sage: P = E([2,1]) sage: import sys sage: n = sys.maxsize @@ -80,12 +80,13 @@ in the error message:: sage: N = 1715761513 - sage: E = EllipticCurve(Integers(N),[3,-13]) + sage: E = EllipticCurve(Integers(N), [3,-13]) sage: P = E(2,1) sage: LCM([2..60])*P Traceback (most recent call last): ... - ZeroDivisionError: Inverse of 26927 does not exist (characteristic = 1715761513 = 26927*63719) + ZeroDivisionError: Inverse of 26927 does not exist + (characteristic = 1715761513 = 26927*63719) AUTHORS: @@ -162,7 +163,7 @@ class EllipticCurvePoint_field(SchemeMorphism_point_abelian_variety_field): (0 : 0 : 1) sage: E(0,0) # brackets are optional (0 : 0 : 1) - sage: E([GF(5)(0), 0]) # entries are coerced + sage: E([GF(5)(0), 0]) # entries are coerced # optional - sage.rings.finite_rings (0 : 0 : 1) sage: E(0.000, 0) @@ -178,23 +179,24 @@ class EllipticCurvePoint_field(SchemeMorphism_point_abelian_variety_field): sage: E = EllipticCurve([0,0,1,-1,0]) sage: S = E(QQ); S - Abelian group of points on Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field + Abelian group of points on + Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field - sage: K.=NumberField(x^2+1) - sage: E=EllipticCurve(K,[0,1,0,-160,308]) - sage: P=E(26,-120) - sage: Q=E(2+12*i,-36+48*i) - sage: P.order() == Q.order() == 4 # long time (3s) + sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0,1,0,-160,308]) # optional - sage.rings.number_field + sage: P = E(26, -120) # optional - sage.rings.number_field + sage: Q = E(2+12*i, -36+48*i) # optional - sage.rings.number_field + sage: P.order() == Q.order() == 4 # long time (3s) # optional - sage.rings.number_field True - sage: 2*P==2*Q + sage: 2*P == 2*Q # optional - sage.rings.number_field False :: - sage: K.=FractionField(PolynomialRing(QQ,'t')) - sage: E=EllipticCurve([0,0,0,0,t^2]) - sage: P=E(0,t) - sage: P,2*P,3*P + sage: K. = FractionField(PolynomialRing(QQ,'t')) + sage: E = EllipticCurve([0,0,0,0,t^2]) + sage: P = E(0,t) + sage: P, 2*P, 3*P ((0 : t : 1), (0 : -t : 1), (0 : 1 : 0)) TESTS:: @@ -218,17 +220,17 @@ class EllipticCurvePoint_field(SchemeMorphism_point_abelian_variety_field): Test that the refactoring from :trac:`14711` did preserve the behaviour of domain and codomain:: - sage: E=EllipticCurve(QQ,[1,1]) - sage: P=E(0,1) + sage: E = EllipticCurve(QQ,[1,1]) + sage: P = E(0,1) sage: P.domain() Spectrum of Rational Field - sage: K.=NumberField(x^2-3,'a') - sage: P=E.base_extend(K)(1,a) - sage: P.domain() + sage: K. = NumberField(x^2 - 3, 'a') # optional - sage.rings.number_field + sage: P = E.base_extend(K)(1,a) # optional - sage.rings.number_field + sage: P.domain() # optional - sage.rings.number_field Spectrum of Number Field in a with defining polynomial x^2 - 3 - sage: P.codomain() + sage: P.codomain() # optional - sage.rings.number_field Elliptic Curve defined by y^2 = x^3 + x + 1 over Number Field in a with defining polynomial x^2 - 3 - sage: P.codomain() == P.curve() + sage: P.codomain() == P.curve() # optional - sage.rings.number_field True """ def __init__(self, curve, v, check=True): @@ -404,18 +406,18 @@ def __pari__(self): Try the same over a finite field:: - sage: E = EllipticCurve(GF(11), [0,0,0,3,0]) - sage: O = E(0) - sage: P = E.point([1,2]) - sage: O.__pari__() + sage: E = EllipticCurve(GF(11), [0,0,0,3,0]) # optional - sage.rings.finite_rings + sage: O = E(0) # optional - sage.rings.finite_rings + sage: P = E.point([1,2]) # optional - sage.rings.finite_rings + sage: O.__pari__() # optional - sage.rings.finite_rings [0] - sage: P.__pari__() + sage: P.__pari__() # optional - sage.rings.finite_rings [Mod(1, 11), Mod(2, 11)] We no longer need to explicitly call ``pari(O)`` and ``pari(P)`` after :trac:`11868`:: - sage: pari(E).elladd(O, P) + sage: pari(E).elladd(O, P) # optional - sage.rings.finite_rings [Mod(1, 11), Mod(2, 11)] """ if self[2]: @@ -431,16 +433,17 @@ def scheme(self): EXAMPLES:: - sage: E=EllipticCurve(QQ,[1,1]) - sage: P=E(0,1) + sage: E = EllipticCurve(QQ,[1,1]) + sage: P = E(0,1) sage: P.scheme() Elliptic Curve defined by y^2 = x^3 + x + 1 over Rational Field sage: P.scheme() == P.curve() True - sage: K.=NumberField(x^2-3,'a') - sage: P=E.base_extend(K)(1,a) - sage: P.scheme() - Elliptic Curve defined by y^2 = x^3 + x + 1 over Number Field in a with defining polynomial x^2 - 3 + sage: K. = NumberField(x^2 - 3,'a') # optional - sage.rings.number_field + sage: P = E.base_extend(K)(1, a) # optional - sage.rings.number_field + sage: P.scheme() # optional - sage.rings.number_field + Elliptic Curve defined by y^2 = x^3 + x + 1 + over Number Field in a with defining polynomial x^2 - 3 """ # The following text is just not true: it applies to the class # EllipticCurvePoint, which appears to be never used, but does @@ -469,13 +472,14 @@ def order(self): EXAMPLES:: - sage: K.=FractionField(PolynomialRing(QQ,'t')) - sage: E=EllipticCurve([0,0,0,-t^2,0]) - sage: P=E(t,0) + sage: K. = FractionField(PolynomialRing(QQ,'t')) + sage: E = EllipticCurve([0, 0, 0, -t^2, 0]) + sage: P = E(t,0) sage: P.order() Traceback (most recent call last): ... - NotImplementedError: Computation of order of a point not implemented over general fields. + NotImplementedError: Computation of order of a point not implemented + over general fields. sage: E(0).additive_order() 1 sage: E(0).order() == 1 @@ -535,16 +539,17 @@ def has_finite_order(self): EXAMPLES:: - sage: K.=FractionField(PolynomialRing(QQ,'t')) - sage: E=EllipticCurve([0,0,0,-t^2,0]) + sage: K. = FractionField(PolynomialRing(QQ,'t')) + sage: E = EllipticCurve([0, 0, 0, -t^2, 0]) sage: P = E(0) sage: P.has_finite_order() True - sage: P=E(t,0) + sage: P = E(t,0) sage: P.has_finite_order() Traceback (most recent call last): ... - NotImplementedError: Computation of order of a point not implemented over general fields. + NotImplementedError: Computation of order of a point not implemented + over general fields. sage: (2*P).is_zero() True """ @@ -564,12 +569,12 @@ def has_infinite_order(self): EXAMPLES:: - sage: K.=FractionField(PolynomialRing(QQ,'t')) - sage: E=EllipticCurve([0,0,0,-t^2,0]) + sage: K. = FractionField(PolynomialRing(QQ,'t')) + sage: E = EllipticCurve([0, 0, 0, -t^2, 0]) sage: P = E(0) sage: P.has_infinite_order() False - sage: P=E(t,0) + sage: P = E(t,0) sage: P.has_infinite_order() Traceback (most recent call last): ... @@ -594,7 +599,7 @@ def plot(self, **args): sage: E = EllipticCurve('389a') sage: P = E([-1,1]) - sage: P.plot(pointsize=30, rgbcolor=(1,0,0)) + sage: P.plot(pointsize=30, rgbcolor=(1,0,0)) # optional - sage.plot Graphics object consisting of 1 graphics primitive """ from sage.plot.point import point @@ -628,7 +633,7 @@ def _add_(self, right): Checks that :trac:`15964` is fixed:: sage: N = 1715761513 - sage: E = EllipticCurve(Integers(N),[3,-13]) + sage: E = EllipticCurve(Integers(N), [3,-13]) sage: P = E(2,1) sage: LCM([2..60])*P Traceback (most recent call last): @@ -637,7 +642,7 @@ def _add_(self, right): (characteristic = 1715761513 = 26927*63719) sage: N = 35 - sage: E = EllipticCurve(Integers(N),[5,1]) + sage: E = EllipticCurve(Integers(N), [5,1]) sage: P = E(0,1) sage: 4*P Traceback (most recent call last): @@ -795,43 +800,43 @@ def is_divisible_by(self, m): A finite field example:: - sage: E = EllipticCurve(GF(101),[23,34]) - sage: E.cardinality().factor() + sage: E = EllipticCurve(GF(101), [23,34]) # optional - sage.rings.finite_rings + sage: E.cardinality().factor() # optional - sage.rings.finite_rings 2 * 53 - sage: Set([T.order() for T in E.points()]) + sage: Set([T.order() for T in E.points()]) # optional - sage.rings.finite_rings {1, 106, 2, 53} - sage: len([T for T in E.points() if T.is_divisible_by(2)]) + sage: len([T for T in E.points() if T.is_divisible_by(2)]) # optional - sage.rings.finite_rings 53 - sage: len([T for T in E.points() if T.is_divisible_by(3)]) + sage: len([T for T in E.points() if T.is_divisible_by(3)]) # optional - sage.rings.finite_rings 106 TESTS: This shows that the bug reported at :trac:`10076` is fixed:: - sage: K = QuadraticField(8,'a') - sage: E = EllipticCurve([K(0),0,0,-1,0]) - sage: P = E([-1,0]) - sage: P.is_divisible_by(2) + sage: K = QuadraticField(8,'a') # optional - sage.rings.number_field + sage: E = EllipticCurve([K(0),0,0,-1,0]) # optional - sage.rings.number_field + sage: P = E([-1,0]) # optional - sage.rings.number_field + sage: P.is_divisible_by(2) # optional - sage.rings.number_field False - sage: P.division_points(2) + sage: P.division_points(2) # optional - sage.rings.number_field [] Note that it is not sufficient to test that ``self.division_points(m,poly_only=True)`` has roots:: - sage: P.division_points(2, poly_only=True).roots() + sage: P.division_points(2, poly_only=True).roots() # optional - sage.rings.number_field [(1/2*a - 1, 1), (-1/2*a - 1, 1)] - sage: tor = E.torsion_points(); len(tor) + sage: tor = E.torsion_points(); len(tor) # optional - sage.rings.number_field 8 - sage: [T.order() for T in tor] + sage: [T.order() for T in tor] # optional - sage.rings.number_field [2, 4, 4, 2, 1, 2, 4, 4] - sage: all(T.is_divisible_by(3) for T in tor) + sage: all(T.is_divisible_by(3) for T in tor) # optional - sage.rings.number_field True - sage: sorted(T for T in tor if T.is_divisible_by(2)) + sage: sorted(T for T in tor if T.is_divisible_by(2)) # optional - sage.rings.number_field [(0 : 1 : 0), (1 : 0 : 1)] - sage: sorted(Set([2*T for T in tor])) + sage: sorted(Set([2*T for T in tor])) # optional - sage.rings.number_field [(0 : 1 : 0), (1 : 0 : 1)] """ # Coerce the input m to an integer @@ -926,63 +931,64 @@ def division_points(self, m, poly_only=False): We create a curve over a non-prime finite field with group of order `18`:: - sage: k. = GF((5,2)) - sage: E = EllipticCurve(k, [1,2+a,3,4*a,2]) - sage: P = E([3,3*a+4]) - sage: factor(E.order()) + sage: k. = GF((5,2)) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(k, [1,2+a,3,4*a,2]) # optional - sage.rings.finite_rings + sage: P = E([3, 3*a+4]) # optional - sage.rings.finite_rings + sage: factor(E.order()) # optional - sage.rings.finite_rings 2 * 3^2 - sage: P.order() + sage: P.order() # optional - sage.rings.finite_rings 9 We find the `1`-division points as a consistency check -- there is just one, of course:: - sage: P.division_points(1) + sage: P.division_points(1) # optional - sage.rings.finite_rings [(3 : 3*a + 4 : 1)] The point `P` has order coprime to 2 but divisible by 3, so:: - sage: P.division_points(2) + sage: P.division_points(2) # optional - sage.rings.finite_rings [(2*a + 1 : 3*a + 4 : 1), (3*a + 1 : a : 1)] We check that each of the 2-division points works as claimed:: - sage: [2*Q for Q in P.division_points(2)] + sage: [2*Q for Q in P.division_points(2)] # optional - sage.rings.finite_rings [(3 : 3*a + 4 : 1), (3 : 3*a + 4 : 1)] Some other checks:: - sage: P.division_points(3) + sage: P.division_points(3) # optional - sage.rings.finite_rings [] - sage: P.division_points(4) + sage: P.division_points(4) # optional - sage.rings.finite_rings [(0 : 3*a + 2 : 1), (1 : 0 : 1)] - sage: P.division_points(5) + sage: P.division_points(5) # optional - sage.rings.finite_rings [(1 : 1 : 1)] An example over a number field (see :trac:`3383`):: sage: E = EllipticCurve('19a1') - sage: K. = NumberField(x^9-3*x^8-4*x^7+16*x^6-3*x^5-21*x^4+5*x^3+7*x^2-7*x+1) - sage: EK = E.base_extend(K) - sage: E(0).division_points(3) + sage: K. = NumberField(x^9 - 3*x^8 - 4*x^7 + 16*x^6 - 3*x^5 # optional - sage.rings.number_field + ....: - 21*x^4 + 5*x^3 + 7*x^2 - 7*x + 1) + sage: EK = E.base_extend(K) # optional - sage.rings.number_field + sage: E(0).division_points(3) # optional - sage.rings.number_field [(0 : 1 : 0), (5 : -10 : 1), (5 : 9 : 1)] - sage: EK(0).division_points(3) + sage: EK(0).division_points(3) # optional - sage.rings.number_field [(0 : 1 : 0), (5 : 9 : 1), (5 : -10 : 1)] - sage: E(0).division_points(9) + sage: E(0).division_points(9) # optional - sage.rings.number_field [(0 : 1 : 0), (5 : -10 : 1), (5 : 9 : 1)] - sage: EK(0).division_points(9) + sage: EK(0).division_points(9) # optional - sage.rings.number_field [(0 : 1 : 0), (5 : 9 : 1), (5 : -10 : 1), (-150/121*t^8 + 414/121*t^7 + 1481/242*t^6 - 2382/121*t^5 - 103/242*t^4 + 629/22*t^3 - 367/242*t^2 - 1307/121*t + 625/121 : 35/484*t^8 - 133/242*t^7 + 445/242*t^6 - 799/242*t^5 + 373/484*t^4 + 113/22*t^3 - 2355/484*t^2 - 753/242*t + 1165/484 : 1), (-150/121*t^8 + 414/121*t^7 + 1481/242*t^6 - 2382/121*t^5 - 103/242*t^4 + 629/22*t^3 - 367/242*t^2 - 1307/121*t + 625/121 : -35/484*t^8 + 133/242*t^7 - 445/242*t^6 + 799/242*t^5 - 373/484*t^4 - 113/22*t^3 + 2355/484*t^2 + 753/242*t - 1649/484 : 1), (-1383/484*t^8 + 970/121*t^7 + 3159/242*t^6 - 5211/121*t^5 + 37/484*t^4 + 654/11*t^3 - 909/484*t^2 - 4831/242*t + 6791/484 : 927/121*t^8 - 5209/242*t^7 - 8187/242*t^6 + 27975/242*t^5 - 1147/242*t^4 - 1729/11*t^3 + 1566/121*t^2 + 12873/242*t - 10871/242 : 1), (-1383/484*t^8 + 970/121*t^7 + 3159/242*t^6 - 5211/121*t^5 + 37/484*t^4 + 654/11*t^3 - 909/484*t^2 - 4831/242*t + 6791/484 : -927/121*t^8 + 5209/242*t^7 + 8187/242*t^6 - 27975/242*t^5 + 1147/242*t^4 + 1729/11*t^3 - 1566/121*t^2 - 12873/242*t + 10629/242 : 1), (-4793/484*t^8 + 6791/242*t^7 + 10727/242*t^6 - 18301/121*t^5 + 2347/484*t^4 + 2293/11*t^3 - 7311/484*t^2 - 17239/242*t + 26767/484 : 30847/484*t^8 - 21789/121*t^7 - 34605/121*t^6 + 117164/121*t^5 - 10633/484*t^4 - 29437/22*t^3 + 39725/484*t^2 + 55428/121*t - 176909/484 : 1), (-4793/484*t^8 + 6791/242*t^7 + 10727/242*t^6 - 18301/121*t^5 + 2347/484*t^4 + 2293/11*t^3 - 7311/484*t^2 - 17239/242*t + 26767/484 : -30847/484*t^8 + 21789/121*t^7 + 34605/121*t^6 - 117164/121*t^5 + 10633/484*t^4 + 29437/22*t^3 - 39725/484*t^2 - 55428/121*t + 176425/484 : 1)] TESTS: Check that :trac:`24844` is fixed:: - sage: p = next_prime(1000000) - sage: E = EllipticCurve(GF(p), 123, 456) - sage: pts = E(0).division_points(3) - sage: P = pts[1]; P + sage: p = next_prime(1000000) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(GF(p), 123, 456) # optional - sage.rings.finite_rings + sage: pts = E(0).division_points(3) # optional - sage.rings.finite_rings + sage: P = pts[1]; P # optional - sage.rings.finite_rings (389063 : 124244 : 1) - sage: P._order + sage: P._order # optional - sage.rings.finite_rings 3 When we successfully divide a point known to have infinite @@ -993,7 +999,7 @@ def division_points(self, m, poly_only=False): sage: P = E(-1,0) sage: P.order() +Infinity - sage: pts = P.division_points(3); len(pts) + sage: pts = P.division_points(3); len(pts) 1 sage: [(Q,Q._order) for Q in pts] [((0 : -1 : 1), +Infinity)] @@ -1196,7 +1202,7 @@ def set_order(self, value, *, check=True): :: - sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 + sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 # optional - sage.rings.finite_rings sage: G = E(5, 0) sage: G.set_order(2) sage: 2*G @@ -1210,27 +1216,27 @@ def set_order(self, value, *, check=True): sage: p = 2^521 - 1 sage: prev_proof_state = proof.arithmetic() - sage: proof.arithmetic(False) # turn off primality checking - sage: F = GF(p) + sage: proof.arithmetic(False) # turn off primality checking + sage: F = GF(p) # optional - sage.rings.finite_rings sage: A = p - 3 sage: B = 1093849038073734274511112390766805569936207598951683748994586394495953116150735016013708737573759623248592132296706313309438452531591012912142327488478985984 sage: q = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005449 - sage: E = EllipticCurve([F(A), F(B)]) - sage: G = E.random_point() - sage: G.set_order(q) - sage: G.order() * G # This takes practically no time. + sage: E = EllipticCurve([F(A), F(B)]) # optional - sage.rings.finite_rings + sage: G = E.random_point() # optional - sage.rings.finite_rings + sage: G.set_order(q) # optional - sage.rings.finite_rings + sage: G.order() * G # This takes practically no time. # optional - sage.rings.finite_rings (0 : 1 : 0) sage: proof.arithmetic(prev_proof_state) # restore state It is an error to pass a `value` equal to `0`:: - sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 - sage: G = E.random_point() - sage: G.set_order(0) + sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 # optional - sage.rings.finite_rings + sage: G = E.random_point() # optional - sage.rings.finite_rings + sage: G.set_order(0) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Value 0 illegal for point order - sage: G.set_order(1000) + sage: G.set_order(1000) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Value 1000 illegal: outside max Hasse bound @@ -1239,9 +1245,9 @@ def set_order(self, value, *, check=True): order of this point. How unlikely is determined by the factorization of the actual order, and the actual group structure:: - sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 - sage: G = E(5, 0) # G has order 2 - sage: G.set_order(11) + sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 # optional - sage.rings.finite_rings + sage: G = E(5, 0) # G has order 2 # optional - sage.rings.finite_rings + sage: G.set_order(11) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Value 11 illegal: 11 * (5 : 0 : 1) is not the identity @@ -1250,10 +1256,10 @@ def set_order(self, value, *, check=True): of interest". For instance, the order can be set to a multiple the actual order:: - sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 - sage: G = E(5, 0) # G has order 2 - sage: G.set_order(8) - sage: G.order() + sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 # optional - sage.rings.finite_rings + sage: G = E(5, 0) # G has order 2 # optional - sage.rings.finite_rings + sage: G.set_order(8) # optional - sage.rings.finite_rings + sage: G.order() # optional - sage.rings.finite_rings 8 AUTHORS: @@ -1292,27 +1298,27 @@ def _line_(self, R, Q): EXAMPLES:: - sage: F.=GF((2,5)) - sage: E=EllipticCurve(F,[0,0,1,1,1]) - sage: P = E(a^4 + 1, a^3) - sage: Q = E(a^4, a^4 + a^3) - sage: O = E(0) - sage: P._line_(P,-2*P) == 0 + sage: F. = GF((2,5)) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F,[0,0,1,1,1]) # optional - sage.rings.finite_rings + sage: P = E(a^4 + 1, a^3) # optional - sage.rings.finite_rings + sage: Q = E(a^4, a^4 + a^3) # optional - sage.rings.finite_rings + sage: O = E(0) # optional - sage.rings.finite_rings + sage: P._line_(P,-2*P) == 0 # optional - sage.rings.finite_rings True - sage: P._line_(Q,-(P+Q)) == 0 + sage: P._line_(Q,-(P+Q)) == 0 # optional - sage.rings.finite_rings True - sage: O._line_(O,Q) == F(1) + sage: O._line_(O,Q) == F(1) # optional - sage.rings.finite_rings True - sage: P._line_(O,Q) == a^4 - a^4 + 1 + sage: P._line_(O,Q) == a^4 - a^4 + 1 # optional - sage.rings.finite_rings True - sage: P._line_(13*P,Q) == a^4 + sage: P._line_(13*P,Q) == a^4 # optional - sage.rings.finite_rings True - sage: P._line_(P,Q) == a^4 + a^3 + a^2 + 1 + sage: P._line_(P,Q) == a^4 + a^3 + a^2 + 1 # optional - sage.rings.finite_rings True See :trac:`7116`:: - sage: P._line_ (Q,O) + sage: P._line_ (Q,O) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Q must be nonzero. @@ -1370,104 +1376,106 @@ def _miller_(self, Q, n): EXAMPLES:: - sage: F.=GF((2,5)) - sage: E=EllipticCurve(F,[0,0,1,1,1]) - sage: P = E(a^4 + 1, a^3) - sage: Fx.=GF((2,(4*5))) - sage: Ex=EllipticCurve(Fx,[0,0,1,1,1]) - sage: phi=Hom(F,Fx)(F.gen().minpoly().roots(Fx)[0][0]) - sage: Px=Ex(phi(P.xy()[0]),phi(P.xy()[1])) - sage: Qx = Ex(b^19 + b^18 + b^16 + b^12 + b^10 + b^9 + b^8 + b^5 + b^3 + 1, b^18 + b^13 + b^10 + b^8 + b^5 + b^4 + b^3 + b) - sage: Px._miller_(Qx,41) == b^17 + b^13 + b^12 + b^9 + b^8 + b^6 + b^4 + 1 + sage: F. = GF((2,5)) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F, [0,0,1,1,1]) # optional - sage.rings.finite_rings + sage: P = E(a^4 + 1, a^3) # optional - sage.rings.finite_rings + sage: Fx. = GF((2,(4*5))) # optional - sage.rings.finite_rings + sage: Ex = EllipticCurve(Fx, [0,0,1,1,1]) # optional - sage.rings.finite_rings + sage: phi = Hom(F,Fx)(F.gen().minpoly().roots(Fx)[0][0]) # optional - sage.rings.finite_rings + sage: Px = Ex(phi(P.xy()[0]), phi(P.xy()[1])) # optional - sage.rings.finite_rings + sage: Qx = Ex(b^19 + b^18 + b^16 + b^12 + b^10 + b^9 + b^8 + b^5 + b^3 + 1, # optional - sage.rings.finite_rings + ....: b^18 + b^13 + b^10 + b^8 + b^5 + b^4 + b^3 + b) + sage: Px._miller_(Qx,41) == b^17 + b^13 + b^12 + b^9 + b^8 + b^6 + b^4 + 1 # optional - sage.rings.finite_rings True - sage: Qx._miller_(Px,41) == b^13 + b^10 + b^8 + b^7 + b^6 + b^5 + sage: Qx._miller_(Px,41) == b^13 + b^10 + b^8 + b^7 + b^6 + b^5 # optional - sage.rings.finite_rings True - sage: P._miller_(E(0),41) + sage: P._miller_(E(0),41) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Q must be nonzero. An example of even order:: - sage: F. = GF((19,4)) - sage: E = EllipticCurve(F,[-1,0]) - sage: P = E(15*a^3 + 17*a^2 + 14*a + 13,16*a^3 + 7*a^2 + a + 18) - sage: Q = E(10*a^3 + 16*a^2 + 4*a + 2, 6*a^3 + 4*a^2 + 3*a + 2) - sage: x=P.weil_pairing(Q,360) - sage: x^360 == F(1) + sage: F. = GF((19,4)) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F, [-1,0]) # optional - sage.rings.finite_rings + sage: P = E(15*a^3 + 17*a^2 + 14*a + 13,16*a^3 + 7*a^2 + a + 18) # optional - sage.rings.finite_rings + sage: Q = E(10*a^3 + 16*a^2 + 4*a + 2, 6*a^3 + 4*a^2 + 3*a + 2) # optional - sage.rings.finite_rings + sage: x = P.weil_pairing(Q, 360) # optional - sage.rings.finite_rings + sage: x^360 == F(1) # optional - sage.rings.finite_rings True You can use the _miller_ function on linearly dependent points, but with the risk of a dividing with zero:: - sage: Px._miller_(2*Px,41) + sage: Px._miller_(2*Px, 41) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ZeroDivisionError: division by zero in finite field A small example of embedding degree 6:: - sage: q = 401; F = GF(q); a = 146; b = 400; k = 6 - sage: E = EllipticCurve([F(a), F(b)]) - sage: R. = F[]; K. = GF(q^k, modulus=x^6 + 4*x^4 + 115*x^3 + 81*x^2 + 51*x + 3) - sage: EK = E.base_extend(K) - sage: P = E([F(338), F(227)]) - sage: Q_x = 333*a^5 + 391*a^4 + 160*a^3 + 335*a^2 + 71*a + 93 - sage: Q_y = 343*a^5 + 273*a^4 + 26*a^3 + 342*a^2 + 340*a + 210 - sage: Q = EK([Q_x, Q_y]) - sage: P._miller_(Q, 127) + sage: q = 401; F = GF(q); a = 146; b = 400; k = 6 # optional - sage.rings.finite_rings + sage: E = EllipticCurve([F(a), F(b)]) # optional - sage.rings.finite_rings + sage: R. = F[] # optional - sage.rings.finite_rings + sage: K. = GF(q^k, modulus=x^6 + 4*x^4 + 115*x^3 + 81*x^2 + 51*x + 3) # optional - sage.rings.finite_rings + sage: EK = E.base_extend(K) # optional - sage.rings.finite_rings + sage: P = E([F(338), F(227)]) # optional - sage.rings.finite_rings + sage: Q_x = 333*a^5 + 391*a^4 + 160*a^3 + 335*a^2 + 71*a + 93 # optional - sage.rings.finite_rings + sage: Q_y = 343*a^5 + 273*a^4 + 26*a^3 + 342*a^2 + 340*a + 210 # optional - sage.rings.finite_rings + sage: Q = EK([Q_x, Q_y]) # optional - sage.rings.finite_rings + sage: P._miller_(Q, 127) # optional - sage.rings.finite_rings 371*a^5 + 39*a^4 + 355*a^3 + 233*a^2 + 20*a + 275 A series of small examples and small torsions. We start with `n=1`, which is trivial: the function is the constant 1:: - sage: E = EllipticCurve([GF(7)(0), 2]) - sage: P = E(5, 1); Q = E(0, 3); I = E(0) - sage: I._miller_(P, 1) + sage: E = EllipticCurve([GF(7)(0), 2]) # optional - sage.rings.finite_rings + sage: P = E(5, 1); Q = E(0, 3); I = E(0) # optional - sage.rings.finite_rings + sage: I._miller_(P, 1) # optional - sage.rings.finite_rings 1 - sage: I._miller_(Q, 1) + sage: I._miller_(Q, 1) # optional - sage.rings.finite_rings 1 A two-torsion example. In this case `f_{n,P}(Q) = x_Q - x_P`:: - sage: E = EllipticCurve([GF(7)(-1), 0]) - sage: P = E(0,0); Q = E(1, 0); - sage: P._miller_(P, 2) + sage: E = EllipticCurve([GF(7)(-1), 0]) # optional - sage.rings.finite_rings + sage: P = E(0,0); Q = E(1, 0); # optional - sage.rings.finite_rings + sage: P._miller_(P, 2) # optional - sage.rings.finite_rings 0 - sage: Q._miller_(Q, 2) + sage: Q._miller_(Q, 2) # optional - sage.rings.finite_rings 0 - sage: P._miller_(Q, 2) + sage: P._miller_(Q, 2) # optional - sage.rings.finite_rings 1 - sage: Q._miller_(P, 2) + sage: Q._miller_(P, 2) # optional - sage.rings.finite_rings 6 A three-torsion example:: - sage: E = EllipticCurve([GF(7)(0), 2]) - sage: P = E(5, 1); Q = E(0, 3); - sage: P._miller_(Q, 3) + sage: E = EllipticCurve([GF(7)(0), 2]) # optional - sage.rings.finite_rings + sage: P = E(5, 1); Q = E(0, 3); # optional - sage.rings.finite_rings + sage: P._miller_(Q, 3) # optional - sage.rings.finite_rings 4 A 4-torsion example:: - sage: E = EllipticCurve([GF(7)(-1), 0]) - sage: P = E(5, 1); Q = E(4, 2) - sage: P._miller_(Q, 4) + sage: E = EllipticCurve([GF(7)(-1), 0]) # optional - sage.rings.finite_rings + sage: P = E(5, 1); Q = E(4, 2) # optional - sage.rings.finite_rings + sage: P._miller_(Q, 4) # optional - sage.rings.finite_rings 3 A 5-torsion example:: - sage: E = EllipticCurve([GF(7)(-1), 4]) - sage: P = E(4, 1); Q = E(6, 5) - sage: P._miller_(Q, 5) + sage: E = EllipticCurve([GF(7)(-1), 4]) # optional - sage.rings.finite_rings + sage: P = E(4, 1); Q = E(6, 5) # optional - sage.rings.finite_rings + sage: P._miller_(Q, 5) # optional - sage.rings.finite_rings 1 A 6-torsion example:: - sage: E = EllipticCurve([GF(7)(3), 1]) - sage: P = E(5, 1); Q = E(3, 3) - sage: P._miller_(Q, 6) + sage: E = EllipticCurve([GF(7)(3), 1]) # optional - sage.rings.finite_rings + sage: P = E(5, 1); Q = E(3, 3) # optional - sage.rings.finite_rings + sage: P._miller_(Q, 6) # optional - sage.rings.finite_rings 5 An example which is part of an ate pairing calculation. The trace of @@ -1475,13 +1483,13 @@ def _miller_(self, Q, n): code:: sage: p = 2017; A = 1; B = 30; r = 29; t = -70; k = 7; - sage: F = GF(p); R. = F[] - sage: E = EllipticCurve([F(A), F(B)]); P = E(369, 716) - sage: K. = GF(p^k, modulus=x^k+2); EK = E.base_extend(K) - sage: Qx = 1226*a^6 + 1778*a^5 + 660*a^4 + 1791*a^3 + 1750*a^2 + 867*a + 770 - sage: Qy = 1764*a^6 + 198*a^5 + 1206*a^4 + 406*a^3 + 1200*a^2 + 273*a + 1712 - sage: Q = EK(Qx, Qy) - sage: Q._miller_(P, t-1) + sage: F = GF(p); R. = F[] # optional - sage.rings.finite_rings + sage: E = EllipticCurve([F(A), F(B)]); P = E(369, 716) # optional - sage.rings.finite_rings + sage: K. = GF(p^k, modulus=x^k+2); EK = E.base_extend(K) # optional - sage.rings.finite_rings + sage: Qx = 1226*a^6 + 1778*a^5 + 660*a^4 + 1791*a^3 + 1750*a^2 + 867*a + 770 # optional - sage.rings.finite_rings + sage: Qy = 1764*a^6 + 198*a^5 + 1206*a^4 + 406*a^3 + 1200*a^2 + 273*a + 1712 # optional - sage.rings.finite_rings + sage: Q = EK(Qx, Qy) # optional - sage.rings.finite_rings + sage: Q._miller_(P, t-1) # optional - sage.rings.finite_rings 1311*a^6 + 1362*a^5 + 1177*a^4 + 807*a^3 + 1331*a^2 + 1530*a + 1931 ALGORITHM: @@ -1549,64 +1557,66 @@ def weil_pairing(self, Q, n, algorithm=None): EXAMPLES:: - sage: F.=GF((2,5)) - sage: E=EllipticCurve(F,[0,0,1,1,1]) - sage: P = E(a^4 + 1, a^3) - sage: Fx.=GF((2,4*5)) - sage: Ex=EllipticCurve(Fx,[0,0,1,1,1]) - sage: phi=Hom(F,Fx)(F.gen().minpoly().roots(Fx)[0][0]) - sage: Px=Ex(phi(P.xy()[0]),phi(P.xy()[1])) - sage: O = Ex(0) - sage: Qx = Ex(b^19 + b^18 + b^16 + b^12 + b^10 + b^9 + b^8 + b^5 + b^3 + 1, b^18 + b^13 + b^10 + b^8 + b^5 + b^4 + b^3 + b) - sage: Px.weil_pairing(Qx,41) == b^19 + b^15 + b^9 + b^8 + b^6 + b^4 + b^3 + b^2 + 1 + sage: F. = GF((2,5)) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F, [0,0,1,1,1]) # optional - sage.rings.finite_rings + sage: P = E(a^4 + 1, a^3) # optional - sage.rings.finite_rings + sage: Fx. = GF((2, 4*5)) # optional - sage.rings.finite_rings + sage: Ex = EllipticCurve(Fx, [0,0,1,1,1]) # optional - sage.rings.finite_rings + sage: phi = Hom(F, Fx)(F.gen().minpoly().roots(Fx)[0][0]) # optional - sage.rings.finite_rings + sage: Px = Ex(phi(P.xy()[0]), phi(P.xy()[1])) # optional - sage.rings.finite_rings + sage: O = Ex(0) # optional - sage.rings.finite_rings + sage: Qx = Ex(b^19 + b^18 + b^16 + b^12 + b^10 + b^9 + b^8 + b^5 + b^3 + 1, # optional - sage.rings.finite_rings + ....: b^18 + b^13 + b^10 + b^8 + b^5 + b^4 + b^3 + b) + sage: Px.weil_pairing(Qx, 41) == b^19 + b^15 + b^9 + b^8 + b^6 + b^4 + b^3 + b^2 + 1 # optional - sage.rings.finite_rings True - sage: Px.weil_pairing(17*Px,41) == Fx(1) + sage: Px.weil_pairing(17*Px, 41) == Fx(1) # optional - sage.rings.finite_rings True - sage: Px.weil_pairing(O,41) == Fx(1) + sage: Px.weil_pairing(O, 41) == Fx(1) # optional - sage.rings.finite_rings True An error is raised if either point is not `n`-torsion:: - sage: Px.weil_pairing(O,40) + sage: Px.weil_pairing(O, 40) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: points must both be n-torsion A larger example (see :trac:`4964`):: - sage: P,Q = EllipticCurve(GF((19,4),'a'),[-1,0]).gens() - sage: P.order(), Q.order() + sage: P, Q = EllipticCurve(GF((19,4),'a'), [-1,0]).gens() # optional - sage.rings.finite_rings + sage: P.order(), Q.order() # optional - sage.rings.finite_rings (360, 360) - sage: z = P.weil_pairing(Q,360) - sage: z.multiplicative_order() + sage: z = P.weil_pairing(Q, 360) # optional - sage.rings.finite_rings + sage: z.multiplicative_order() # optional - sage.rings.finite_rings 360 An example over a number field:: - sage: P,Q = EllipticCurve('11a1').change_ring(CyclotomicField(5)).torsion_subgroup().gens() - sage: P,Q = (P.element(), Q.element()) - sage: (P.order(),Q.order()) + sage: E = EllipticCurve('11a1').change_ring(CyclotomicField(5)) # optional - sage.rings.number_field + sage: P, Q = E.torsion_subgroup().gens() # optional - sage.rings.number_field + sage: P, Q = (P.element(), Q.element()) # optional - sage.rings.number_field + sage: (P.order(), Q.order()) # optional - sage.rings.number_field (5, 5) - sage: P.weil_pairing(Q,5) + sage: P.weil_pairing(Q, 5) # optional - sage.rings.number_field zeta5^2 - sage: Q.weil_pairing(P,5) + sage: Q.weil_pairing(P, 5) # optional - sage.rings.number_field zeta5^3 TESTS: Check that the original Sage implementation still works:: - sage: GF(65537^2).inject_variables() + sage: GF(65537^2).inject_variables() # optional - sage.rings.finite_rings Defining z2 - sage: E = EllipticCurve(GF(65537^2), [0,1]) - sage: P = E(22, 28891) - sage: Q = E(-93, 40438*z2 + 31573) - sage: P.weil_pairing(Q, 7282, algorithm='sage') + sage: E = EllipticCurve(GF(65537^2), [0,1]) # optional - sage.rings.finite_rings + sage: P = E(22, 28891) # optional - sage.rings.finite_rings + sage: Q = E(-93, 40438*z2 + 31573) # optional - sage.rings.finite_rings + sage: P.weil_pairing(Q, 7282, algorithm='sage') # optional - sage.rings.finite_rings 19937*z2 + 65384 Passing an unknown ``algorithm=`` argument should fail:: - sage: P.weil_pairing(Q, 7282, algorithm='_invalid_') + sage: P.weil_pairing(Q, 7282, algorithm='_invalid_') # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: unknown algorithm @@ -1725,14 +1735,14 @@ def tate_pairing(self, Q, n, k, q=None): A simple example, pairing a point with itself, and pairing a point with another rational point:: - sage: p = 103; A = 1; B = 18; E = EllipticCurve(GF(p), [A, B]) - sage: P = E(33, 91); n = P.order(); n + sage: p = 103; A = 1; B = 18; E = EllipticCurve(GF(p), [A, B]) # optional - sage.rings.finite_rings + sage: P = E(33, 91); n = P.order(); n # optional - sage.rings.finite_rings 19 - sage: k = GF(n)(p).multiplicative_order(); k + sage: k = GF(n)(p).multiplicative_order(); k # optional - sage.rings.finite_rings 6 - sage: P.tate_pairing(P, n, k) + sage: P.tate_pairing(P, n, k) # optional - sage.rings.finite_rings 1 - sage: Q = E(87, 51) + sage: Q = E(87, 51) # optional - sage.rings.finite_rings sage: P.tate_pairing(Q, n, k) 1 sage: set_random_seed(35) @@ -1743,62 +1753,64 @@ def tate_pairing(self, Q, n, k, q=None): the pairing extension field, and we also demonstrate the bilinearity of the pairing:: - sage: K. = GF((p,k)) - sage: EK = E.base_extend(K); P = EK(P) - sage: Qx = 69*a^5 + 96*a^4 + 22*a^3 + 86*a^2 + 6*a + 35 - sage: Qy = 34*a^5 + 24*a^4 + 16*a^3 + 41*a^2 + 4*a + 40 - sage: Q = EK(Qx, Qy); + sage: K. = GF((p,k)) # optional - sage.rings.finite_rings + sage: EK = E.base_extend(K); P = EK(P) # optional - sage.rings.finite_rings + sage: Qx = 69*a^5 + 96*a^4 + 22*a^3 + 86*a^2 + 6*a + 35 # optional - sage.rings.finite_rings + sage: Qy = 34*a^5 + 24*a^4 + 16*a^3 + 41*a^2 + 4*a + 40 # optional - sage.rings.finite_rings + sage: Q = EK(Qx, Qy); # optional - sage.rings.finite_rings Multiply by cofactor so Q has order n:: - sage: h = 551269674; Q = h*Q - sage: P = EK(P); P.tate_pairing(Q, n, k) + sage: h = 551269674; Q = h*Q # optional - sage.rings.finite_rings + sage: P = EK(P); P.tate_pairing(Q, n, k) # optional - sage.rings.finite_rings 24*a^5 + 34*a^4 + 3*a^3 + 69*a^2 + 86*a + 45 - sage: s = Integer(randrange(1,n)) - sage: ans1 = (s*P).tate_pairing(Q, n, k) - sage: ans2 = P.tate_pairing(s*Q, n, k) - sage: ans3 = P.tate_pairing(Q, n, k)^s - sage: ans1 == ans2 == ans3 + sage: s = Integer(randrange(1,n)) # optional - sage.rings.finite_rings + sage: ans1 = (s*P).tate_pairing(Q, n, k) # optional - sage.rings.finite_rings + sage: ans2 = P.tate_pairing(s*Q, n, k) # optional - sage.rings.finite_rings + sage: ans3 = P.tate_pairing(Q, n, k)^s # optional - sage.rings.finite_rings + sage: ans1 == ans2 == ans3 # optional - sage.rings.finite_rings True - sage: (ans1 != 1) and (ans1^n == 1) + sage: (ans1 != 1) and (ans1^n == 1) # optional - sage.rings.finite_rings True Here is an example of using the Tate pairing to compute the Weil pairing (using the same data as above):: - sage: e = Integer((p^k-1)/n); e + sage: e = Integer((p^k-1)/n); e # optional - sage.rings.finite_rings 62844857712 - sage: P.weil_pairing(Q, n)^e + sage: P.weil_pairing(Q, n)^e # optional - sage.rings.finite_rings 94*a^5 + 99*a^4 + 29*a^3 + 45*a^2 + 57*a + 34 - sage: P.tate_pairing(Q, n, k) == P._miller_(Q, n)^e + sage: P.tate_pairing(Q, n, k) == P._miller_(Q, n)^e # optional - sage.rings.finite_rings True - sage: Q.tate_pairing(P, n, k) == Q._miller_(P, n)^e + sage: Q.tate_pairing(P, n, k) == Q._miller_(P, n)^e # optional - sage.rings.finite_rings True - sage: P.tate_pairing(Q, n, k)/Q.tate_pairing(P, n, k) + sage: P.tate_pairing(Q, n, k)/Q.tate_pairing(P, n, k) # optional - sage.rings.finite_rings 94*a^5 + 99*a^4 + 29*a^3 + 45*a^2 + 57*a + 34 An example where we have to pass the base field size (and we again have agreement with the Weil pairing):: - sage: F.=GF((2,5)) - sage: E=EllipticCurve(F,[0,0,1,1,1]) - sage: P = E(a^4 + 1, a^3) - sage: Fx.=GF((2,4*5)) - sage: Ex=EllipticCurve(Fx,[0,0,1,1,1]) - sage: phi=Hom(F,Fx)(F.gen().minpoly().roots(Fx)[0][0]) - sage: Px=Ex(phi(P.xy()[0]),phi(P.xy()[1])) - sage: Qx = Ex(b^19+b^18+b^16+b^12+b^10+b^9+b^8+b^5+b^3+1, b^18+b^13+b^10+b^8+b^5+b^4+b^3+b) - sage: Px.tate_pairing(Qx, n=41, k=4) + sage: F. = GF((2,5)) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F, [0,0,1,1,1]) # optional - sage.rings.finite_rings + sage: P = E(a^4 + 1, a^3) # optional - sage.rings.finite_rings + sage: Fx. = GF((2,4*5)) # optional - sage.rings.finite_rings + sage: Ex = EllipticCurve(Fx,[0,0,1,1,1]) # optional - sage.rings.finite_rings + sage: phi = Hom(F, Fx)(F.gen().minpoly().roots(Fx)[0][0]) # optional - sage.rings.finite_rings + sage: Px = Ex(phi(P.xy()[0]), phi(P.xy()[1])) # optional - sage.rings.finite_rings + sage: Qx = Ex(b^19 + b^18 + b^16 + b^12 + b^10 + b^9 + b^8 + b^5 + b^3 + 1, # optional - sage.rings.finite_rings + ....: b^18 + b^13 + b^10 + b^8 + b^5 + b^4 + b^3 + b) + sage: Px.tate_pairing(Qx, n=41, k=4) # optional - sage.rings.finite_rings Traceback (most recent call last): ... - ValueError: Unexpected field degree: set keyword argument q equal to the size of the base field (big field is GF(q^4)). - sage: num = Px.tate_pairing(Qx, n=41, k=4, q=32); num + ValueError: Unexpected field degree: set keyword argument q equal to + the size of the base field (big field is GF(q^4)). + sage: num = Px.tate_pairing(Qx, n=41, k=4, q=32); num # optional - sage.rings.finite_rings b^19 + b^14 + b^13 + b^12 + b^6 + b^4 + b^3 - sage: den = Qx.tate_pairing(Px, n=41, k=4, q=32); den + sage: den = Qx.tate_pairing(Px, n=41, k=4, q=32); den # optional - sage.rings.finite_rings b^19 + b^17 + b^16 + b^15 + b^14 + b^10 + b^6 + b^2 + 1 - sage: e = Integer((32^4-1)/41); e + sage: e = Integer((32^4-1)/41); e # optional - sage.rings.finite_rings 25575 - sage: Px.weil_pairing(Qx, 41)^e == num/den + sage: Px.weil_pairing(Qx, 41)^e == num/den # optional - sage.rings.finite_rings True .. NOTE:: @@ -1880,63 +1892,63 @@ def ate_pairing(self, Q, n, k, t, q=None): An example with embedding degree 6:: sage: p = 7549; A = 0; B = 1; n = 157; k = 6; t = 14 - sage: F = GF(p); E = EllipticCurve(F, [A, B]) - sage: R. = F[]; K. = GF((p,k), modulus=x^k+2) - sage: EK = E.base_extend(K) - sage: P = EK(3050, 5371); Q = EK(6908*a^4, 3231*a^3) - sage: P.ate_pairing(Q, n, k, t) + sage: F = GF(p); E = EllipticCurve(F, [A, B]) # optional - sage.rings.finite_rings + sage: R. = F[]; K. = GF((p,k), modulus=x^k+2) # optional - sage.rings.finite_rings + sage: EK = E.base_extend(K) # optional - sage.rings.finite_rings + sage: P = EK(3050, 5371); Q = EK(6908*a^4, 3231*a^3) # optional - sage.rings.finite_rings + sage: P.ate_pairing(Q, n, k, t) # optional - sage.rings.finite_rings 6708*a^5 + 4230*a^4 + 4350*a^3 + 2064*a^2 + 4022*a + 6733 - sage: s = Integer(randrange(1, n)) - sage: (s*P).ate_pairing(Q, n, k, t) == P.ate_pairing(s*Q, n, k, t) + sage: s = Integer(randrange(1, n)) # optional - sage.rings.finite_rings + sage: (s*P).ate_pairing(Q, n, k, t) == P.ate_pairing(s*Q, n, k, t) # optional - sage.rings.finite_rings True - sage: P.ate_pairing(s*Q, n, k, t) == P.ate_pairing(Q, n, k, t)^s + sage: P.ate_pairing(s*Q, n, k, t) == P.ate_pairing(Q, n, k, t)^s # optional - sage.rings.finite_rings True Another example with embedding degree 7 and positive trace:: sage: p = 2213; A = 1; B = 49; n = 1093; k = 7; t = 28 - sage: F = GF(p); E = EllipticCurve(F, [A, B]) - sage: R. = F[]; K. = GF((p,k), modulus=x^k+2) - sage: EK = E.base_extend(K) - sage: P = EK(1583, 1734) - sage: Qx = 1729*a^6+1767*a^5+245*a^4+980*a^3+1592*a^2+1883*a+722 - sage: Qy = 1299*a^6+1877*a^5+1030*a^4+1513*a^3+1457*a^2+309*a+1636 - sage: Q = EK(Qx, Qy) - sage: P.ate_pairing(Q, n, k, t) + sage: F = GF(p); E = EllipticCurve(F, [A, B]) # optional - sage.rings.finite_rings + sage: R. = F[]; K. = GF((p,k), modulus=x^k+2) # optional - sage.rings.finite_rings + sage: EK = E.base_extend(K) # optional - sage.rings.finite_rings + sage: P = EK(1583, 1734) # optional - sage.rings.finite_rings + sage: Qx = 1729*a^6+1767*a^5+245*a^4+980*a^3+1592*a^2+1883*a+722 # optional - sage.rings.finite_rings + sage: Qy = 1299*a^6+1877*a^5+1030*a^4+1513*a^3+1457*a^2+309*a+1636 # optional - sage.rings.finite_rings + sage: Q = EK(Qx, Qy) # optional - sage.rings.finite_rings + sage: P.ate_pairing(Q, n, k, t) # optional - sage.rings.finite_rings 1665*a^6 + 1538*a^5 + 1979*a^4 + 239*a^3 + 2134*a^2 + 2151*a + 654 - sage: s = Integer(randrange(1, n)) - sage: (s*P).ate_pairing(Q, n, k, t) == P.ate_pairing(s*Q, n, k, t) + sage: s = Integer(randrange(1, n)) # optional - sage.rings.finite_rings + sage: (s*P).ate_pairing(Q, n, k, t) == P.ate_pairing(s*Q, n, k, t) # optional - sage.rings.finite_rings True - sage: P.ate_pairing(s*Q, n, k, t) == P.ate_pairing(Q, n, k, t)^s + sage: P.ate_pairing(s*Q, n, k, t) == P.ate_pairing(Q, n, k, t)^s # optional - sage.rings.finite_rings True Another example with embedding degree 7 and negative trace:: sage: p = 2017; A = 1; B = 30; n = 29; k = 7; t = -70 - sage: F = GF(p); E = EllipticCurve(F, [A, B]) - sage: R. = F[]; K. = GF((p,k), modulus=x^k+2) - sage: EK = E.base_extend(K) - sage: P = EK(369, 716) - sage: Qx = 1226*a^6+1778*a^5+660*a^4+1791*a^3+1750*a^2+867*a+770 - sage: Qy = 1764*a^6+198*a^5+1206*a^4+406*a^3+1200*a^2+273*a+1712 - sage: Q = EK(Qx, Qy) - sage: P.ate_pairing(Q, n, k, t) + sage: F = GF(p); E = EllipticCurve(F, [A, B]) # optional - sage.rings.finite_rings + sage: R. = F[]; K. = GF((p,k), modulus=x^k+2) # optional - sage.rings.finite_rings + sage: EK = E.base_extend(K) # optional - sage.rings.finite_rings + sage: P = EK(369, 716) # optional - sage.rings.finite_rings + sage: Qx = 1226*a^6+1778*a^5+660*a^4+1791*a^3+1750*a^2+867*a+770 # optional - sage.rings.finite_rings + sage: Qy = 1764*a^6+198*a^5+1206*a^4+406*a^3+1200*a^2+273*a+1712 # optional - sage.rings.finite_rings + sage: Q = EK(Qx, Qy) # optional - sage.rings.finite_rings + sage: P.ate_pairing(Q, n, k, t) # optional - sage.rings.finite_rings 1794*a^6 + 1161*a^5 + 576*a^4 + 488*a^3 + 1950*a^2 + 1905*a + 1315 - sage: s = Integer(randrange(1, n)) - sage: (s*P).ate_pairing(Q, n, k, t) == P.ate_pairing(s*Q, n, k, t) + sage: s = Integer(randrange(1, n)) # optional - sage.rings.finite_rings + sage: (s*P).ate_pairing(Q, n, k, t) == P.ate_pairing(s*Q, n, k, t) # optional - sage.rings.finite_rings True - sage: P.ate_pairing(s*Q, n, k, t) == P.ate_pairing(Q, n, k, t)^s + sage: P.ate_pairing(s*Q, n, k, t) == P.ate_pairing(Q, n, k, t)^s # optional - sage.rings.finite_rings True Using the same data, we show that the ate pairing is a power of the Tate pairing (see [HSV2006]_ end of section 3.1):: - sage: c = (k*p^(k-1)).mod(n); T = t - 1 - sage: N = gcd(T^k - 1, p^k - 1) - sage: s = Integer(N/n) - sage: L = Integer((T^k - 1)/N) - sage: M = (L*s*c.inverse_mod(n)).mod(n) - sage: P.ate_pairing(Q, n, k, t) == Q.tate_pairing(P, n, k)^M + sage: c = (k*p^(k-1)).mod(n); T = t - 1 # optional - sage.rings.finite_rings + sage: N = gcd(T^k - 1, p^k - 1) # optional - sage.rings.finite_rings + sage: s = Integer(N/n) # optional - sage.rings.finite_rings + sage: L = Integer((T^k - 1)/N) # optional - sage.rings.finite_rings + sage: M = (L*s*c.inverse_mod(n)).mod(n) # optional - sage.rings.finite_rings + sage: P.ate_pairing(Q, n, k, t) == Q.tate_pairing(P, n, k)^M # optional - sage.rings.finite_rings True An example where we have to pass the base field size (and we again have @@ -1944,44 +1956,47 @@ def ate_pairing(self, Q, n, k, t, q=None): `F`-rational, (it is the homomorphic image of an `F`-rational point) it is nonetheless in `ker(\pi-1)`, and so is a legitimate input:: - sage: q = 2^5; F.=GF(q) - sage: n = 41; k = 4; t = -8 - sage: E=EllipticCurve(F,[0,0,1,1,1]) - sage: P = E(a^4 + 1, a^3) - sage: Fx.=GF(q^k) - sage: Ex=EllipticCurve(Fx,[0,0,1,1,1]) - sage: phi=Hom(F,Fx)(F.gen().minpoly().roots(Fx)[0][0]) - sage: Px=Ex(phi(P.xy()[0]),phi(P.xy()[1])) - sage: Qx = Ex(b^19+b^18+b^16+b^12+b^10+b^9+b^8+b^5+b^3+1, b^18+b^13+b^10+b^8+b^5+b^4+b^3+b) - sage: Qx = Ex(Qx[0]^q, Qx[1]^q) - Qx # ensure Qx is in ker(pi - q) - sage: Px.ate_pairing(Qx, n, k, t) + sage: q = 2^5; F. = GF(q) # optional - sage.rings.finite_rings + sage: n = 41; k = 4; t = -8 # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F,[0,0,1,1,1]) # optional - sage.rings.finite_rings + sage: P = E(a^4 + 1, a^3) # optional - sage.rings.finite_rings + sage: Fx. = GF(q^k) # optional - sage.rings.finite_rings + sage: Ex = EllipticCurve(Fx, [0,0,1,1,1]) # optional - sage.rings.finite_rings + sage: phi = Hom(F, Fx)(F.gen().minpoly().roots(Fx)[0][0]) # optional - sage.rings.finite_rings + sage: Px = Ex(phi(P.xy()[0]), phi(P.xy()[1])) # optional - sage.rings.finite_rings + sage: Qx = Ex(b^19+b^18+b^16+b^12+b^10+b^9+b^8+b^5+b^3+1, # optional - sage.rings.finite_rings + ....: b^18+b^13+b^10+b^8+b^5+b^4+b^3+b) + sage: Qx = Ex(Qx[0]^q, Qx[1]^q) - Qx # ensure Qx is in ker(pi - q) # optional - sage.rings.finite_rings + sage: Px.ate_pairing(Qx, n, k, t) # optional - sage.rings.finite_rings Traceback (most recent call last): ... - ValueError: Unexpected field degree: set keyword argument q equal to the size of the base field (big field is GF(q^4)). - sage: Px.ate_pairing(Qx, n, k, t, q) - b^19 + b^18 + b^17 + b^16 + b^15 + b^14 + b^13 + b^12 + b^11 + b^9 + b^8 + b^5 + b^4 + b^2 + b + 1 + ValueError: Unexpected field degree: set keyword argument q equal to + the size of the base field (big field is GF(q^4)). + sage: Px.ate_pairing(Qx, n, k, t, q) # optional - sage.rings.finite_rings + b^19 + b^18 + b^17 + b^16 + b^15 + b^14 + b^13 + b^12 + + b^11 + b^9 + b^8 + b^5 + b^4 + b^2 + b + 1 sage: s = Integer(randrange(1, n)) - sage: (s*Px).ate_pairing(Qx, n, k, t, q) == Px.ate_pairing(s*Qx, n, k, t, q) + sage: (s*Px).ate_pairing(Qx, n, k, t, q) == Px.ate_pairing(s*Qx, n, k, t, q) # optional - sage.rings.finite_rings True - sage: Px.ate_pairing(s*Qx, n, k, t, q) == Px.ate_pairing(Qx, n, k, t, q)^s + sage: Px.ate_pairing(s*Qx, n, k, t, q) == Px.ate_pairing(Qx, n, k, t, q)^s # optional - sage.rings.finite_rings True - sage: c = (k*q^(k-1)).mod(n); T = t - 1 - sage: N = gcd(T^k - 1, q^k - 1) - sage: s = Integer(N/n) - sage: L = Integer((T^k - 1)/N) - sage: M = (L*s*c.inverse_mod(n)).mod(n) - sage: Px.ate_pairing(Qx, n, k, t, q) == Qx.tate_pairing(Px, n, k, q)^M + sage: c = (k*q^(k-1)).mod(n); T = t - 1 # optional - sage.rings.finite_rings + sage: N = gcd(T^k - 1, q^k - 1) # optional - sage.rings.finite_rings + sage: s = Integer(N/n) # optional - sage.rings.finite_rings + sage: L = Integer((T^k - 1)/N) # optional - sage.rings.finite_rings + sage: M = (L*s*c.inverse_mod(n)).mod(n) # optional - sage.rings.finite_rings + sage: Px.ate_pairing(Qx, n, k, t, q) == Qx.tate_pairing(Px, n, k, q)^M # optional - sage.rings.finite_rings True It is an error if `Q` is not in the kernel of `\pi - p`, where `\pi` is the Frobenius automorphism:: - sage: p = 29; A = 1; B = 0; n = 5; k = 2; t = 10 - sage: F = GF(p); R. = F[] - sage: E = EllipticCurve(F, [A, B]); - sage: K. = GF((p,k), modulus=x^k+2); EK = E.base_extend(K) - sage: P = EK(13, 8); Q = EK(13, 21) - sage: P.ate_pairing(Q, n, k, t) + sage: p = 29; A = 1; B = 0; n = 5; k = 2; t = 10 # optional - sage.rings.finite_rings + sage: F = GF(p); R. = F[] # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F, [A, B]); # optional - sage.rings.finite_rings + sage: K. = GF((p,k), modulus=x^k+2); EK = E.base_extend(K) # optional - sage.rings.finite_rings + sage: P = EK(13, 8); Q = EK(13, 21) # optional - sage.rings.finite_rings + sage: P.ate_pairing(Q, n, k, t) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Point (13 : 21 : 1) not in Ker(pi - q) @@ -1989,11 +2004,11 @@ def ate_pairing(self, Q, n, k, t, q=None): It is also an error if `P` is not in the kernel os `\pi - 1`:: sage: p = 29; A = 1; B = 0; n = 5; k = 2; t = 10 - sage: F = GF(p); R. = F[] - sage: E = EllipticCurve(F, [A, B]); - sage: K. = GF((p,k), modulus=x^k+2); EK = E.base_extend(K) - sage: P = EK(14, 10*a); Q = EK(13, 21) - sage: P.ate_pairing(Q, n, k, t) + sage: F = GF(p); R. = F[] # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F, [A, B]); # optional - sage.rings.finite_rings + sage: K. = GF((p,k), modulus=x^k+2); EK = E.base_extend(K) # optional - sage.rings.finite_rings + sage: P = EK(14, 10*a); Q = EK(13, 21) # optional - sage.rings.finite_rings + sage: P.ate_pairing(Q, n, k, t) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: This point (14 : 10*a : 1) is not in Ker(pi - 1) @@ -2063,7 +2078,7 @@ class EllipticCurvePoint_number_field(EllipticCurvePoint_field): (0 : 0 : 1) sage: E(0,0) # brackets are optional (0 : 0 : 1) - sage: E([GF(5)(0), 0]) # entries are coerced + sage: E([GF(5)(0), 0]) # entries are coerced # optional - sage.rings.finite_rings (0 : 0 : 1) sage: E(0.000, 0) @@ -2079,7 +2094,8 @@ class EllipticCurvePoint_number_field(EllipticCurvePoint_field): sage: E = EllipticCurve([0,0,1,-1,0]) sage: S = E(QQ); S - Abelian group of points on Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field + Abelian group of points on + Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field TESTS:: @@ -2241,26 +2257,27 @@ def is_on_identity_component(self, embedding=None): For `K=\QQ` there is no need to specify an embedding:: - sage: E=EllipticCurve('5077a1') + sage: E = EllipticCurve('5077a1') sage: [E.lift_x(x).is_on_identity_component() for x in srange(-3,5)] [False, False, False, False, False, True, True, True] An example over a field with two real embeddings:: - sage: L. = QuadraticField(2) - sage: E=EllipticCurve(L,[0,1,0,a,a]) - sage: P=E(-1,0) - sage: [P.is_on_identity_component(e) for e in L.embeddings(RR)] + sage: L. = QuadraticField(2) # optional - sage.rings.number_field + sage: E = EllipticCurve(L, [0,1,0,a,a]) # optional - sage.rings.number_field + sage: P = E(-1,0) # optional - sage.rings.number_field + sage: [P.is_on_identity_component(e) for e in L.embeddings(RR)] # optional - sage.rings.number_field [False, True] We can check this as follows:: - sage: [e(E.discriminant())>0 for e in L.embeddings(RR)] + sage: [e(E.discriminant()) > 0 for e in L.embeddings(RR)] # optional - sage.rings.number_field [True, False] - sage: e = L.embeddings(RR)[0] - sage: E1 = EllipticCurve(RR,[e(ai) for ai in E.ainvs()]) - sage: e1,e2,e3 = E1.two_division_polynomial().roots(RR,multiplicities=False) - sage: e1 < e2 < e3 and e(P[0]) < e3 + sage: e = L.embeddings(RR)[0] # optional - sage.rings.number_field + sage: E1 = EllipticCurve(RR, [e(ai) for ai in E.ainvs()]) # optional - sage.rings.number_field + sage: e1, e2, e3 = E1.two_division_polynomial().roots(RR, # optional - sage.rings.number_field + ....: multiplicities=False) + sage: e1 < e2 < e3 and e(P[0]) < e3 # optional - sage.rings.number_field True """ if self.is_zero(): # trivial case @@ -2331,21 +2348,21 @@ def has_good_reduction(self, P=None): :: - sage: K. = NumberField(x^2+1) - sage: E = EllipticCurve(K,[0,1,0,-160,308]) - sage: P = E(26,-120) - sage: E.discriminant().support() + sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0,1,0,-160,308]) # optional - sage.rings.number_field + sage: P = E(26, -120) # optional - sage.rings.number_field + sage: E.discriminant().support() # optional - sage.rings.number_field [Fractional ideal (i + 1), - Fractional ideal (-i - 2), - Fractional ideal (2*i + 1), - Fractional ideal (3)] - sage: [E.tamagawa_exponent(p) for p in E.discriminant().support()] + Fractional ideal (-i - 2), + Fractional ideal (2*i + 1), + Fractional ideal (3)] + sage: [E.tamagawa_exponent(p) for p in E.discriminant().support()] # optional - sage.rings.number_field [1, 4, 4, 4] - sage: P.has_good_reduction() + sage: P.has_good_reduction() # optional - sage.rings.number_field False - sage: (2*P).has_good_reduction() + sage: (2*P).has_good_reduction() # optional - sage.rings.number_field False - sage: (4*P).has_good_reduction() + sage: (4*P).has_good_reduction() # optional - sage.rings.number_field True TESTS: @@ -2353,14 +2370,14 @@ def has_good_reduction(self, P=None): An example showing that :trac:`8498` is fixed:: sage: E = EllipticCurve('11a1') - sage: K. = NumberField(x^2+47) - sage: EK = E.base_extend(K) - sage: T = EK(5,5) - sage: P = EK(-2, -1/2*t - 1/2) - sage: p = K.ideal(11) - sage: T.has_good_reduction(p) + sage: K. = NumberField(x^2 + 47) # optional - sage.rings.number_field + sage: EK = E.base_extend(K) # optional - sage.rings.number_field + sage: T = EK(5, 5) # optional - sage.rings.number_field + sage: P = EK(-2, -1/2*t - 1/2) # optional - sage.rings.number_field + sage: p = K.ideal(11) # optional - sage.rings.number_field + sage: T.has_good_reduction(p) # optional - sage.rings.number_field False - sage: P.has_good_reduction(p) + sage: P.has_good_reduction(p) # optional - sage.rings.number_field True """ if self.is_zero(): # trivial case @@ -2441,22 +2458,22 @@ def reduction(self, p): :: - sage: F. = NumberField(x^2+5) - sage: E = EllipticCurve(F,[1,2,3,4,0]) - sage: Q = E(98,931) - sage: Q.reduction(a) + sage: F. = NumberField(x^2 + 5) # optional - sage.rings.number_field + sage: E = EllipticCurve(F, [1,2,3,4,0]) # optional - sage.rings.number_field + sage: Q = E(98, 931) # optional - sage.rings.number_field + sage: Q.reduction(a) # optional - sage.rings.number_field (3 : 1 : 1) - sage: Q.reduction(11) + sage: Q.reduction(11) # optional - sage.rings.number_field (10 : 7 : 1) :: - sage: F. = NumberField(x^3+x^2+1) - sage: E = EllipticCurve(F,[a,2]) - sage: P = E(a,1) - sage: P.reduction(F.ideal(5)) + sage: F. = NumberField(x^3 + x^2 + 1) # optional - sage.rings.number_field + sage: E = EllipticCurve(F, [a,2]) # optional - sage.rings.number_field + sage: P = E(a, 1) # optional - sage.rings.number_field + sage: P.reduction(F.ideal(5)) # optional - sage.rings.number_field (abar : 1 : 1) - sage: P.reduction(F.ideal(a^2-4*a-2)) + sage: P.reduction(F.ideal(a^2 - 4*a - 2)) # optional - sage.rings.number_field (abar : 1 : 1) """ P = self @@ -2542,7 +2559,8 @@ def height(self, precision=None, normalised=True, algorithm='pari'): :: sage: E = EllipticCurve('4602a1'); E - Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 37746035*x - 89296920339 over Rational Field + Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 37746035*x - 89296920339 + over Rational Field sage: x = 77985922458974949246858229195945103471590 sage: y = 19575260230015313702261379022151675961965157108920263594545223 sage: d = 2254020761884782243 @@ -2569,19 +2587,20 @@ def height(self, precision=None, normalised=True, algorithm='pari'): Canonical heights over number fields are implemented as well:: sage: R. = QQ[] - sage: K. = NumberField(x^3-2) - sage: E = EllipticCurve([a, 4]); E - Elliptic Curve defined by y^2 = x^3 + a*x + 4 over Number Field in a with defining polynomial x^3 - 2 - sage: P = E((0,2)) - sage: P.height() + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: E = EllipticCurve([a, 4]); E # optional - sage.rings.number_field + Elliptic Curve defined by y^2 = x^3 + a*x + 4 + over Number Field in a with defining polynomial x^3 - 2 + sage: P = E((0,2)) # optional - sage.rings.number_field + sage: P.height() # optional - sage.rings.number_field 0.810463096585925 - sage: P.height(precision=100) + sage: P.height(precision=100) # optional - sage.rings.number_field 0.81046309658592536863991810577 - sage: P.height(precision=200) + sage: P.height(precision=200) # optional - sage.rings.number_field 0.81046309658592536863991810576865158896130286417155832378086 - sage: (2*P).height() / P.height() + sage: (2*P).height() / P.height() # optional - sage.rings.number_field 4.00000000000000 - sage: (100*P).height() / P.height() + sage: (100*P).height() / P.height() # optional - sage.rings.number_field 10000.0000000000 Setting normalised=False multiplies the height by the degree of `K`:: @@ -2592,12 +2611,12 @@ def height(self, precision=None, normalised=True, algorithm='pari'): 0.0511114082399688 sage: P.height(normalised=False) 0.0511114082399688 - sage: K. = CyclotomicField(5) - sage: EK = E.change_ring(K) - sage: PK = EK([0,0]) - sage: PK.height() + sage: K. = CyclotomicField(5) # optional - sage.rings.number_field + sage: EK = E.change_ring(K) # optional - sage.rings.number_field + sage: PK = EK([0,0]) # optional - sage.rings.number_field + sage: PK.height() # optional - sage.rings.number_field 0.0511114082399688 - sage: PK.height(normalised=False) + sage: PK.height(normalised=False) # optional - sage.rings.number_field 0.204445632959875 Some consistency checks:: @@ -2607,31 +2626,31 @@ def height(self, precision=None, normalised=True, algorithm='pari'): sage: P.height() 1.36857250535393 - sage: EK = E.change_ring(QuadraticField(-3,'a')) - sage: PK = EK([-2,3,1]) - sage: PK.height() + sage: EK = E.change_ring(QuadraticField(-3,'a')) # optional - sage.rings.number_field + sage: PK = EK([-2,3,1]) # optional - sage.rings.number_field + sage: PK.height() # optional - sage.rings.number_field 1.36857250535393 - sage: K. = NumberField(x^2+1) - sage: E = EllipticCurve(K, [0,0,4,6*i,0]) - sage: Q = E.lift_x(-9/4); Q + sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,4,6*i,0]) # optional - sage.rings.number_field + sage: Q = E.lift_x(-9/4); Q # optional - sage.rings.number_field (-9/4 : -27/8*i : 1) - sage: Q.height() + sage: Q.height() # optional - sage.rings.number_field 2.69518560017909 - sage: (15*Q).height() / Q.height() + sage: (15*Q).height() / Q.height() # optional - sage.rings.number_field 225.000000000000 sage: E = EllipticCurve('37a') sage: P = E([0,-1]) sage: P.height() 0.0511114082399688 - sage: K. = QuadraticField(-7) - sage: ED = E.quadratic_twist(-7) - sage: Q = E.isomorphism_to(ED.change_ring(K))(P); Q + sage: K. = QuadraticField(-7) # optional - sage.rings.number_field + sage: ED = E.quadratic_twist(-7) # optional - sage.rings.number_field + sage: Q = E.isomorphism_to(ED.change_ring(K))(P); Q # optional - sage.rings.number_field (0 : -7/2*a - 1/2 : 1) - sage: Q.height() + sage: Q.height() # optional - sage.rings.number_field 0.0511114082399688 - sage: Q.height(precision=100) + sage: Q.height(precision=100) # optional - sage.rings.number_field 0.051111408239968840235886099757 An example to show that the bug at :trac:`5252` is fixed:: @@ -2666,17 +2685,17 @@ def height(self, precision=None, normalised=True, algorithm='pari'): An example to show that the bug at :trac:`12509` is fixed (precision issues):: sage: x = polygen(QQ) - sage: K. = NumberField(x^2-x-1) - sage: v = [0, a + 1, 1, 28665*a - 46382, 2797026*a - 4525688] - sage: E = EllipticCurve(v) - sage: P = E([72*a - 509/5, -682/25*a - 434/25]) - sage: P.height() + sage: K. = NumberField(x^2 - x - 1) # optional - sage.rings.number_field + sage: v = [0, a + 1, 1, 28665*a - 46382, 2797026*a - 4525688] # optional - sage.rings.number_field + sage: E = EllipticCurve(v) # optional - sage.rings.number_field + sage: P = E([72*a - 509/5, -682/25*a - 434/25]) # optional - sage.rings.number_field + sage: P.height() # optional - sage.rings.number_field 1.38877711688727 - sage: (2*P).height()/P.height() + sage: (2*P).height()/P.height() # optional - sage.rings.number_field 4.00000000000000 - sage: (2*P).height(precision=100)/P.height(precision=100) + sage: (2*P).height(precision=100)/P.height(precision=100) # optional - sage.rings.number_field 4.0000000000000000000000000000 - sage: (2*P).height(precision=1000)/P.height(precision=1000) + sage: (2*P).height(precision=1000)/P.height(precision=1000) # optional - sage.rings.number_field 4.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 This shows that the bug reported at :trac:`13951` has been fixed:: @@ -2685,9 +2704,9 @@ def height(self, precision=None, normalised=True, algorithm='pari'): sage: P1 = E(2,5) sage: P1.height() 1.06248137652528 - sage: F = E.change_ring(QuadraticField(-3,'a')) - sage: P2 = F([2,5]) - sage: P2.height() + sage: F = E.change_ring(QuadraticField(-3, 'a')) # optional - sage.rings.number_field + sage: P2 = F([2,5]) # optional - sage.rings.number_field + sage: P2.height() # optional - sage.rings.number_field 1.06248137652528 """ if self.has_finite_order(): @@ -2762,24 +2781,26 @@ def archimedean_local_height(self, v=None, prec=None, weighted=False): Examples 1, 2, and 3 from [Sil1988]_:: - sage: K. = QuadraticField(-2) - sage: E = EllipticCurve(K, [0,-1,1,0,0]); E - Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 over Number Field in a with defining polynomial x^2 + 2 with a = 1.414213562373095?*I - sage: P = E.lift_x(2+a); P + sage: K. = QuadraticField(-2) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0,-1,1,0,0]); E # optional - sage.rings.number_field + Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 over Number Field + in a with defining polynomial x^2 + 2 with a = 1.414213562373095?*I + sage: P = E.lift_x(2 + a); P # optional - sage.rings.number_field (a + 2 : 2*a + 1 : 1) - sage: P.archimedean_local_height(K.places(prec=170)[0]) / 2 + sage: P.archimedean_local_height(K.places(prec=170)[0]) / 2 # optional - sage.rings.number_field 0.45754773287523276736211210741423654346576029814695 - sage: K. = NumberField(x^2+1) - sage: E = EllipticCurve(K, [0,0,4,6*i,0]); E - Elliptic Curve defined by y^2 + 4*y = x^3 + 6*i*x over Number Field in i with defining polynomial x^2 + 1 - sage: P = E((0,0)) - sage: P.archimedean_local_height(K.places()[0]) / 2 + sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,4,6*i,0]); E # optional - sage.rings.number_field + Elliptic Curve defined by y^2 + 4*y = x^3 + 6*i*x + over Number Field in i with defining polynomial x^2 + 1 + sage: P = E((0,0)) # optional - sage.rings.number_field + sage: P.archimedean_local_height(K.places()[0]) / 2 # optional - sage.rings.number_field 0.510184995162373 - sage: Q = E.lift_x(-9/4); Q + sage: Q = E.lift_x(-9/4); Q # optional - sage.rings.number_field (-9/4 : -27/8*i : 1) - sage: Q.archimedean_local_height(K.places()[0]) / 2 + sage: Q.archimedean_local_height(K.places()[0]) / 2 # optional - sage.rings.number_field 0.654445619529600 An example over the rational numbers:: @@ -2792,10 +2813,10 @@ def archimedean_local_height(self, v=None, prec=None, weighted=False): Local heights of torsion points can be non-zero (unlike the global height):: - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0, 0, 0, K(1), 0]) - sage: P = E(i, 0) - sage: P.archimedean_local_height() + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, K(1), 0]) # optional - sage.rings.number_field + sage: P = E(i, 0) # optional - sage.rings.number_field + sage: P.archimedean_local_height() # optional - sage.rings.number_field 0.346573590279973 TESTS: @@ -2803,33 +2824,34 @@ def archimedean_local_height(self, v=None, prec=None, weighted=False): See :trac:`12509`:: sage: x = polygen(QQ) - sage: K. = NumberField(x^2-x-1) - sage: v = [0, a + 1, 1, 28665*a - 46382, 2797026*a - 4525688] - sage: E = EllipticCurve(v) - sage: P = E([72*a - 509/5, -682/25*a - 434/25]) - sage: P.archimedean_local_height() + sage: K. = NumberField(x^2 - x - 1) # optional - sage.rings.number_field + sage: v = [0, a + 1, 1, 28665*a - 46382, 2797026*a - 4525688] # optional - sage.rings.number_field + sage: E = EllipticCurve(v) # optional - sage.rings.number_field + sage: P = E([72*a - 509/5, -682/25*a - 434/25]) # optional - sage.rings.number_field + sage: P.archimedean_local_height() # optional - sage.rings.number_field -0.220660795546828 See :trac:`19276`:: - sage: K. = NumberField(x^2-x-104) - sage: E = EllipticCurve([1, a - 1, 1, -816765673272*a - 7931030674178, 1478955604013312315*a + 14361086227143654561]) - sage: P = E(5393511/49*a + 52372721/49 , -33896210324/343*a - 329141996591/343 ) - sage: P.height() + sage: K. = NumberField(x^2 - x - 104) # optional - sage.rings.number_field + sage: E = EllipticCurve([1, a - 1, 1, -816765673272*a - 7931030674178, 1478955604013312315*a + 14361086227143654561]) # optional - sage.rings.number_field + sage: P = E(5393511/49*a + 52372721/49 , -33896210324/343*a - 329141996591/343 ) # optional - sage.rings.number_field + sage: P.height() # optional - sage.rings.number_field 0.974232017827741 See :trac:`29966`:: - sage: K. = NumberField(x^3 - x^2 - 6*x + 2) - sage: E = EllipticCurve([1, -a^2 + 2*a + 4, 0, -6056450500590472699700624*a^2 - 11239394326797569935861742*a + 4241549693833829432516231, 1904879037869682826729875958079326124520*a^2 + 3535022146945771697732350459284777382011*a - 1334055169621036218710397707677347972626]) - sage: P = E([1033399668533*a^2 + 1917754693229*a - 723726883800 , 12536493059202326563*a^2 + 23264879148900575548*a - 8779756111574815918 , 1]) - sage: P.height() + sage: K. = NumberField(x^3 - x^2 - 6*x + 2) # optional - sage.rings.number_field + sage: E = EllipticCurve([1, -a^2 + 2*a + 4, 0, -6056450500590472699700624*a^2 - 11239394326797569935861742*a + 4241549693833829432516231, # optional - sage.rings.number_field + ....: 1904879037869682826729875958079326124520*a^2 + 3535022146945771697732350459284777382011*a - 1334055169621036218710397707677347972626]) + sage: P = E([1033399668533*a^2 + 1917754693229*a - 723726883800 , 12536493059202326563*a^2 + 23264879148900575548*a - 8779756111574815918 , 1]) # optional - sage.rings.number_field + sage: P.height() # optional - sage.rings.number_field 0.297318833424763 - sage: (2*P).height() / P.height() + sage: (2*P).height() / P.height() # optional - sage.rings.number_field 4.00000000000000 - sage: P.height(200) + sage: P.height(200) # optional - sage.rings.number_field 0.29731883342476341806143743594519935578696537745294661858984 - sage: (2*P).height(200) / P.height(200) + sage: (2*P).height(200) / P.height(200) # optional - sage.rings.number_field 4.0000000000000000000000000000000000000000000000000000000000 """ from sage.rings.number_field.number_field import refine_embedding @@ -2987,26 +3009,27 @@ def non_archimedean_local_height(self, v=None, prec=None, Examples 2 and 3 from [Sil1988]_:: - sage: K. = NumberField(x^2+1) - sage: E = EllipticCurve(K, [0,0,4,6*i,0]); E - Elliptic Curve defined by y^2 + 4*y = x^3 + 6*i*x over Number Field in i with defining polynomial x^2 + 1 - sage: P = E((0,0)) - sage: P.non_archimedean_local_height(K.ideal(i+1)) + sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,4,6*i,0]); E # optional - sage.rings.number_field + Elliptic Curve defined by y^2 + 4*y = x^3 + 6*i*x + over Number Field in i with defining polynomial x^2 + 1 + sage: P = E((0,0)) # optional - sage.rings.number_field + sage: P.non_archimedean_local_height(K.ideal(i+1)) # optional - sage.rings.number_field -1/2*log(2) - sage: P.non_archimedean_local_height(K.ideal(3)) + sage: P.non_archimedean_local_height(K.ideal(3)) # optional - sage.rings.number_field 0 - sage: P.non_archimedean_local_height(K.ideal(1-2*i)) + sage: P.non_archimedean_local_height(K.ideal(1-2*i)) # optional - sage.rings.number_field 0 - sage: Q = E.lift_x(-9/4); Q + sage: Q = E.lift_x(-9/4); Q # optional - sage.rings.number_field (-9/4 : -27/8*i : 1) - sage: Q.non_archimedean_local_height(K.ideal(1+i)) + sage: Q.non_archimedean_local_height(K.ideal(1+i)) # optional - sage.rings.number_field 2*log(2) - sage: Q.non_archimedean_local_height(K.ideal(3)) + sage: Q.non_archimedean_local_height(K.ideal(3)) # optional - sage.rings.number_field 0 - sage: Q.non_archimedean_local_height(K.ideal(1-2*i)) + sage: Q.non_archimedean_local_height(K.ideal(1-2*i)) # optional - sage.rings.number_field 0 - sage: Q.non_archimedean_local_height() + sage: Q.non_archimedean_local_height() # optional - sage.rings.number_field 2*log(2) An example over the rational numbers:: @@ -3019,30 +3042,30 @@ def non_archimedean_local_height(self, v=None, prec=None, Local heights of torsion points can be non-zero (unlike the global height):: - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0, 0, 0, K(1), 0]) - sage: P = E(i, 0) - sage: P.non_archimedean_local_height() + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, K(1), 0]) # optional - sage.rings.number_field + sage: P = E(i, 0) # optional - sage.rings.number_field + sage: P.non_archimedean_local_height() # optional - sage.rings.number_field -1/2*log(2) TESTS:: - sage: Q.non_archimedean_local_height(prec=100) + sage: Q.non_archimedean_local_height(prec=100) # optional - sage.rings.number_field 1.3862943611198906188344642429 - sage: (3*Q).non_archimedean_local_height() + sage: (3*Q).non_archimedean_local_height() # optional - sage.rings.number_field 1/2*log(75923153929839865104) - sage: F. = NumberField(x^4 + 2*x^3 + 19*x^2 + 18*x + 288) - sage: F.ring_of_integers().basis() + sage: F. = NumberField(x^4 + 2*x^3 + 19*x^2 + 18*x + 288) # optional - sage.rings.number_field + sage: F.ring_of_integers().basis() # optional - sage.rings.number_field [1, 5/6*a^3 + 1/6*a, 1/6*a^3 + 1/6*a^2, a^3] - sage: F.class_number() + sage: F.class_number() # optional - sage.rings.number_field 12 - sage: E = EllipticCurve('37a').change_ring(F) - sage: P = E((-a^2/6 - a/6 - 1, a)); P + sage: E = EllipticCurve('37a').change_ring(F) # optional - sage.rings.number_field + sage: P = E((-a^2/6 - a/6 - 1, a)); P # optional - sage.rings.number_field (-1/6*a^2 - 1/6*a - 1 : a : 1) - sage: P[0].is_integral() + sage: P[0].is_integral() # optional - sage.rings.number_field True - sage: P.non_archimedean_local_height() + sage: P.non_archimedean_local_height() # optional - sage.rings.number_field 0 This shows that the bug reported at :trac:`13951` has been fixed:: @@ -3177,7 +3200,7 @@ def elliptic_logarithm(self, embedding=None, precision=100, False sage: P.elliptic_logarithm (precision=96) 0.4793482501902193161295330101 + 0.985868850775824102211203849...*I - sage: Q=E([3,5]) + sage: Q = E([3,5]) sage: Q.is_on_identity_component() True sage: Q.elliptic_logarithm (precision=96) @@ -3229,30 +3252,36 @@ def elliptic_logarithm(self, embedding=None, precision=100, Examples over number fields:: - sage: K. = NumberField(x^3-2) - sage: embs = K.embeddings(CC) - sage: E = EllipticCurve([0,1,0,a,a]) - sage: Ls = [E.period_lattice(e) for e in embs] - sage: [L.real_flag for L in Ls] + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: embs = K.embeddings(CC) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # optional - sage.rings.number_field + sage: Ls = [E.period_lattice(e) for e in embs] # optional - sage.rings.number_field + sage: [L.real_flag for L in Ls] # optional - sage.rings.number_field [0, 0, -1] - sage: P = E(-1,0) # order 2 - sage: [L.elliptic_logarithm(P) for L in Ls] - [-1.73964256006716 - 1.07861534489191*I, -0.363756518406398 - 1.50699412135253*I, 1.90726488608927] - - sage: E = EllipticCurve([-a^2 - a - 1, a^2 + a]) - sage: Ls = [E.period_lattice(e) for e in embs] - sage: pts = [E(2*a^2 - a - 1 , -2*a^2 - 2*a + 6 ), E(-2/3*a^2 - 1/3 , -4/3*a - 2/3 ), E(5/4*a^2 - 1/2*a , -a^2 - 1/4*a + 9/4 ), E(2*a^2 + 3*a + 4 , -7*a^2 - 10*a - 12 )] - sage: [[L.elliptic_logarithm(P) for P in pts] for L in Ls] - [[0.250819591818930 - 0.411963479992219*I, -0.290994550611374 - 1.37239400324105*I, -0.693473752205595 - 2.45028458830342*I, -0.151659609775291 - 1.48985406505459*I], [1.33444787667954 - 1.50889756650544*I, 0.792633734249234 - 0.548467043256610*I, 0.390154532655013 + 0.529423541805758*I, 0.931968675085317 - 0.431006981443071*I], [1.14758249500109 + 0.853389664016075*I, 2.59823462472518 + 0.853389664016075*I, 1.75372176444709, 0.303069634723001]] + sage: P = E(-1,0) # order 2 # optional - sage.rings.number_field + sage: [L.elliptic_logarithm(P) for L in Ls] # optional - sage.rings.number_field + [-1.73964256006716 - 1.07861534489191*I, + -0.363756518406398 - 1.50699412135253*I, 1.90726488608927] + + sage: E = EllipticCurve([-a^2 - a - 1, a^2 + a]) # optional - sage.rings.number_field + sage: Ls = [E.period_lattice(e) for e in embs] # optional - sage.rings.number_field + sage: pts = [E(2*a^2 - a - 1 , -2*a^2 - 2*a + 6 ), + ....: E(-2/3*a^2 - 1/3 , -4/3*a - 2/3 ), + ....: E(5/4*a^2 - 1/2*a , -a^2 - 1/4*a + 9/4 ), + ....: E(2*a^2 + 3*a + 4 , -7*a^2 - 10*a - 12 )] + sage: [[L.elliptic_logarithm(P) for P in pts] for L in Ls] # optional - sage.rings.number_field + [[0.250819591818930 - 0.411963479992219*I, -0.290994550611374 - 1.37239400324105*I, -0.693473752205595 - 2.45028458830342*I, -0.151659609775291 - 1.48985406505459*I], + [1.33444787667954 - 1.50889756650544*I, 0.792633734249234 - 0.548467043256610*I, 0.390154532655013 + 0.529423541805758*I, 0.931968675085317 - 0.431006981443071*I], + [1.14758249500109 + 0.853389664016075*I, 2.59823462472518 + 0.853389664016075*I, 1.75372176444709, 0.303069634723001]] :: - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0,0,0,9*i-10,21-i]) - sage: emb = K.embeddings(CC)[1] - sage: L = E.period_lattice(emb) - sage: P = E(2-i,4+2*i) - sage: L.elliptic_logarithm(P,prec=100) + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,0,0,9*i-10,21-i]) # optional - sage.rings.number_field + sage: emb = K.embeddings(CC)[1] # optional - sage.rings.number_field + sage: L = E.period_lattice(emb) # optional - sage.rings.number_field + sage: P = E(2-i, 4+2*i) # optional - sage.rings.number_field + sage: L.elliptic_logarithm(P, prec=100) # optional - sage.rings.number_field 0.70448375537782208460499649302 - 0.79246725643650979858266018068*I """ from sage.rings.number_field.number_field import refine_embedding @@ -3370,31 +3399,32 @@ def padic_elliptic_logarithm(self, p, absprec=20): EXAMPLES:: sage: E = EllipticCurve([0,1,1,-2,0]) - sage: E(0).padic_elliptic_logarithm(3) + sage: E(0).padic_elliptic_logarithm(3) # optional - sage.rings.padics 0 - sage: P = E(0,0) - sage: P.padic_elliptic_logarithm(3) + sage: P = E(0, 0) # optional - sage.rings.padics + sage: P.padic_elliptic_logarithm(3) # optional - sage.rings.padics 2 + 2*3 + 3^3 + 2*3^7 + 3^8 + 3^9 + 3^11 + 3^15 + 2*3^17 + 3^18 + O(3^19) - sage: P.padic_elliptic_logarithm(3).lift() + sage: P.padic_elliptic_logarithm(3).lift() # optional - sage.rings.padics 660257522 - sage: P = E(-11/9,28/27) - sage: [(2*P).padic_elliptic_logarithm(p)/P.padic_elliptic_logarithm(p) for p in prime_range(20)] # long time (3s) + sage: P = E(-11/9, 28/27) # optional - sage.rings.padics + sage: [(2*P).padic_elliptic_logarithm(p)/P.padic_elliptic_logarithm(p) for p in prime_range(20)] # long time (3s) # optional - sage.rings.padics [2 + O(2^19), 2 + O(3^20), 2 + O(5^19), 2 + O(7^19), 2 + O(11^19), 2 + O(13^19), 2 + O(17^19), 2 + O(19^19)] - sage: [(3*P).padic_elliptic_logarithm(p)/P.padic_elliptic_logarithm(p) for p in prime_range(12)] # long time (2s) + sage: [(3*P).padic_elliptic_logarithm(p)/P.padic_elliptic_logarithm(p) for p in prime_range(12)] # long time (2s) # optional - sage.rings.padics [1 + 2 + O(2^19), 3 + 3^20 + O(3^21), 3 + O(5^19), 3 + O(7^19), 3 + O(11^19)] - sage: [(5*P).padic_elliptic_logarithm(p)/P.padic_elliptic_logarithm(p) for p in prime_range(12)] # long time (2s) + sage: [(5*P).padic_elliptic_logarithm(p)/P.padic_elliptic_logarithm(p) for p in prime_range(12)] # long time (2s) # optional - sage.rings.padics [1 + 2^2 + O(2^19), 2 + 3 + O(3^20), 5 + O(5^19), 5 + O(7^19), 5 + O(11^19)] An example which arose during reviewing :trac:`4741`:: sage: E = EllipticCurve('794a1') sage: P = E(-1,2) - sage: P.padic_elliptic_logarithm(2) # default precision=20 + sage: P.padic_elliptic_logarithm(2) # default precision=20 # optional - sage.rings.padics 2^4 + 2^5 + 2^6 + 2^8 + 2^9 + 2^13 + 2^14 + 2^15 + O(2^16) - sage: P.padic_elliptic_logarithm(2, absprec=30) + sage: P.padic_elliptic_logarithm(2, absprec=30) # optional - sage.rings.padics 2^4 + 2^5 + 2^6 + 2^8 + 2^9 + 2^13 + 2^14 + 2^15 + 2^22 + 2^23 + 2^24 + O(2^26) - sage: P.padic_elliptic_logarithm(2, absprec=40) - 2^4 + 2^5 + 2^6 + 2^8 + 2^9 + 2^13 + 2^14 + 2^15 + 2^22 + 2^23 + 2^24 + 2^28 + 2^29 + 2^31 + 2^34 + O(2^35) + sage: P.padic_elliptic_logarithm(2, absprec=40) # optional - sage.rings.padics + 2^4 + 2^5 + 2^6 + 2^8 + 2^9 + 2^13 + 2^14 + 2^15 + 2^22 + 2^23 + 2^24 + + 2^28 + 2^29 + 2^31 + 2^34 + O(2^35) """ if not p.is_prime(): raise ValueError('p must be prime') @@ -3481,9 +3511,9 @@ def _magma_init_(self, magma): EXAMPLES:: - sage: E = EllipticCurve(GF(17), [1,-1]) - sage: P = E([13, 4]) - sage: P._magma_init_(magma) # optional - magma + sage: E = EllipticCurve(GF(17), [1,-1]) # optional - sage.rings.finite_rings + sage: P = E([13, 4]) # optional - sage.rings.finite_rings + sage: P._magma_init_(magma) # optional - magma # optional - sage.rings.finite_rings 'EllipticCurve([_sage_ref...|GF(17)!0,GF(17)!0,GF(17)!0,GF(17)!1,GF(17)!16])![13,4]' """ E = self.curve()._magma_init_(magma) @@ -3497,14 +3527,14 @@ def _acted_upon_(self, other, side): EXAMPLES:: - sage: P = EllipticCurve(GF(65537), [2,2]).lift_x(6) - sage: P.order().factor() + sage: P = EllipticCurve(GF(65537), [2,2]).lift_x(6) # optional - sage.rings.finite_rings + sage: P.order().factor() # optional - sage.rings.finite_rings 2^2 * 3 * 37^2 - sage: getattr(74*P, '_order', None) + sage: getattr(74*P, '_order', None) # optional - sage.rings.finite_rings 222 - sage: getattr(P*4070, '_order', None) + sage: getattr(P*4070, '_order', None) # optional - sage.rings.finite_rings 222 - sage: getattr(506*P*37, '_order', None) + sage: getattr(506*P*37, '_order', None) # optional - sage.rings.finite_rings 222 """ k = ZZ(other) @@ -3587,14 +3617,14 @@ def discrete_log(self, Q, ord=None): EXAMPLES:: - sage: F = GF((3,6),'a') - sage: a = F.gen() - sage: E = EllipticCurve([0,1,1,a,a]) - sage: E.cardinality() + sage: F = GF((3,6),'a') # optional - sage.rings.finite_rings + sage: a = F.gen() # optional - sage.rings.finite_rings + sage: E = EllipticCurve([0,1,1,a,a]) # optional - sage.rings.finite_rings + sage: E.cardinality() # optional - sage.rings.finite_rings 762 - sage: P = E.gens()[0] - sage: Q = 400*P - sage: P.discrete_log(Q) + sage: P = E.gens()[0] # optional - sage.rings.finite_rings + sage: Q = 400*P # optional - sage.rings.finite_rings + sage: P.discrete_log(Q) # optional - sage.rings.finite_rings 400 TESTS: @@ -3604,16 +3634,16 @@ def discrete_log(self, Q, ord=None): sage: sz = randint(8,32) sage: e = randint(1,3) sage: p = random_prime(ceil(2**(sz/e))) - sage: E = EllipticCurve(j=GF((p,e),'a').random_element()) - sage: P = E.random_point() - sage: Q = randrange(2**999) * P - sage: x = P.discrete_log(Q) - sage: x*P == Q + sage: E = EllipticCurve(j=GF((p,e),'a').random_element()) # optional - sage.rings.finite_rings + sage: P = E.random_point() # optional - sage.rings.finite_rings + sage: Q = randrange(2**999) * P # optional - sage.rings.finite_rings + sage: x = P.discrete_log(Q) # optional - sage.rings.finite_rings + sage: x*P == Q # optional - sage.rings.finite_rings True Doctest deprecation:: - sage: P.discrete_log(Q, ord=P.order()) + sage: P.discrete_log(Q, ord=P.order()) # optional - sage.rings.finite_rings doctest:warning ... DeprecationWarning: The "ord" argument to .discrete_log() is obsolete. ... @@ -3671,11 +3701,11 @@ def padic_elliptic_logarithm(self,Q, p): sage: p=235322474717419 sage: b=8856682 - sage: E = EllipticCurve(GF(p), [0, b]) - sage: P = E(200673830421813, 57025307876612) - sage: Q = E(40345734829479, 211738132651297) - sage: x = P.padic_elliptic_logarithm(Q, p) - sage: x * P == Q + sage: E = EllipticCurve(GF(p), [0, b]) # optional - sage.rings.finite_rings + sage: P = E(200673830421813, 57025307876612) # optional - sage.rings.finite_rings + sage: Q = E(40345734829479, 211738132651297) # optional - sage.rings.finite_rings + sage: x = P.padic_elliptic_logarithm(Q, p) # optional - sage.rings.finite_rings sage.rings.padics + sage: x * P == Q # optional - sage.rings.finite_rings sage.rings.padics True TESTS: @@ -3685,11 +3715,11 @@ def padic_elliptic_logarithm(self,Q, p): sage: a = 49850651047495986645822557378918223 sage: b = 21049438014429831351540675253466229 sage: p = 54283205379427155782089046839411711 - sage: E = EllipticCurve(GF(p),[a, b]) - sage: P = E.random_point() - sage: Q = randrange(0, p-1) * P - sage: x = P.padic_elliptic_logarithm(Q, p) - sage: x*P == Q + sage: E = EllipticCurve(GF(p), [a, b]) # optional - sage.rings.finite_rings + sage: P = E.random_point() # optional - sage.rings.finite_rings + sage: Q = randrange(0, p-1) * P # optional - sage.rings.finite_rings + sage: x = P.padic_elliptic_logarithm(Q, p) # optional - sage.rings.finite_rings sage.rings.padics + sage: x*P == Q # optional - sage.rings.finite_rings sage.rings.padics True """ E = self.curve() @@ -3737,9 +3767,9 @@ def has_finite_order(self): EXAMPLES:: - sage: E = EllipticCurve(GF(7), [1,3]) - sage: P = E.points()[3] - sage: P.has_finite_order() + sage: E = EllipticCurve(GF(7), [1,3]) # optional - sage.rings.finite_rings + sage: P = E.points()[3] # optional - sage.rings.finite_rings + sage: P.has_finite_order() # optional - sage.rings.finite_rings True """ return True @@ -3756,67 +3786,68 @@ def order(self): EXAMPLES:: - sage: k. = GF((5,5)) - sage: E = EllipticCurve(k,[2,4]); E + sage: k. = GF((5,5)) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(k,[2,4]); E # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + 2*x + 4 over Finite Field in a of size 5^5 - sage: P = E(3*a^4 + 3*a , 2*a + 1 ) - sage: P.order() + sage: P = E(3*a^4 + 3*a, 2*a + 1) # optional - sage.rings.finite_rings + sage: P.order() # optional - sage.rings.finite_rings 3227 - sage: Q = E(0,2) - sage: Q.order() + sage: Q = E(0,2) # optional - sage.rings.finite_rings + sage: Q.order() # optional - sage.rings.finite_rings 7 - sage: Q.additive_order() + sage: Q.additive_order() # optional - sage.rings.finite_rings 7 :: - sage: p=next_prime(2^150) - sage: E=EllipticCurve(GF(p),[1,1]) - sage: P=E(831623307675610677632782670796608848711856078, 42295786042873366706573292533588638217232964) - sage: P.order() + sage: p = next_prime(2^150) + sage: E = EllipticCurve(GF(p), [1,1]) # optional - sage.rings.finite_rings + sage: P = E(831623307675610677632782670796608848711856078, # optional - sage.rings.finite_rings + ....: 42295786042873366706573292533588638217232964) + sage: P.order() # optional - sage.rings.finite_rings 1427247692705959881058262545272474300628281448 - sage: P.order() == E.cardinality() + sage: P.order() == E.cardinality() # optional - sage.rings.finite_rings True The next example has `j(E)=0`:: sage: p = 33554501 - sage: F. = GF((p,2)) - sage: E = EllipticCurve(F,[0,1]) - sage: E.j_invariant() + sage: F. = GF((p,2)) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F, [0,1]) # optional - sage.rings.finite_rings + sage: E.j_invariant() # optional - sage.rings.finite_rings 0 - sage: P = E.random_point() - sage: P.order() # random + sage: P = E.random_point() # optional - sage.rings.finite_rings + sage: P.order() # random # optional - sage.rings.finite_rings 16777251 Similarly when `j(E)=1728`:: sage: p = 33554473 - sage: F. = GF((p,2)) - sage: E = EllipticCurve(F,[1,0]) - sage: E.j_invariant() + sage: F. = GF((p,2)) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F, [1,0]) # optional - sage.rings.finite_rings + sage: E.j_invariant() # optional - sage.rings.finite_rings 1728 - sage: P = E.random_point() - sage: P.order() # random + sage: P = E.random_point() # optional - sage.rings.finite_rings + sage: P.order() # random # optional - sage.rings.finite_rings 46912611635760 TESTS: Check that the order actually gets cached (:trac:`32786`):: - sage: E = EllipticCurve(GF(31337), [42,1]) - sage: P = E.lift_x(1) - sage: hasattr(P, '_order') + sage: E = EllipticCurve(GF(31337), [42,1]) # optional - sage.rings.finite_rings + sage: P = E.lift_x(1) # optional - sage.rings.finite_rings + sage: hasattr(P, '_order') # optional - sage.rings.finite_rings False - sage: P.order() + sage: P.order() # optional - sage.rings.finite_rings 15649 - sage: P._order + sage: P._order # optional - sage.rings.finite_rings 15649 The curve order should also get cached as a side effect of computing a point order:: - sage: E._order + sage: E._order # optional - sage.rings.finite_rings 31298 """ try: diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py index 418bfd8995f..3c72b31fa2f 100644 --- a/src/sage/schemes/elliptic_curves/ell_rational_field.py +++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py @@ -3961,22 +3961,22 @@ def reduction(self,p): EXAMPLES:: sage: E = EllipticCurve('389a1') - sage: E.reduction(2) + sage: E.reduction(2) # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 + y = x^3 + x^2 over Finite Field of size 2 - sage: E.reduction(3) + sage: E.reduction(3) # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 3 - sage: E.reduction(5) + sage: E.reduction(5) # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 + y = x^3 + x^2 + 3*x over Finite Field of size 5 - sage: E.reduction(38) + sage: E.reduction(38) # optional - sage.rings.finite_rings Traceback (most recent call last): ... AttributeError: p must be prime. - sage: E.reduction(389) + sage: E.reduction(389) # optional - sage.rings.finite_rings Traceback (most recent call last): ... AttributeError: The curve must have good reduction at p. - sage: E = EllipticCurve([5^4,5^6]) - sage: E.reduction(5) + sage: E = EllipticCurve([5^4, 5^6]) + sage: E.reduction(5) # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 5 """ p = rings.Integer(p) @@ -4061,14 +4061,16 @@ def torsion_subgroup(self): EXAMPLES:: sage: EllipticCurve('11a').torsion_subgroup() - Torsion Subgroup isomorphic to Z/5 associated to the Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Torsion Subgroup isomorphic to Z/5 associated to the + Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: EllipticCurve('37b').torsion_subgroup() - Torsion Subgroup isomorphic to Z/3 associated to the Elliptic Curve defined by y^2 + y = x^3 + x^2 - 23*x - 50 over Rational Field + Torsion Subgroup isomorphic to Z/3 associated to the + Elliptic Curve defined by y^2 + y = x^3 + x^2 - 23*x - 50 over Rational Field :: - sage: e = EllipticCurve([-1386747,368636886]);e - Elliptic Curve defined by y^2 = x^3 - 1386747*x + 368636886 over Rational Field + sage: e = EllipticCurve([-1386747,368636886]); e + Elliptic Curve defined by y^2 = x^3 - 1386747*x + 368636886 over Rational Field sage: G = e.torsion_subgroup(); G Torsion Subgroup isomorphic to Z/8 + Z/2 associated to the Elliptic Curve defined by y^2 = x^3 - 1386747*x + 368636886 over @@ -4078,7 +4080,10 @@ def torsion_subgroup(self): sage: G.1 (282 : 0 : 1) sage: list(G) - [(0 : 1 : 0), (147 : -12960 : 1), (2307 : -97200 : 1), (-933 : -29160 : 1), (1011 : 0 : 1), (-933 : 29160 : 1), (2307 : 97200 : 1), (147 : 12960 : 1), (-1293 : 0 : 1), (1227 : 22680 : 1), (-285 : 27216 : 1), (8787 : 816480 : 1), (282 : 0 : 1), (8787 : -816480 : 1), (-285 : -27216 : 1), (1227 : -22680 : 1)] + [(0 : 1 : 0), (147 : -12960 : 1), (2307 : -97200 : 1), (-933 : -29160 : 1), + (1011 : 0 : 1), (-933 : 29160 : 1), (2307 : 97200 : 1), (147 : 12960 : 1), + (-1293 : 0 : 1), (1227 : 22680 : 1), (-285 : 27216 : 1), (8787 : 816480 : 1), + (282 : 0 : 1), (8787 : -816480 : 1), (-285 : -27216 : 1), (1227 : -22680 : 1)] """ try: G = self.__torsion_subgroup @@ -4261,7 +4266,8 @@ def cm_discriminant(self): sage: E.cm_discriminant() Traceback (most recent call last): ... - ValueError: Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field does not have CM + ValueError: Elliptic Curve defined by y^2 + y = x^3 - x + over Rational Field does not have CM """ try: @@ -4308,7 +4314,7 @@ def has_rational_cm(self, field=None): If we extend scalars to a field in which the discriminant is a square, the CM becomes rational:: - sage: E.has_rational_cm(QuadraticField(-3)) + sage: E.has_rational_cm(QuadraticField(-3)) # optional - sage.rings.number_field True sage: E = EllipticCurve(j=8000) @@ -4322,7 +4328,7 @@ def has_rational_cm(self, field=None): Again, we may extend scalars to a field in which the discriminant is a square, where the CM becomes rational:: - sage: E.has_rational_cm(QuadraticField(-2)) + sage: E.has_rational_cm(QuadraticField(-2)) # optional - sage.rings.number_field True The field need not be a number field provided that it is an @@ -4336,10 +4342,11 @@ def has_rational_cm(self, field=None): An error is raised if a field is given which is not an extension of `\QQ`, i.e., not of characteristic `0`:: - sage: E.has_rational_cm(GF(2)) + sage: E.has_rational_cm(GF(2)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... - ValueError: Error in has_rational_cm: Finite Field of size 2 is not an extension field of QQ + ValueError: Error in has_rational_cm: Finite Field of size 2 + is not an extension field of QQ """ if field is None: return False @@ -4363,8 +4370,8 @@ def quadratic_twist(self, D): EXAMPLES:: sage: E = EllipticCurve('37a1') - sage: E7=E.quadratic_twist(7); E7 - Elliptic Curve defined by y^2 = x^3 - 784*x + 5488 over Rational Field + sage: E7 = E.quadratic_twist(7); E7 + Elliptic Curve defined by y^2 = x^3 - 784*x + 5488 over Rational Field sage: E7.conductor() 29008 sage: E7.quadratic_twist(7) == E @@ -4667,16 +4674,27 @@ def isogenies_prime_degree(self, l=None): [] sage: E = EllipticCurve(j = -262537412640768000) sage: E.isogenies_prime_degree() - [Isogeny of degree 163 from Elliptic Curve defined by y^2 + y = x^3 - 2174420*x + 1234136692 over Rational Field to Elliptic Curve defined by y^2 + y = x^3 - 57772164980*x - 5344733777551611 over Rational Field] + [Isogeny of degree 163 + from Elliptic Curve defined by y^2 + y = x^3 - 2174420*x + 1234136692 over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - 57772164980*x - 5344733777551611 over Rational Field] sage: E1 = E.quadratic_twist(6584935282) sage: E1.isogenies_prime_degree() - [Isogeny of degree 163 from Elliptic Curve defined by y^2 = x^3 - 94285835957031797981376080*x + 352385311612420041387338054224547830898 over Rational Field to Elliptic Curve defined by y^2 = x^3 - 2505080375542377840567181069520*x - 1526091631109553256978090116318797845018020806 over Rational Field] + [Isogeny of degree 163 + from Elliptic Curve defined by y^2 = x^3 - 94285835957031797981376080*x + 352385311612420041387338054224547830898 over Rational Field + to Elliptic Curve defined by y^2 = x^3 - 2505080375542377840567181069520*x - 1526091631109553256978090116318797845018020806 over Rational Field] sage: E = EllipticCurve('14a1') sage: E.isogenies_prime_degree(2) - [Isogeny of degree 2 from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field to Elliptic Curve defined by y^2 + x*y + y = x^3 - 36*x - 70 over Rational Field] + [Isogeny of degree 2 + from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field + to Elliptic Curve defined by y^2 + x*y + y = x^3 - 36*x - 70 over Rational Field] sage: E.isogenies_prime_degree(3) - [Isogeny of degree 3 from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field to Elliptic Curve defined by y^2 + x*y + y = x^3 - x over Rational Field, Isogeny of degree 3 from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field to Elliptic Curve defined by y^2 + x*y + y = x^3 - 171*x - 874 over Rational Field] + [Isogeny of degree 3 + from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field + to Elliptic Curve defined by y^2 + x*y + y = x^3 - x over Rational Field, + Isogeny of degree 3 + from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field + to Elliptic Curve defined by y^2 + x*y + y = x^3 - 171*x - 874 over Rational Field] sage: E.isogenies_prime_degree(5) [] sage: E.isogenies_prime_degree(11) @@ -5194,7 +5212,8 @@ def galois_representation(self): sage: rho = EllipticCurve('11a1').galois_representation() sage: rho - Compatible family of Galois representations associated to the Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Compatible family of Galois representations associated to + the Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: rho.is_irreducible(7) True sage: rho.is_irreducible(5) @@ -5447,9 +5466,10 @@ def sha(self): EXAMPLES:: sage: E = EllipticCurve('37a1') - sage: S=E.sha() + sage: S = E.sha() sage: S - Tate-Shafarevich group for the Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field + Tate-Shafarevich group for the Elliptic Curve + defined by y^2 + y = x^3 - x over Rational Field sage: S.bound_kolyvagin() ([2], 1) """ @@ -5536,7 +5556,8 @@ def tate_curve(self, p): sage: e = EllipticCurve('130a1') sage: e.tate_curve(2) - 2-adic Tate curve associated to the Elliptic Curve defined by y^2 + x*y + y = x^3 - 33*x + 68 over Rational Field + 2-adic Tate curve associated to the Elliptic Curve + defined by y^2 + x*y + y = x^3 - 33*x + 68 over Rational Field The input curve must have multiplicative reduction at the prime. @@ -5550,7 +5571,8 @@ def tate_curve(self, p): We compute with `p=5`:: sage: T = e.tate_curve(5); T - 5-adic Tate curve associated to the Elliptic Curve defined by y^2 + x*y + y = x^3 - 33*x + 68 over Rational Field + 5-adic Tate curve associated to the Elliptic Curve + defined by y^2 + x*y + y = x^3 - 33*x + 68 over Rational Field We find the Tate parameter `q`:: @@ -5835,9 +5857,12 @@ def integral_points(self, mw_base='auto', both_signs=False, verbose=False): EXAMPLES: A curve of rank 3 with no torsion points:: sage: E = EllipticCurve([0,0,1,-7,6]) - sage: P1=E.point((2,0)); P2=E.point((-1,3)); P3=E.point((4,6)) - sage: a=E.integral_points([P1,P2,P3]); a - [(-3 : 0 : 1), (-2 : 3 : 1), (-1 : 3 : 1), (0 : 2 : 1), (1 : 0 : 1), (2 : 0 : 1), (3 : 3 : 1), (4 : 6 : 1), (8 : 21 : 1), (11 : 35 : 1), (14 : 51 : 1), (21 : 95 : 1), (37 : 224 : 1), (52 : 374 : 1), (93 : 896 : 1), (342 : 6324 : 1), (406 : 8180 : 1), (816 : 23309 : 1)] + sage: P1 = E.point((2,0)); P2 = E.point((-1,3)); P3 = E.point((4,6)) + sage: a = E.integral_points([P1,P2,P3]); a + [(-3 : 0 : 1), (-2 : 3 : 1), (-1 : 3 : 1), (0 : 2 : 1), (1 : 0 : 1), + (2 : 0 : 1), (3 : 3 : 1), (4 : 6 : 1), (8 : 21 : 1), (11 : 35 : 1), + (14 : 51 : 1), (21 : 95 : 1), (37 : 224 : 1), (52 : 374 : 1), + (93 : 896 : 1), (342 : 6324 : 1), (406 : 8180 : 1), (816 : 23309 : 1)] :: @@ -5861,8 +5886,15 @@ def integral_points(self, mw_base='auto', both_signs=False, verbose=False): :: sage: E = EllipticCurve([0,0,1,-7,6]) - sage: a=E.integral_points(both_signs=True); a - [(-3 : -1 : 1), (-3 : 0 : 1), (-2 : -4 : 1), (-2 : 3 : 1), (-1 : -4 : 1), (-1 : 3 : 1), (0 : -3 : 1), (0 : 2 : 1), (1 : -1 : 1), (1 : 0 : 1), (2 : -1 : 1), (2 : 0 : 1), (3 : -4 : 1), (3 : 3 : 1), (4 : -7 : 1), (4 : 6 : 1), (8 : -22 : 1), (8 : 21 : 1), (11 : -36 : 1), (11 : 35 : 1), (14 : -52 : 1), (14 : 51 : 1), (21 : -96 : 1), (21 : 95 : 1), (37 : -225 : 1), (37 : 224 : 1), (52 : -375 : 1), (52 : 374 : 1), (93 : -897 : 1), (93 : 896 : 1), (342 : -6325 : 1), (342 : 6324 : 1), (406 : -8181 : 1), (406 : 8180 : 1), (816 : -23310 : 1), (816 : 23309 : 1)] + sage: a = E.integral_points(both_signs=True); a + [(-3 : -1 : 1), (-3 : 0 : 1), (-2 : -4 : 1), (-2 : 3 : 1), (-1 : -4 : 1), + (-1 : 3 : 1), (0 : -3 : 1), (0 : 2 : 1), (1 : -1 : 1), (1 : 0 : 1), + (2 : -1 : 1), (2 : 0 : 1), (3 : -4 : 1), (3 : 3 : 1), (4 : -7 : 1), + (4 : 6 : 1), (8 : -22 : 1), (8 : 21 : 1), (11 : -36 : 1), (11 : 35 : 1), + (14 : -52 : 1), (14 : 51 : 1), (21 : -96 : 1), (21 : 95 : 1), + (37 : -225 : 1), (37 : 224 : 1), (52 : -375 : 1), (52 : 374 : 1), + (93 : -897 : 1), (93 : 896 : 1), (342 : -6325 : 1), (342 : 6324 : 1), + (406 : -8181 : 1), (406 : 8180 : 1), (816 : -23310 : 1), (816 : 23309 : 1)] An example with negative discriminant:: @@ -5872,10 +5904,10 @@ def integral_points(self, mw_base='auto', both_signs=False, verbose=False): Another example with rank 5 and no torsion points:: sage: E = EllipticCurve([-879984,319138704]) - sage: P1=E.point((540,1188)); P2=E.point((576,1836)) - sage: P3=E.point((468,3132)); P4=E.point((612,3132)) - sage: P5=E.point((432,4428)) - sage: a=E.integral_points([P1,P2,P3,P4,P5]); len(a) # long time (18s on sage.math, 2011) + sage: P1 = E.point((540,1188)); P2 = E.point((576,1836)) + sage: P3 = E.point((468,3132)); P4 = E.point((612,3132)) + sage: P5 = E.point((432,4428)) + sage: a = E.integral_points([P1,P2,P3,P4,P5]); len(a) # long time (18s on sage.math, 2011) 54 TESTS: @@ -6240,7 +6272,7 @@ def S_integral_points(self, S, mw_base='auto', both_signs=False, verbose=False, sage: P1 = E.point((2,0)) sage: P2 = E.point((-1,3)) sage: P3 = E.point((4,6)) - sage: a = E.S_integral_points(S=[2,3], mw_base=[P1,P2,P3], verbose=True);a + sage: a = E.S_integral_points(S=[2,3], mw_base=[P1,P2,P3], verbose=True); a max_S: 3 len_S: 3 len_tors: 1 lambda 0.485997517468... k1,k2,k3,k4 7.65200453902598e234 1.31952866480763 3.54035317966420e9 2.42767548272846e17 @@ -6266,7 +6298,19 @@ def S_integral_points(self, S, mw_base='auto', both_signs=False, verbose=False, x-coords of points with bounded absolute value [-3, -2, -1, 0, 1, 2] Total number of S-integral points: 43 - [(-3 : 0 : 1), (-26/9 : 28/27 : 1), (-8159/2916 : 233461/157464 : 1), (-2759/1024 : 60819/32768 : 1), (-151/64 : 1333/512 : 1), (-1343/576 : 36575/13824 : 1), (-2 : 3 : 1), (-7/4 : 25/8 : 1), (-1 : 3 : 1), (-47/256 : 9191/4096 : 1), (0 : 2 : 1), (1/4 : 13/8 : 1), (4/9 : 35/27 : 1), (9/16 : 69/64 : 1), (58/81 : 559/729 : 1), (7/9 : 17/27 : 1), (6169/6561 : 109871/531441 : 1), (1 : 0 : 1), (17/16 : -25/64 : 1), (2 : 0 : 1), (33/16 : 17/64 : 1), (172/81 : 350/729 : 1), (9/4 : 7/8 : 1), (25/9 : 64/27 : 1), (3 : 3 : 1), (31/9 : 116/27 : 1), (4 : 6 : 1), (25/4 : 111/8 : 1), (1793/256 : 68991/4096 : 1), (8 : 21 : 1), (625/64 : 14839/512 : 1), (11 : 35 : 1), (14 : 51 : 1), (21 : 95 : 1), (37 : 224 : 1), (52 : 374 : 1), (6142/81 : 480700/729 : 1), (93 : 896 : 1), (4537/36 : 305425/216 : 1), (342 : 6324 : 1), (406 : 8180 : 1), (816 : 23309 : 1), (207331217/4096 : 2985362173625/262144 : 1)] + [(-3 : 0 : 1), (-26/9 : 28/27 : 1), (-8159/2916 : 233461/157464 : 1), + (-2759/1024 : 60819/32768 : 1), (-151/64 : 1333/512 : 1), + (-1343/576 : 36575/13824 : 1), (-2 : 3 : 1), (-7/4 : 25/8 : 1), (-1 : 3 : 1), + (-47/256 : 9191/4096 : 1), (0 : 2 : 1), (1/4 : 13/8 : 1), (4/9 : 35/27 : 1), + (9/16 : 69/64 : 1), (58/81 : 559/729 : 1), (7/9 : 17/27 : 1), + (6169/6561 : 109871/531441 : 1), (1 : 0 : 1), (17/16 : -25/64 : 1), (2 : 0 : 1), + (33/16 : 17/64 : 1), (172/81 : 350/729 : 1), (9/4 : 7/8 : 1), (25/9 : 64/27 : 1), + (3 : 3 : 1), (31/9 : 116/27 : 1), (4 : 6 : 1), (25/4 : 111/8 : 1), + (1793/256 : 68991/4096 : 1), (8 : 21 : 1), (625/64 : 14839/512 : 1), (11 : 35 : 1), + (14 : 51 : 1), (21 : 95 : 1), (37 : 224 : 1), (52 : 374 : 1), + (6142/81 : 480700/729 : 1), (93 : 896 : 1), (4537/36 : 305425/216 : 1), + (342 : 6324 : 1), (406 : 8180 : 1), (816 : 23309 : 1), + (207331217/4096 : 2985362173625/262144 : 1)] It is not necessary to specify mw_base; if it is not provided, then the Mordell-Weil basis must be computed, which may take @@ -6281,7 +6325,9 @@ def S_integral_points(self, S, mw_base='auto', both_signs=False, verbose=False, An example with negative discriminant:: sage: EllipticCurve('900d1').S_integral_points([17], both_signs=True) - [(-11 : -27 : 1), (-11 : 27 : 1), (-4 : -34 : 1), (-4 : 34 : 1), (4 : -18 : 1), (4 : 18 : 1), (2636/289 : -98786/4913 : 1), (2636/289 : 98786/4913 : 1), (16 : -54 : 1), (16 : 54 : 1)] + [(-11 : -27 : 1), (-11 : 27 : 1), (-4 : -34 : 1), (-4 : 34 : 1), (4 : -18 : 1), + (4 : 18 : 1), (2636/289 : -98786/4913 : 1), (2636/289 : 98786/4913 : 1), + (16 : -54 : 1), (16 : 54 : 1)] Output checked with Magma (corrected in 3 cases):: @@ -6298,16 +6344,16 @@ def S_integral_points(self, S, mw_base='auto', both_signs=False, verbose=False, sage: EllipticCurve([1,1,1,-301,-1821]).S_integral_points([13,2]) [(-13 : 16 : 1), - (-9 : 20 : 1), - (-7 : 4 : 1), - (21 : 30 : 1), - (23 : 52 : 1), - (63 : 452 : 1), - (71 : 548 : 1), - (87 : 756 : 1), - (2711 : 139828 : 1), - (7323 : 623052 : 1), - (17687 : 2343476 : 1)] + (-9 : 20 : 1), + (-7 : 4 : 1), + (21 : 30 : 1), + (23 : 52 : 1), + (63 : 452 : 1), + (71 : 548 : 1), + (87 : 756 : 1), + (2711 : 139828 : 1), + (7323 : 623052 : 1), + (17687 : 2343476 : 1)] - Some parts of this implementation are partially based on the function integral_points() @@ -6842,25 +6888,25 @@ def cremona_curves(conductors): sage: [(E.label(), E.rank()) for E in cremona_curves(srange(35,40))] [('35a1', 0), - ('35a2', 0), - ('35a3', 0), - ('36a1', 0), - ('36a2', 0), - ('36a3', 0), - ('36a4', 0), - ('37a1', 1), - ('37b1', 0), - ('37b2', 0), - ('37b3', 0), - ('38a1', 0), - ('38a2', 0), - ('38a3', 0), - ('38b1', 0), - ('38b2', 0), - ('39a1', 0), - ('39a2', 0), - ('39a3', 0), - ('39a4', 0)] + ('35a2', 0), + ('35a3', 0), + ('36a1', 0), + ('36a2', 0), + ('36a3', 0), + ('36a4', 0), + ('37a1', 1), + ('37b1', 0), + ('37b2', 0), + ('37b3', 0), + ('38a1', 0), + ('38a2', 0), + ('38a3', 0), + ('38b1', 0), + ('38b2', 0), + ('39a1', 0), + ('39a2', 0), + ('39a3', 0), + ('39a4', 0)] """ if isinstance(conductors, (rings.RingElement, int)): conductors = [conductors] @@ -6875,17 +6921,18 @@ def cremona_optimal_curves(conductors): sage: [(E.label(), E.rank()) for E in cremona_optimal_curves(srange(35,40))] [('35a1', 0), - ('36a1', 0), - ('37a1', 1), - ('37b1', 0), - ('38a1', 0), - ('38b1', 0), - ('39a1', 0)] + ('36a1', 0), + ('37a1', 1), + ('37b1', 0), + ('38a1', 0), + ('38b1', 0), + ('39a1', 0)] There is one case -- 990h3 -- when the optimal curve isn't labeled with a 1:: sage: [e.cremona_label() for e in cremona_optimal_curves([990])] - ['990a1', '990b1', '990c1', '990d1', '990e1', '990f1', '990g1', '990h3', '990i1', '990j1', '990k1', '990l1'] + ['990a1', '990b1', '990c1', '990d1', '990e1', '990f1', '990g1', + '990h3', '990i1', '990j1', '990k1', '990l1'] """ if isinstance(conductors, (rings.RingElement, int)): conductors = [conductors] diff --git a/src/sage/schemes/elliptic_curves/ell_wp.py b/src/sage/schemes/elliptic_curves/ell_wp.py index 8ea82fe35e2..0f1c425e563 100644 --- a/src/sage/schemes/elliptic_curves/ell_wp.py +++ b/src/sage/schemes/elliptic_curves/ell_wp.py @@ -91,36 +91,42 @@ def weierstrass_p(E, prec=20, algorithm=None): sage: E.weierstrass_p(prec=8, algorithm='quadratic') z^-2 + 31/15*z^2 + 2501/756*z^4 + 961/675*z^6 + O(z^8) - sage: k = GF(11) - sage: E = EllipticCurve(k, [1,1]) - sage: E.weierstrass_p(prec=6, algorithm='fast') + sage: k = GF(11) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(k, [1,1]) # optional - sage.rings.finite_rings + sage: E.weierstrass_p(prec=6, algorithm='fast') # optional - sage.rings.finite_rings z^-2 + 2*z^2 + 3*z^4 + O(z^6) - sage: E.weierstrass_p(prec=7, algorithm='fast') + sage: E.weierstrass_p(prec=7, algorithm='fast') # optional - sage.rings.finite_rings Traceback (most recent call last): ... - ValueError: for computing the Weierstrass p-function via the fast algorithm, the characteristic (11) of the underlying field must be greater than prec + 4 = 11 - sage: E.weierstrass_p(prec=8) + ValueError: for computing the Weierstrass p-function via the fast algorithm, + the characteristic (11) of the underlying field must be greater than prec + 4 = 11 + sage: E.weierstrass_p(prec=8) # optional - sage.rings.finite_rings z^-2 + 2*z^2 + 3*z^4 + 5*z^6 + O(z^8) - sage: E.weierstrass_p(prec=8, algorithm='quadratic') + sage: E.weierstrass_p(prec=8, algorithm='quadratic') # optional - sage.rings.finite_rings z^-2 + 2*z^2 + 3*z^4 + 5*z^6 + O(z^8) - sage: E.weierstrass_p(prec=8, algorithm='pari') + sage: E.weierstrass_p(prec=8, algorithm='pari') # optional - sage.rings.finite_rings z^-2 + 2*z^2 + 3*z^4 + 5*z^6 + O(z^8) - sage: E.weierstrass_p(prec=9) + sage: E.weierstrass_p(prec=9) # optional - sage.rings.finite_rings Traceback (most recent call last): ... - NotImplementedError: currently no algorithms for computing the Weierstrass p-function for that characteristic / precision pair is implemented. Lower the precision below char(k) - 2 - sage: E.weierstrass_p(prec=9, algorithm="quadratic") + NotImplementedError: currently no algorithms for computing the Weierstrass + p-function for that characteristic / precision pair is implemented. + Lower the precision below char(k) - 2 + sage: E.weierstrass_p(prec=9, algorithm="quadratic") # optional - sage.rings.finite_rings Traceback (most recent call last): ... - ValueError: for computing the Weierstrass p-function via the quadratic algorithm, the characteristic (11) of the underlying field must be greater than prec + 2 = 11 - sage: E.weierstrass_p(prec=9, algorithm='pari') + ValueError: for computing the Weierstrass p-function via the quadratic + algorithm, the characteristic (11) of the underlying field must be greater + than prec + 2 = 11 + sage: E.weierstrass_p(prec=9, algorithm='pari') # optional - sage.rings.finite_rings Traceback (most recent call last): ... - ValueError: for computing the Weierstrass p-function via pari, the characteristic (11) of the underlying field must be greater than prec + 2 = 11 + ValueError: for computing the Weierstrass p-function via pari, the + characteristic (11) of the underlying field must be greater than prec + 2 = 11 TESTS:: - sage: E.weierstrass_p(prec=4, algorithm='foo') + sage: E.weierstrass_p(prec=4, algorithm='foo') # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: unknown algorithm for computing the Weierstrass p-function @@ -173,7 +179,8 @@ def compute_wp_pari(E,prec): sage: compute_wp_pari(E, prec=20) z^-2 - 1/7*z^4 + 1/637*z^10 - 1/84721*z^16 + O(z^20) sage: compute_wp_pari(E, prec=30) - z^-2 - 1/7*z^4 + 1/637*z^10 - 1/84721*z^16 + 3/38548055*z^22 - 4/8364927935*z^28 + O(z^30) + z^-2 - 1/7*z^4 + 1/637*z^10 - 1/84721*z^16 + + 3/38548055*z^22 - 4/8364927935*z^28 + O(z^30) """ ep = E.__pari__() wpp = ep.ellwp(n=prec) @@ -217,9 +224,10 @@ def compute_wp_quadratic(k, A, B, prec): sage: E.weierstrass_p(prec=10, algorithm='quadratic') z^-2 - 7/5*z^2 + 49/75*z^6 + O(z^10) - sage: E = EllipticCurve(GF(103),[1,2]) - sage: E.weierstrass_p(algorithm='quadratic') - z^-2 + 41*z^2 + 88*z^4 + 11*z^6 + 57*z^8 + 55*z^10 + 73*z^12 + 11*z^14 + 17*z^16 + 50*z^18 + O(z^20) + sage: E = EllipticCurve(GF(103), [1,2]) # optional - sage.rings.finite_rings + sage: E.weierstrass_p(algorithm='quadratic') # optional - sage.rings.finite_rings + z^-2 + 41*z^2 + 88*z^4 + 11*z^6 + 57*z^8 + 55*z^10 + 73*z^12 + + 11*z^14 + 17*z^16 + 50*z^18 + O(z^20) sage: from sage.schemes.elliptic_curves.ell_wp import compute_wp_quadratic sage: compute_wp_quadratic(E.base_ring(), E.a4(), E.a6(), prec=10) @@ -273,8 +281,8 @@ def compute_wp_fast(k, A, B, m): sage: compute_wp_fast(QQ, 1, 8, 7) z^-2 - 1/5*z^2 - 8/7*z^4 + 1/75*z^6 + O(z^7) - sage: k = GF(37) - sage: compute_wp_fast(k, k(1), k(8), 5) + sage: k = GF(37) # optional - sage.rings.finite_rings + sage: compute_wp_fast(k, k(1), k(8), 5) # optional - sage.rings.finite_rings z^-2 + 22*z^2 + 20*z^4 + O(z^5) """ R = PowerSeriesRing(k,'z',default_prec=m+5) @@ -320,15 +328,15 @@ def solve_linear_differential_system(a, b, c, alpha): EXAMPLES:: sage: from sage.schemes.elliptic_curves.ell_wp import solve_linear_differential_system - sage: k = GF(17) - sage: R. = PowerSeriesRing(k) - sage: a = 1+x+O(x^7); b = x+O(x^7); c = 1+x^3+O(x^7); alpha = k(3) - sage: f = solve_linear_differential_system(a,b,c,alpha) - sage: f + sage: k = GF(17) # optional - sage.rings.finite_rings + sage: R. = PowerSeriesRing(k) # optional - sage.rings.finite_rings + sage: a = 1 + x + O(x^7); b = x + O(x^7); c = 1 + x^3 + O(x^7); alpha = k(3) # optional - sage.rings.finite_rings + sage: f = solve_linear_differential_system(a, b, c, alpha) # optional - sage.rings.finite_rings + sage: f # optional - sage.rings.finite_rings 3 + x + 15*x^2 + x^3 + 10*x^5 + 3*x^6 + 13*x^7 + O(x^8) - sage: a*f.derivative()+b*f - c + sage: a*f.derivative() + b*f - c # optional - sage.rings.finite_rings O(x^7) - sage: f(0) == alpha + sage: f(0) == alpha # optional - sage.rings.finite_rings True """ a_recip = 1/a diff --git a/src/sage/schemes/elliptic_curves/formal_group.py b/src/sage/schemes/elliptic_curves/formal_group.py index 591ce2d6f29..ad981fffc84 100644 --- a/src/sage/schemes/elliptic_curves/formal_group.py +++ b/src/sage/schemes/elliptic_curves/formal_group.py @@ -29,7 +29,8 @@ def __init__(self, E): sage: E = EllipticCurve('11a') sage: F = E.formal_group(); F - Formal Group associated to the Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Formal Group associated to the Elliptic Curve + defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: F == loads(dumps(F)) True """ @@ -486,21 +487,21 @@ def group_law(self, prec=10): sage: ehat.group_law(5) t1 + t2 - t1*t2 - 2*t1^3*t2 - 3*t1^2*t2^2 - 2*t1*t2^3 + O(t1, t2)^5 - sage: e = EllipticCurve(GF(7), [3, 4]) - sage: ehat = e.formal() - sage: ehat.group_law(3) + sage: e = EllipticCurve(GF(7), [3, 4]) # optional - sage.rings.finite_rings + sage: ehat = e.formal() # optional - sage.rings.finite_rings + sage: ehat.group_law(3) # optional - sage.rings.finite_rings t1 + t2 + O(t1, t2)^3 - sage: F = ehat.group_law(7); F + sage: F = ehat.group_law(7); F # optional - sage.rings.finite_rings t1 + t2 + t1^4*t2 + 2*t1^3*t2^2 + 2*t1^2*t2^3 + t1*t2^4 + O(t1, t2)^7 TESTS:: - sage: R. = GF(7)[[]] - sage: F(x, ehat.inverse()(x)) + sage: R. = GF(7)[[]] # optional - sage.rings.finite_rings + sage: F(x, ehat.inverse()(x)) # optional - sage.rings.finite_rings 0 + O(x, y, z)^7 - sage: F(x, y) == F(y, x) + sage: F(x, y) == F(y, x) # optional - sage.rings.finite_rings True - sage: F(x, F(y, z)) == F(F(x, y), z) + sage: F(x, F(y, z)) == F(F(x, y), z) # optional - sage.rings.finite_rings True Let's ensure caching with changed precision is working:: @@ -623,21 +624,21 @@ def mult_by_n(self, n, prec=10): TESTS:: - sage: F = EllipticCurve(GF(17), [1, 1]).formal_group() - sage: F.mult_by_n(10, 50) # long time (13s on sage.math, 2011) + sage: F = EllipticCurve(GF(17), [1, 1]).formal_group() # optional - sage.rings.finite_rings + sage: F.mult_by_n(10, 50) # long time (13s on sage.math, 2011) # optional - sage.rings.finite_rings 10*t + 5*t^5 + 7*t^7 + 13*t^9 + t^11 + 16*t^13 + 13*t^15 + 9*t^17 + 16*t^19 + 15*t^23 + 15*t^25 + 2*t^27 + 10*t^29 + 8*t^31 + 15*t^33 + 6*t^35 + 7*t^37 + 9*t^39 + 10*t^41 + 5*t^43 + 4*t^45 + 6*t^47 + 13*t^49 + O(t^50) - sage: F = EllipticCurve(GF(101), [1, 1]).formal_group() - sage: F.mult_by_n(100, 20) + sage: F = EllipticCurve(GF(101), [1, 1]).formal_group() # optional - sage.rings.finite_rings + sage: F.mult_by_n(100, 20) # optional - sage.rings.finite_rings 100*t + O(t^20) sage: P. = PolynomialRing(ZZ, 5) sage: E = EllipticCurve(list(P.gens())) - sage: E.formal().mult_by_n(2,prec=5) + sage: E.formal().mult_by_n(2, prec=5) 2*t - a1*t^2 - 2*a2*t^3 + (a1*a2 - 7*a3)*t^4 + O(t^5) sage: E = EllipticCurve(QQ, [1,2,3,4,6]) - sage: E.formal().mult_by_n(2,prec=5) + sage: E.formal().mult_by_n(2, prec=5) 2*t - t^2 - 4*t^3 - 19*t^4 + O(t^5) """ if self.curve().base_ring().is_field() and self.curve().base_ring().characteristic() == 0 and n != 0: diff --git a/src/sage/schemes/elliptic_curves/heegner.py b/src/sage/schemes/elliptic_curves/heegner.py index e4e19cf154b..f75315a6d45 100644 --- a/src/sage/schemes/elliptic_curves/heegner.py +++ b/src/sage/schemes/elliptic_curves/heegner.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: optional - sage.rings.number_field r""" Heegner points on elliptic curves over the rational numbers @@ -15,7 +15,8 @@ sage: z = P.point_exact(201); z (-4/3 : 1/9*a : 1) sage: parent(z) - Abelian group of points on Elliptic Curve defined by y^2 + x*y = x^3 + 1 over Number Field in a with defining polynomial x^2 - 12*x + 111 + Abelian group of points on Elliptic Curve defined by y^2 + x*y = x^3 + 1 + over Number Field in a with defining polynomial x^2 - 12*x + 111 sage: parent(z[0]).discriminant() -3 sage: E.quadratic_twist(-3).rank() @@ -33,7 +34,9 @@ sage: z[0].charpoly().factor() (x^6 + x^5 - 1/4*x^4 + 19/10*x^3 + 31/20*x^2 - 7/10*x + 49/100)^2 sage: z[1].charpoly().factor() - x^12 - x^11 + 6/5*x^10 - 33/40*x^9 - 89/320*x^8 + 3287/800*x^7 - 5273/1600*x^6 + 993/4000*x^5 + 823/320*x^4 - 2424/625*x^3 + 12059/12500*x^2 + 3329/25000*x + 123251/250000 + x^12 - x^11 + 6/5*x^10 - 33/40*x^9 - 89/320*x^8 + 3287/800*x^7 + - 5273/1600*x^6 + 993/4000*x^5 + 823/320*x^4 - 2424/625*x^3 + + 12059/12500*x^2 + 3329/25000*x + 123251/250000 sage: f = P.x_poly_exact(300); f x^6 + x^5 - 1/4*x^4 + 19/10*x^3 + 31/20*x^2 - 7/10*x + 49/100 sage: f.discriminant().factor() @@ -148,11 +151,11 @@ def heegner_points(N, D=None, c=None): EXAMPLES:: - sage: heegner_points(389,-7) + sage: heegner_points(389, -7) Set of all Heegner points on X_0(389) associated to QQ[sqrt(-7)] - sage: heegner_points(389,-7,1) + sage: heegner_points(389, -7, 1) All Heegner points of conductor 1 on X_0(389) associated to QQ[sqrt(-7)] - sage: heegner_points(389,-7,5) + sage: heegner_points(389, -7, 5) All Heegner points of conductor 5 on X_0(389) associated to QQ[sqrt(-7)] """ if D is None and c is None: @@ -514,7 +517,8 @@ def quadratic_field(self): sage: E = EllipticCurve('389a'); K = E.heegner_point(-7,5).ring_class_field() sage: K.quadratic_field() - Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 with sqrt_minus_7 = 2.645751311064591?*I + Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 + with sqrt_minus_7 = 2.645751311064591?*I """ D = self.__D var = 'sqrt_minus_%s'%(-D) @@ -540,13 +544,15 @@ def galois_group(self, base=QQ): sage: A.galois_group() Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 5 sage: A.galois_group(B) - Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 5 over Hilbert class field of QQ[sqrt(-7)] + Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 5 + over Hilbert class field of QQ[sqrt(-7)] sage: A.galois_group().cardinality() 12 sage: A.galois_group(B).cardinality() 6 sage: C.galois_group(A) - Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 15 over Ring class field extension of QQ[sqrt(-7)] of conductor 5 + Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 15 + over Ring class field extension of QQ[sqrt(-7)] of conductor 5 sage: C.galois_group(A).cardinality() 4 """ @@ -602,7 +608,8 @@ class GaloisGroup(SageObject): sage: G.cardinality() 12 sage: G.complex_conjugation() - Complex conjugation automorphism of Ring class field extension of QQ[sqrt(-7)] of conductor 5 + Complex conjugation automorphism of Ring class field extension of QQ[sqrt(-7)] + of conductor 5 TESTS:: @@ -625,9 +632,11 @@ def __init__(self, field, base=QQ): sage: K5 = heegner_points(389,-7,5).ring_class_field() sage: K1 = heegner_points(389,-7,1).ring_class_field() sage: sage.schemes.elliptic_curves.heegner.GaloisGroup(K5,K1) - Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 5 over Hilbert class field of QQ[sqrt(-7)] + Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 5 + over Hilbert class field of QQ[sqrt(-7)] sage: K5.galois_group(K1) - Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 5 over Hilbert class field of QQ[sqrt(-7)] + Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 5 + over Hilbert class field of QQ[sqrt(-7)] """ if not isinstance(field, RingClassField): raise TypeError("field must be of type RingClassField") @@ -773,13 +782,17 @@ def base_field(self): sage: Kc.absolute_degree() 12 sage: G = Kc.galois_group(K); G - Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 5 over Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 with sqrt_minus_7 = 2.645751311064591?*I + Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 5 + over Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 + with sqrt_minus_7 = 2.645751311064591?*I sage: G.cardinality() 6 sage: G.base_field() - Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 with sqrt_minus_7 = 2.645751311064591?*I + Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 + with sqrt_minus_7 = 2.645751311064591?*I sage: G = Kc.galois_group(Kc); G - Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 5 over Ring class field extension of QQ[sqrt(-7)] of conductor 5 + Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 5 + over Ring class field extension of QQ[sqrt(-7)] of conductor 5 sage: G.cardinality() 1 sage: G.base_field() @@ -848,7 +861,8 @@ def lift_of_hilbert_class_field_galois_group(self): sage: K5 = heegner_points(389,-52,5).ring_class_field() sage: G = K5.galois_group(K5.quadratic_field()) sage: G.lift_of_hilbert_class_field_galois_group() - (Class field automorphism defined by x^2 + 325*y^2, Class field automorphism defined by 2*x^2 + 2*x*y + 163*y^2) + (Class field automorphism defined by x^2 + 325*y^2, + Class field automorphism defined by 2*x^2 + 2*x*y + 163*y^2) sage: G.cardinality() 12 sage: K5.quadratic_field().class_number() @@ -887,7 +901,12 @@ def _list(self): sage: E = EllipticCurve('389a'); F= E.heegner_point(-7,5).ring_class_field() sage: G = F.galois_group(F.quadratic_field()) sage: G._list() - (Class field automorphism defined by x^2 + x*y + 44*y^2, Class field automorphism defined by 2*x^2 - x*y + 22*y^2, Class field automorphism defined by 2*x^2 + x*y + 22*y^2, Class field automorphism defined by 4*x^2 - x*y + 11*y^2, Class field automorphism defined by 4*x^2 + x*y + 11*y^2, Class field automorphism defined by 7*x^2 + 7*x*y + 8*y^2) + (Class field automorphism defined by x^2 + x*y + 44*y^2, + Class field automorphism defined by 2*x^2 - x*y + 22*y^2, + Class field automorphism defined by 2*x^2 + x*y + 22*y^2, + Class field automorphism defined by 4*x^2 - x*y + 11*y^2, + Class field automorphism defined by 4*x^2 + x*y + 11*y^2, + Class field automorphism defined by 7*x^2 + 7*x*y + 8*y^2) Example over `\QQ` (it is not implemented yet):: @@ -899,7 +918,8 @@ def _list(self): Example over Hilbert class field:: - sage: K3 = heegner_points(389,-52,3).ring_class_field(); K1 = heegner_points(389,-52,1).ring_class_field() + sage: K3 = heegner_points(389,-52,3).ring_class_field() + sage: K1 = heegner_points(389,-52,1).ring_class_field() sage: G = K3.galois_group(K1) sage: G._list() (Class field automorphism defined by x^2 + 117*y^2, Class field automorphism defined by 9*x^2 - 6*x*y + 14*y^2, Class field automorphism defined by 9*x^2 + 13*y^2, Class field automorphism defined by 9*x^2 + 6*x*y + 14*y^2) @@ -1221,7 +1241,8 @@ def complex_conjugation(self): sage: E = EllipticCurve('389a') sage: G = E.heegner_point(-7,5).ring_class_field().galois_group() sage: G.complex_conjugation() - Complex conjugation automorphism of Ring class field extension of QQ[sqrt(-7)] of conductor 5 + Complex conjugation automorphism of Ring class field extension + of QQ[sqrt(-7)] of conductor 5 """ if self.base_field() != QQ: raise ValueError("the base field must be fixed by complex conjugation") @@ -1267,7 +1288,8 @@ def parent(self): EXAMPLES:: sage: E = EllipticCurve('389a') - sage: s = E.heegner_point(-7,5).ring_class_field().galois_group().complex_conjugation() + sage: G = E.heegner_point(-7,5).ring_class_field().galois_group() + sage: s = G.complex_conjugation() sage: s.parent() Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 5 """ @@ -1280,7 +1302,8 @@ def domain(self): EXAMPLES:: sage: E = EllipticCurve('389a') - sage: s = E.heegner_point(-7,5).ring_class_field().galois_group().complex_conjugation() + sage: G = E.heegner_point(-7,5).ring_class_field().galois_group() + sage: s = G.complex_conjugation() sage: s.domain() Ring class field extension of QQ[sqrt(-7)] of conductor 5 """ @@ -1293,9 +1316,11 @@ class GaloisAutomorphismComplexConjugation(GaloisAutomorphism): EXAMPLES:: - sage: conj = heegner_point(37,-7,5).ring_class_field().galois_group().complex_conjugation() + sage: G = heegner_point(37,-7,5).ring_class_field().galois_group() + sage: conj = G.complex_conjugation() sage: conj - Complex conjugation automorphism of Ring class field extension of QQ[sqrt(-7)] of conductor 5 + Complex conjugation automorphism of Ring class field extension + of QQ[sqrt(-7)] of conductor 5 sage: conj.domain() Ring class field extension of QQ[sqrt(-7)] of conductor 5 @@ -1316,7 +1341,8 @@ def __init__(self, parent): sage: G = heegner_point(37,-7,5).ring_class_field().galois_group() sage: sage.schemes.elliptic_curves.heegner.GaloisAutomorphismComplexConjugation(G) - Complex conjugation automorphism of Ring class field extension of QQ[sqrt(-7)] of conductor 5 + Complex conjugation automorphism of Ring class field extension + of QQ[sqrt(-7)] of conductor 5 """ GaloisAutomorphism.__init__(self, parent) @@ -1401,7 +1427,8 @@ def order(self): """ EXAMPLES:: - sage: conj = heegner_point(37,-7,5).ring_class_field().galois_group().complex_conjugation() + sage: G = heegner_point(37,-7,5).ring_class_field().galois_group() + sage: conj = G.complex_conjugation() sage: conj.order() 2 """ @@ -1439,7 +1466,8 @@ def __init__(self, parent, quadratic_form, alpha=None): EXAMPLES:: - sage: H = heegner_points(389,-20,3); G = H.ring_class_field().galois_group(H.quadratic_field()) + sage: H = heegner_points(389,-20,3) + sage: G = H.ring_class_field().galois_group(H.quadratic_field()) sage: f = BinaryQF_reduced_representatives(-20*9)[0] sage: sage.schemes.elliptic_curves.heegner.GaloisAutomorphismQuadraticForm(G, f) Class field automorphism defined by x^2 + 45*y^2 @@ -1503,9 +1531,11 @@ def alpha(self): sage: K1 = heegner_points(389,-52,1).ring_class_field() sage: G = K5.galois_group(K1) sage: orb = sorted([g.alpha() for g in G]); orb # random (the sign depends on the database being installed or not) - [1, -1/2*sqrt_minus_52, 1/2*sqrt_minus_52 + 1, 1/2*sqrt_minus_52 - 1, 1/2*sqrt_minus_52 - 2, -1/2*sqrt_minus_52 - 2] + [1, -1/2*sqrt_minus_52, 1/2*sqrt_minus_52 + 1, 1/2*sqrt_minus_52 - 1, + 1/2*sqrt_minus_52 - 2, -1/2*sqrt_minus_52 - 2] sage: sorted([x^2 for x in orb]) # just for testing - [-13, -sqrt_minus_52 - 12, sqrt_minus_52 - 12, -2*sqrt_minus_52 - 9, 2*sqrt_minus_52 - 9, 1] + [-13, -sqrt_minus_52 - 12, sqrt_minus_52 - 12, + -2*sqrt_minus_52 - 9, 2*sqrt_minus_52 - 9, 1] """ if self.__alpha is None: raise ValueError("alpha data not defined") @@ -1652,7 +1682,8 @@ def ideal(self): sage: G[1].ideal() Fractional ideal (2, 1/2*sqrt_minus_20 + 1) sage: [s.ideal().gens() for s in G] - [(1, 3/2*sqrt_minus_20), (2, 3/2*sqrt_minus_20 - 1), (5, 3/2*sqrt_minus_20), (7, 3/2*sqrt_minus_20 - 2)] + [(1, 3/2*sqrt_minus_20), (2, 3/2*sqrt_minus_20 - 1), + (5, 3/2*sqrt_minus_20), (7, 3/2*sqrt_minus_20 - 2)] """ M = self.parent().field() K = M.quadratic_field() @@ -1820,7 +1851,8 @@ def conductor(self): sage: heegner_point(389,-7,5).conductor() 5 sage: E = EllipticCurve('37a1'); P = E.kolyvagin_point(-67,7); P - Kolyvagin point of discriminant -67 and conductor 7 on elliptic curve of conductor 37 + Kolyvagin point of discriminant -67 and conductor 7 + on elliptic curve of conductor 37 sage: P.conductor() 7 sage: E = EllipticCurve('389a'); P = E.heegner_point(-7, 5); P.conductor() @@ -1838,7 +1870,8 @@ def discriminant(self): sage: heegner_point(389,-7,5).discriminant() -7 sage: E = EllipticCurve('37a1'); P = E.kolyvagin_point(-67,7); P - Kolyvagin point of discriminant -67 and conductor 7 on elliptic curve of conductor 37 + Kolyvagin point of discriminant -67 and conductor 7 + on elliptic curve of conductor 37 sage: P.discriminant() -67 sage: E = EllipticCurve('389a'); P = E.heegner_point(-7, 5); P.discriminant() @@ -1855,11 +1888,13 @@ def quadratic_field(self): sage: x = heegner_point(37,-7,5) sage: x.quadratic_field() - Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 with sqrt_minus_7 = 2.645751311064591?*I + Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 + with sqrt_minus_7 = 2.645751311064591?*I sage: E = EllipticCurve('37a'); P = E.heegner_point(-40) sage: P.quadratic_field() - Number Field in sqrt_minus_40 with defining polynomial x^2 + 40 with sqrt_minus_40 = 6.324555320336759?*I + Number Field in sqrt_minus_40 with defining polynomial x^2 + 40 + with sqrt_minus_40 = 6.324555320336759?*I sage: P.quadratic_field() is P.quadratic_field() True sage: type(P.quadratic_field()) @@ -1876,13 +1911,15 @@ def quadratic_order(self): EXAMPLES:: sage: heegner_point(389,-7,5).quadratic_order() - Order in Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 with sqrt_minus_7 = 2.645751311064591?*I + Order in Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 + with sqrt_minus_7 = 2.645751311064591?*I sage: heegner_point(389,-7,5).quadratic_order().basis() [1, 5*sqrt_minus_7] sage: E = EllipticCurve('37a'); P = E.heegner_point(-40,11) sage: P.quadratic_order() - Order in Number Field in sqrt_minus_40 with defining polynomial x^2 + 40 with sqrt_minus_40 = 6.324555320336759?*I + Order in Number Field in sqrt_minus_40 with defining polynomial x^2 + 40 + with sqrt_minus_40 = 6.324555320336759?*I sage: P.quadratic_order().basis() [1, 11*sqrt_minus_40] """ @@ -2069,7 +2106,7 @@ def discriminants(self, n=10, weak=False): The discriminant -111 satisfies only the weak Heegner hypothesis, since it is divisible by 37:: - sage: X.discriminants(15,weak=True) + sage: X.discriminants(15, weak=True) [-7, -11, -40, -47, -67, -71, -83, -84, -95, -104, -107, -111, -115, -120, -123] """ N = self.level() @@ -2101,7 +2138,8 @@ class HeegnerPoints_level_disc(HeegnerPoints): sage: H.discriminant() -7 sage: H.quadratic_field() - Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 with sqrt_minus_7 = 2.645751311064591?*I + Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 + with sqrt_minus_7 = 2.645751311064591?*I sage: H.kolyvagin_conductors() [1, 3, 5, 13, 15, 17, 19, 31, 39, 41] @@ -2190,7 +2228,8 @@ def quadratic_field(self): sage: E = EllipticCurve('389a'); K = E.heegner_point(-7,5).ring_class_field() sage: K.quadratic_field() - Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 with sqrt_minus_7 = 2.645751311064591?*I + Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 + with sqrt_minus_7 = 2.645751311064591?*I """ D = self.__D var = 'sqrt_minus_%s'%(-D) @@ -2221,7 +2260,7 @@ def kolyvagin_conductors(self, r=None, n=10, E=None, m=None): EXAMPLES:: - sage: H = heegner_points(389,-7) + sage: H = heegner_points(389, -7) sage: H.kolyvagin_conductors(0) [1] sage: H.kolyvagin_conductors(1) @@ -2230,9 +2269,9 @@ def kolyvagin_conductors(self, r=None, n=10, E=None, m=None): [3, 5, 13, 17, 19, 31, 41, 47, 59, 61, 73, 83, 89, 97, 101] sage: H.kolyvagin_conductors(1,5) [3, 5, 13, 17, 19] - sage: H.kolyvagin_conductors(1,5,EllipticCurve('389a'),3) + sage: H.kolyvagin_conductors(1, 5, EllipticCurve('389a'), 3) [5, 17, 41, 59, 83] - sage: H.kolyvagin_conductors(2,5,EllipticCurve('389a'),3) + sage: H.kolyvagin_conductors(2, 5, EllipticCurve('389a'), 3) [85, 205, 295, 415, 697] """ D = self.__D @@ -2288,15 +2327,15 @@ def is_kolyvagin_conductor(N, E, D, r, n, c): EXAMPLES:: sage: from sage.schemes.elliptic_curves.heegner import is_kolyvagin_conductor - sage: is_kolyvagin_conductor(389,None,-7,1,None,5) + sage: is_kolyvagin_conductor(389, None, -7, 1, None, 5) True - sage: is_kolyvagin_conductor(389,None,-7,1,None,7) + sage: is_kolyvagin_conductor(389, None, -7, 1, None, 7) False - sage: is_kolyvagin_conductor(389,None,-7,1,None,11) + sage: is_kolyvagin_conductor(389, None, -7, 1, None, 11) False - sage: is_kolyvagin_conductor(389,EllipticCurve('389a'),-7,1,3,5) + sage: is_kolyvagin_conductor(389, EllipticCurve('389a'), -7, 1, 3, 5) True - sage: is_kolyvagin_conductor(389,EllipticCurve('389a'),-7,1,11,5) + sage: is_kolyvagin_conductor(389, EllipticCurve('389a'), -7, 1, 11, 5) False """ ND = N*D @@ -2341,7 +2380,8 @@ class HeegnerPoints_level_disc_cond(HeegnerPoints_level, HeegnerPoints_level_dis (147, 631) sage: H.quadratic_field() - Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 with sqrt_minus_7 = 2.645751311064591?*I + Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 + with sqrt_minus_7 = 2.645751311064591?*I sage: H.ring_class_field() Ring class field extension of QQ[sqrt(-7)] of conductor 5 @@ -2476,9 +2516,11 @@ def __getitem__(self, i): sage: len(H) 12 sage: H[0] - Heegner point 5/778*sqrt(-7) - 147/778 of discriminant -7 and conductor 5 on X_0(389) + Heegner point 5/778*sqrt(-7) - 147/778 of discriminant -7 and conductor 5 + on X_0(389) sage: H[-1] - Heegner point 5/5446*sqrt(-7) - 757/778 of discriminant -7 and conductor 5 on X_0(389) + Heegner point 5/5446*sqrt(-7) - 757/778 of discriminant -7 and conductor 5 + on X_0(389) """ return self.points()[i] @@ -2632,11 +2674,13 @@ class HeegnerPointOnX0N(HeegnerPoint): sage: x.discriminant() -7 sage: x.quadratic_field() - Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 with sqrt_minus_7 = 2.645751311064591?*I + Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 + with sqrt_minus_7 = 2.645751311064591?*I sage: x.quadratic_form() 37*x^2 + 11*x*y + 2*y^2 sage: x.quadratic_order() - Order in Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 with sqrt_minus_7 = 2.645751311064591?*I + Order in Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 + with sqrt_minus_7 = 2.645751311064591?*I sage: x.tau() 5/74*sqrt_minus_7 - 11/74 sage: loads(dumps(x)) == x @@ -2661,12 +2705,15 @@ def __init__(self, N, D, c=ZZ(1), f=None, check=True): EXAMPLES:: + sage: from sage.schemes.elliptic_curves.heegner import HeegnerPointOnX0N sage: x = heegner_point(389, -7, 5); x - Heegner point 5/778*sqrt(-7) - 147/778 of discriminant -7 and conductor 5 on X_0(389) + Heegner point 5/778*sqrt(-7) - 147/778 of discriminant -7 and conductor 5 + on X_0(389) sage: type(x) - sage: sage.schemes.elliptic_curves.heegner.HeegnerPointOnX0N(389, -7, 5, None, check=False) - Heegner point 5/778*sqrt(-7) - 147/778 of discriminant -7 and conductor 5 on X_0(389) + sage: HeegnerPointOnX0N(389, -7, 5, None, check=False) + Heegner point 5/778*sqrt(-7) - 147/778 of discriminant -7 and conductor 5 + on X_0(389) """ if check: N = ZZ(N) @@ -2771,7 +2818,8 @@ def atkin_lehner_act(self, Q=None): sage: x = heegner_point(389,-7,5) sage: x.atkin_lehner_act() - Heegner point 5/199168*sqrt(-7) - 631/199168 of discriminant -7 and conductor 5 on X_0(389) + Heegner point 5/199168*sqrt(-7) - 631/199168 of discriminant -7 + and conductor 5 on X_0(389) sage: x = heegner_point(45,D=-11,c=1); x Heegner point 1/90*sqrt(-11) - 13/90 of discriminant -11 on X_0(45) @@ -2859,14 +2907,17 @@ def map_to_curve(self, E): EXAMPLES:: - sage: x = heegner_point(389,-7,5); x - Heegner point 5/778*sqrt(-7) - 147/778 of discriminant -7 and conductor 5 on X_0(389) + sage: x = heegner_point(389, -7, 5); x + Heegner point 5/778*sqrt(-7) - 147/778 of discriminant -7 + and conductor 5 on X_0(389) sage: y = x.map_to_curve(EllipticCurve('389a')); y - Heegner point of discriminant -7 and conductor 5 on elliptic curve of conductor 389 + Heegner point of discriminant -7 and conductor 5 + on elliptic curve of conductor 389 sage: y.curve().cremona_label() '389a1' sage: y.heegner_point_on_X0N() - Heegner point 5/778*sqrt(-7) - 147/778 of discriminant -7 and conductor 5 on X_0(389) + Heegner point 5/778*sqrt(-7) - 147/778 of discriminant -7 + and conductor 5 on X_0(389) You can also directly apply the modular parametrization of the elliptic curve:: @@ -2886,9 +2937,13 @@ def galois_orbit_over_K(self): EXAMPLES:: sage: x = heegner_point(389,-7,3); x - Heegner point 3/778*sqrt(-7) - 223/778 of discriminant -7 and conductor 3 on X_0(389) + Heegner point 3/778*sqrt(-7) - 223/778 of discriminant -7 + and conductor 3 on X_0(389) sage: x.galois_orbit_over_K() - [Heegner point 3/778*sqrt(-7) - 223/778 of discriminant -7 and conductor 3 on X_0(389), Heegner point 3/1556*sqrt(-7) - 223/1556 of discriminant -7 and conductor 3 on X_0(389), Heegner point 3/1556*sqrt(-7) - 1001/1556 of discriminant -7 and conductor 3 on X_0(389), Heegner point 3/3112*sqrt(-7) - 223/3112 of discriminant -7 and conductor 3 on X_0(389)] + [Heegner point 3/778*sqrt(-7) - 223/778 of discriminant -7 and conductor 3 on X_0(389), + Heegner point 3/1556*sqrt(-7) - 223/1556 of discriminant -7 and conductor 3 on X_0(389), + Heegner point 3/1556*sqrt(-7) - 1001/1556 of discriminant -7 and conductor 3 on X_0(389), + Heegner point 3/3112*sqrt(-7) - 223/3112 of discriminant -7 and conductor 3 on X_0(389)] """ c = self.conductor() N = self.level() @@ -2957,15 +3012,15 @@ def __init__(self, E, x, check=True): - `x` -- Heegner point on `X_0(N)` - ``check`` -- bool (default: ``True``); if ``True``, ensure that `D`, - `c` are of type Integer and define a Heegner point - on `E` + `c` are of type Integer and define a Heegner point on `E` EXAMPLES:: sage: x = heegner_point(389,-7,5) sage: E = EllipticCurve('389a') sage: sage.schemes.elliptic_curves.heegner.HeegnerPointOnEllipticCurve(E, x) - Heegner point of discriminant -7 and conductor 5 on elliptic curve of conductor 389 + Heegner point of discriminant -7 and conductor 5 on elliptic curve + of conductor 389 """ if check: if E.conductor() != x.level(): @@ -3072,9 +3127,11 @@ def heegner_point_on_X0N(self): EXAMPLES:: sage: E = EllipticCurve('37a'); P = E.heegner_point(-7,5); P - Heegner point of discriminant -7 and conductor 5 on elliptic curve of conductor 37 + Heegner point of discriminant -7 and conductor 5 on elliptic curve + of conductor 37 sage: P.heegner_point_on_X0N() - Heegner point 5/74*sqrt(-7) - 11/74 of discriminant -7 and conductor 5 on X_0(37) + Heegner point 5/74*sqrt(-7) - 11/74 of discriminant -7 and conductor 5 + on X_0(37) """ return self.__x @@ -3156,7 +3213,8 @@ def kolyvagin_point(self): sage: P = y.kolyvagin_point(); P Kolyvagin point of discriminant -7 on elliptic curve of conductor 37 sage: P.numerical_approx() # abs tol 1e-15 - (-3.36910401903861e-16 - 2.22076195576076e-16*I : 3.33066907387547e-16 + 2.22076195576075e-16*I : 1.00000000000000) + (-3.36910401903861e-16 - 2.22076195576076e-16*I + : 3.33066907387547e-16 + 2.22076195576075e-16*I : 1.00000000000000) """ return KolyvaginPoint(self) @@ -3177,7 +3235,8 @@ def _trace_index(self, *args, **kwds): EXAMPLES:: sage: E = EllipticCurve('77a1') - sage: P = E.heegner_point(-19); y = P._trace_numerical_conductor_1(); [c.real() for c in y] + sage: P = E.heegner_point(-19); y = P._trace_numerical_conductor_1() + sage: [c.real() for c in y] [-1.2...e-16, -1.00000000000000, 1.00000000000000] sage: -2*E.gens()[0] (0 : -1 : 1) @@ -3187,7 +3246,8 @@ def _trace_index(self, *args, **kwds): sage: P = E.heegner_point(-68); P Heegner point of discriminant -68 on elliptic curve of conductor 77 sage: N(P) - (0.219223593595584 - 1.87443160153148*I : -1.34232921921325 - 1.52356748877889*I : 1.00000000000000) + (0.219223593595584 - 1.87443160153148*I + : -1.34232921921325 - 1.52356748877889*I : 1.00000000000000) sage: P._trace_index() 0 """ @@ -3227,7 +3287,8 @@ def quadratic_form(self): 389*x^2 + 147*x*y + 14*y^2 sage: P = EllipticCurve('389a').heegner_point(-7, 5, (778,925,275)); P - Heegner point of discriminant -7 and conductor 5 on elliptic curve of conductor 389 + Heegner point of discriminant -7 and conductor 5 on elliptic curve + of conductor 389 sage: P.quadratic_form() 778*x^2 + 925*x*y + 275*y^2 """ @@ -3254,7 +3315,8 @@ def numerical_approx(self, prec=53, algorithm=None): sage: E = EllipticCurve('37a'); P = E.heegner_point(-7); P Heegner point of discriminant -7 on elliptic curve of conductor 37 sage: P.numerical_approx() # abs tol 1e-15 - (-3.36910401903861e-16 - 2.22076195576076e-16*I : 3.33066907387547e-16 + 2.22076195576075e-16*I : 1.00000000000000) + (-3.36910401903861e-16 - 2.22076195576076e-16*I + : 3.33066907387547e-16 + 2.22076195576075e-16*I : 1.00000000000000) sage: P.numerical_approx(10) # expect random digits (0.0030 - 0.0028*I : -0.0030 + 0.0028*I : 1.0) sage: P.numerical_approx(100)[0] # expect random digits @@ -3262,7 +3324,8 @@ def numerical_approx(self, prec=53, algorithm=None): sage: E = EllipticCurve('37a'); P = E.heegner_point(-40); P Heegner point of discriminant -40 on elliptic curve of conductor 37 sage: P.numerical_approx() # abs tol 1e-14 - (-3.15940603400359e-16 + 1.41421356237309*I : 1.00000000000000 - 1.41421356237309*I : 1.00000000000000) + (-3.15940603400359e-16 + 1.41421356237309*I + : 1.00000000000000 - 1.41421356237309*I : 1.00000000000000) A rank 2 curve, where all Heegner points of conductor 1 are 0:: @@ -3276,15 +3339,20 @@ def numerical_approx(self, prec=53, algorithm=None): However, Heegner points of bigger conductor are often nonzero:: sage: E = EllipticCurve('389a'); P = E.heegner_point(-7, 5); P - Heegner point of discriminant -7 and conductor 5 on elliptic curve of conductor 389 + Heegner point of discriminant -7 and conductor 5 on elliptic curve + of conductor 389 sage: numerical_approx(P) - (0.675507556926807 + 0.344749649302635*I : -0.377142931401887 + 0.843366227137146*I : 1.00000000000000) + (0.675507556926807 + 0.344749649302635*I + : -0.377142931401887 + 0.843366227137146*I : 1.00000000000000) sage: P.numerical_approx() - (0.6755075569268... + 0.3447496493026...*I : -0.3771429314018... + 0.8433662271371...*I : 1.00000000000000) + (0.6755075569268... + 0.3447496493026...*I + : -0.3771429314018... + 0.8433662271371...*I : 1.00000000000000) sage: E.heegner_point(-7, 11).numerical_approx() - (0.1795583794118... + 0.02035501750912...*I : -0.5573941377055... + 0.2738940831635...*I : 1.00000000000000) + (0.1795583794118... + 0.02035501750912...*I + : -0.5573941377055... + 0.2738940831635...*I : 1.00000000000000) sage: E.heegner_point(-7, 13).numerical_approx() - (1.034302915374... - 3.302744319777...*I : 1.323937875767... + 6.908264226850...*I : 1.00000000000000) + (1.034302915374... - 3.302744319777...*I + : 1.323937875767... + 6.908264226850...*I : 1.00000000000000) We find (probably) the defining polynomial of the `x`-coordinate of `P`, which defines a class field. The shape of diff --git a/src/sage/schemes/elliptic_curves/saturation.py b/src/sage/schemes/elliptic_curves/saturation.py index 57367c515d4..88775ee22a4 100644 --- a/src/sage/schemes/elliptic_curves/saturation.py +++ b/src/sage/schemes/elliptic_curves/saturation.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: optional - sage.rings.finite_rings sage.rings.number_field r""" Saturation of Mordell-Weil groups of elliptic curves over number fields @@ -55,7 +55,7 @@ from sage.arith.misc import kronecker as kro from sage.structure.sage_object import SageObject -def reduce_mod_q(x,amodq): +def reduce_mod_q(x, amodq): r"""The reduction of ``x`` modulo the prime ideal defined by ``amodq``. INPUT: @@ -75,15 +75,15 @@ def reduce_mod_q(x,amodq): sage: from sage.schemes.elliptic_curves.saturation import reduce_mod_q sage: x = polygen(QQ) - sage: pol = x^3 -x^2 -3*x + 1 + sage: pol = x^3 - x^2 - 3*x + 1 sage: K. = NumberField(pol) - sage: [(q,[(amodq,reduce_mod_q(1-a+a^4,amodq)) - ....: for amodq in sorted(pol.roots(GF(q), multiplicities=False))]) - ....: for q in primes(50,70)] + sage: [(q, [(amodq, reduce_mod_q(1 - a + a^4, amodq)) + ....: for amodq in sorted(pol.roots(GF(q), multiplicities=False))]) + ....: for q in primes(50, 70)] [(53, []), - (59, [(36, 28)]), - (61, [(40, 35)]), - (67, [(10, 8), (62, 28), (63, 60)])] + (59, [(36, 28)]), + (61, [(40, 35)]), + (67, [(10, 8), (62, 28), (63, 60)])] """ Fq = amodq.parent() try: @@ -138,7 +138,8 @@ def __init__(self, E, verbose=False): # and gens are generators of that reduction. def add_reductions(self, q): - r"""Add reduction data at primes above q if not already there. + r""" + Add reduction data at primes above ``q`` if not already there. INPUT: @@ -165,8 +166,8 @@ def add_reductions(self, q): {} sage: saturator.add_reductions(19) sage: saturator._reductions - {19: {0: (20, - Elliptic Curve defined by y^2 + y = x^3 + 18*x^2 + 9*x + 18 over Finite Field of size 19)}} + {19: {0: (20, Elliptic Curve defined by y^2 + y = x^3 + 18*x^2 + 9*x + 18 + over Finite Field of size 19)}} Over a number field:: @@ -177,23 +178,23 @@ def add_reductions(self, q): sage: for q in primes(20): ....: saturator.add_reductions(q) sage: saturator._reductions - {2: {}, - 3: {}, - 5: {}, - 7: {}, - 11: {3: (16, - Elliptic Curve defined by y^2 = x^3 + x^2 + 3*x + 3 over Finite Field of size 11), - 8: (8, - Elliptic Curve defined by y^2 = x^3 + x^2 + 8*x + 8 over Finite Field of size 11)}, - 13: {}, - 17: {7: (20, - Elliptic Curve defined by y^2 = x^3 + x^2 + 7*x + 7 over Finite Field of size 17), - 10: (18, - Elliptic Curve defined by y^2 = x^3 + x^2 + 10*x + 10 over Finite Field of size 17)}, - 19: {6: (16, - Elliptic Curve defined by y^2 = x^3 + x^2 + 6*x + 6 over Finite Field of size 19), - 13: (12, - Elliptic Curve defined by y^2 = x^3 + x^2 + 13*x + 13 over Finite Field of size 19)}} + {2: {}, + 3: {}, + 5: {}, + 7: {}, + 11: {3: (16, Elliptic Curve defined by y^2 = x^3 + x^2 + 3*x + 3 + over Finite Field of size 11), + 8: (8, Elliptic Curve defined by y^2 = x^3 + x^2 + 8*x + 8 + over Finite Field of size 11)}, + 13: {}, + 17: {7: (20, Elliptic Curve defined by y^2 = x^3 + x^2 + 7*x + 7 + over Finite Field of size 17), + 10: (18, Elliptic Curve defined by y^2 = x^3 + x^2 + 10*x + 10 + over Finite Field of size 17)}, + 19: {6: (16, Elliptic Curve defined by y^2 = x^3 + x^2 + 6*x + 6 + over Finite Field of size 19), + 13: (12, Elliptic Curve defined by y^2 = x^3 + x^2 + 13*x + 13 + over Finite Field of size 19)}} """ if q in self._reductions: return @@ -228,17 +229,17 @@ def full_p_saturation(self, Plist, p): sage: E = EllipticCurve('389a') sage: K. = QuadraticField(-1) sage: EK = E.change_ring(K) - sage: P = EK(1+i,-1-2*i) + sage: P = EK(1 + i, -1 - 2*i) sage: saturator = EllipticCurveSaturator(EK, verbose=True) - sage: saturator.full_p_saturation([8*P],2) + sage: saturator.full_p_saturation([8*P], 2) --starting full 2-saturation Points were not 2-saturated, exponent was 3 ([(i + 1 : -2*i - 1 : 1)], 3) - sage: Q = EK(0,0) - sage: R = EK(-1,1) + sage: Q = EK(0, 0) + sage: R = EK(-1, 1) sage: saturator = EllipticCurveSaturator(EK, verbose=False) - sage: saturator.full_p_saturation([P,Q,R],3) + sage: saturator.full_p_saturation([P, Q, R], 3) ([(i + 1 : -2*i - 1 : 1), (0 : 0 : 1), (-1 : 1 : 1)], 0) An example where the points are not 7-saturated and we gain @@ -247,11 +248,10 @@ def full_p_saturation(self, Plist, p): `p`-rank 2 (which occurs for the reduction modulo `(16-5i)`), which uses the Weil pairing:: - sage: saturator.full_p_saturation([P,Q+3*R,Q-4*R],7) + sage: saturator.full_p_saturation([P, Q + 3*R, Q - 4*R], 7) ([(i + 1 : -2*i - 1 : 1), - (2869/676 : 154413/17576 : 1), - (-7095/502681 : -366258864/356400829 : 1)], - 1) + (2869/676 : 154413/17576 : 1), + (-7095/502681 : -366258864/356400829 : 1)], 1) """ if not Plist: return Plist, ZZ.zero() @@ -328,23 +328,23 @@ def p_saturation(self, Plist, p, sieve=True): sage: E = EllipticCurve('389a') sage: K. = QuadraticField(-1) sage: EK = E.change_ring(K) - sage: P = EK(1+i,-1-2*i) + sage: P = EK(1 + i, -1 - 2*i) sage: saturator = EllipticCurveSaturator(EK) - sage: saturator.p_saturation([P],2) + sage: saturator.p_saturation([P], 2) False - sage: saturator.p_saturation([2*P],2) + sage: saturator.p_saturation([2*P], 2) (0, (i + 1 : -2*i - 1 : 1)) - sage: Q = EK(0,0) - sage: R = EK(-1,1) - sage: saturator.p_saturation([P,Q,R],3) + sage: Q = EK(0, 0) + sage: R = EK(-1, 1) + sage: saturator.p_saturation([P, Q, R], 3) False Here we see an example where 19-saturation is proved, with the verbose flag set to True so that we can see what is going on:: sage: saturator = EllipticCurveSaturator(EK, verbose=True) - sage: saturator.p_saturation([P,Q,R],19) + sage: saturator.p_saturation([P, Q, R], 19) Using sieve method to saturate... E has 19-torsion over Finite Field of size 197, projecting points --> [(15 : 168 : 1), (0 : 0 : 1), (196 : 1 : 1)] @@ -361,27 +361,27 @@ def p_saturation(self, Plist, p, sieve=True): An example where the points are not 11-saturated:: sage: saturator = EllipticCurveSaturator(EK, verbose=False) - sage: res = saturator.p_saturation([P+5*Q,P-6*Q,R],11); res - (0, - (-5783311/14600041*i + 1396143/14600041 : 37679338314/55786756661*i + 3813624227/55786756661 : 1)) + sage: res = saturator.p_saturation([P + 5*Q, P - 6*Q, R], 11); res + (0, (-5783311/14600041*i + 1396143/14600041 + : 37679338314/55786756661*i + 3813624227/55786756661 : 1)) That means that the 0'th point may be replaced by the displayed point to achieve an index gain of 11:: - sage: saturator.p_saturation([res[1],P-6*Q,R],11) + sage: saturator.p_saturation([res[1], P - 6*Q, R], 11) False TESTS: See :trac:`27387`:: - sage: K. = NumberField(x^2-x-26) - sage: E = EllipticCurve([a,1-a,0,93-16*a, 3150-560*a]) - sage: P = E([65-35*a/3, (959*a-5377)/9]) + sage: K. = NumberField(x^2 - x - 26) + sage: E = EllipticCurve([a, 1 - a, 0, 93 - 16*a, 3150 - 560*a]) + sage: P = E([65 - 35*a/3, (959*a-5377)/9]) sage: T = E.torsion_points()[0] sage: from sage.schemes.elliptic_curves.saturation import EllipticCurveSaturator sage: saturator = EllipticCurveSaturator(E, True) - sage: saturator.p_saturation([P,T], 2) + sage: saturator.p_saturation([P, T], 2) Using sieve method to saturate... ... -- points were not 2-saturated, gaining index 2 @@ -390,7 +390,7 @@ def p_saturation(self, Plist, p, sieve=True): A CM example where large siecing primes are needed (LMFDB label 2.0.3.1-50625.1-CMb2):: - sage: K. = NumberField(x^2-x+1) + sage: K. = NumberField(x^2 - x + 1) sage: E = EllipticCurve(K, [0, 0, 1, -750, 7906]) sage: E.has_rational_cm() True @@ -593,11 +593,11 @@ def p_projections(Eq, Plist, p, debug=False): INPUT: - - `Eq` -- An elliptic curve over a finite field. + - ``Eq`` -- An elliptic curve over a finite field. - - `Plist` -- a list of points on `Eq`. + - ``Plist`` -- a list of points on `Eq`. - - `p` -- a prime number. + - ``p`` -- a prime number. OUTPUT: @@ -626,7 +626,9 @@ def p_projections(Eq, Plist, p, debug=False): sage: EF = E.change_ring(F) sage: G = EF.abelian_group() sage: G - Additive abelian group isomorphic to Z/147 + Z/3 embedded in Abelian group of points on Elliptic Curve defined by y^2 + y = x^3 + 402*x + 6 over Finite Field of size 409 + Additive abelian group isomorphic to Z/147 + Z/3 + embedded in Abelian group of points on Elliptic Curve + defined by y^2 + y = x^3 + 402*x + 6 over Finite Field of size 409 sage: G.order().factor() 3^2 * 7^2 @@ -637,9 +639,9 @@ def p_projections(Eq, Plist, p, debug=False): sage: Plist = [EF([-2,3]), EF([0,2]), EF([1,0])] sage: from sage.schemes.elliptic_curves.saturation import p_projections - sage: [(p,p_projections(EF,Plist,p)) for p in primes(11)] # random + sage: [(p, p_projections(EF, Plist, p)) for p in primes(11)] # random [(2, []), (3, [(0, 2, 2), (2, 2, 1)]), (5, []), (7, [(5, 1, 1)])] - sage: [(p,len(p_projections(EF,Plist,p))) for p in primes(11)] + sage: [(p, len(p_projections(EF, Plist, p))) for p in primes(11)] [(2, 0), (3, 2), (5, 0), (7, 1)] """ if debug: diff --git a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py index 4db88f1f7f2..6ca567ffe7b 100644 --- a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py +++ b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py @@ -421,16 +421,16 @@ class WeierstrassIsomorphism(EllipticCurveHom, baseWI): sage: from sage.schemes.elliptic_curves.weierstrass_morphism import * sage: WeierstrassIsomorphism(EllipticCurve([0,1,2,3,4]), (-1,2,3,4)) Elliptic-curve morphism: - From: Elliptic Curve defined by y^2 + 2*y = x^3 + x^2 + 3*x + 4 over Rational Field - To: Elliptic Curve defined by y^2 - 6*x*y - 10*y = x^3 - 2*x^2 - 11*x - 2 over Rational Field - Via: (u,r,s,t) = (-1, 2, 3, 4) + From: Elliptic Curve defined by y^2 + 2*y = x^3 + x^2 + 3*x + 4 over Rational Field + To: Elliptic Curve defined by y^2 - 6*x*y - 10*y = x^3 - 2*x^2 - 11*x - 2 over Rational Field + Via: (u,r,s,t) = (-1, 2, 3, 4) sage: E = EllipticCurve([0,1,2,3,4]) sage: F = EllipticCurve(E.cremona_label()) sage: WeierstrassIsomorphism(E, None, F) Elliptic-curve morphism: - From: Elliptic Curve defined by y^2 + 2*y = x^3 + x^2 + 3*x + 4 over Rational Field - To: Elliptic Curve defined by y^2 = x^3 + x^2 + 3*x + 5 over Rational Field - Via: (u,r,s,t) = (1, 0, 0, -1) + From: Elliptic Curve defined by y^2 + 2*y = x^3 + x^2 + 3*x + 4 over Rational Field + To: Elliptic Curve defined by y^2 = x^3 + x^2 + 3*x + 5 over Rational Field + Via: (u,r,s,t) = (1, 0, 0, -1) sage: w = WeierstrassIsomorphism(None, (1,0,0,-1), F) sage: w._domain == E True @@ -443,10 +443,10 @@ def __init__(self, E=None, urst=None, F=None): Check for :trac:`33215`:: - sage: E = EllipticCurve(GF(71^2),[5,5]) sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: iso = WeierstrassIsomorphism(E, (1,2,3,4)) - sage: ~iso # indirect doctest + sage: E = EllipticCurve(GF(71^2), [5,5]) # optional - sage.rings.finite_rings + sage: iso = WeierstrassIsomorphism(E, (1,2,3,4)) # optional - sage.rings.finite_rings + sage: ~iso # indirect doctest # optional - sage.rings.finite_rings Elliptic-curve morphism: From: Elliptic Curve defined by y^2 + 6*x*y + 8*y = x^3 + 68*x^2 + 64*x + 7 over Finite Field in z2 of size 71^2 To: Elliptic Curve defined by y^2 = x^3 + 5*x + 5 over Finite Field in z2 of size 71^2 @@ -454,8 +454,7 @@ def __init__(self, E=None, urst=None, F=None): Test for :trac:`33312`:: - sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: type(iso.degree()) + sage: type(iso.degree()) # optional - sage.rings.finite_rings """ from .ell_generic import is_EllipticCurve @@ -534,16 +533,16 @@ def _comparison_impl(left, right, op): sage: w1 == w2 False - sage: E = EllipticCurve_from_j(GF(7)(0)) - sage: F = E.change_weierstrass_model(2,3,4,5) - sage: a = E.isomorphisms(F) - sage: b = [w*a[0] for w in F.automorphisms()] - sage: b.sort() - sage: a == b + sage: E = EllipticCurve_from_j(GF(7)(0)) # optional - sage.rings.finite_rings + sage: F = E.change_weierstrass_model(2,3,4,5) # optional - sage.rings.finite_rings + sage: a = E.isomorphisms(F) # optional - sage.rings.finite_rings + sage: b = [w*a[0] for w in F.automorphisms()] # optional - sage.rings.finite_rings + sage: b.sort() # optional - sage.rings.finite_rings + sage: a == b # optional - sage.rings.finite_rings True - sage: c = [a[0]*w for w in E.automorphisms()] - sage: c.sort() - sage: a == c + sage: c = [a[0]*w for w in E.automorphisms()] # optional - sage.rings.finite_rings + sage: c.sort() # optional - sage.rings.finite_rings + sage: a == c # optional - sage.rings.finite_rings True """ if not isinstance(left, WeierstrassIsomorphism) or not isinstance(right, WeierstrassIsomorphism): @@ -589,15 +588,17 @@ def _eval(self, P): EXAMPLES:: sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: E = EllipticCurve([i,0]); E - Elliptic Curve defined by y^2 = x^3 + I*x over Number Field in I with defining polynomial x^2 + 1 with I = 1*I - sage: iso = WeierstrassIsomorphism(E, (i,1,2,3)) - sage: P = E.change_ring(QQbar).lift_x(QQbar.random_element()) - sage: Q = iso._eval(P) - sage: Q.curve() - Elliptic Curve defined by y^2 + (-4*I)*x*y + 6*I*y = x^3 + x^2 + (I-9)*x + (-I+8) over Algebraic Field - sage: y = next(filter(bool, iter(QQbar.random_element, None))) # sample until nonzero - sage: iso._eval((0, y, 0)) == 0 + sage: E = EllipticCurve([i, 0]); E # optional - sage.rings.number_field + Elliptic Curve defined by y^2 = x^3 + I*x + over Number Field in I with defining polynomial x^2 + 1 with I = 1*I + sage: iso = WeierstrassIsomorphism(E, (i,1,2,3)) # optional - sage.rings.number_field + sage: P = E.change_ring(QQbar).lift_x(QQbar.random_element()) # optional - sage.rings.number_field + sage: Q = iso._eval(P) # optional - sage.rings.number_field + sage: Q.curve() # optional - sage.rings.number_field + Elliptic Curve defined by y^2 + (-4*I)*x*y + 6*I*y = x^3 + x^2 + (I-9)*x + (-I+8) + over Algebraic Field + sage: y = next(filter(bool, iter(QQbar.random_element, None))) # sample until nonzero # optional - sage.rings.number_field + sage: iso._eval((0, y, 0)) == 0 # optional - sage.rings.number_field True """ if self._domain.defining_polynomial()(*P): @@ -634,14 +635,14 @@ def __call__(self, P): Check that copying the order over works:: - sage: E = EllipticCurve(GF(431^2), [1,0]) - sage: i = next(a for a in E.automorphisms() if a^2 == -a^24) - sage: P,_ = E.gens() - sage: P._order + sage: E = EllipticCurve(GF(431^2), [1,0]) # optional - sage.rings.finite_rings + sage: i = next(a for a in E.automorphisms() if a^2 == -a^24) # optional - sage.rings.finite_rings + sage: P,_ = E.gens() # optional - sage.rings.finite_rings + sage: P._order # optional - sage.rings.finite_rings 432 - sage: i(P)._order + sage: i(P)._order # optional - sage.rings.finite_rings 432 - sage: E(i(P))._order + sage: E(i(P))._order # optional - sage.rings.finite_rings 432 """ if P[2] == 0: @@ -750,8 +751,10 @@ def rational_maps(self): sage: E2 = EllipticCurve_from_j(E1.j_invariant()) sage: iso = E1.isomorphism_to(E2); iso Elliptic-curve morphism: - From: Elliptic Curve defined by y^2 + 11*x*y + 33*y = x^3 + 22*x^2 + 44*x + 55 over Rational Field - To: Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 684*x + 6681 over Rational Field + From: Elliptic Curve defined by y^2 + 11*x*y + 33*y = x^3 + 22*x^2 + 44*x + 55 + over Rational Field + To: Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 684*x + 6681 + over Rational Field Via: (u,r,s,t) = (1, -17, -5, 77) sage: iso.rational_maps() (x + 17, 5*x + y + 8) @@ -763,11 +766,11 @@ def rational_maps(self): :: - sage: E = EllipticCurve(GF(65537), [1,1,1,1,1]) - sage: w = E.isomorphism_to(E.short_weierstrass_model()) - sage: f,g = w.rational_maps() - sage: P = E.random_point() - sage: w(P).xy() == (f(P.xy()), g(P.xy())) + sage: E = EllipticCurve(GF(65537), [1,1,1,1,1]) # optional - sage.rings.finite_rings + sage: w = E.isomorphism_to(E.short_weierstrass_model()) # optional - sage.rings.finite_rings + sage: f,g = w.rational_maps() # optional - sage.rings.finite_rings + sage: P = E.random_point() # optional - sage.rings.finite_rings + sage: w(P).xy() == (f(P.xy()), g(P.xy())) # optional - sage.rings.finite_rings True TESTS: @@ -791,8 +794,10 @@ def x_rational_map(self): sage: E2 = EllipticCurve_from_j(E1.j_invariant()) sage: iso = E1.isomorphism_to(E2); iso Elliptic-curve morphism: - From: Elliptic Curve defined by y^2 + 11*x*y + 33*y = x^3 + 22*x^2 + 44*x + 55 over Rational Field - To: Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 684*x + 6681 over Rational Field + From: Elliptic Curve defined by y^2 + 11*x*y + 33*y = x^3 + 22*x^2 + 44*x + 55 + over Rational Field + To: Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 684*x + 6681 + over Rational Field Via: (u,r,s,t) = (1, -17, -5, 77) sage: iso.x_rational_map() x + 17 @@ -824,7 +829,11 @@ def kernel_polynomial(self): sage: iso.kernel_polynomial() 1 sage: psi = E1.isogeny(iso.kernel_polynomial(), codomain=E2); psi - Isogeny of degree 1 from Elliptic Curve defined by y^2 + 11*x*y + 33*y = x^3 + 22*x^2 + 44*x + 55 over Rational Field to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 684*x + 6681 over Rational Field + Isogeny of degree 1 + from Elliptic Curve defined by y^2 + 11*x*y + 33*y = x^3 + 22*x^2 + 44*x + 55 + over Rational Field + to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 684*x + 6681 + over Rational Field sage: psi in {iso, -iso} True @@ -844,8 +853,8 @@ def is_separable(self): EXAMPLES:: - sage: E = EllipticCurve(GF(31337), [0,1]) - sage: {f.is_separable() for f in E.automorphisms()} + sage: E = EllipticCurve(GF(31337), [0,1]) # optional - sage.rings.finite_rings + sage: {f.is_separable() for f in E.automorphisms()} # optional - sage.rings.finite_rings {True} """ return True @@ -859,9 +868,9 @@ def dual(self): EXAMPLES:: sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: E = EllipticCurve(QuadraticField(-3), [0,1]) - sage: w = WeierstrassIsomorphism(E, (CyclotomicField(3).gen(),0,0,0)) - sage: (w.dual() * w).rational_maps() + sage: E = EllipticCurve(QuadraticField(-3), [0,1]) # optional - sage.rings.number_field + sage: w = WeierstrassIsomorphism(E, (CyclotomicField(3).gen(),0,0,0)) # optional - sage.rings.number_field + sage: (w.dual() * w).rational_maps() # optional - sage.rings.number_field (x, y) :: @@ -887,7 +896,8 @@ def __neg__(self): sage: -w Elliptic-curve morphism: From: Elliptic Curve defined by y^2 + 11*x*y + 33*y = x^3 + 22*x^2 + 44*x + 55 over Rational Field - To: Elliptic Curve defined by y^2 + 17/6*x*y + 49/13068*y = x^3 - 769/396*x^2 - 3397/862488*x + 44863/7513995456 over Rational Field + To: Elliptic Curve defined by y^2 + 17/6*x*y + 49/13068*y = x^3 - 769/396*x^2 - 3397/862488*x + 44863/7513995456 + over Rational Field Via: (u,r,s,t) = (-66, 77, -99, -979) sage: -(-w) == w True @@ -895,22 +905,22 @@ def __neg__(self): :: sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: K. = QuadraticField(-3) - sage: E = EllipticCurve(K, [0,1]) - sage: w = WeierstrassIsomorphism(E, (CyclotomicField(3).gen(),0,0,0)) - sage: w.tuple() + sage: K. = QuadraticField(-3) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0,1]) # optional - sage.rings.number_field + sage: w = WeierstrassIsomorphism(E, (CyclotomicField(3).gen(),0,0,0)) # optional - sage.rings.number_field + sage: w.tuple() # optional - sage.rings.number_field (1/2*a - 1/2, 0, 0, 0) - sage: (-w).tuple() + sage: (-w).tuple() # optional - sage.rings.number_field (-1/2*a + 1/2, 0, 0, 0) - sage: (-w)^3 == -(w^3) + sage: (-w)^3 == -(w^3) # optional - sage.rings.number_field True :: sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism, identity_morphism - sage: E = EllipticCurve(QuadraticField(-1), [1,0]) - sage: t = WeierstrassIsomorphism(E, (i,0,0,0)) - sage: -t^2 == identity_morphism(E) + sage: E = EllipticCurve(QuadraticField(-1), [1,0]) # optional - sage.rings.number_field + sage: t = WeierstrassIsomorphism(E, (i,0,0,0)) # optional - sage.rings.number_field + sage: -t^2 == identity_morphism(E) # optional - sage.rings.number_field True """ a1,_,a3,_,_ = self._domain.a_invariants() @@ -931,8 +941,8 @@ def scaling_factor(self): EXAMPLES:: - sage: E = EllipticCurve(QQbar, [0,1]) - sage: all(f.scaling_factor() == f.formal()[1] for f in E.automorphisms()) + sage: E = EllipticCurve(QQbar, [0,1]) # optional - sage.rings.number_field + sage: all(f.scaling_factor() == f.formal()[1] for f in E.automorphisms()) # optional - sage.rings.number_field True ALGORITHM: The scaling factor equals the `u` component of diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index 653033b7878..d62c207ea79 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -1851,7 +1851,7 @@ def change_ring(self, R): sage: P. = ProjectiveSpace(QQ, 1) sage: X = P.subscheme([3*x^2 - y^2]) sage: H = Hom(X, X) - sage: X.change_ring(GF(3)) + sage: X.change_ring(GF(3)) # optional - sage.rings.finite_rings Closed subscheme of Projective Space of dimension 1 over Finite Field of size 3 defined by: -y^2 diff --git a/src/sage/schemes/generic/divisor_group.py b/src/sage/schemes/generic/divisor_group.py index 2399808c15c..dfcb699d457 100644 --- a/src/sage/schemes/generic/divisor_group.py +++ b/src/sage/schemes/generic/divisor_group.py @@ -224,7 +224,7 @@ def base_extend(self, R): sage: from sage.schemes.generic.divisor_group import DivisorGroup sage: DivisorGroup(Spec(ZZ), ZZ).base_extend(QQ) Group of QQ-Divisors on Spectrum of Integer Ring - sage: DivisorGroup(Spec(ZZ), ZZ).base_extend(GF(7)) + sage: DivisorGroup(Spec(ZZ), ZZ).base_extend(GF(7)) # optional - sage.rings.finite_rings Group of (Finite Field of size 7)-Divisors on Spectrum of Integer Ring Divisor groups are unique:: diff --git a/src/sage/schemes/generic/homset.py b/src/sage/schemes/generic/homset.py index 224aa5e99c0..920bc758b0b 100644 --- a/src/sage/schemes/generic/homset.py +++ b/src/sage/schemes/generic/homset.py @@ -632,10 +632,10 @@ def _element_constructor_(self, *v, **kwds): EXAMPLES:: sage: A2 = AffineSpace(ZZ, 2) - sage: F = GF(3) - sage: F_points = A2(F); type(F_points) + sage: F = GF(3) # optional - sage.rings.finite_rings + sage: F_points = A2(F); type(F_points) # optional - sage.rings.finite_rings - sage: F_points([2,5]) + sage: F_points([2,5]) # optional - sage.rings.finite_rings (2, 2) sage: P2 = ProjectiveSpace(GF(3), 2) # optional - sage.rings.finite_rings diff --git a/src/sage/schemes/generic/morphism.py b/src/sage/schemes/generic/morphism.py index 7aac451f1ab..66b15f9ca56 100644 --- a/src/sage/schemes/generic/morphism.py +++ b/src/sage/schemes/generic/morphism.py @@ -1767,8 +1767,8 @@ def __init__(self, X): TESTS:: - sage: A = AffineSpace(2, GF(3)) - sage: A.identity_morphism().defining_polynomials() + sage: A = AffineSpace(2, GF(3)) # optional - sage.rings.finite_rings + sage: A.identity_morphism().defining_polynomials() # optional - sage.rings.finite_rings (x0, x1) """ super().__init__(X) diff --git a/src/sage/schemes/hyperelliptic_curves/constructor.py b/src/sage/schemes/hyperelliptic_curves/constructor.py index afd87af8cb3..d1d1391d57a 100644 --- a/src/sage/schemes/hyperelliptic_curves/constructor.py +++ b/src/sage/schemes/hyperelliptic_curves/constructor.py @@ -71,63 +71,69 @@ def HyperellipticCurve(f, h=0, names=None, PP=None, check_squarefree=True): sage: R. = QQ[] sage: HyperellipticCurve(x^5 + x + 1) Hyperelliptic Curve over Rational Field defined by y^2 = x^5 + x + 1 - sage: HyperellipticCurve(x^19 + x + 1, x-2) + sage: HyperellipticCurve(x^19 + x + 1, x - 2) Hyperelliptic Curve over Rational Field defined by y^2 + (x - 2)*y = x^19 + x + 1 - sage: k. = GF(9); R. = k[] - sage: HyperellipticCurve(x^3 + x - 1, x+a) - Hyperelliptic Curve over Finite Field in a of size 3^2 defined by y^2 + (x + a)*y = x^3 + x + 2 + sage: k. = GF(9); R. = k[] # optional - sage.rings.finite_rings + sage: HyperellipticCurve(x^3 + x - 1, x+a) # optional - sage.rings.finite_rings + Hyperelliptic Curve over Finite Field in a of size 3^2 + defined by y^2 + (x + a)*y = x^3 + x + 2 Characteristic two:: - sage: P. = GF(8,'a')[] - sage: HyperellipticCurve(x^7+1, x) - Hyperelliptic Curve over Finite Field in a of size 2^3 defined by y^2 + x*y = x^7 + 1 - sage: HyperellipticCurve(x^8+x^7+1, x^4+1) - Hyperelliptic Curve over Finite Field in a of size 2^3 defined by y^2 + (x^4 + 1)*y = x^8 + x^7 + 1 + sage: P. = GF(8, 'a')[] # optional - sage.rings.finite_rings + sage: HyperellipticCurve(x^7 + 1, x) # optional - sage.rings.finite_rings + Hyperelliptic Curve over Finite Field in a of size 2^3 + defined by y^2 + x*y = x^7 + 1 + sage: HyperellipticCurve(x^8 + x^7 + 1, x^4 + 1) # optional - sage.rings.finite_rings + Hyperelliptic Curve over Finite Field in a of size 2^3 + defined by y^2 + (x^4 + 1)*y = x^8 + x^7 + 1 - sage: HyperellipticCurve(x^8+1, x) + sage: HyperellipticCurve(x^8 + 1, x) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Not a hyperelliptic curve: highly singular at infinity. - sage: HyperellipticCurve(x^8+x^7+1, x^4) + sage: HyperellipticCurve(x^8 + x^7 + 1, x^4) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Not a hyperelliptic curve: singularity in the provided affine patch. - sage: F. = PowerSeriesRing(FiniteField(2)) - sage: P. = PolynomialRing(FractionField(F)) - sage: HyperellipticCurve(x^5+t, x) - Hyperelliptic Curve over Laurent Series Ring in t over Finite Field of size 2 defined by y^2 + x*y = x^5 + t + sage: F. = PowerSeriesRing(FiniteField(2)) # optional - sage.rings.finite_rings + sage: P. = PolynomialRing(FractionField(F)) # optional - sage.rings.finite_rings + sage: HyperellipticCurve(x^5 + t, x) # optional - sage.rings.finite_rings + Hyperelliptic Curve over Laurent Series Ring in t over Finite Field of size 2 + defined by y^2 + x*y = x^5 + t We can change the names of the variables in the output:: - sage: k. = GF(9); R. = k[] - sage: HyperellipticCurve(x^3 + x - 1, x+a, names=['X','Y']) - Hyperelliptic Curve over Finite Field in a of size 3^2 defined by Y^2 + (X + a)*Y = X^3 + X + 2 + sage: k. = GF(9); R. = k[] # optional - sage.rings.finite_rings + sage: HyperellipticCurve(x^3 + x - 1, x + a, names=['X','Y']) # optional - sage.rings.finite_rings + Hyperelliptic Curve over Finite Field in a of size 3^2 + defined by Y^2 + (X + a)*Y = X^3 + X + 2 This class also allows curves of genus zero or one, which are strictly speaking not hyperelliptic:: sage: P. = QQ[] - sage: HyperellipticCurve(x^2+1) + sage: HyperellipticCurve(x^2 + 1) Hyperelliptic Curve over Rational Field defined by y^2 = x^2 + 1 - sage: HyperellipticCurve(x^4-1) + sage: HyperellipticCurve(x^4 - 1) Hyperelliptic Curve over Rational Field defined by y^2 = x^4 - 1 - sage: HyperellipticCurve(x^3+2*x+2) + sage: HyperellipticCurve(x^3 + 2*x + 2) Hyperelliptic Curve over Rational Field defined by y^2 = x^3 + 2*x + 2 Double roots:: - sage: P. = GF(7)[] + sage: P. = GF(7)[] # optional - sage.rings.finite_rings sage: HyperellipticCurve((x^3-x+2)^2*(x^6-1)) Traceback (most recent call last): ... ValueError: Not a hyperelliptic curve: singularity in the provided affine patch. - sage: HyperellipticCurve((x^3-x+2)^2*(x^6-1), check_squarefree=False) - Hyperelliptic Curve over Finite Field of size 7 defined by y^2 = x^12 + 5*x^10 + 4*x^9 + x^8 + 3*x^7 + 3*x^6 + 2*x^4 + 3*x^3 + 6*x^2 + 4*x + 3 + sage: HyperellipticCurve((x^3-x+2)^2*(x^6-1), check_squarefree=False) # optional - sage.rings.finite_rings + Hyperelliptic Curve over Finite Field of size 7 defined by + y^2 = x^12 + 5*x^10 + 4*x^9 + x^8 + 3*x^7 + 3*x^6 + 2*x^4 + 3*x^3 + 6*x^2 + 4*x + 3 The input for a (smooth) hyperelliptic curve of genus `g` should not contain polynomials of degree greater than `2g+2`. In the following @@ -137,8 +143,8 @@ def HyperellipticCurve(f, h=0, names=None, PP=None, check_squarefree=True): sage: P. = QQ[] sage: h = x^100 - sage: F = x^6+1 - sage: f = F-h^2/4 + sage: F = x^6 + 1 + sage: f = F - h^2/4 sage: HyperellipticCurve(f, h) Traceback (most recent call last): ... @@ -150,9 +156,9 @@ def HyperellipticCurve(f, h=0, names=None, PP=None, check_squarefree=True): An example with a singularity over an inseparable extension of the base field:: - sage: F. = GF(5)[] - sage: P. = F[] - sage: HyperellipticCurve(x^5+t) + sage: F. = GF(5)[] # optional - sage.rings.finite_rings + sage: P. = F[] # optional - sage.rings.finite_rings + sage: HyperellipticCurve(x^5 + t) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: Not a hyperelliptic curve: singularity in the provided affine patch. @@ -163,7 +169,7 @@ def HyperellipticCurve(f, h=0, names=None, PP=None, check_squarefree=True): not checked whether the discriminant is a unit in `\ZZ^*`.:: sage: P. = ZZ[] - sage: HyperellipticCurve(3*x^7+6*x+6) + sage: HyperellipticCurve(3*x^7 + 6*x + 6) Hyperelliptic Curve over Integer Ring defined by y^2 = 3*x^7 + 6*x + 6 TESTS: @@ -176,17 +182,17 @@ def HyperellipticCurve(f, h=0, names=None, PP=None, check_squarefree=True): Check that two curves with the same class name have the same class type:: - sage: R. = PolynomialRing(GF(next_prime(10^9))) - sage: C = HyperellipticCurve(t^5 + t + 1) - sage: C2 = HyperellipticCurve(t^5 + 3*t + 1) - sage: type(C2) == type(C) + sage: R. = PolynomialRing(GF(next_prime(10^9))) # optional - sage.rings.finite_rings + sage: C = HyperellipticCurve(t^5 + t + 1) # optional - sage.rings.finite_rings + sage: C2 = HyperellipticCurve(t^5 + 3*t + 1) # optional - sage.rings.finite_rings + sage: type(C2) == type(C) # optional - sage.rings.finite_rings True Check that the inheritance is correct:: - sage: R. = PolynomialRing(GF(next_prime(10^9))) - sage: C = HyperellipticCurve(t^5 + t + 1) - sage: type(C).mro() + sage: R. = PolynomialRing(GF(next_prime(10^9))) # optional - sage.rings.finite_rings + sage: C = HyperellipticCurve(t^5 + t + 1) # optional - sage.rings.finite_rings + sage: type(C).mro() # optional - sage.rings.finite_rings [, , , diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py index ab883076d33..48d8dfedf81 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.rings.finite_rings r""" Hyperelliptic curves over a finite field @@ -7,7 +8,8 @@ sage: x = polygen(K) sage: C = HyperellipticCurve(x^7 - x^5 - 2, x^2 + a) sage: C._points_fast_sqrt() - [(0 : 1 : 0), (a + 1 : a : 1), (a + 1 : a + 1 : 1), (2 : a + 1 : 1), (2*a : 2*a + 2 : 1), (2*a : 2*a : 1), (1 : a + 1 : 1)] + [(0 : 1 : 0), (a + 1 : a : 1), (a + 1 : a + 1 : 1), (2 : a + 1 : 1), + (2*a : 2*a + 2 : 1), (2*a : 2*a : 1), (1 : a + 1 : 1)] AUTHORS: @@ -204,7 +206,8 @@ def frobenius_matrix_hypellfrob(self, N=None): sage: H.frobenius_matrix_hypellfrob() Traceback (most recent call last): ... - NotImplementedError: Computation of Frobenius matrix only implemented for hyperelliptic curves defined over prime fields. + NotImplementedError: Computation of Frobenius matrix only implemented + for hyperelliptic curves defined over prime fields. nor too small characteristic:: @@ -279,7 +282,8 @@ def frobenius_matrix(self, N=None, algorithm='hypellfrob'): sage: H.frobenius_matrix(algorithm='hypellfrob') Traceback (most recent call last): ... - NotImplementedError: Computation of Frobenius matrix only implemented for hyperelliptic curves defined over prime fields. + NotImplementedError: Computation of Frobenius matrix only implemented + for hyperelliptic curves defined over prime fields. nor too small characteristic:: @@ -394,10 +398,15 @@ def frobenius_polynomial_matrix(self, M=None, algorithm='hypellfrob'): sage: R. = PolynomialRing(K) sage: H = HyperellipticCurve(t^9 + t^5 + 1) sage: H.frobenius_polynomial_matrix() - x^8 + 281*x^7 + 55939*x^6 + 14144175*x^5 + 3156455369*x^4 + 707194605825*x^3 + 139841906155939*x^2 + 35122892542149719*x + 6249500014999800001 + x^8 + 281*x^7 + 55939*x^6 + 14144175*x^5 + 3156455369*x^4 + 707194605825*x^3 + + 139841906155939*x^2 + 35122892542149719*x + 6249500014999800001 sage: H = HyperellipticCurve(t^15 + t^5 + 1) - sage: H.frobenius_polynomial_matrix() # long time, 8s on a Corei7 - x^14 - 76*x^13 + 220846*x^12 - 12984372*x^11 + 24374326657*x^10 - 1203243210304*x^9 + 1770558798515792*x^8 - 74401511415210496*x^7 + 88526169366991084208*x^6 - 3007987702642212810304*x^5 + 3046608028331197124223343*x^4 - 81145833008762983138584372*x^3 + 69007473838551978905211279154*x^2 - 1187357507124810002849977200076*x + 781140631562281254374947500349999 + sage: H.frobenius_polynomial_matrix() # long time, 8s on a Corei7 + x^14 - 76*x^13 + 220846*x^12 - 12984372*x^11 + 24374326657*x^10 - 1203243210304*x^9 + + 1770558798515792*x^8 - 74401511415210496*x^7 + 88526169366991084208*x^6 + - 3007987702642212810304*x^5 + 3046608028331197124223343*x^4 + - 81145833008762983138584372*x^3 + 69007473838551978905211279154*x^2 + - 1187357507124810002849977200076*x + 781140631562281254374947500349999 This ``hypellfrob`` program doesn't support non-prime fields:: @@ -407,7 +416,8 @@ def frobenius_polynomial_matrix(self, M=None, algorithm='hypellfrob'): sage: H.frobenius_polynomial_matrix(algorithm='hypellfrob') Traceback (most recent call last): ... - NotImplementedError: Computation of Frobenius matrix only implemented for hyperelliptic curves defined over prime fields. + NotImplementedError: Computation of Frobenius matrix only implemented + for hyperelliptic curves defined over prime fields. """ K = self.base_ring() p = K.characteristic() @@ -594,7 +604,8 @@ def _points_fast_sqrt(self): sage: x = polygen(K) sage: C = HyperellipticCurve(x^7 - 1, x^2 + a) sage: C._points_fast_sqrt() - [(0 : 1 : 0), (a : 2*a + 1 : 1), (2 : a + 1 : 1), (2*a + 2 : 2*a : 1), (2*a + 2 : 1 : 1), (1 : 2*a + 2 : 1), (1 : 0 : 1)] + [(0 : 1 : 0), (a : 2*a + 1 : 1), (2 : a + 1 : 1), (2*a + 2 : 2*a : 1), + (2*a + 2 : 1 : 1), (1 : 2*a + 2 : 1), (1 : 0 : 1)] sage: K. = GF(49, 'a') sage: x = polygen(K) sage: C = HyperellipticCurve(x^5 - x^2 - 1, x^2 + a) @@ -614,7 +625,10 @@ def _points_fast_sqrt(self): sage: x = polygen(GF(13)) sage: C = HyperellipticCurve(x^3 + x^2 - 1) sage: C._points_fast_sqrt() - [(0 : 1 : 0), (0 : 5 : 1), (0 : 8 : 1), (1 : 1 : 1), (1 : 12 : 1), (3 : 3 : 1), (3 : 10 : 1), (4 : 1 : 1), (4 : 12 : 1), (6 : 2 : 1), (6 : 11 : 1), (7 : 1 : 1), (7 : 12 : 1), (8 : 4 : 1), (8 : 9 : 1), (9 : 4 : 1), (9 : 9 : 1), (12 : 5 : 1), (12 : 8 : 1)] + [(0 : 1 : 0), (0 : 5 : 1), (0 : 8 : 1), (1 : 1 : 1), (1 : 12 : 1), + (3 : 3 : 1), (3 : 10 : 1), (4 : 1 : 1), (4 : 12 : 1), (6 : 2 : 1), + (6 : 11 : 1), (7 : 1 : 1), (7 : 12 : 1), (8 : 4 : 1), (8 : 9 : 1), + (9 : 4 : 1), (9 : 9 : 1), (12 : 5 : 1), (12 : 8 : 1)] sage: set(C._points_fast_sqrt()) == set(C._points_cache_sqrt()) True """ @@ -714,7 +728,8 @@ def _points_cache_sqrt(self, brute_force=False): sage: x = polygen(GF(7)) sage: C = HyperellipticCurve(x^3 + x^2 - 1) sage: C._points_cache_sqrt() - [(0 : 1 : 0), (1 : 6 : 1), (1 : 1 : 1), (2 : 5 : 1), (2 : 2 : 1), (3 : 0 : 1), (4 : 4 : 1), (4 : 3 : 1), (5 : 4 : 1), (5 : 3 : 1)] + [(0 : 1 : 0), (1 : 6 : 1), (1 : 1 : 1), (2 : 5 : 1), (2 : 2 : 1), + (3 : 0 : 1), (4 : 4 : 1), (4 : 3 : 1), (5 : 4 : 1), (5 : 3 : 1)] sage: set(C._points_cache_sqrt()) == set(C._points_cache_sqrt(brute_force=True)) True """ @@ -796,7 +811,8 @@ def points(self): sage: x = polygen(GF(7)) sage: C = HyperellipticCurve(x^7 - x^2 - 1) sage: C.points() - [(0 : 1 : 0), (2 : 5 : 1), (2 : 2 : 1), (3 : 0 : 1), (4 : 6 : 1), (4 : 1 : 1), (5 : 0 : 1), (6 : 5 : 1), (6 : 2 : 1)] + [(0 : 1 : 0), (2 : 5 : 1), (2 : 2 : 1), (3 : 0 : 1), (4 : 6 : 1), + (4 : 1 : 1), (5 : 0 : 1), (6 : 5 : 1), (6 : 2 : 1)] :: @@ -811,7 +827,8 @@ def points(self): sage: R. = GF(7)[] sage: H = HyperellipticCurve(3*x^2 + 5*x + 1) sage: H.points() - [(0 : 6 : 1), (0 : 1 : 1), (1 : 4 : 1), (1 : 3 : 1), (2 : 4 : 1), (2 : 3 : 1), (3 : 6 : 1), (3 : 1 : 1)] + [(0 : 6 : 1), (0 : 1 : 1), (1 : 4 : 1), (1 : 3 : 1), (2 : 4 : 1), + (2 : 3 : 1), (3 : 6 : 1), (3 : 1 : 1)] The method currently lists points on the plane projective model, that is the closure in `\mathbb{P}^2` of the curve defined by `y^2+hy=f`. @@ -827,7 +844,8 @@ def points(self): sage: R.=GF(11)[] sage: H = HyperellipticCurve(x*(x+1)*(x+2)*(x+3)*(x+4)*(x+5)) sage: H.points() - [(0 : 1 : 0), (0 : 0 : 1), (1 : 7 : 1), (1 : 4 : 1), (5 : 7 : 1), (5 : 4 : 1), (6 : 0 : 1), (7 : 0 : 1), (8 : 0 : 1), (9 : 0 : 1), (10 : 0 : 1)] + [(0 : 1 : 0), (0 : 0 : 1), (1 : 7 : 1), (1 : 4 : 1), (5 : 7 : 1), (5 : 4 : 1), + (6 : 0 : 1), (7 : 0 : 1), (8 : 0 : 1), (9 : 0 : 1), (10 : 0 : 1)] The plane model of the genus 2 hyperelliptic curve in the above example is the curve in `\mathbb{P}^2` defined by `y^2z^4=g(x,z)` where @@ -1571,21 +1589,21 @@ def Cartier_matrix(self): EXAMPLES:: - sage: K.=GF(9,'x')[] - sage: C=HyperellipticCurve(x^7-1,0) + sage: K. = GF(9,'x')[] + sage: C = HyperellipticCurve(x^7 - 1, 0) sage: C.Cartier_matrix() [0 0 2] [0 0 0] [0 1 0] - sage: K.=GF(49,'x')[] - sage: C=HyperellipticCurve(x^5+1,0) + sage: K. = GF(49, 'x')[] + sage: C = HyperellipticCurve(x^5 + 1, 0) sage: C.Cartier_matrix() [0 3] [0 0] - sage: P.=GF(9,'a')[] - sage: E=HyperellipticCurve(x^29+1,0) + sage: P. = GF(9, 'a')[] + sage: E = HyperellipticCurve(x^29 + 1, 0) sage: E.Cartier_matrix() [0 0 1 0 0 0 0 0 0 0 0 0 0 0] [0 0 0 0 0 1 0 0 0 0 0 0 0 0] @@ -1769,21 +1787,21 @@ def Hasse_Witt(self): EXAMPLES:: - sage: K.=GF(9,'x')[] - sage: C=HyperellipticCurve(x^7-1,0) + sage: K. = GF(9, 'x')[] + sage: C = HyperellipticCurve(x^7 - 1, 0) sage: C.Hasse_Witt() [0 0 0] [0 0 0] [0 0 0] - sage: K.=GF(49,'x')[] - sage: C=HyperellipticCurve(x^5+1,0) + sage: K. = GF(49, 'x')[] + sage: C = HyperellipticCurve(x^5 + 1, 0) sage: C.Hasse_Witt() [0 0] [0 0] - sage: P.=GF(9,'a')[] - sage: E=HyperellipticCurve(x^29+1,0) + sage: P. = GF(9, 'a')[] + sage: E = HyperellipticCurve(x^29 + 1, 0) sage: E.Hasse_Witt() [0 0 0 0 0 0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0 0 0 0 0 0] @@ -1825,18 +1843,18 @@ def a_number(self): EXAMPLES:: - sage: K.=GF(49,'x')[] - sage: C=HyperellipticCurve(x^5+1,0) + sage: K. = GF(49, 'x')[] + sage: C = HyperellipticCurve(x^5 + 1, 0) sage: C.a_number() 1 - sage: K.=GF(9,'x')[] - sage: C=HyperellipticCurve(x^7-1,0) + sage: K. = GF(9, 'x')[] + sage: C = HyperellipticCurve(x^7 - 1, 0) sage: C.a_number() 1 - sage: P.=GF(9,'a')[] - sage: E=HyperellipticCurve(x^29+1,0) + sage: P. = GF(9, 'a')[] + sage: E = HyperellipticCurve(x^29 + 1, 0) sage: E.a_number() 5 """ @@ -1867,18 +1885,18 @@ def p_rank(self): EXAMPLES:: - sage: K.=GF(49,'x')[] - sage: C=HyperellipticCurve(x^5+1,0) + sage: K. = GF(49, 'x')[] + sage: C = HyperellipticCurve(x^5 + 1, 0) sage: C.p_rank() 0 - sage: K.=GF(9,'x')[] - sage: C=HyperellipticCurve(x^7-1,0) + sage: K. = GF(9, 'x')[] + sage: C = HyperellipticCurve(x^7 - 1, 0) sage: C.p_rank() 0 - sage: P.=GF(9,'a')[] - sage: E=HyperellipticCurve(x^29+1,0) + sage: P. = GF(9, 'a')[] + sage: E = HyperellipticCurve(x^29 + 1, 0) sage: E.p_rank() 0 """ diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py index ad3b7d59a53..4aea89c393a 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py @@ -3,10 +3,11 @@ EXAMPLES:: - sage: P. = GF(5)[] - sage: f = x^5 - 3*x^4 - 2*x^3 + 6*x^2 + 3*x - 1 - sage: C = HyperellipticCurve(f); C - Hyperelliptic Curve over Finite Field of size 5 defined by y^2 = x^5 + 2*x^4 + 3*x^3 + x^2 + 3*x + 4 + sage: P. = GF(5)[] # optional - sage.rings.finite_rings + sage: f = x^5 - 3*x^4 - 2*x^3 + 6*x^2 + 3*x - 1 # optional - sage.rings.finite_rings + sage: C = HyperellipticCurve(f); C # optional - sage.rings.finite_rings + Hyperelliptic Curve over Finite Field of size 5 + defined by y^2 = x^5 + 2*x^4 + 3*x^3 + x^2 + 3*x + 4 :: @@ -46,12 +47,13 @@ def is_HyperellipticCurve(C): """ EXAMPLES:: + sage: from sage.schemes.hyperelliptic_curves.hyperelliptic_generic import is_HyperellipticCurve sage: R. = QQ[]; C = HyperellipticCurve(x^3 + x - 1); C Hyperelliptic Curve over Rational Field defined by y^2 = x^3 + x - 1 - sage: sage.schemes.hyperelliptic_curves.hyperelliptic_generic.is_HyperellipticCurve(C) + sage: is_HyperellipticCurve(C) True """ - return isinstance(C,HyperellipticCurve_generic) + return isinstance(C, HyperellipticCurve_generic) class HyperellipticCurve_generic(plane_curve.ProjectivePlaneCurve): @@ -83,14 +85,14 @@ class HyperellipticCurve_generic(plane_curve.ProjectivePlaneCurve): sage: C0 = HyperellipticCurve(f0) sage: f1 = x^5 - x^3 + x - 22 sage: C1 = HyperellipticCurve(f1) - sage: Q. = GF(5)[] - sage: f2 = y^5 - y^3 + y - 22 - sage: C2 = HyperellipticCurve(f2) + sage: Q. = GF(5)[] # optional - sage.rings.finite_rings + sage: f2 = y^5 - y^3 + y - 22 # optional - sage.rings.finite_rings + sage: C2 = HyperellipticCurve(f2) # optional - sage.rings.finite_rings sage: hash(C0) == hash(C0) True sage: hash(C0) == hash(C1) False - sage: hash(C1) == hash(C2) + sage: hash(C1) == hash(C2) # optional - sage.rings.finite_rings False """ def __init__(self, PP, f, h=None, names=None, genus=None): @@ -126,16 +128,20 @@ def change_ring(self, R): sage: R. = QQ[] sage: H = HyperellipticCurve(x^5 - 10*x + 9) - sage: K = Qp(3,5) - sage: L. = K.extension(x^30-3) - sage: HK = H.change_ring(K) - sage: HL = HK.change_ring(L); HL - Hyperelliptic Curve over 3-adic Eisenstein Extension Field in a defined by x^30 - 3 defined by (1 + O(a^150))*y^2 = (1 + O(a^150))*x^5 + (2 + 2*a^30 + a^60 + 2*a^90 + 2*a^120 + O(a^150))*x + a^60 + O(a^210) - - sage: R. = FiniteField(7)[] - sage: H = HyperellipticCurve(x^8 + x + 5) - sage: H.base_extend(FiniteField(7^2, 'a')) - Hyperelliptic Curve over Finite Field in a of size 7^2 defined by y^2 = x^8 + x + 5 + sage: K = Qp(3, 5) # optional - sage.rings.padics + sage: L. = K.extension(x^30 - 3) # optional - sage.rings.padics + sage: HK = H.change_ring(K) # optional - sage.rings.padics + sage: HL = HK.change_ring(L); HL # optional - sage.rings.padics + Hyperelliptic Curve + over 3-adic Eisenstein Extension Field in a defined by x^30 - 3 + defined by (1 + O(a^150))*y^2 = (1 + O(a^150))*x^5 + + (2 + 2*a^30 + a^60 + 2*a^90 + 2*a^120 + O(a^150))*x + a^60 + O(a^210) + + sage: R. = FiniteField(7)[] # optional - sage.rings.finite_rings + sage: H = HyperellipticCurve(x^8 + x + 5) # optional - sage.rings.finite_rings + sage: H.base_extend(FiniteField(7^2, 'a')) # optional - sage.rings.finite_rings + Hyperelliptic Curve over Finite Field in a of size 7^2 + defined by y^2 = x^8 + x + 5 """ from .constructor import HyperellipticCurve f, h = self._hyperelliptic_polynomials @@ -192,7 +198,7 @@ def is_singular(self): EXAMPLES:: sage: R. = QQ[] - sage: H = HyperellipticCurve(x^5+1) + sage: H = HyperellipticCurve(x^5 + 1) sage: H.is_singular() False @@ -201,7 +207,7 @@ def is_singular(self): the following example.:: sage: R. = QQ[] - sage: H = HyperellipticCurve(x^5+2) + sage: H = HyperellipticCurve(x^5 + 2) sage: from sage.misc.verbose import set_verbose sage: set_verbose(-1) sage: H.is_singular() @@ -219,23 +225,23 @@ def is_smooth(self): EXAMPLES:: - sage: R. = GF(13)[] - sage: H = HyperellipticCurve(x^8+1) - sage: H.is_smooth() + sage: R. = GF(13)[] # optional - sage.rings.finite_rings + sage: H = HyperellipticCurve(x^8 + 1) # optional - sage.rings.finite_rings + sage: H.is_smooth() # optional - sage.rings.finite_rings True A hyperelliptic curve with genus at least 2 always has a singularity at infinity when viewed as a *plane* projective curve. This can be seen in the following example.:: - sage: R. = GF(27, 'a')[] - sage: H = HyperellipticCurve(x^10+2) + sage: R. = GF(27, 'a')[] # optional - sage.rings.finite_rings + sage: H = HyperellipticCurve(x^10 + 2) # optional - sage.rings.finite_rings sage: from sage.misc.verbose import set_verbose sage: set_verbose(-1) - sage: H.is_smooth() + sage: H.is_smooth() # optional - sage.rings.finite_rings True sage: from sage.schemes.curves.projective_curve import ProjectivePlaneCurve - sage: ProjectivePlaneCurve.is_smooth(H) + sage: ProjectivePlaneCurve.is_smooth(H) # optional - sage.rings.finite_rings False """ return True @@ -285,36 +291,40 @@ def odd_degree_model(self): ... ValueError: No odd degree model exists over field of definition - sage: K2 = QuadraticField(-2, 'a') - sage: Hp2 = H.change_ring(K2).odd_degree_model(); Hp2 - Hyperelliptic Curve over Number Field in a with defining polynomial x^2 + 2 with a = 1.414213562373095?*I defined by y^2 = 6*a*x^5 - 29*x^4 - 20*x^2 + 6*a*x + 1 + sage: K2 = QuadraticField(-2, 'a') # optional - sage.rings.number_field + sage: Hp2 = H.change_ring(K2).odd_degree_model(); Hp2 # optional - sage.rings.number_field + Hyperelliptic Curve over Number Field in a + with defining polynomial x^2 + 2 with a = 1.414213562373095?*I + defined by y^2 = 6*a*x^5 - 29*x^4 - 20*x^2 + 6*a*x + 1 - sage: K3 = QuadraticField(-3, 'b') - sage: Hp3 = H.change_ring(QuadraticField(-3, 'b')).odd_degree_model(); Hp3 - Hyperelliptic Curve over Number Field in b with defining polynomial x^2 + 3 with b = 1.732050807568878?*I defined by y^2 = -4*b*x^5 - 14*x^4 - 20*b*x^3 - 35*x^2 + 6*b*x + 1 + sage: K3 = QuadraticField(-3, 'b') # optional - sage.rings.number_field + sage: Hp3 = H.change_ring(QuadraticField(-3, 'b')).odd_degree_model(); Hp3 # optional - sage.rings.number_field + Hyperelliptic Curve over Number Field in b + with defining polynomial x^2 + 3 with b = 1.732050807568878?*I + defined by y^2 = -4*b*x^5 - 14*x^4 - 20*b*x^3 - 35*x^2 + 6*b*x + 1 - Of course, Hp2 and Hp3 are isomorphic over the composite + Of course, ``Hp2`` and ``Hp3`` are isomorphic over the composite extension. One consequence of this is that odd degree models reduced over "different" fields should have the same number of points on their reductions. 43 and 67 split completely in the compositum, so when we reduce we find: - sage: P2 = K2.factor(43)[0][0] - sage: P3 = K3.factor(43)[0][0] - sage: Hp2.change_ring(K2.residue_field(P2)).frobenius_polynomial() + sage: P2 = K2.factor(43)[0][0] # optional - sage.rings.number_field + sage: P3 = K3.factor(43)[0][0] # optional - sage.rings.number_field + sage: Hp2.change_ring(K2.residue_field(P2)).frobenius_polynomial() # optional - sage.rings.number_field x^4 - 16*x^3 + 134*x^2 - 688*x + 1849 - sage: Hp3.change_ring(K3.residue_field(P3)).frobenius_polynomial() + sage: Hp3.change_ring(K3.residue_field(P3)).frobenius_polynomial() # optional - sage.rings.number_field x^4 - 16*x^3 + 134*x^2 - 688*x + 1849 - sage: H.change_ring(GF(43)).odd_degree_model().frobenius_polynomial() + sage: H.change_ring(GF(43)).odd_degree_model().frobenius_polynomial() # optional - sage.rings.finite_rings x^4 - 16*x^3 + 134*x^2 - 688*x + 1849 - sage: P2 = K2.factor(67)[0][0] - sage: P3 = K3.factor(67)[0][0] - sage: Hp2.change_ring(K2.residue_field(P2)).frobenius_polynomial() + sage: P2 = K2.factor(67)[0][0] # optional - sage.rings.number_field + sage: P3 = K3.factor(67)[0][0] # optional - sage.rings.number_field + sage: Hp2.change_ring(K2.residue_field(P2)).frobenius_polynomial() # optional - sage.rings.number_field x^4 - 8*x^3 + 150*x^2 - 536*x + 4489 - sage: Hp3.change_ring(K3.residue_field(P3)).frobenius_polynomial() + sage: Hp3.change_ring(K3.residue_field(P3)).frobenius_polynomial() # optional - sage.rings.number_field x^4 - 8*x^3 + 150*x^2 - 536*x + 4489 - sage: H.change_ring(GF(67)).odd_degree_model().frobenius_polynomial() + sage: H.change_ring(GF(67)).odd_degree_model().frobenius_polynomial() # optional - sage.rings.finite_rings x^4 - 8*x^3 + 150*x^2 - 536*x + 4489 TESTS:: @@ -373,15 +383,18 @@ def _magma_init_(self, magma): EXAMPLES:: sage: R. = QQ[]; C = HyperellipticCurve(x^3 + x - 1, x); C - Hyperelliptic Curve over Rational Field defined by y^2 + x*y = x^3 + x - 1 - sage: magma(C) # optional - magma + Hyperelliptic Curve over Rational Field + defined by y^2 + x*y = x^3 + x - 1 + sage: magma(C) # optional - magma Hyperelliptic Curve defined by y^2 + x*y = x^3 + x - 1 over Rational Field - sage: R. = GF(9,'a')[]; C = HyperellipticCurve(x^3 + x - 1, x^10); C - Hyperelliptic Curve over Finite Field in a of size 3^2 defined by y^2 + x^10*y = x^3 + x + 2 - sage: D = magma(C); D # optional - magma + sage: R. = GF(9,'a')[]; C = HyperellipticCurve(x^3 + x - 1, x^10); C # optional - sage.rings.finite_rings + Hyperelliptic Curve over Finite Field in a of size 3^2 + defined by y^2 + x^10*y = x^3 + x + 2 + sage: D = magma(C); D # optional - magma # optional - sage.rings.finite_rings Hyperelliptic Curve defined by y^2 + (x^10)*y = x^3 + x + 2 over GF(3^2) - sage: D.sage() # optional - magma - Hyperelliptic Curve over Finite Field in a of size 3^2 defined by y^2 + x^10*y = x^3 + x + 2 + sage: D.sage() # optional - magma # optional - sage.rings.finite_rings + Hyperelliptic Curve over Finite Field in a of size 3^2 + defined by y^2 + x^10*y = x^3 + x + 2 """ f, h = self._hyperelliptic_polynomials return 'HyperellipticCurve(%s, %s)'%(f._magma_init_(magma), h._magma_init_(magma)) @@ -429,15 +442,15 @@ def local_coordinates_at_nonweierstrass(self, P, prec=20, name='t'): EXAMPLES:: sage: R. = QQ['x'] - sage: H = HyperellipticCurve(x^5-23*x^3+18*x^2+40*x) - sage: P = H(1,6) - sage: x,y = H.local_coordinates_at_nonweierstrass(P,prec=5) + sage: H = HyperellipticCurve(x^5 - 23*x^3 + 18*x^2 + 40*x) + sage: P = H(1, 6) + sage: x,y = H.local_coordinates_at_nonweierstrass(P, prec=5) sage: x 1 + t + O(t^5) sage: y 6 + t - 7/2*t^2 - 1/2*t^3 - 25/48*t^4 + O(t^5) - sage: Q = H(-2,12) - sage: x,y = H.local_coordinates_at_nonweierstrass(Q,prec=5) + sage: Q = H(-2, 12) + sage: x,y = H.local_coordinates_at_nonweierstrass(Q, prec=5) sage: x -2 + t + O(t^5) sage: y @@ -481,7 +494,7 @@ def local_coordinates_at_weierstrass(self, P, prec=20, name='t'): EXAMPLES:: sage: R. = QQ['x'] - sage: H = HyperellipticCurve(x^5-23*x^3+18*x^2+40*x) + sage: H = HyperellipticCurve(x^5 - 23*x^3 + 18*x^2 + 40*x) sage: A = H(4, 0) sage: x, y = H.local_coordinates_at_weierstrass(A, prec=7) sage: x @@ -533,7 +546,7 @@ def local_coordinates_at_infinity(self, prec=20, name='t'): EXAMPLES:: sage: R. = QQ['x'] - sage: H = HyperellipticCurve(x^5-5*x^2+1) + sage: H = HyperellipticCurve(x^5 - 5*x^2 + 1) sage: x,y = H.local_coordinates_at_infinity(10) sage: x t^-2 + 5*t^4 - t^8 - 50*t^10 + O(t^12) @@ -543,7 +556,7 @@ def local_coordinates_at_infinity(self, prec=20, name='t'): :: sage: R. = QQ['x'] - sage: H = HyperellipticCurve(x^3-x+1) + sage: H = HyperellipticCurve(x^3 - x + 1) sage: x,y = H.local_coordinates_at_infinity(10) sage: x t^-2 + t^2 - t^4 - t^6 + 3*t^8 + O(t^12) @@ -587,13 +600,14 @@ def local_coord(self, P, prec=20, name='t'): EXAMPLES:: sage: R. = QQ['x'] - sage: H = HyperellipticCurve(x^5-23*x^3+18*x^2+40*x) + sage: H = HyperellipticCurve(x^5 - 23*x^3 + 18*x^2 + 40*x) sage: H.local_coord(H(1 ,6), prec=5) (1 + t + O(t^5), 6 + t - 7/2*t^2 - 1/2*t^3 - 25/48*t^4 + O(t^5)) sage: H.local_coord(H(4, 0), prec=7) (4 + 1/360*t^2 - 191/23328000*t^4 + 7579/188956800000*t^6 + O(t^7), t + O(t^7)) sage: H.local_coord(H(0, 1, 0), prec=5) - (t^-2 + 23*t^2 - 18*t^4 - 569*t^6 + O(t^7), t^-5 + 46*t^-1 - 36*t - 609*t^3 + 1656*t^5 + O(t^6)) + (t^-2 + 23*t^2 - 18*t^4 - 569*t^6 + O(t^7), + t^-5 + 46*t^-1 - 36*t - 609*t^3 + 1656*t^5 + O(t^6)) AUTHOR: - Jennifer Balakrishnan (2007-12) @@ -616,7 +630,8 @@ def rational_points(self, **kwds): For the LMFDB genus 2 curve `932.a.3728.1 `:: - sage: R. = PolynomialRing(QQ); C = HyperellipticCurve(R([0, -1, 1, 0, 1, -2, 1]), R([1])); + sage: R. = PolynomialRing(QQ) + sage: C = HyperellipticCurve(R([0, -1, 1, 0, 1, -2, 1]), R([1])) sage: C.rational_points(bound=8) [(-1 : -3 : 1), (-1 : 2 : 1), @@ -631,7 +646,7 @@ def rational_points(self, **kwds): Check that :trac:`29509` is fixed for the LMFDB genus 2 curve `169.a.169.1 `:: - sage: C = HyperellipticCurve(R([0, 0, 0, 0, 1, 1]), R([1, 1, 0, 1])); + sage: C = HyperellipticCurve(R([0, 0, 0, 0, 1, 1]), R([1, 1, 0, 1])) sage: C.rational_points(bound=10) [(-1 : 0 : 1), (-1 : 1 : 1), @@ -641,9 +656,9 @@ def rational_points(self, **kwds): An example over a number field:: - sage: R. = PolynomialRing(QuadraticField(2)); - sage: C = HyperellipticCurve(R([1, 0, 0, 0, 0, 1])); - sage: C.rational_points(bound=2) + sage: R. = PolynomialRing(QuadraticField(2)) # optional - sage.rings.number_field + sage: C = HyperellipticCurve(R([1, 0, 0, 0, 0, 1])) # optional - sage.rings.number_field + sage: C.rational_points(bound=2) # optional - sage.rings.number_field [(-1 : 0 : 1), (0 : -1 : 1), (0 : 1 : 0), diff --git a/src/sage/schemes/hyperelliptic_curves/invariants.py b/src/sage/schemes/hyperelliptic_curves/invariants.py index a6952117abc..b0793dc5524 100644 --- a/src/sage/schemes/hyperelliptic_curves/invariants.py +++ b/src/sage/schemes/hyperelliptic_curves/invariants.py @@ -24,14 +24,15 @@ def diffxy(f, x, xtimes, y, ytimes): EXAMPLES:: + sage: from sage.schemes.hyperelliptic_curves.invariants import diffxy sage: R. = QQ[] - sage: sage.schemes.hyperelliptic_curves.invariants.diffxy(u^2*v^3, u, 0, v, 0) + sage: .diffxy(u^2*v^3, u, 0, v, 0) u^2*v^3 - sage: sage.schemes.hyperelliptic_curves.invariants.diffxy(u^2*v^3, u, 2, v, 1) + sage: diffxy(u^2*v^3, u, 2, v, 1) 6*v^2 - sage: sage.schemes.hyperelliptic_curves.invariants.diffxy(u^2*v^3, u, 2, v, 2) + sage: diffxy(u^2*v^3, u, 2, v, 2) 12*v - sage: sage.schemes.hyperelliptic_curves.invariants.diffxy(u^2*v^3 + u^4*v^4, u, 2, v, 2) + sage: diffxy(u^2*v^3 + u^4*v^4, u, 2, v, 2) 144*u^2*v^2 + 12*v """ h = f @@ -67,7 +68,8 @@ def differential_operator(f, g, k): sage: differential_operator(x^2*y, x*y^2, 2) 1/36*dfdy^2*dgdx^2 - 1/18*dfdx*dfdy*dgdx*dgdy + 1/36*dfdx^2*dgdy^2 sage: differential_operator(x^2*y, x*y^2, 4) - 1/576*dfdy^4*dgdx^4 - 1/144*dfdx*dfdy^3*dgdx^3*dgdy + 1/96*dfdx^2*dfdy^2*dgdx^2*dgdy^2 - 1/144*dfdx^3*dfdy*dgdx*dgdy^3 + 1/576*dfdx^4*dgdy^4 + 1/576*dfdy^4*dgdx^4 - 1/144*dfdx*dfdy^3*dgdx^3*dgdy + 1/96*dfdx^2*dfdy^2*dgdx^2*dgdy^2 + - 1/144*dfdx^3*dfdy*dgdx*dgdy^3 + 1/576*dfdx^4*dgdy^4 """ (x, y) = f.parent().gens() n = max(ZZ(f.degree()), ZZ(k)) @@ -173,8 +175,8 @@ def ubs(f): 'y2': 0, 'y3': 0} - sage: R. = GF(31)[] - sage: ubs(t^6 + 2*t^5 + t^2 + 3*t + 1) + sage: R. = GF(31)[] # optional - sage.rings.finite_rings + sage: ubs(t^6 + 2*t^5 + t^2 + 3*t + 1) # optional - sage.rings.finite_rings {'A': 0, 'B': -12, 'C': -15, @@ -217,11 +219,11 @@ def clebsch_to_igusa(A, B, C, D): sage: igusa_to_clebsch(*clebsch_to_igusa(2, 3, 4, 5)) (2, 3, 4, 5) - sage: Cs = tuple(map(GF(31), (2, 3, 4, 5))); Cs + sage: Cs = tuple(map(GF(31), (2, 3, 4, 5))); Cs # optional - sage.rings.finite_rings (2, 3, 4, 5) - sage: clebsch_to_igusa(*Cs) + sage: clebsch_to_igusa(*Cs) # optional - sage.rings.finite_rings (8, 10, 15, 26) - sage: igusa_to_clebsch(*clebsch_to_igusa(*Cs)) + sage: igusa_to_clebsch(*clebsch_to_igusa(*Cs)) # optional - sage.rings.finite_rings (2, 3, 4, 5) """ I2 = -120*A @@ -243,11 +245,11 @@ def igusa_to_clebsch(I2, I4, I6, I10): sage: clebsch_to_igusa(*igusa_to_clebsch(-2400, 173700, 23112000, -10309890600)) (-2400, 173700, 23112000, -10309890600) - sage: Is = tuple(map(GF(31), (-2400, 173700, 23112000, -10309890600))); Is + sage: Is = tuple(map(GF(31), (-2400, 173700, 23112000, -10309890600))); Is # optional - sage.rings.finite_rings (18, 7, 12, 27) - sage: igusa_to_clebsch(*Is) + sage: igusa_to_clebsch(*Is) # optional - sage.rings.finite_rings (20, 25, 25, 12) - sage: clebsch_to_igusa(*igusa_to_clebsch(*Is)) + sage: clebsch_to_igusa(*igusa_to_clebsch(*Is)) # optional - sage.rings.finite_rings (18, 7, 12, 27) """ A = -(+ I2) / 120 @@ -274,9 +276,9 @@ def clebsch_invariants(f): sage: clebsch_invariants(x^6 + x^5 + x^4 + x^2 + 2) (62/15, 15434/5625, -236951/140625, 229930748/791015625) - sage: magma(x^6 + 1).ClebschInvariants() # optional - magma + sage: magma(x^6 + 1).ClebschInvariants() # optional - magma [ 2, 2/3, -2/9, 0 ] - sage: magma(x^6 + x^5 + x^4 + x^2 + 2).ClebschInvariants() # optional - magma + sage: magma(x^6 + x^5 + x^4 + x^2 + 2).ClebschInvariants() # optional - magma [ 62/15, 15434/5625, -236951/140625, 229930748/791015625 ] """ R = f.parent().base_ring() @@ -307,9 +309,9 @@ def igusa_clebsch_invariants(f): sage: igusa_clebsch_invariants(x^6 + x^5 + x^4 + x^2 + 2) (-496, 6220, -955932, -1111784) - sage: magma(x^6 + 1).IgusaClebschInvariants() # optional - magma + sage: magma(x^6 + 1).IgusaClebschInvariants() # optional - magma [ -240, 1620, -119880, -46656 ] - sage: magma(x^6 + x^5 + x^4 + x^2 + 2).IgusaClebschInvariants() # optional - magma + sage: magma(x^6 + x^5 + x^4 + x^2 + 2).IgusaClebschInvariants() # optional - magma [ -496, 6220, -955932, -1111784 ] TESTS: @@ -321,10 +323,11 @@ def igusa_clebsch_invariants(f): sage: igusa_clebsch_invariants(x^5 + a*x^4 + b*x^3 + c*x^2 + d*x + e)[0] 6*b^2 - 16*a*c + 40*d - sage: absolute_igusa_invariants_wamelen(GF(5)['x'](x^6 - 2*x)) + sage: absolute_igusa_invariants_wamelen(GF(5)['x'](x^6 - 2*x)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... - NotImplementedError: Invariants of binary sextics/genus 2 hyperelliptic curves not implemented in characteristics 2, 3, and 5 + NotImplementedError: Invariants of binary sextics/genus 2 hyperelliptic curves + not implemented in characteristics 2, 3, and 5 """ return clebsch_to_igusa(*clebsch_invariants(f)) @@ -348,16 +351,18 @@ def absolute_igusa_invariants_wamelen(f): The following example can be checked against van Wamelen's paper:: - sage: i1, i2, i3 = absolute_igusa_invariants_wamelen(-x^5 + 3*x^4 + 2*x^3 - 6*x^2 - 3*x + 1) + sage: h = -x^5 + 3*x^4 + 2*x^3 - 6*x^2 - 3*x + 1 + sage: i1, i2, i3 = absolute_igusa_invariants_wamelen(h) sage: list(map(factor, (i1, i2, i3))) [2^7 * 3^15, 2^5 * 3^11 * 5, 2^4 * 3^9 * 31] TESTS:: - sage: absolute_igusa_invariants_wamelen(GF(3)['x'](x^5 - 2*x)) + sage: absolute_igusa_invariants_wamelen(GF(3)['x'](x^5 - 2*x)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... - NotImplementedError: Invariants of binary sextics/genus 2 hyperelliptic curves not implemented in characteristics 2, 3, and 5 + NotImplementedError: Invariants of binary sextics/genus 2 hyperelliptic curves + not implemented in characteristics 2, 3, and 5 """ I2, I4, I6, I10 = igusa_clebsch_invariants(f) i1 = I2**5/I10 @@ -383,7 +388,8 @@ def absolute_igusa_invariants_kohel(f): The following example can be checked against Kohel's database [KohECHIDNA]_ :: - sage: i1, i2, i3 = absolute_igusa_invariants_kohel(-x^5 + 3*x^4 + 2*x^3 - 6*x^2 - 3*x + 1) + sage: h = -x^5 + 3*x^4 + 2*x^3 - 6*x^2 - 3*x + 1 + sage: i1, i2, i3 = absolute_igusa_invariants_kohel(h) sage: list(map(factor, (i1, i2, i3))) [2^2 * 3^5 * 5 * 31, 2^5 * 3^11 * 5, 2^4 * 3^9 * 31] sage: list(map(factor, (150660, 28343520, 9762768))) @@ -391,10 +397,11 @@ def absolute_igusa_invariants_kohel(f): TESTS:: - sage: absolute_igusa_invariants_kohel(GF(2)['x'](x^5 - x)) + sage: absolute_igusa_invariants_kohel(GF(2)['x'](x^5 - x)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... - NotImplementedError: Invariants of binary sextics/genus 2 hyperelliptic curves not implemented in characteristics 2, 3, and 5 + NotImplementedError: Invariants of binary sextics/genus 2 hyperelliptic curves + not implemented in characteristics 2, 3, and 5 """ I2, I4, I6, I10 = igusa_clebsch_invariants(f) i1 = I4*I6/I10 diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py b/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py index 21de152a878..b8c224a5db9 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py @@ -23,21 +23,21 @@ class HyperellipticJacobian_generic(Jacobian_generic): """ EXAMPLES:: - sage: FF = FiniteField(2003) - sage: R. = PolynomialRing(FF) - sage: f = x**5 + 1184*x**3 + 1846*x**2 + 956*x + 560 - sage: C = HyperellipticCurve(f) - sage: J = C.jacobian() - sage: a = x**2 + 376*x + 245; b = 1015*x + 1368 - sage: X = J(FF) - sage: D = X([a,b]) - sage: D + sage: FF = FiniteField(2003) # optional - sage.rings.finite_rings + sage: R. = PolynomialRing(FF) # optional - sage.rings.finite_rings + sage: f = x**5 + 1184*x**3 + 1846*x**2 + 956*x + 560 # optional - sage.rings.finite_rings + sage: C = HyperellipticCurve(f) # optional - sage.rings.finite_rings + sage: J = C.jacobian() # optional - sage.rings.finite_rings + sage: a = x**2 + 376*x + 245; b = 1015*x + 1368 # optional - sage.rings.finite_rings + sage: X = J(FF) # optional - sage.rings.finite_rings + sage: D = X([a,b]) # optional - sage.rings.finite_rings + sage: D # optional - sage.rings.finite_rings (x^2 + 376*x + 245, y + 988*x + 635) - sage: J(0) + sage: J(0) # optional - sage.rings.finite_rings (1) - sage: D == J([a,b]) + sage: D == J([a,b]) # optional - sage.rings.finite_rings True - sage: D == D + J(0) + sage: D == D + J(0) # optional - sage.rings.finite_rings True An more extended example, demonstrating arithmetic in J(QQ) and @@ -56,24 +56,29 @@ class HyperellipticJacobian_generic(Jacobian_generic): sage: C.defining_polynomial() -x0^5 + x0*x1*x2^3 + x1^2*x2^3 + x0*x2^4 - x2^5 sage: C(QQ) - Set of rational points of Hyperelliptic Curve over Rational Field defined by v^2 + u*v = u^5 - u + 1 - sage: K. = NumberField(x^2-2) - sage: C(K) - Set of rational points of Hyperelliptic Curve over Number Field in t with defining polynomial x^2 - 2 defined by v^2 + u*v = u^5 - u + 1 + Set of rational points of Hyperelliptic Curve over Rational Field + defined by v^2 + u*v = u^5 - u + 1 + sage: K. = NumberField(x^2 - 2) # optional - sage.rings.number_field + sage: C(K) # optional - sage.rings.number_field + Set of rational points of Hyperelliptic Curve + over Number Field in t with defining polynomial x^2 - 2 + defined by v^2 + u*v = u^5 - u + 1 sage: P = C(QQ)(0,1,1); P (0 : 1 : 1) sage: P == C(0,1,1) True sage: C(0,1,1).parent() - Set of rational points of Hyperelliptic Curve over Rational Field defined by v^2 + u*v = u^5 - u + 1 - sage: P1 = C(K)(P) - sage: P2 = C(K)([2,4*t-1,1]) - sage: P3 = C(K)([-1/2,1/8*(7*t+2),1]) - sage: P1, P2, P3 + Set of rational points of Hyperelliptic Curve over Rational Field + defined by v^2 + u*v = u^5 - u + 1 + sage: P1 = C(K)(P) # optional - sage.rings.number_field + sage: P2 = C(K)([2, 4*t - 1, 1]) # optional - sage.rings.number_field + sage: P3 = C(K)([-1/2, 1/8*(7*t+2), 1]) # optional - sage.rings.number_field + sage: P1, P2, P3 # optional - sage.rings.number_field ((0 : 1 : 1), (2 : 4*t - 1 : 1), (-1/2 : 7/8*t + 1/4 : 1)) sage: J = C.jacobian() sage: J - Jacobian of Hyperelliptic Curve over Rational Field defined by v^2 + u*v = u^5 - u + 1 + Jacobian of Hyperelliptic Curve over Rational Field + defined by v^2 + u*v = u^5 - u + 1 sage: Q = J(QQ)(P); Q (u, v - 1) sage: for i in range(6): Q*i @@ -83,47 +88,54 @@ class HyperellipticJacobian_generic(Jacobian_generic): (u^2, v + 1) (u, v + 1) (1) - sage: Q1 = J(K)(P1); print("%s -> %s"%( P1, Q1 )) + sage: Q1 = J(K)(P1); print("%s -> %s"%( P1, Q1 )) # optional - sage.rings.number_field (0 : 1 : 1) -> (u, v - 1) - sage: Q2 = J(K)(P2); print("%s -> %s"%( P2, Q2 )) + sage: Q2 = J(K)(P2); print("%s -> %s"%( P2, Q2 )) # optional - sage.rings.number_field (2 : 4*t - 1 : 1) -> (u - 2, v - 4*t + 1) - sage: Q3 = J(K)(P3); print("%s -> %s"%( P3, Q3 )) + sage: Q3 = J(K)(P3); print("%s -> %s"%( P3, Q3 )) # optional - sage.rings.number_field (-1/2 : 7/8*t + 1/4 : 1) -> (u + 1/2, v - 7/8*t - 1/4) - sage: R. = PolynomialRing(K) - sage: Q4 = J(K)([x^2-t,R(1)]) - sage: for i in range(4): Q4*i + sage: R. = PolynomialRing(K) # optional - sage.rings.number_field + sage: Q4 = J(K)([x^2 - t, R(1)]) # optional - sage.rings.number_field + sage: for i in range(4): Q4*i # optional - sage.rings.number_field (1) (u^2 - t, v - 1) (u^2 + (-3/4*t - 9/16)*u + 1/2*t + 1/4, v + (-1/32*t - 57/64)*u + 1/2*t + 9/16) - (u^2 + (1352416/247009*t - 1636930/247009)*u - 1156544/247009*t + 1900544/247009, v + (-2326345442/122763473*t + 3233153137/122763473)*u + 2439343104/122763473*t - 3350862929/122763473) - sage: R2 = Q2*5; R2 - (u^2 - 3789465233/116983808*u - 267915823/58491904, v + (-233827256513849/1789384327168*t + 1/2)*u - 15782925357447/894692163584*t) - sage: R3 = Q3*5; R3 - (u^2 + 5663300808399913890623/14426454798950909645952*u - 26531814176395676231273/28852909597901819291904, v + (253155440321645614070860868199103/2450498420175733688903836378159104*t + 1/2)*u + 2427708505064902611513563431764311/4900996840351467377807672756318208*t) - sage: R4 = Q4*5; R4 - (u^2 - 3789465233/116983808*u - 267915823/58491904, v + (233827256513849/1789384327168*t + 1/2)*u + 15782925357447/894692163584*t) + (u^2 + (1352416/247009*t - 1636930/247009)*u - 1156544/247009*t + 1900544/247009, + v + (-2326345442/122763473*t + 3233153137/122763473)*u + + 2439343104/122763473*t - 3350862929/122763473) + sage: R2 = Q2*5; R2 # optional - sage.rings.number_field + (u^2 - 3789465233/116983808*u - 267915823/58491904, + v + (-233827256513849/1789384327168*t + 1/2)*u - 15782925357447/894692163584*t) + sage: R3 = Q3*5; R3 # optional - sage.rings.number_field + (u^2 + 5663300808399913890623/14426454798950909645952*u + - 26531814176395676231273/28852909597901819291904, + v + (253155440321645614070860868199103/2450498420175733688903836378159104*t + 1/2)*u + + 2427708505064902611513563431764311/4900996840351467377807672756318208*t) + sage: R4 = Q4*5; R4 # optional - sage.rings.number_field + (u^2 - 3789465233/116983808*u - 267915823/58491904, + v + (233827256513849/1789384327168*t + 1/2)*u + 15782925357447/894692163584*t) Thus we find the following identity:: - sage: 5*Q2 + 5*Q4 + sage: 5*Q2 + 5*Q4 # optional - sage.rings.number_field (1) Moreover the following relation holds in the 5-torsion subgroup:: - sage: Q2 + Q4 == 2*Q1 + sage: Q2 + Q4 == 2*Q1 # optional - sage.rings.number_field True TESTS:: - sage: k. = GF(9); R. = k[] - sage: J1 = HyperellipticCurve(x^3 + x - 1, x+a).jacobian() - sage: FF = FiniteField(2003) - sage: R. = PolynomialRing(FF) - sage: f = x**5 + 1184*x**3 + 1846*x**2 + 956*x + 560 - sage: J2 = HyperellipticCurve(f).jacobian() - sage: J1 == J1 + sage: k. = GF(9); R. = k[] # optional - sage.rings.finite_rings + sage: J1 = HyperellipticCurve(x^3 + x - 1, x + a).jacobian() # optional - sage.rings.finite_rings + sage: FF = FiniteField(2003) # optional - sage.rings.finite_rings + sage: R. = PolynomialRing(FF) # optional - sage.rings.finite_rings + sage: f = x**5 + 1184*x**3 + 1846*x**2 + 956*x + 560 # optional - sage.rings.finite_rings + sage: J2 = HyperellipticCurve(f).jacobian() # optional - sage.rings.finite_rings + sage: J1 == J1 # optional - sage.rings.finite_rings True - sage: J1 == J2 + sage: J1 == J2 # optional - sage.rings.finite_rings False """ def dimension(self): @@ -136,12 +148,12 @@ def dimension(self): EXAMPLES:: - sage: k. = GF(9); R. = k[] - sage: HyperellipticCurve(x^3 + x - 1, x+a).jacobian().dimension() + sage: k. = GF(9); R. = k[] # optional - sage.rings.finite_rings + sage: HyperellipticCurve(x^3 + x - 1, x + a).jacobian().dimension() # optional - sage.rings.finite_rings 1 - sage: g = HyperellipticCurve(x^6 + x - 1, x+a).jacobian().dimension(); g + sage: g = HyperellipticCurve(x^6 + x - 1, x + a).jacobian().dimension(); g # optional - sage.rings.finite_rings 2 - sage: type(g) + sage: type(g) # optional - sage.rings.finite_rings <... 'sage.rings.integer.Integer'> """ return Integer(self.curve().genus()) diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py b/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py index 74cdccbaa49..8ed4e0d3f45 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py @@ -8,7 +8,8 @@ sage: C = HyperellipticCurve(f); C Hyperelliptic Curve over Rational Field defined by y^2 = x^5 + x + 1 sage: C(QQ) - Set of rational points of Hyperelliptic Curve over Rational Field defined by y^2 = x^5 + x + 1 + Set of rational points of Hyperelliptic Curve over Rational Field + defined by y^2 = x^5 + x + 1 sage: P = C([0,1,1]) sage: J = C.jacobian(); J Jacobian of Hyperelliptic Curve over Rational Field defined by y^2 = x^5 + x + 1 @@ -21,23 +22,18 @@ :: - sage: F. = GF(3) - sage: R. = F[] - sage: f = x^5-1 - sage: C = HyperellipticCurve(f) - sage: J = C.jacobian() - sage: X = J(F) - sage: a = x^2-x+1 - sage: b = -x +1 - sage: c = x-1 - sage: d = 0 - sage: D1 = X([a,b]) - sage: D1 + sage: F. = GF(3) # optional - sage.rings.finite_rings + sage: R. = F[] # optional - sage.rings.finite_rings + sage: f = x^5 - 1 # optional - sage.rings.finite_rings + sage: C = HyperellipticCurve(f) # optional - sage.rings.finite_rings + sage: J = C.jacobian() # optional - sage.rings.finite_rings + sage: X = J(F) # optional - sage.rings.finite_rings + sage: a = x^2 - x + 1; b = -x + 1; c = x - 1; d = 0 # optional - sage.rings.finite_rings + sage: D1 = X([a,b]); D1 # optional - sage.rings.finite_rings (x^2 + 2*x + 1, y + x + 2) - sage: D2 = X([c,d]) - sage: D2 + sage: D2 = X([c,d]); D2 # optional - sage.rings.finite_rings (x + 2, y) - sage: D1+D2 + sage: D1 + D2 # optional - sage.rings.finite_rings (x^2 + 2*x + 2, y + 2*x + 1) """ # **************************************************************************** @@ -102,23 +98,18 @@ def __call__(self, P): :: - sage: F. = GF(3) - sage: R. = F[] - sage: f = x^5-1 - sage: C = HyperellipticCurve(f) - sage: J = C.jacobian() - sage: X = J(F) - sage: a = x^2-x+1 - sage: b = -x +1 - sage: c = x-1 - sage: d = 0 - sage: D1 = X([a,b]) - sage: D1 + sage: F. = GF(3) # optional - sage.rings.finite_rings + sage: R. = F[] # optional - sage.rings.finite_rings + sage: f = x^5 - 1 # optional - sage.rings.finite_rings + sage: C = HyperellipticCurve(f) # optional - sage.rings.finite_rings + sage: J = C.jacobian() # optional - sage.rings.finite_rings + sage: X = J(F) # optional - sage.rings.finite_rings + sage: a = x^2 - x + 1; b = -x + 1; c = x - 1; d = 0 # optional - sage.rings.finite_rings + sage: D1 = X([a,b]); D1 # optional - sage.rings.finite_rings (x^2 + 2*x + 1, y + x + 2) - sage: D2 = X([c,d]) - sage: D2 + sage: D2 = X([c,d]); D2 # optional - sage.rings.finite_rings (x + 2, y) - sage: D1+D2 + sage: D1 + D2 # optional - sage.rings.finite_rings (x^2 + 2*x + 2, y + 2*x + 1) """ if isinstance(P, (Integer, int)) and P == 0: diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py b/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py index 19262aece79..ae2e36228c0 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py @@ -36,42 +36,42 @@ :: - sage: x = GF(37)['x'].gen() - sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x); H + sage: x = GF(37)['x'].gen() # optional - sage.rings.finite_rings + sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x); H # optional - sage.rings.finite_rings Hyperelliptic Curve over Finite Field of size 37 defined by y^2 = x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x At this time, Jacobians of hyperelliptic curves are handled differently than elliptic curves:: - sage: J = H.jacobian(); J + sage: J = H.jacobian(); J # optional - sage.rings.finite_rings Jacobian of Hyperelliptic Curve over Finite Field of size 37 defined by y^2 = x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x - sage: J = J(J.base_ring()); J + sage: J = J(J.base_ring()); J # optional - sage.rings.finite_rings Set of rational points of Jacobian of Hyperelliptic Curve over Finite Field of size 37 defined by y^2 = x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x Points on the Jacobian are represented by Mumford's polynomials. First we find a couple of points on the curve:: - sage: P1 = H.lift_x(2); P1 + sage: P1 = H.lift_x(2); P1 # optional - sage.rings.finite_rings (2 : 11 : 1) - sage: Q1 = H.lift_x(10); Q1 + sage: Q1 = H.lift_x(10); Q1 # optional - sage.rings.finite_rings (10 : 18 : 1) Observe that 2 and 10 are the roots of the polynomials in x, respectively:: - sage: P = J(P1); P + sage: P = J(P1); P # optional - sage.rings.finite_rings (x + 35, y + 26) - sage: Q = J(Q1); Q + sage: Q = J(Q1); Q # optional - sage.rings.finite_rings (x + 27, y + 19) :: - sage: P + Q + sage: P + Q # optional - sage.rings.finite_rings (x^2 + 25*x + 20, y + 13*x) - sage: (x^2 + 25*x + 20).roots(multiplicities=False) + sage: (x^2 + 25*x + 20).roots(multiplicities=False) # optional - sage.rings.finite_rings [10, 2] Frobenius satisfies @@ -85,24 +85,24 @@ :: - sage: 1904*P + sage: 1904*P # optional - sage.rings.finite_rings (1) - sage: 34*P == 0 + sage: 34*P == 0 # optional - sage.rings.finite_rings True - sage: 35*P == P + sage: 35*P == P # optional - sage.rings.finite_rings True - sage: 33*P == -P + sage: 33*P == -P # optional - sage.rings.finite_rings True :: - sage: Q*1904 + sage: Q*1904 # optional - sage.rings.finite_rings (1) - sage: Q*238 == 0 + sage: Q*238 == 0 # optional - sage.rings.finite_rings True - sage: Q*239 == Q + sage: Q*239 == Q # optional - sage.rings.finite_rings True - sage: Q*237 == -Q + sage: Q*237 == -Q # optional - sage.rings.finite_rings True """ @@ -230,23 +230,23 @@ def cantor_composition_simple(D1,D2,f,genus): :: - sage: F. = NumberField(x^2 - 2, 'a') - sage: J = H.jacobian()(F); J + sage: F. = NumberField(x^2 - 2, 'a') # optional - sage.rings.number_field + sage: J = H.jacobian()(F); J # optional - sage.rings.number_field Set of rational points of Jacobian of Hyperelliptic Curve over Number Field in a with defining polynomial x^2 - 2 defined by y^2 = x^5 + x :: - sage: P = J(H.lift_x(F(1))); P + sage: P = J(H.lift_x(F(1))); P # optional - sage.rings.number_field (x - 1, y - a) - sage: Q = J(H.lift_x(F(0))); Q + sage: Q = J(H.lift_x(F(0))); Q # optional - sage.rings.number_field (x, y) - sage: 2*P + 2*Q # indirect doctest + sage: 2*P + 2*Q # indirect doctest # optional - sage.rings.number_field (x^2 - 2*x + 1, y - 3/2*a*x + 1/2*a) - sage: 2*(P + Q) # indirect doctest + sage: 2*(P + Q) # indirect doctest # optional - sage.rings.number_field (x^2 - 2*x + 1, y - 3/2*a*x + 1/2*a) - sage: 3*P # indirect doctest + sage: 3*P # indirect doctest # optional - sage.rings.number_field (x^2 - 25/32*x + 49/32, y - 45/256*a*x - 315/256*a) """ a1, b1 = D1 @@ -272,48 +272,57 @@ def cantor_composition(D1,D2,f,h,genus): r""" EXAMPLES:: - sage: F. = GF(7^2, 'a') - sage: x = F['x'].gen() - sage: f = x^7 + x^2 + a - sage: H = HyperellipticCurve(f, 2*x); H - Hyperelliptic Curve over Finite Field in a of size 7^2 defined by y^2 + 2*x*y = x^7 + x^2 + a - sage: J = H.jacobian()(F); J + sage: F. = GF(7^2, 'a') # optional - sage.rings.finite_rings + sage: x = F['x'].gen() # optional - sage.rings.finite_rings + sage: f = x^7 + x^2 + a # optional - sage.rings.finite_rings + sage: H = HyperellipticCurve(f, 2*x); H # optional - sage.rings.finite_rings + Hyperelliptic Curve over Finite Field in a of size 7^2 + defined by y^2 + 2*x*y = x^7 + x^2 + a + sage: J = H.jacobian()(F); J # optional - sage.rings.finite_rings Set of rational points of Jacobian of Hyperelliptic Curve over Finite Field in a of size 7^2 defined by y^2 + 2*x*y = x^7 + x^2 + a :: - sage: Q = J(H.lift_x(F(1))); Q + sage: Q = J(H.lift_x(F(1))); Q # optional - sage.rings.finite_rings (x + 6, y + 2*a + 2) - sage: 10*Q # indirect doctest - (x^3 + (3*a + 1)*x^2 + (2*a + 5)*x + a + 5, y + (4*a + 5)*x^2 + (a + 1)*x + 6*a + 3) - sage: 7*8297*Q + sage: 10*Q # indirect doctest # optional - sage.rings.finite_rings + (x^3 + (3*a + 1)*x^2 + (2*a + 5)*x + a + 5, + y + (4*a + 5)*x^2 + (a + 1)*x + 6*a + 3) + sage: 7*8297*Q # optional - sage.rings.finite_rings (1) :: - sage: Q = J(H.lift_x(F(a+1))); Q + sage: Q = J(H.lift_x(F(a+1))); Q # optional - sage.rings.finite_rings (x + 6*a + 6, y + 2*a) - sage: 7*8297*Q # indirect doctest + sage: 7*8297*Q # indirect doctest # optional - sage.rings.finite_rings (1) A test over a prime field: - sage: F = GF(next_prime(10^30)) - sage: x = F['x'].gen() - sage: f = x^7 + x^2 + 1 - sage: H = HyperellipticCurve(f, 2*x); H - Hyperelliptic Curve over Finite Field of size 1000000000000000000000000000057 defined by y^2 + 2*x*y = x^7 + x^2 + 1 - sage: J = H.jacobian()(F); J + sage: F = GF(next_prime(10^30)) # optional - sage.rings.finite_rings + sage: x = F['x'].gen() # optional - sage.rings.finite_rings + sage: f = x^7 + x^2 + 1 # optional - sage.rings.finite_rings + sage: H = HyperellipticCurve(f, 2*x); H # optional - sage.rings.finite_rings + Hyperelliptic Curve over Finite Field of size 1000000000000000000000000000057 + defined by y^2 + 2*x*y = x^7 + x^2 + 1 + sage: J = H.jacobian()(F); J # optional - sage.rings.finite_rings Set of rational points of Jacobian of Hyperelliptic Curve over Finite Field of size 1000000000000000000000000000057 defined by y^2 + 2*x*y = x^7 + x^2 + 1 - sage: Q = J(H.lift_x(F(1))); Q + sage: Q = J(H.lift_x(F(1))); Q # optional - sage.rings.finite_rings (x + 1000000000000000000000000000056, y + 1000000000000000000000000000056) - sage: 10*Q # indirect doctest - (x^3 + 150296037169838934997145567227*x^2 + 377701248971234560956743242408*x + 509456150352486043408603286615, y + 514451014495791237681619598519*x^2 + 875375621665039398768235387900*x + 861429240012590886251910326876) - sage: 7*8297*Q - (x^3 + 35410976139548567549919839063*x^2 + 26230404235226464545886889960*x + 681571430588959705539385624700, y + 999722365017286747841221441793*x^2 + 262703715994522725686603955650*x + 626219823403254233972118260890) + sage: 10*Q # indirect doctest # optional - sage.rings.finite_rings + (x^3 + 150296037169838934997145567227*x^2 + + 377701248971234560956743242408*x + 509456150352486043408603286615, + y + 514451014495791237681619598519*x^2 + + 875375621665039398768235387900*x + 861429240012590886251910326876) + sage: 7*8297*Q # optional - sage.rings.finite_rings + (x^3 + 35410976139548567549919839063*x^2 + + 26230404235226464545886889960*x + 681571430588959705539385624700, + y + 999722365017286747841221441793*x^2 + + 262703715994522725686603955650*x + 626219823403254233972118260890) """ a1, b1 = D1 a2, b2 = D2 @@ -363,22 +372,22 @@ def __init__(self, parent, polys, check=True): EXAMPLES:: - sage: x = GF(37)['x'].gen() - sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x) - sage: J = H.jacobian()(GF(37)); J + sage: x = GF(37)['x'].gen() # optional - sage.rings.finite_rings + sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x) # optional - sage.rings.finite_rings + sage: J = H.jacobian()(GF(37)); J # optional - sage.rings.finite_rings Set of rational points of Jacobian of Hyperelliptic Curve over Finite Field of size 37 defined by y^2 = x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x :: - sage: P1 = J(H.lift_x(2)); P1 # indirect doctest + sage: P1 = J(H.lift_x(2)); P1 # indirect doctest # optional - sage.rings.finite_rings (x + 35, y + 26) - sage: P1.parent() + sage: P1.parent() # optional - sage.rings.finite_rings Set of rational points of Jacobian of Hyperelliptic Curve over Finite Field of size 37 defined by y^2 = x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x - sage: type(P1) + sage: type(P1) # optional - sage.rings.finite_rings """ SchemeMorphism.__init__(self, parent) @@ -400,15 +409,15 @@ def _printing_polys(self): TESTS:: - sage: F. = GF(7^2, 'a') - sage: x = F['x'].gen() - sage: f = x^7 + x^2 + a - sage: H = HyperellipticCurve(f, 2*x) - sage: J = H.jacobian()(F) + sage: F. = GF(7^2, 'a') # optional - sage.rings.finite_rings + sage: x = F['x'].gen() # optional - sage.rings.finite_rings + sage: f = x^7 + x^2 + a # optional - sage.rings.finite_rings + sage: H = HyperellipticCurve(f, 2*x) # optional - sage.rings.finite_rings + sage: J = H.jacobian()(F) # optional - sage.rings.finite_rings :: - sage: Q = J(H.lift_x(F(1))); Q # indirect doctest + sage: Q = J(H.lift_x(F(1))); Q # indirect doctest # optional - sage.rings.finite_rings (x + 6, y + 2*a + 2) """ a, b = self.__polys @@ -423,19 +432,19 @@ def _repr_(self): EXAMPLES:: - sage: F. = GF(7^2, 'a') - sage: x = F['x'].gen() - sage: f = x^7 + x^2 + a - sage: H = HyperellipticCurve(f, 2*x) - sage: J = H.jacobian()(F) + sage: F. = GF(7^2, 'a') # optional - sage.rings.finite_rings + sage: x = F['x'].gen() # optional - sage.rings.finite_rings + sage: f = x^7 + x^2 + a # optional - sage.rings.finite_rings + sage: H = HyperellipticCurve(f, 2*x) # optional - sage.rings.finite_rings + sage: J = H.jacobian()(F) # optional - sage.rings.finite_rings :: - sage: Q = J(0); Q # indirect doctest + sage: Q = J(0); Q # indirect doctest # optional - sage.rings.finite_rings (1) - sage: Q = J(H.lift_x(F(1))); Q # indirect doctest + sage: Q = J(H.lift_x(F(1))); Q # indirect doctest # optional - sage.rings.finite_rings (x + 6, y + 2*a + 2) - sage: Q + Q # indirect doctest + sage: Q + Q # indirect doctest # optional - sage.rings.finite_rings (x^2 + 5*x + 1, y + 3*a*x + 6*a + 2) """ if self.is_zero(): @@ -449,22 +458,22 @@ def _latex_(self): EXAMPLES:: - sage: F. = GF(7^2) - sage: x = F['x'].gen() - sage: f = x^7 + x^2 + alpha - sage: H = HyperellipticCurve(f, 2*x) - sage: J = H.jacobian()(F) + sage: F. = GF(7^2) # optional - sage.rings.finite_rings + sage: x = F['x'].gen() # optional - sage.rings.finite_rings + sage: f = x^7 + x^2 + alpha # optional - sage.rings.finite_rings + sage: H = HyperellipticCurve(f, 2*x) # optional - sage.rings.finite_rings + sage: J = H.jacobian()(F) # optional - sage.rings.finite_rings :: - sage: Q = J(0); print(latex(Q)) # indirect doctest + sage: Q = J(0); print(latex(Q)) # indirect doctest # optional - sage.rings.finite_rings \left(1\right) - sage: Q = J(H.lift_x(F(1))); print(latex(Q)) # indirect doctest + sage: Q = J(H.lift_x(F(1))); print(latex(Q)) # indirect doctest # optional - sage.rings.finite_rings \left(x + 6, y + 2 \alpha + 2\right) :: - sage: print(latex(Q + Q)) + sage: print(latex(Q + Q)) # optional - sage.rings.finite_rings \left(x^{2} + 5 x + 1, y + 3 \alpha x + 6 \alpha + 2\right) """ if self.is_zero(): @@ -474,8 +483,7 @@ def _latex_(self): def scheme(self): r""" - Return the scheme this morphism maps to; or, where this divisor - lives. + Return the scheme this morphism maps to; or, where this divisor lives. .. warning:: @@ -490,16 +498,16 @@ def scheme(self): sage: x = QQ['x'].gen() sage: f = x^5 + x sage: H = HyperellipticCurve(f) - sage: F. = NumberField(x^2 - 2, 'a') - sage: J = H.jacobian()(F); J + sage: F. = NumberField(x^2 - 2, 'a') # optional - sage.rings.number_field + sage: J = H.jacobian()(F); J # optional - sage.rings.number_field Set of rational points of Jacobian of Hyperelliptic Curve over Number Field in a with defining polynomial x^2 - 2 defined by y^2 = x^5 + x :: - sage: P = J(H.lift_x(F(1))) - sage: P.scheme() + sage: P = J(H.lift_x(F(1))) # optional - sage.rings.number_field + sage: P.scheme() # optional - sage.rings.number_field Jacobian of Hyperelliptic Curve over Rational Field defined by y^2 = x^5 + x """ return self.codomain() @@ -515,16 +523,16 @@ def __list__(self): sage: x = QQ['x'].gen() sage: f = x^5 + x sage: H = HyperellipticCurve(f) - sage: F. = NumberField(x^2 - 2, 'a') - sage: J = H.jacobian()(F); J + sage: F. = NumberField(x^2 - 2, 'a') # optional - sage.rings.number_field + sage: J = H.jacobian()(F); J # optional - sage.rings.number_field Set of rational points of Jacobian of Hyperelliptic Curve over Number Field in a with defining polynomial x^2 - 2 defined by y^2 = x^5 + x :: - sage: P = J(H.lift_x(F(1))) - sage: list(P) # indirect doctest + sage: P = J(H.lift_x(F(1))) # optional - sage.rings.number_field + sage: list(P) # indirect doctest # optional - sage.rings.number_field [x - 1, a] """ return list(self.__polys) @@ -539,16 +547,16 @@ def __tuple__(self): sage: x = QQ['x'].gen() sage: f = x^5 + x sage: H = HyperellipticCurve(f) - sage: F. = NumberField(x^2 - 2, 'a') - sage: J = H.jacobian()(F); J + sage: F. = NumberField(x^2 - 2, 'a') # optional - sage.rings.number_field + sage: J = H.jacobian()(F); J # optional - sage.rings.number_field Set of rational points of Jacobian of Hyperelliptic Curve over Number Field in a with defining polynomial x^2 - 2 defined by y^2 = x^5 + x :: - sage: P = J(H.lift_x(F(1))) - sage: tuple(P) # indirect doctest + sage: P = J(H.lift_x(F(1))) # optional - sage.rings.number_field + sage: tuple(P) # indirect doctest # optional - sage.rings.number_field (x - 1, a) """ return tuple(self.__polys) @@ -563,22 +571,22 @@ def __getitem__(self, n): sage: x = QQ['x'].gen() sage: f = x^5 + x sage: H = HyperellipticCurve(f) - sage: F. = NumberField(x^2 - 2, 'a') - sage: J = H.jacobian()(F); J + sage: F. = NumberField(x^2 - 2, 'a') # optional - sage.rings.number_field + sage: J = H.jacobian()(F); J # optional - sage.rings.number_field Set of rational points of Jacobian of Hyperelliptic Curve over Number Field in a with defining polynomial x^2 - 2 defined by y^2 = x^5 + x :: - sage: P = J(H.lift_x(F(1))) - sage: P[0] # indirect doctest + sage: P = J(H.lift_x(F(1))) # optional - sage.rings.number_field + sage: P[0] # indirect doctest # optional - sage.rings.number_field x - 1 - sage: P[1] # indirect doctest + sage: P[1] # indirect doctest # optional - sage.rings.number_field a - sage: P[-1] # indirect doctest + sage: P[-1] # indirect doctest # optional - sage.rings.number_field a - sage: P[:1] # indirect doctest + sage: P[:1] # indirect doctest # optional - sage.rings.number_field [x - 1] """ return list(self.__polys)[n] @@ -647,17 +655,17 @@ def __bool__(self): EXAMPLES:: - sage: x = GF(37)['x'].gen() - sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x) - sage: J = H.jacobian()(GF(37)) + sage: x = GF(37)['x'].gen() # optional - sage.rings.finite_rings + sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x) # optional - sage.rings.finite_rings + sage: J = H.jacobian()(GF(37)) # optional - sage.rings.finite_rings :: - sage: P1 = J(H.lift_x(2)); P1 + sage: P1 = J(H.lift_x(2)); P1 # optional - sage.rings.finite_rings (x + 35, y + 26) - sage: P1 == 0 # indirect doctest + sage: P1 == 0 # indirect doctest # optional - sage.rings.finite_rings False - sage: P1 - P1 == 0 # indirect doctest + sage: P1 - P1 == 0 # indirect doctest # optional - sage.rings.finite_rings True """ return self.__polys[0] != 1 @@ -670,25 +678,25 @@ def __neg__(self): EXAMPLES:: - sage: x = GF(37)['x'].gen() - sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x) - sage: J = H.jacobian()(GF(37)) - sage: P1 = J(H.lift_x(2)); P1 + sage: x = GF(37)['x'].gen() # optional - sage.rings.finite_rings + sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x) # optional - sage.rings.finite_rings + sage: J = H.jacobian()(GF(37)) # optional - sage.rings.finite_rings + sage: P1 = J(H.lift_x(2)); P1 # optional - sage.rings.finite_rings (x + 35, y + 26) - sage: - P1 # indirect doctest + sage: - P1 # indirect doctest # optional - sage.rings.finite_rings (x + 35, y + 11) - sage: P1 + (-P1) # indirect doctest + sage: P1 + (-P1) # indirect doctest # optional - sage.rings.finite_rings (1) :: sage: H2 = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x, x) - sage: J2 = H2.jacobian()(GF(37)) - sage: P2 = J2(H2.lift_x(2)); P2 + sage: J2 = H2.jacobian()(GF(37)) # optional - sage.rings.finite_rings + sage: P2 = J2(H2.lift_x(2)); P2 # optional - sage.rings.finite_rings (x + 35, y + 15) - sage: - P2 # indirect doctest + sage: - P2 # indirect doctest # optional - sage.rings.finite_rings (x + 35, y + 24) - sage: P2 + (-P2) # indirect doctest + sage: P2 + (-P2) # indirect doctest # optional - sage.rings.finite_rings (1) TESTS: @@ -697,16 +705,16 @@ def __neg__(self): sage: P. = QQ[] sage: f = x^5 - x + 1; h = x - sage: C = HyperellipticCurve(f,h,'u,v') + sage: C = HyperellipticCurve(f, h, 'u,v') sage: J = C.jacobian() - sage: K. = NumberField(x^2-2) - sage: R. = K[] - sage: Q = J(K)([x^2-t,R(1)]) - sage: Q + sage: K. = NumberField(x^2 - 2) # optional - sage.rings.number_field + sage: R. = K[] # optional - sage.rings.number_field + sage: Q = J(K)([x^2 - t, R(1)]) # optional - sage.rings.number_field + sage: Q # optional - sage.rings.number_field (u^2 - t, v - 1) - sage: -Q + sage: -Q # optional - sage.rings.number_field (u^2 - t, v + u + 1) - sage: Q + (-Q) # indirect doctest + sage: Q + (-Q) # indirect doctest # optional - sage.rings.number_field (1) """ @@ -733,15 +741,15 @@ def _add_(self,other): EXAMPLES:: - sage: x = GF(37)['x'].gen() - sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x) - sage: J = H.jacobian()(GF(37)) + sage: x = GF(37)['x'].gen() # optional - sage.rings.finite_rings + sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x) # optional - sage.rings.finite_rings + sage: J = H.jacobian()(GF(37)) # optional - sage.rings.finite_rings :: - sage: P1 = J(H.lift_x(2)); P1 + sage: P1 = J(H.lift_x(2)); P1 # optional - sage.rings.finite_rings (x + 35, y + 26) - sage: P1 + P1 # indirect doctest + sage: P1 + P1 # indirect doctest # optional - sage.rings.finite_rings (x^2 + 33*x + 4, y + 13*x) """ X = self.parent() @@ -764,30 +772,30 @@ def _sub_(self, other): EXAMPLES:: - sage: x = GF(37)['x'].gen() - sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x) - sage: J = H.jacobian()(GF(37)) + sage: x = GF(37)['x'].gen() # optional - sage.rings.finite_rings + sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x) # optional - sage.rings.finite_rings + sage: J = H.jacobian()(GF(37)) # optional - sage.rings.finite_rings :: - sage: P1 = J(H.lift_x(2)); P1 + sage: P1 = J(H.lift_x(2)); P1 # optional - sage.rings.finite_rings (x + 35, y + 26) - sage: P1 - P1 # indirect doctest + sage: P1 - P1 # indirect doctest # optional - sage.rings.finite_rings (1) :: - sage: P2 = J(H.lift_x(4)); P2 + sage: P2 = J(H.lift_x(4)); P2 # optional - sage.rings.finite_rings (x + 33, y + 34) Observe that the `x`-coordinates are the same but the `y`-coordinates differ:: - sage: P1 - P2 # indirect doctest + sage: P1 - P2 # indirect doctest # optional - sage.rings.finite_rings (x^2 + 31*x + 8, y + 7*x + 12) - sage: P1 + P2 # indirect doctest + sage: P1 + P2 # indirect doctest # optional - sage.rings.finite_rings (x^2 + 31*x + 8, y + 4*x + 18) - sage: (P1 - P2) - (P1 + P2) + 2*P2 # indirect doctest + sage: (P1 - P2) - (P1 + P2) + 2*P2 # indirect doctest # optional - sage.rings.finite_rings (1) """ return self + (-other) diff --git a/src/sage/schemes/hyperelliptic_curves/mestre.py b/src/sage/schemes/hyperelliptic_curves/mestre.py index 31ba672800c..d7b9e0a5f68 100644 --- a/src/sage/schemes/hyperelliptic_curves/mestre.py +++ b/src/sage/schemes/hyperelliptic_curves/mestre.py @@ -67,26 +67,31 @@ def HyperellipticCurve_from_invariants(i, reduced=True, precision=None, sage: HyperellipticCurve_from_invariants([3840,414720,491028480,2437709561856]) Traceback (most recent call last): ... - NotImplementedError: Reduction of hyperelliptic curves not yet implemented. See trac #14755 and #14756. - sage: HyperellipticCurve_from_invariants([3840,414720,491028480,2437709561856],reduced = False) - Hyperelliptic Curve over Rational Field defined by y^2 = -46656*x^6 + 46656*x^5 - 19440*x^4 + 4320*x^3 - 540*x^2 + 4410*x - 1 + NotImplementedError: Reduction of hyperelliptic curves not yet implemented. + See trac #14755 and #14756. + sage: HyperellipticCurve_from_invariants([3840,414720,491028480,2437709561856], + ....: reduced=False) + Hyperelliptic Curve over Rational Field defined by + y^2 = -46656*x^6 + 46656*x^5 - 19440*x^4 + 4320*x^3 - 540*x^2 + 4410*x - 1 sage: HyperellipticCurve_from_invariants([21, 225/64, 22941/512, 1]) Traceback (most recent call last): ... - NotImplementedError: Reduction of hyperelliptic curves not yet implemented. See trac #14755 and #14756. + NotImplementedError: Reduction of hyperelliptic curves not yet implemented. + See trac #14755 and #14756. An example over a finite field:: - sage: H = HyperellipticCurve_from_invariants([GF(13)(1),3,7,5]); H + sage: H = HyperellipticCurve_from_invariants([GF(13)(1), 3, 7, 5]); H # optional - sage.rings.finite_rings Hyperelliptic Curve over Finite Field of size 13 defined by ... - sage: H.igusa_clebsch_invariants() + sage: H.igusa_clebsch_invariants() # optional - sage.rings.finite_rings (4, 9, 6, 11) An example over a number field:: - sage: K = QuadraticField(353, 'a') - sage: H = HyperellipticCurve_from_invariants([21, 225/64, 22941/512, 1], reduced = false) - sage: f = K['x'](H.hyperelliptic_polynomials()[0]) + sage: K = QuadraticField(353, 'a') # optional - sage.rings.number_field + sage: H = HyperellipticCurve_from_invariants([21, 225/64, 22941/512, 1], # optional - sage.rings.number_field + ....: reduced=false) + sage: f = K['x'](H.hyperelliptic_polynomials()[0]) # optional - sage.rings.number_field If the Mestre Conic defined by the Igusa-Clebsch invariants has no rational points, then there exists no hyperelliptic curve over the base field with @@ -95,14 +100,17 @@ def HyperellipticCurve_from_invariants(i, reduced=True, precision=None, sage: HyperellipticCurve_from_invariants([1,2,3,4]) Traceback (most recent call last): ... - ValueError: No such curve exists over Rational Field as there are no rational points on Projective Conic Curve over Rational Field defined by -2572155000*u^2 - 317736000*u*v + 1250755459200*v^2 + 2501510918400*u*w + 39276887040*v*w + 2736219686912*w^2 + ValueError: No such curve exists over Rational Field as there are + no rational points on Projective Conic Curve over Rational Field defined by + -2572155000*u^2 - 317736000*u*v + 1250755459200*v^2 + 2501510918400*u*w + + 39276887040*v*w + 2736219686912*w^2 Mestre's algorithm only works for generic curves of genus two, so another algorithm is needed for those curves with extra automorphism. See also :trac:`12199`:: sage: P. = QQ[] - sage: C = HyperellipticCurve(x^6+1) + sage: C = HyperellipticCurve(x^6 + 1) sage: i = C.igusa_clebsch_invariants() sage: HyperellipticCurve_from_invariants(i) Traceback (most recent call last): @@ -114,12 +122,13 @@ def HyperellipticCurve_from_invariants(i, reduced=True, precision=None, different from 2, 3, and 5, so another algorithm will be needed for fields of those characteristics. See also :trac:`12200`:: - sage: P. = GF(3)[] - sage: HyperellipticCurve(x^6+x+1).igusa_clebsch_invariants() + sage: P. = GF(3)[] # optional - sage.rings.finite_rings + sage: HyperellipticCurve(x^6 + x + 1).igusa_clebsch_invariants() # optional - sage.rings.finite_rings Traceback (most recent call last): ... - NotImplementedError: Invariants of binary sextics/genus 2 hyperelliptic curves not implemented in characteristics 2, 3, and 5 - sage: HyperellipticCurve_from_invariants([GF(5)(1),1,0,1]) + NotImplementedError: Invariants of binary sextics/genus 2 hyperelliptic curves + not implemented in characteristics 2, 3, and 5 + sage: HyperellipticCurve_from_invariants([GF(5)(1), 1, 0, 1]) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ZeroDivisionError: inverse of Mod(0, 5) does not exist @@ -221,7 +230,7 @@ def Mestre_conic(i, xyz=False, names='u,v,w'): invariants: I2, I4, I6, I10 - ``xyz`` - Boolean (default: False) if True, the algorithm also returns three invariants x,y,z used in Mestre's algorithm - - ``names`` (default: 'u,v,w') - the variable names for the Conic + - ``names`` (default: 'u,v,w') - the variable names for the conic OUTPUT: @@ -232,24 +241,33 @@ def Mestre_conic(i, xyz=False, names='u,v,w'): A standard example:: sage: Mestre_conic([1,2,3,4]) - Projective Conic Curve over Rational Field defined by -2572155000*u^2 - 317736000*u*v + 1250755459200*v^2 + 2501510918400*u*w + 39276887040*v*w + 2736219686912*w^2 + Projective Conic Curve over Rational Field defined by + -2572155000*u^2 - 317736000*u*v + 1250755459200*v^2 + 2501510918400*u*w + + 39276887040*v*w + 2736219686912*w^2 Note that the algorithm works over number fields as well:: - sage: k = NumberField(x^2-41,'a') - sage: a = k.an_element() - sage: Mestre_conic([1,2+a,a,4+a]) - Projective Conic Curve over Number Field in a with defining polynomial x^2 - 41 defined by (-801900000*a + 343845000)*u^2 + (855360000*a + 15795864000)*u*v + (312292800000*a + 1284808579200)*v^2 + (624585600000*a + 2569617158400)*u*w + (15799910400*a + 234573143040)*v*w + (2034199306240*a + 16429854656512)*w^2 + sage: k = NumberField(x^2 - 41, 'a') # optional - sage.rings.number_field + sage: a = k.an_element() # optional - sage.rings.number_field + sage: Mestre_conic([1, 2+a, a, 4+a]) # optional - sage.rings.number_field + Projective Conic Curve over Number Field in a with defining polynomial x^2 - 41 + defined by (-801900000*a + 343845000)*u^2 + (855360000*a + 15795864000)*u*v + + (312292800000*a + 1284808579200)*v^2 + (624585600000*a + 2569617158400)*u*w + + (15799910400*a + 234573143040)*v*w + (2034199306240*a + 16429854656512)*w^2 And over finite fields:: - sage: Mestre_conic([GF(7)(10),GF(7)(1),GF(7)(2),GF(7)(3)]) - Projective Conic Curve over Finite Field of size 7 defined by -2*u*v - v^2 - 2*u*w + 2*v*w - 3*w^2 + sage: Mestre_conic([GF(7)(10), GF(7)(1), GF(7)(2), GF(7)(3)]) # optional - sage.rings.finite_rings + Projective Conic Curve over Finite Field of size 7 + defined by -2*u*v - v^2 - 2*u*w + 2*v*w - 3*w^2 An example with xyz:: sage: Mestre_conic([5,6,7,8], xyz=True) - (Projective Conic Curve over Rational Field defined by -415125000*u^2 + 608040000*u*v + 33065136000*v^2 + 66130272000*u*w + 240829440*v*w + 10208835584*w^2, 232/1125, -1072/16875, 14695616/2109375) + (Projective Conic Curve over Rational Field + defined by -415125000*u^2 + 608040000*u*v + 33065136000*v^2 + + 66130272000*u*w + 240829440*v*w + 10208835584*w^2, + 232/1125, -1072/16875, 14695616/2109375) ALGORITHM: diff --git a/src/sage/schemes/plane_conics/con_field.py b/src/sage/schemes/plane_conics/con_field.py index 7b052147c55..8dea55bd55e 100644 --- a/src/sage/schemes/plane_conics/con_field.py +++ b/src/sage/schemes/plane_conics/con_field.py @@ -231,13 +231,15 @@ def determinant(self): Determinants are only defined in characteristic different from `2`:: - sage: C = Conic(GF(2), [1, 1, 1, 1, 1, 0]) - sage: C.is_smooth() + sage: C = Conic(GF(2), [1, 1, 1, 1, 1, 0]) # optional - sage.rings.finite_rings + sage: C.is_smooth() # optional - sage.rings.finite_rings True - sage: C.determinant() + sage: C.determinant() # optional - sage.rings.finite_rings Traceback (most recent call last): ... - ValueError: The conic self (= Projective Conic Curve over Finite Field of size 2 defined by x^2 + x*y + y^2 + x*z + y*z) has no symmetric matrix because the base field has characteristic 2 + ValueError: The conic self (= Projective Conic Curve over Finite Field + of size 2 defined by x^2 + x*y + y^2 + x*z + y*z) has no symmetric matrix + because the base field has characteristic 2 """ return self.symmetric_matrix().determinant() @@ -268,13 +270,15 @@ def diagonal_matrix(self): :: - sage: c = Conic(GF(4, 'a'), [0, 1, 1, 1, 1, 1]) - sage: c.is_smooth() + sage: c = Conic(GF(4, 'a'), [0, 1, 1, 1, 1, 1]) # optional - sage.rings.finite_rings + sage: c.is_smooth() # optional - sage.rings.finite_rings True - sage: c.diagonal_matrix() + sage: c.diagonal_matrix() # optional - sage.rings.finite_rings Traceback (most recent call last): ... - ValueError: The conic self (= Projective Conic Curve over Finite Field in a of size 2^2 defined by x*y + y^2 + x*z + y*z + z^2) has no symmetric matrix because the base field has characteristic 2 + ValueError: The conic self (= Projective Conic Curve over Finite Field + in a of size 2^2 defined by x*y + y^2 + x*z + y*z + z^2) has + no symmetric matrix because the base field has characteristic 2 """ A = self.symmetric_matrix() B = self.base_ring() @@ -384,7 +388,7 @@ def gens(self): :: sage: P. = QQ[] - sage: c = Conic(x^2+y^2+z^2) + sage: c = Conic(x^2 + y^2 + z^2) sage: c.gens() (xbar, ybar, zbar) sage: c.defining_polynomial()(c.gens()) @@ -394,8 +398,8 @@ def gens(self): :: - sage: C. = Conic(GF(3), [1, 1, 1]) - sage: C + sage: C. = Conic(GF(3), [1, 1, 1]) # optional - sage.rings.finite_rings + sage: C # optional - sage.rings.finite_rings Projective Conic Curve over Finite Field of size 3 defined by a^2 + b^2 + c^2 """ @@ -578,15 +582,16 @@ def has_singular_point(self, point=False): sage: c.has_singular_point(point = True) (True, (0 : 1 : 0)) - sage: P. = GF(7)[] - sage: e = Conic((x+y+z)*(x-y+2*z)); e - Projective Conic Curve over Finite Field of size 7 defined by x^2 - y^2 + 3*x*z + y*z + 2*z^2 + sage: P. = GF(7)[] # optional - sage.rings.finite_rings + sage: e = Conic((x+y+z)*(x-y+2*z)); e # optional - sage.rings.finite_rings + Projective Conic Curve over Finite Field of size 7 + defined by x^2 - y^2 + 3*x*z + y*z + 2*z^2 sage: e.has_singular_point(point = True) (True, (2 : 4 : 1)) sage: Conic([1, 1, -1]).has_singular_point() False - sage: Conic([1, 1, -1]).has_singular_point(point = True) + sage: Conic([1, 1, -1]).has_singular_point(point=True) (False, None) ``has_singular_point`` is not implemented over all fields @@ -594,17 +599,19 @@ def has_singular_point(self, point=False): :: - sage: F. = FiniteField(8) - sage: Conic([a, a+1, 1]).has_singular_point(point = True) + sage: F. = FiniteField(8) # optional - sage.rings.finite_rings + sage: Conic([a, a + 1, 1]).has_singular_point(point=True) # optional - sage.rings.finite_rings (True, (a + 1 : 0 : 1)) - sage: P. = GF(2)[] - sage: C = Conic(P, [t,t,1]); C - Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 2 (using GF2X) defined by t*x^2 + t*y^2 + z^2 - sage: C.has_singular_point(point = False) + sage: P. = GF(2)[] # optional - sage.rings.finite_rings + sage: C = Conic(P, [t,t,1]); C # optional - sage.rings.finite_rings + Projective Conic Curve over Fraction Field of Univariate Polynomial Ring + in t over Finite Field of size 2 (using GF2X) defined by t*x^2 + t*y^2 + z^2 + sage: C.has_singular_point(point = False) # optional - sage.rings.finite_rings Traceback (most recent call last): ... - NotImplementedError: Sorry, find singular point on conics not implemented over all fields of characteristic 2. + NotImplementedError: Sorry, find singular point on conics not implemented + over all fields of characteristic 2. """ if not point: ret = self.has_singular_point(point=True) @@ -747,7 +754,7 @@ def is_smooth(self): sage: Conic([1,-1,0]).is_smooth() False - sage: Conic(GF(2),[1,1,1,1,1,0]).is_smooth() + sage: Conic(GF(2),[1,1,1,1,1,0]).is_smooth() # optional - sage.rings.finite_rings True """ if self.base_ring().characteristic() == 2: diff --git a/src/sage/schemes/plane_conics/constructor.py b/src/sage/schemes/plane_conics/constructor.py index 5cb1399be6d..0ce41ae724e 100644 --- a/src/sage/schemes/plane_conics/constructor.py +++ b/src/sage/schemes/plane_conics/constructor.py @@ -106,26 +106,27 @@ def Conic(base_field, F=None, names=None, unique=True): sage: X,Y,Z = QQ['X,Y,Z'].gens() sage: Conic(X^2 - X*Y + Y^2 - Z^2) Projective Conic Curve over Rational Field defined by X^2 - X*Y + Y^2 - Z^2 - sage: x,y = GF(7)['x,y'].gens() - sage: Conic(x^2 - x + 2*y^2 - 3, 'U,V,W') - Projective Conic Curve over Finite Field of size 7 defined by U^2 + 2*V^2 - U*W - 3*W^2 + sage: x,y = GF(7)['x,y'].gens() # optional - sage.rings.finite_rings + sage: Conic(x^2 - x + 2*y^2 - 3, 'U,V,W') # optional - sage.rings.finite_rings + Projective Conic Curve over Finite Field of size 7 + defined by U^2 + 2*V^2 - U*W - 3*W^2 Conic curves given by matrices :: sage: Conic(matrix(QQ, [[1, 2, 0], [4, 0, 0], [7, 0, 9]]), 'x,y,z') Projective Conic Curve over Rational Field defined by x^2 + 6*x*y + 7*x*z + 9*z^2 - sage: x,y,z = GF(11)['x,y,z'].gens() - sage: C = Conic(x^2+y^2-2*z^2); C + sage: x,y,z = GF(11)['x,y,z'].gens() # optional - sage.rings.finite_rings + sage: C = Conic(x^2 + y^2 - 2*z^2); C # optional - sage.rings.finite_rings Projective Conic Curve over Finite Field of size 11 defined by x^2 + y^2 - 2*z^2 - sage: Conic(C.symmetric_matrix(), 'x,y,z') + sage: Conic(C.symmetric_matrix(), 'x,y,z') # optional - sage.rings.finite_rings Projective Conic Curve over Finite Field of size 11 defined by x^2 + y^2 - 2*z^2 Conics given by coefficients :: sage: Conic(QQ, [1,2,3]) Projective Conic Curve over Rational Field defined by x^2 + 2*y^2 + 3*z^2 - sage: Conic(GF(7), [1,2,3,4,5,6], 'X') + sage: Conic(GF(7), [1,2,3,4,5,6], 'X') # optional - sage.rings.finite_rings Projective Conic Curve over Finite Field of size 7 defined by X0^2 + 2*X0*X1 - 3*X1^2 + 3*X0*X2 - 2*X1*X2 - X2^2 @@ -139,8 +140,8 @@ def Conic(base_field, F=None, names=None, unique=True): sage: C.point([3,4]) (3 : 4 : 1) - sage: a = AffineSpace(GF(13),2) - sage: Conic([a([x,x^2]) for x in range(5)]) + sage: a = AffineSpace(GF(13), 2) # optional - sage.rings.finite_rings + sage: Conic([a([x,x^2]) for x in range(5)]) # optional - sage.rings.finite_rings Projective Conic Curve over Finite Field of size 13 defined by x^2 - y*z """ if not (base_field is None or isinstance(base_field, IntegralDomain)): diff --git a/src/sage/schemes/projective/projective_space.py b/src/sage/schemes/projective/projective_space.py index b81b45ab3b0..9301202f4d4 100644 --- a/src/sage/schemes/projective/projective_space.py +++ b/src/sage/schemes/projective/projective_space.py @@ -914,7 +914,7 @@ def change_ring(self, R): sage: P. = ProjectiveSpace(2, ZZ) sage: PQ = P.change_ring(QQ); PQ Projective Space of dimension 2 over Rational Field - sage: PQ.change_ring(GF(5)) + sage: PQ.change_ring(GF(5)) # optional - sage.rings.finite_rings Projective Space of dimension 2 over Finite Field of size 5 :: diff --git a/src/sage/schemes/toric/homset.py b/src/sage/schemes/toric/homset.py index d61de988170..d75b0ce27f7 100644 --- a/src/sage/schemes/toric/homset.py +++ b/src/sage/schemes/toric/homset.py @@ -329,7 +329,7 @@ def is_finite(self): sage: P2 = toric_varieties.P2() sage: P2.point_set().is_finite() False - sage: P2.change_ring(GF(7)).point_set().is_finite() + sage: P2.change_ring(GF(7)).point_set().is_finite() # optional - sage.rings.finite_rings True """ variety = self.codomain() @@ -508,11 +508,11 @@ def cardinality(self): sage: o = lattice_polytope.cross_polytope(3) sage: V = ToricVariety(FaceFan(o)) - sage: V.change_ring(GF(2)).point_set().cardinality() + sage: V.change_ring(GF(2)).point_set().cardinality() # optional - sage.rings.finite_rings 27 - sage: V.change_ring(GF(8, "a")).point_set().cardinality() + sage: V.change_ring(GF(8, "a")).point_set().cardinality() # optional - sage.rings.finite_rings 729 - sage: V.change_ring(GF(101)).point_set().cardinality() + sage: V.change_ring(GF(101)).point_set().cardinality() # optional - sage.rings.finite_rings 1061208 For non-smooth varieties over finite fields, the homogeneous diff --git a/src/sage/schemes/toric/library.py b/src/sage/schemes/toric/library.py index 42d670b5311..393baa2b47f 100644 --- a/src/sage/schemes/toric/library.py +++ b/src/sage/schemes/toric/library.py @@ -1476,7 +1476,7 @@ def torus(self, n, names='z+', base_ring=QQ): in 3-d lattice N sage: T3.gens() (z0, z1, z2) - sage: sorted(T3.change_ring(GF(3)).point_set().list()) + sage: sorted(T3.change_ring(GF(3)).point_set().list()) # optional - sage.rings.finite_rings [[1 : 1 : 1], [1 : 1 : 2], [1 : 2 : 1], [1 : 2 : 2], [2 : 1 : 1], [2 : 1 : 2], [2 : 2 : 1], [2 : 2 : 2]] """ From fdb625e26c6782171c850b5d1941d4f73bc0d0a2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 24 Mar 2023 11:39:35 -0700 Subject: [PATCH 088/135] sage.schemes: More # optional and cosmetic doctest changes (fixup) --- src/sage/schemes/elliptic_curves/ell_generic.py | 10 +++++----- src/sage/schemes/elliptic_curves/ell_point.py | 10 +++++----- src/sage/schemes/elliptic_curves/ell_wp.py | 2 +- src/sage/schemes/elliptic_curves/formal_group.py | 2 +- src/sage/schemes/hyperelliptic_curves/invariants.py | 2 +- .../schemes/hyperelliptic_curves/jacobian_morphism.py | 2 +- src/sage/schemes/plane_conics/con_field.py | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/ell_generic.py b/src/sage/schemes/elliptic_curves/ell_generic.py index be1e4714b5e..0a542588e4c 100644 --- a/src/sage/schemes/elliptic_curves/ell_generic.py +++ b/src/sage/schemes/elliptic_curves/ell_generic.py @@ -685,9 +685,9 @@ def is_x_coord(self, x): :: - sage: F = GF(32,'a') # optional - sage.rings.finite_rings - sage: E = EllipticCurve(F,[1,0,0,0,1]) # optional - sage.rings.finite_rings - sage: set(P[0] for P in E.points() if P!=E(0)) == set(x for x in F if E.is_x_coord(x)) + sage: F = GF(32,'a') # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F,[1,0,0,0,1]) # optional - sage.rings.finite_rings + sage: set(P[0] for P in E.points() if P!=E(0)) == set(x for x in F if E.is_x_coord(x)) # optional - sage.rings.finite_rings True """ K = self.base_ring() @@ -999,7 +999,7 @@ def __is_over_RationalField(self): sage: E._EllipticCurve_generic__is_over_RationalField() True sage: E = EllipticCurve(GF(5),[1,1]) # optional - sage.rings.finite_rings - sage: E._EllipticCurve_generic__is_over_RationalField() + sage: E._EllipticCurve_generic__is_over_RationalField() # optional - sage.rings.finite_rings False """ return isinstance(self.base_ring(), rings.RationalField) @@ -2489,7 +2489,7 @@ def frobenius_isogeny(self, n=1): over Finite Field in z3 of size 13^3 To: Elliptic Curve defined by y^2 = x^3 + (5*z3^2+7*z3+11)*x + (5*z3^2+12*z3+1) over Finite Field in z3 of size 13^3 - sage: E.frobenius_isogeny(3) + sage: E.frobenius_isogeny(3) # optional - sage.rings.finite_rings Frobenius endomorphism of degree 2197 = 13^3: From: Elliptic Curve defined by y^2 = x^3 + z3*x + z3^2 over Finite Field in z3 of size 13^3 diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py index 952a4cbc61b..5d57a4d8d93 100644 --- a/src/sage/schemes/elliptic_curves/ell_point.py +++ b/src/sage/schemes/elliptic_curves/ell_point.py @@ -1203,9 +1203,9 @@ def set_order(self, value, *, check=True): :: sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 12 # optional - sage.rings.finite_rings - sage: G = E(5, 0) - sage: G.set_order(2) - sage: 2*G + sage: G = E(5, 0) # optional - sage.rings.finite_rings + sage: G.set_order(2) # optional - sage.rings.finite_rings + sage: 2*G # optional - sage.rings.finite_rings (0 : 1 : 0) We now give a more interesting case, the NIST-P521 curve. Its @@ -1743,10 +1743,10 @@ def tate_pairing(self, Q, n, k, q=None): sage: P.tate_pairing(P, n, k) # optional - sage.rings.finite_rings 1 sage: Q = E(87, 51) # optional - sage.rings.finite_rings - sage: P.tate_pairing(Q, n, k) + sage: P.tate_pairing(Q, n, k) # optional - sage.rings.finite_rings 1 sage: set_random_seed(35) - sage: P.tate_pairing(P,n,k) + sage: P.tate_pairing(P, n, k) # optional - sage.rings.finite_rings 1 We now let Q be a point on the same curve as above, but defined over diff --git a/src/sage/schemes/elliptic_curves/ell_wp.py b/src/sage/schemes/elliptic_curves/ell_wp.py index 0f1c425e563..4fc3bdd503b 100644 --- a/src/sage/schemes/elliptic_curves/ell_wp.py +++ b/src/sage/schemes/elliptic_curves/ell_wp.py @@ -230,7 +230,7 @@ def compute_wp_quadratic(k, A, B, prec): + 11*z^14 + 17*z^16 + 50*z^18 + O(z^20) sage: from sage.schemes.elliptic_curves.ell_wp import compute_wp_quadratic - sage: compute_wp_quadratic(E.base_ring(), E.a4(), E.a6(), prec=10) + sage: compute_wp_quadratic(E.base_ring(), E.a4(), E.a6(), prec=10) # optional - sage.rings.finite_rings z^-2 + 41*z^2 + 88*z^4 + 11*z^6 + 57*z^8 + O(z^10) """ m = (prec + 1)//2 diff --git a/src/sage/schemes/elliptic_curves/formal_group.py b/src/sage/schemes/elliptic_curves/formal_group.py index ad981fffc84..3e481809da5 100644 --- a/src/sage/schemes/elliptic_curves/formal_group.py +++ b/src/sage/schemes/elliptic_curves/formal_group.py @@ -506,7 +506,7 @@ def group_law(self, prec=10): Let's ensure caching with changed precision is working:: - sage: e.formal_group().group_law(4) + sage: e.formal_group().group_law(4) # optional - sage.rings.finite_rings t1 + t2 + O(t1, t2)^4 Test for :trac:`9646`:: diff --git a/src/sage/schemes/hyperelliptic_curves/invariants.py b/src/sage/schemes/hyperelliptic_curves/invariants.py index b0793dc5524..7db44ac03aa 100644 --- a/src/sage/schemes/hyperelliptic_curves/invariants.py +++ b/src/sage/schemes/hyperelliptic_curves/invariants.py @@ -26,7 +26,7 @@ def diffxy(f, x, xtimes, y, ytimes): sage: from sage.schemes.hyperelliptic_curves.invariants import diffxy sage: R. = QQ[] - sage: .diffxy(u^2*v^3, u, 0, v, 0) + sage: diffxy(u^2*v^3, u, 0, v, 0) u^2*v^3 sage: diffxy(u^2*v^3, u, 2, v, 1) 6*v^2 diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py b/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py index ae2e36228c0..ae36bc6a727 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py @@ -690,7 +690,7 @@ def __neg__(self): :: - sage: H2 = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x, x) + sage: H2 = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x, x) # optional - sage.rings.finite_rings sage: J2 = H2.jacobian()(GF(37)) # optional - sage.rings.finite_rings sage: P2 = J2(H2.lift_x(2)); P2 # optional - sage.rings.finite_rings (x + 35, y + 15) diff --git a/src/sage/schemes/plane_conics/con_field.py b/src/sage/schemes/plane_conics/con_field.py index 8dea55bd55e..8409365872e 100644 --- a/src/sage/schemes/plane_conics/con_field.py +++ b/src/sage/schemes/plane_conics/con_field.py @@ -586,7 +586,7 @@ def has_singular_point(self, point=False): sage: e = Conic((x+y+z)*(x-y+2*z)); e # optional - sage.rings.finite_rings Projective Conic Curve over Finite Field of size 7 defined by x^2 - y^2 + 3*x*z + y*z + 2*z^2 - sage: e.has_singular_point(point = True) + sage: e.has_singular_point(point = True) # optional - sage.rings.finite_rings (True, (2 : 4 : 1)) sage: Conic([1, 1, -1]).has_singular_point() From a6581370a1d29ec4e027ef4188d329fa0cf0d83f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 24 Mar 2023 11:55:47 -0700 Subject: [PATCH 089/135] sage.schemes: More cosmetic doctest changes --- src/sage/schemes/plane_conics/con_field.py | 57 ++++++++++++------- .../schemes/plane_conics/con_number_field.py | 7 ++- .../plane_conics/con_rational_field.py | 12 +++- .../con_rational_function_field.py | 25 +++++--- 4 files changed, 69 insertions(+), 32 deletions(-) diff --git a/src/sage/schemes/plane_conics/con_field.py b/src/sage/schemes/plane_conics/con_field.py index 8409365872e..931b82649d5 100644 --- a/src/sage/schemes/plane_conics/con_field.py +++ b/src/sage/schemes/plane_conics/con_field.py @@ -338,7 +338,9 @@ def diagonalization(self, names=None): sage: Conic(GF(2), [1,1,1,1,1,0]).diagonalization() # optional - sage.rings.finite_rings Traceback (most recent call last): ... - ValueError: The conic self (= Projective Conic Curve over Finite Field of size 2 defined by x^2 + x*y + y^2 + x*z + y*z) has no symmetric matrix because the base field has characteristic 2 + ValueError: The conic self (= Projective Conic Curve over Finite Field + of size 2 defined by x^2 + x*y + y^2 + x*z + y*z) has no symmetric matrix + because the base field has characteristic 2 An example over a global function field: @@ -677,8 +679,10 @@ def hom(self, x, Y=None): Traceback (most recent call last): ... ValueError: The matrix x (= [ 0 0 1/2] - [ 0 1 0] - [ 1 0 0]) does not define a map from self (= Projective Conic Curve over Rational Field defined by -x^2 + y^2 + z^2) to Y (= Projective Conic Curve over Rational Field defined by -x^2 + y^2 + z^2) + [ 0 1 0] + [ 1 0 0]) does not define a map + from self (= Projective Conic Curve over Rational Field defined by -x^2 + y^2 + z^2) + to Y (= Projective Conic Curve over Rational Field defined by -x^2 + y^2 + z^2) The identity map between two representations of the same conic: @@ -701,13 +705,15 @@ def hom(self, x, Y=None): sage: P. = QQ[] sage: C = Conic([1,0,0,t,0,1/t]) sage: D = Conic([1/t^2, 0, -2/t^2, t, 0, (t + 1)/t^2]) - sage: T = Matrix([[t,0,1],[0,1,0],[0,0,1]]) + sage: T = Matrix([[t,0,1], [0,1,0], [0,0,1]]) sage: C.hom(T, D) Scheme morphism: - From: Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Rational Field defined by x^2 + t*y^2 + 1/t*z^2 - To: Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Rational Field defined by 1/(t^2)*x^2 + t*y^2 - 2/(t^2)*x*z + (t + 1)/(t^2)*z^2 - Defn: Defined on coordinates by sending (x : y : z) to - (t*x + z : y : z) + From: Projective Conic Curve over Fraction Field of Univariate + Polynomial Ring in t over Rational Field defined by x^2 + t*y^2 + 1/t*z^2 + To: Projective Conic Curve over Fraction Field of Univariate + Polynomial Ring in t over Rational Field defined by + 1/(t^2)*x^2 + t*y^2 - 2/(t^2)*x*z + (t + 1)/(t^2)*z^2 + Defn: Defined on coordinates by sending (x : y : z) to (t*x + z : y : z) """ if is_Matrix(x): @@ -915,7 +921,8 @@ def parametrization(self, point=None, morphism=True): sage: C.parametrization() Traceback (most recent call last): ... - ValueError: Conic Projective Conic Curve over Rational Field defined by x^2 + y^2 + 7*z^2 has no rational points over Rational Field! + ValueError: Conic Projective Conic Curve over Rational Field defined by + x^2 + y^2 + 7*z^2 has no rational points over Rational Field! A ``ValueError`` is raised if ``self`` is not smooth :: @@ -923,7 +930,8 @@ def parametrization(self, point=None, morphism=True): sage: C.parametrization() Traceback (most recent call last): ... - ValueError: The conic self (=Projective Conic Curve over Rational Field defined by x^2 + y^2) is not smooth, hence does not have a parametrization. + ValueError: The conic self (=Projective Conic Curve over Rational Field + defined by x^2 + y^2) is not smooth, hence does not have a parametrization. """ if (self._parametrization is not None) and not point: par = self._parametrization @@ -1020,7 +1028,8 @@ def random_rational_point(self, *args1, **args2): sage: Conic(QQ, [1, 1, 1]).random_rational_point() Traceback (most recent call last): ... - ValueError: Conic Projective Conic Curve over Rational Field defined by x^2 + y^2 + z^2 has no rational points over Rational Field! + ValueError: Conic Projective Conic Curve over Rational Field defined by + x^2 + y^2 + z^2 has no rational points over Rational Field! """ if not self.is_smooth(): @@ -1057,13 +1066,15 @@ def rational_point(self, algorithm='default', read_cache=True): sage: C.rational_point() Traceback (most recent call last): ... - ValueError: Conic Projective Conic Curve over Rational Field defined by x^2 + 2*y^2 + z^2 has no rational points over Rational Field! + ValueError: Conic Projective Conic Curve over Rational Field defined by + x^2 + 2*y^2 + z^2 has no rational points over Rational Field! sage: C = Conic(x^2 + y^2 + 7*z^2) sage: C.rational_point(algorithm = 'rnfisnorm') Traceback (most recent call last): ... - ValueError: Conic Projective Conic Curve over Rational Field defined by x^2 + y^2 + 7*z^2 has no rational points over Rational Field! + ValueError: Conic Projective Conic Curve over Rational Field defined by + x^2 + y^2 + 7*z^2 has no rational points over Rational Field! Examples over number fields :: @@ -1127,12 +1138,18 @@ def rational_point(self, algorithm='default', read_cache=True): sage: G.rational_point(algorithm='magma') # optional - magma # optional - sage.rings.number_field Traceback (most recent call last): ... - ValueError: Conic Projective Conic Curve over Number Field in s with defining polynomial x^2 - 2 with s = 1.414213562373095? defined by s*x^2 + 30*y^2 - 21*z^2 has no rational points over Number Field in s with defining polynomial x^2 - 2 with s = 1.414213562373095?! + ValueError: Conic Projective Conic Curve over Number Field in s + with defining polynomial x^2 - 2 with s = 1.414213562373095? + defined by s*x^2 + 30*y^2 - 21*z^2 has no rational points over + Number Field in s with defining polynomial x^2 - 2 with s = 1.414213562373095?! sage: G.rational_point(algorithm='magma', # optional - magma # optional - sage.rings.number_field ....: read_cache=False) Traceback (most recent call last): ... - ValueError: Conic Projective Conic Curve over Number Field in s with defining polynomial x^2 - 2 with s = 1.414213562373095? defined by s*x^2 + 30*y^2 - 21*z^2 has no rational points over Number Field in s with defining polynomial x^2 - 2 with s = 1.414213562373095?! + ValueError: Conic Projective Conic Curve over Number Field in s + with defining polynomial x^2 - 2 with s = 1.414213562373095? + defined by s*x^2 + 30*y^2 - 21*z^2 has no rational points over + Number Field in s with defining polynomial x^2 - 2 with s = 1.414213562373095?! Examples over finite fields :: @@ -1155,7 +1172,9 @@ def rational_point(self, algorithm='default', read_cache=True): sage: Conic(RR, [1, 1, 1]).rational_point() # optional - sage.rings.finite_rings Traceback (most recent call last): ... - ValueError: Conic Projective Conic Curve over Real Field with 53 bits of precision defined by x^2 + y^2 + z^2 has no rational points over Real Field with 53 bits of precision! + ValueError: Conic Projective Conic Curve over Real Field + with 53 bits of precision defined by x^2 + y^2 + z^2 has + no rational points over Real Field with 53 bits of precision! """ bl, pt = self.has_rational_point(point=True, algorithm=algorithm, read_cache=read_cache) @@ -1182,7 +1201,8 @@ def singular_point(self): sage: Conic(QQ, [1,1,1,1,1,1]).singular_point() Traceback (most recent call last): ... - ValueError: The conic self (= Projective Conic Curve over Rational Field defined by x^2 + x*y + y^2 + x*z + y*z + z^2) has no rational singular point + ValueError: The conic self (= Projective Conic Curve over Rational Field + defined by x^2 + x*y + y^2 + x*z + y*z + z^2) has no rational singular point """ b = self.has_singular_point(point=True) if not b[0]: @@ -1247,8 +1267,7 @@ def upper_triangular_matrix(self): def variable_names(self): r""" - Returns the variable names of the defining polynomial - of ``self``. + Returns the variable names of the defining polynomial of ``self``. EXAMPLES: diff --git a/src/sage/schemes/plane_conics/con_number_field.py b/src/sage/schemes/plane_conics/con_number_field.py index da20b6f3802..4b0e7f1c5d4 100644 --- a/src/sage/schemes/plane_conics/con_number_field.py +++ b/src/sage/schemes/plane_conics/con_number_field.py @@ -113,7 +113,7 @@ def has_rational_point(self, point=False, obstruction=False, An example over `\QQ` :: sage: C = Conic(QQ, [1, 113922743, -310146482690273725409]) - sage: C.has_rational_point(point = True) + sage: C.has_rational_point(point=True) (True, (-76842858034579/5424 : -5316144401/5424 : 1)) sage: C.has_rational_point(algorithm='local', read_cache=False) True @@ -130,10 +130,11 @@ def has_rational_point(self, point=False, obstruction=False, ....: read_cache=False) Traceback (most recent call last): ... - ValueError: Algorithm rnfisnorm cannot be combined with obstruction = True in has_rational_point + ValueError: Algorithm rnfisnorm cannot be combined with + obstruction = True in has_rational_point sage: P. = QQ[] - sage: L. = NumberField(x^3-5) + sage: L. = NumberField(x^3 - 5) sage: C = Conic(L, [1, 2, -3]) sage: C.has_rational_point(point=True, algorithm='rnfisnorm') (True, (5/3 : -1/3 : 1)) diff --git a/src/sage/schemes/plane_conics/con_rational_field.py b/src/sage/schemes/plane_conics/con_rational_field.py index a929ba3d780..68286fbed7b 100644 --- a/src/sage/schemes/plane_conics/con_rational_field.py +++ b/src/sage/schemes/plane_conics/con_rational_field.py @@ -147,7 +147,11 @@ def has_rational_point(self, point=False, obstruction=False, sage: l = Sequence(cartesian_product_iterator([[-1, 0, 1] for i in range(6)])) sage: c = [Conic(QQ, a) for a in l if a != [0,0,0] and a != (0,0,0,0,0,0)] sage: d = [] - sage: d = [[C] + [C.has_rational_point(algorithm=algorithm, read_cache=False, obstruction=(algorithm != 'rnfisnorm'), point=(algorithm != 'local')) for algorithm in ['local', 'qfsolve', 'rnfisnorm']] for C in c[::10]] # long time: 7 seconds + sage: d = [[C] + [C.has_rational_point(algorithm=algorithm, read_cache=False, # long time: 7 seconds + ....: obstruction=(algorithm != 'rnfisnorm'), + ....: point=(algorithm != 'local')) + ....: for algorithm in ['local', 'qfsolve', 'rnfisnorm']] + ....: for C in c[::10]] sage: assert all(e[1][0] == e[2][0] and e[1][0] == e[3][0] for e in d) sage: assert all(e[0].defining_polynomial()(Sequence(e[i][1])) == 0 for e in d for i in [2,3] if e[1][0]) """ @@ -356,7 +360,8 @@ def parametrization(self, point=None, morphism=True): sage: C.parametrization() Traceback (most recent call last): ... - ValueError: Conic Projective Conic Curve over Rational Field defined by x^2 + 2*y^2 + z^2 has no rational points over Rational Field! + ValueError: Conic Projective Conic Curve over Rational Field defined + by x^2 + 2*y^2 + z^2 has no rational points over Rational Field! A ``ValueError`` is raised if ``self`` is not smooth :: @@ -364,7 +369,8 @@ def parametrization(self, point=None, morphism=True): sage: C.parametrization() Traceback (most recent call last): ... - ValueError: The conic self (=Projective Conic Curve over Rational Field defined by x^2 + y^2) is not smooth, hence does not have a parametrization. + ValueError: The conic self (=Projective Conic Curve over Rational Field defined + by x^2 + y^2) is not smooth, hence does not have a parametrization. """ if (self._parametrization is not None) and not point: par = self._parametrization diff --git a/src/sage/schemes/plane_conics/con_rational_function_field.py b/src/sage/schemes/plane_conics/con_rational_function_field.py index 4b38bc47db1..8e5bf4669c2 100644 --- a/src/sage/schemes/plane_conics/con_rational_function_field.py +++ b/src/sage/schemes/plane_conics/con_rational_function_field.py @@ -24,7 +24,7 @@ Points can be found using :meth:`has_rational_point`:: sage: K. = FractionField(QQ['t']) - sage: C = Conic([1,-t,t]) + sage: C = Conic([1, -t, t]) sage: C.has_rational_point(point=True) (True, (0 : 1 : 1)) """ @@ -205,14 +205,25 @@ def has_rational_point(self, point=False, algorithm='default', Traceback (most recent call last): ... TypeError: self (=Scheme morphism: - From: Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 7 defined by (-2*t^2 - 3)*x^2 + (-t^3 + 3*t^2 - 2*t - 2)/(t + 3)*y^2 + (-t^6 + 3*t^5 + t^3 - t^2 - t + 2)/(t^4 + t^3 - 3*t^2 + 3*t + 1)*z^2 - To: Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 7 defined by (-2*t^2 - 3)*x^2 + (t^2 + 3*t + 3)*x*y + (-2*t^2 - 2)*y^2 + (-t^2 + 3*t + 2)*x*z + (-3*t + 3)*y*z + (-3*t^2 + t - 2)*z^2 + From: Projective Conic Curve over Fraction Field of Univariate + Polynomial Ring in t over Finite Field of size 7 defined by + (-2*t^2 - 3)*x^2 + (-t^3 + 3*t^2 - 2*t - 2)/(t + 3)*y^2 + (-t^6 + 3*t^5 + t^3 - t^2 - t + 2)/(t^4 + t^3 - 3*t^2 + 3*t + 1)*z^2 + To: Projective Conic Curve over Fraction Field of Univariate + Polynomial Ring in t over Finite Field of size 7 defined by + (-2*t^2 - 3)*x^2 + (t^2 + 3*t + 3)*x*y + (-2*t^2 - 2)*y^2 + (-t^2 + 3*t + 2)*x*z + (-3*t + 3)*y*z + (-3*t^2 + t - 2)*z^2 Defn: Defined on coordinates by sending (x : y : z) to - (x + (2*t - 2)/(t + 3)*y + (3*t^4 + 2*t^3 - 2*t^2 - 2*t + 3)/(t^4 + t^3 - 3*t^2 + 3*t + 1)*z : y + (-t^3 - t^2 + 3*t - 1)/(t^3 - 3*t^2 + 2*t + 2)*z : z)) domain must equal right (=Scheme morphism: - From: Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 7 defined by (-2*t^3 - t^2 + 3*t + 3)*x^2 + (t - 3)*y^2 + (-t^7 + 2*t^5 + t^4 + 2*t^3 + 3*t^2 - t - 1)*z^2 - To: Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 7 defined by -2/(t^3 - 3*t^2 + 2*t + 2)*x^2 + 1/(t^3 + 3*t^2 - 2*t + 1)*y^2 + (-t^6 + 3*t^5 + t^3 - t^2 - t + 2)/(t^9 - 2*t^8 + t^7 - t^6 + 3*t^5 - 3*t^3 + t^2 - 2*t + 3)*z^2 + (x + (2*t - 2)/(t + 3)*y + (3*t^4 + 2*t^3 - 2*t^2 - 2*t + 3)/(t^4 + t^3 - 3*t^2 + 3*t + 1)*z + : y + (-t^3 - t^2 + 3*t - 1)/(t^3 - 3*t^2 + 2*t + 2)*z : z)) + domain must equal right (=Scheme morphism: + From: Projective Conic Curve over Fraction Field of Univariate + Polynomial Ring in t over Finite Field of size 7 defined by + (-2*t^3 - t^2 + 3*t + 3)*x^2 + (t - 3)*y^2 + (-t^7 + 2*t^5 + t^4 + 2*t^3 + 3*t^2 - t - 1)*z^2 + To: Projective Conic Curve over Fraction Field of Univariate + Polynomial Ring in t over Finite Field of size 7 defined by + -2/(t^3 - 3*t^2 + 2*t + 2)*x^2 + 1/(t^3 + 3*t^2 - 2*t + 1)*y^2 + (-t^6 + 3*t^5 + t^3 - t^2 - t + 2)/(t^9 - 2*t^8 + t^7 - t^6 + 3*t^5 - 3*t^3 + t^2 - 2*t + 3)*z^2 Defn: Defined on coordinates by sending (x : y : z) to - ((t^3 - 3*t^2 + 2*t + 2)*x : (t^2 - 2)*y : (t^5 - 3*t^4 + t^2 + 3*t + 3)*z)) codomain + ((t^3 - 3*t^2 + 2*t + 2)*x : (t^2 - 2)*y : (t^5 - 3*t^4 + t^2 + 3*t + 3)*z)) + codomain From 2507c8f96e05770d042b2a8e0c9ab85428809a6a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 24 Mar 2023 13:55:04 -0700 Subject: [PATCH 090/135] sage.schemes: Even more cosmetic doctest changes --- src/sage/schemes/affine/affine_homset.py | 2 +- .../schemes/affine/affine_rational_point.py | 12 +- src/sage/schemes/product_projective/homset.py | 4 +- .../schemes/product_projective/subscheme.py | 43 +--- .../schemes/projective/projective_homset.py | 10 +- .../schemes/projective/projective_morphism.py | 123 +++++----- .../schemes/projective/projective_space.py | 18 +- .../projective/projective_subscheme.py | 24 +- src/sage/schemes/toric/chow_group.py | 37 ++- src/sage/schemes/toric/divisor.py | 15 +- src/sage/schemes/toric/divisor_class.pyx | 6 +- src/sage/schemes/toric/fano_variety.py | 222 +++++++---------- src/sage/schemes/toric/ideal.py | 2 +- src/sage/schemes/toric/library.py | 224 +++++------------- src/sage/schemes/toric/morphism.py | 3 +- src/sage/schemes/toric/sheaf/klyachko.py | 77 +++--- src/sage/schemes/toric/toric_subscheme.py | 5 +- src/sage/schemes/toric/variety.py | 48 ++-- 18 files changed, 326 insertions(+), 549 deletions(-) diff --git a/src/sage/schemes/affine/affine_homset.py b/src/sage/schemes/affine/affine_homset.py index 0aeb032c40e..d0a87fae087 100644 --- a/src/sage/schemes/affine/affine_homset.py +++ b/src/sage/schemes/affine/affine_homset.py @@ -248,7 +248,7 @@ def points(self, **kwds): Warning: computations in the numerical fields are inexact;points may be computed partially or incorrectly. [(-1.00000000000000, 0.000000000000000), - (0.000000000000000, 0.000000000000000)] + (0.000000000000000, 0.000000000000000)] :: diff --git a/src/sage/schemes/affine/affine_rational_point.py b/src/sage/schemes/affine/affine_rational_point.py index 84ff522cc98..6846935f4f8 100644 --- a/src/sage/schemes/affine/affine_rational_point.py +++ b/src/sage/schemes/affine/affine_rational_point.py @@ -77,10 +77,10 @@ def enum_affine_rational_field(X, B): sage: from sage.schemes.affine.affine_rational_point import enum_affine_rational_field sage: enum_affine_rational_field(A(QQ), 1) [(-1, -1, -1), (-1, -1, 0), (-1, -1, 1), (-1, 0, -1), (-1, 0, 0), (-1, 0, 1), - (-1, 1, -1), (-1, 1, 0), (-1, 1, 1), (0, -1, -1), (0, -1, 0), (0, -1, 1), - (0, 0, -1), (0, 0, 0), (0, 0, 1), (0, 1, -1), (0, 1, 0), (0, 1, 1), (1, -1, -1), - (1, -1, 0), (1, -1, 1), (1, 0, -1), (1, 0, 0), (1, 0, 1), (1, 1, -1), (1, 1, 0), - (1, 1, 1)] + (-1, 1, -1), (-1, 1, 0), (-1, 1, 1), (0, -1, -1), (0, -1, 0), (0, -1, 1), + (0, 0, -1), (0, 0, 0), (0, 0, 1), (0, 1, -1), (0, 1, 0), (0, 1, 1), (1, -1, -1), + (1, -1, 0), (1, -1, 1), (1, 0, -1), (1, 0, 0), (1, 0, 1), (1, 1, -1), (1, 1, 0), + (1, 1, 1)] :: @@ -97,8 +97,8 @@ def enum_affine_rational_field(X, B): sage: C = Curve(x^2 + y - x) sage: enum_affine_rational_field(C, 10) # long time (3 s) [(-2, -6), (-1, -2), (-2/3, -10/9), (-1/2, -3/4), (-1/3, -4/9), - (0, 0), (1/3, 2/9), (1/2, 1/4), (2/3, 2/9), (1, 0), - (4/3, -4/9), (3/2, -3/4), (5/3, -10/9), (2, -2), (3, -6)] + (0, 0), (1/3, 2/9), (1/2, 1/4), (2/3, 2/9), (1, 0), + (4/3, -4/9), (3/2, -3/4), (5/3, -10/9), (2, -2), (3, -6)] AUTHORS: diff --git a/src/sage/schemes/product_projective/homset.py b/src/sage/schemes/product_projective/homset.py index 17aa83c4bcd..4e84d38c954 100644 --- a/src/sage/schemes/product_projective/homset.py +++ b/src/sage/schemes/product_projective/homset.py @@ -38,8 +38,8 @@ class SchemeHomset_points_product_projective_spaces_ring(SchemeHomset_points): EXAMPLES:: sage: from sage.schemes.product_projective.homset import SchemeHomset_points_product_projective_spaces_ring - sage: SchemeHomset_points_product_projective_spaces_ring(Spec(QQ), \ - ProductProjectiveSpaces([1, 1], QQ, 'z')) + sage: SchemeHomset_points_product_projective_spaces_ring( + ....: Spec(QQ), ProductProjectiveSpaces([1, 1], QQ, 'z')) Set of rational points of Product of projective spaces P^1 x P^1 over Rational Field """ diff --git a/src/sage/schemes/product_projective/subscheme.py b/src/sage/schemes/product_projective/subscheme.py index 6faa499cee2..059a82646ff 100644 --- a/src/sage/schemes/product_projective/subscheme.py +++ b/src/sage/schemes/product_projective/subscheme.py @@ -47,8 +47,8 @@ class AlgebraicScheme_subscheme_product_projective(AlgebraicScheme_subscheme_pro sage: P. = ProductProjectiveSpaces([1, 1], QQ) sage: P.subscheme([u*x^2 - v*y*x]) - Closed subscheme of Product of projective spaces P^1 x P^1 over Rational - Field defined by: + Closed subscheme of Product of projective spaces P^1 x P^1 over Rational Field + defined by: x^2*u - x*y*v TESTS:: @@ -98,15 +98,9 @@ def segre_embedding(self, PP=None): (no polynomials) To: Closed subscheme of Projective Space of dimension 7 over Complex Field with 53 bits of precision defined by: - -u5*u6 + u4*u7, - -u3*u6 + u2*u7, - -u3*u4 + u2*u5, - -u3*u5 + u1*u7, - -u3*u4 + u1*u6, - -u3*u4 + u0*u7, - -u2*u4 + u0*u6, - -u1*u4 + u0*u5, - -u1*u2 + u0*u3 + -u5*u6 + u4*u7, -u3*u6 + u2*u7, -u3*u4 + u2*u5, + -u3*u5 + u1*u7, -u3*u4 + u1*u6, -u3*u4 + u0*u7, + -u2*u4 + u0*u6, -u1*u4 + u0*u5, -u1*u2 + u0*u3 Defn: Defined by sending (x : y , u : v , s : t) to (x*u*s : x*u*t : x*v*s : x*v*t : y*u*s : y*u*t : y*v*s : y*v*t). @@ -117,28 +111,15 @@ def segre_embedding(self, PP=None): Scheme morphism: From: Closed subscheme of Product of projective spaces P^2 x P^1 x P^1 over Integer Ring defined by: - x^3, - u - v, - s^2 - t^2 + x^3, u - v, s^2 - t^2 To: Closed subscheme of Projective Space of dimension 11 over Integer Ring defined by: - u10^2 - u11^2, - u9 - u11, - u8 - u10, - -u7*u10 + u6*u11, - u6*u10 - u7*u11, - u6^2 - u7^2, - u5 - u7, - u4 - u6, - u3^3, - -u3*u10 + u2*u11, - u2*u10 - u3*u11, - -u3*u6 + u2*u7, - u2*u6 - u3*u7, - u2*u3^2, - u2^2 - u3^2, - u1 - u3, - u0 - u2 + u10^2 - u11^2, u9 - u11, u8 - u10, + -u7*u10 + u6*u11, u6*u10 - u7*u11, u6^2 - u7^2, + u5 - u7, u4 - u6, u3^3, + -u3*u10 + u2*u11, u2*u10 - u3*u11, -u3*u6 + u2*u7, + u2*u6 - u3*u7, u2*u3^2, u2^2 - u3^2, + u1 - u3, u0 - u2 Defn: Defined by sending (x : y : z , u : v , s : t) to (x*u*s : x*u*t : x*v*s : x*v*t : y*u*s : y*u*t : y*v*s : y*v*t : z*u*s : z*u*t : z*v*s : z*v*t). diff --git a/src/sage/schemes/projective/projective_homset.py b/src/sage/schemes/projective/projective_homset.py index 16cd4fd42a1..36b0f79956b 100644 --- a/src/sage/schemes/projective/projective_homset.py +++ b/src/sage/schemes/projective/projective_homset.py @@ -150,11 +150,11 @@ def points(self, **kwds): verbose 0 (...: projective_homset.py, points) Warning: computations in the numerical fields are inexact;points may be computed partially or incorrectly. [(-0.500000000000000 + 0.866025403784439*I : 1.00000000000000 : 0.000000000000000), - (-0.500000000000000 - 0.866025403784439*I : 1.00000000000000 : 0.000000000000000), - (-1.00000000000000*I : 0.000000000000000 : 1.00000000000000), - (0.000000000000000 : 0.000000000000000 : 1.00000000000000), - (1.00000000000000 : 1.00000000000000 : 0.000000000000000), - (1.00000000000000*I : 0.000000000000000 : 1.00000000000000)] + (-0.500000000000000 - 0.866025403784439*I : 1.00000000000000 : 0.000000000000000), + (-1.00000000000000*I : 0.000000000000000 : 1.00000000000000), + (0.000000000000000 : 0.000000000000000 : 1.00000000000000), + (1.00000000000000 : 1.00000000000000 : 0.000000000000000), + (1.00000000000000*I : 0.000000000000000 : 1.00000000000000)] sage: L[0].codomain() Projective Space of dimension 2 over Complex Field with 53 bits of precision diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 7d2b540adde..ddb6b12d903 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -426,7 +426,8 @@ def _fastpolys(self): sage: H = Hom(P,P) sage: f = H([x^2 + y^2, y^2]) sage: [g.op_list() for g in f._fastpolys] - [[('load_const', 0), ('load_const', 1), ('load_arg', ...), ('ipow', 2), 'mul', 'add', ('load_const', 1), ('load_arg', ...), ('ipow', 2), 'mul', 'add', 'return'], [('load_const', 0), ('load_const', 1), ('load_arg', 1), ('ipow', 2), 'mul', 'add', 'return']] + [[('load_const', 0), ('load_const', 1), ('load_arg', ...), ('ipow', 2), 'mul', 'add', ('load_const', 1), ('load_arg', ...), ('ipow', 2), 'mul', 'add', 'return'], + [('load_const', 0), ('load_const', 1), ('load_arg', 1), ('ipow', 2), 'mul', 'add', 'return']] """ polys = self._polys @@ -702,10 +703,10 @@ def as_dynamical_system(self): :: - sage: P. = ProjectiveSpace(GF(5), 1) # optional - sage.rings.finite_rings - sage: H = End(P) # optional - sage.rings.finite_rings - sage: f = H([x^2, y^2]) # optional - sage.rings.finite_rings - sage: type(f.as_dynamical_system()) # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(5), 1) # optional - sage.rings.finite_rings + sage: H = End(P) # optional - sage.rings.finite_rings + sage: f = H([x^2, y^2]) # optional - sage.rings.finite_rings + sage: type(f.as_dynamical_system()) # optional - sage.rings.finite_rings :: @@ -769,11 +770,11 @@ def scale_by(self, t): :: - sage: P. = ProjectiveSpace(GF(7), 2) # optional - sage.rings.finite_rings - sage: X = P.subscheme(x^2 - y^2) # optional - sage.rings.finite_rings - sage: H = Hom(X, X) # optional - sage.rings.finite_rings - sage: f = H([x^2, y^2, z^2]) # optional - sage.rings.finite_rings - sage: f.scale_by(x - y); f # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(7), 2) # optional - sage.rings.finite_rings + sage: X = P.subscheme(x^2 - y^2) # optional - sage.rings.finite_rings + sage: H = Hom(X, X) # optional - sage.rings.finite_rings + sage: f = H([x^2, y^2, z^2]) # optional - sage.rings.finite_rings + sage: f.scale_by(x - y); f # optional - sage.rings.finite_rings Scheme endomorphism of Closed subscheme of Projective Space of dimension 2 over Finite Field of size 7 defined by: x^2 - y^2 Defn: Defined on coordinates by sending (x : y : z) to @@ -834,11 +835,11 @@ def normalize_coordinates(self, **kwds): :: - sage: P. = ProjectiveSpace(GF(7), 2) # optional - sage.rings.finite_rings - sage: X = P.subscheme(x^2 - y^2) # optional - sage.rings.finite_rings - sage: H = Hom(X, X) # optional - sage.rings.finite_rings - sage: f = H([x^3 + x*y^2, x*y^2, x*z^2]) # optional - sage.rings.finite_rings - sage: f.normalize_coordinates(); f # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(7), 2) # optional - sage.rings.finite_rings + sage: X = P.subscheme(x^2 - y^2) # optional - sage.rings.finite_rings + sage: H = Hom(X, X) # optional - sage.rings.finite_rings + sage: f = H([x^3 + x*y^2, x*y^2, x*z^2]) # optional - sage.rings.finite_rings + sage: f.normalize_coordinates(); f # optional - sage.rings.finite_rings Scheme endomorphism of Closed subscheme of Projective Space of dimension 2 over Finite Field of size 7 defined by: x^2 - y^2 Defn: Defined on coordinates by sending (x : y : z) to (2*y^2 : y^2 : z^2) @@ -856,10 +857,10 @@ def normalize_coordinates(self, **kwds): :: - sage: K. = QuadraticField(5) # optional - sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field - sage: f = DynamicalSystem([w*x^2 + (1/5*w)*y^2, w*y^2]) # optional - sage.rings.number_field - sage: f.normalize_coordinates(); f # optional - sage.rings.number_field + sage: K. = QuadraticField(5) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: f = DynamicalSystem([w*x^2 + (1/5*w)*y^2, w*y^2]) # optional - sage.rings.number_field + sage: f.normalize_coordinates(); f # optional - sage.rings.number_field Dynamical System of Projective Space of dimension 1 over Number Field in w with defining polynomial x^2 - 5 with w = 2.236067977499790? Defn: Defined on coordinates by sending (x : y) to (5*x^2 + y^2 : 5*y^2) @@ -867,11 +868,11 @@ def normalize_coordinates(self, **kwds): :: sage: R. = PolynomialRing(ZZ) - sage: K. = NumberField(t^3 - 11) # optional - sage.rings.number_field - sage: a = 7/(b - 1) # optional - sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field - sage: f = DynamicalSystem_projective([a*y^2 - (a*y - x)^2, y^2]) # optional - sage.rings.number_field - sage: f.normalize_coordinates(); f # optional - sage.rings.number_field + sage: K. = NumberField(t^3 - 11) # optional - sage.rings.number_field + sage: a = 7/(b - 1) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: f = DynamicalSystem_projective([a*y^2 - (a*y - x)^2, y^2]) # optional - sage.rings.number_field + sage: f.normalize_coordinates(); f # optional - sage.rings.number_field Dynamical System of Projective Space of dimension 1 over Number Field in b with defining polynomial t^3 - 11 Defn: Defined on coordinates by sending (x : y) to @@ -1142,12 +1143,12 @@ def dehomogenize(self, n): :: - sage: K. = QuadraticField(3) # optional - sage.rings.number_field - sage: O = K.ring_of_integers() # optional - sage.rings.number_field - sage: P. = ProjectiveSpace(O, 1) # optional - sage.rings.number_field - sage: H = End(P) # optional - sage.rings.number_field - sage: f = H([x^2 - O(w)*y^2, y^2]) # optional - sage.rings.number_field - sage: f.dehomogenize(1) # optional - sage.rings.number_field + sage: K. = QuadraticField(3) # optional - sage.rings.number_field + sage: O = K.ring_of_integers() # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(O, 1) # optional - sage.rings.number_field + sage: H = End(P) # optional - sage.rings.number_field + sage: f = H([x^2 - O(w)*y^2, y^2]) # optional - sage.rings.number_field + sage: f.dehomogenize(1) # optional - sage.rings.number_field Scheme endomorphism of Affine Space of dimension 1 over Maximal Order in Number Field in w with defining polynomial x^2 - 3 with w = 1.732050807568878? @@ -1236,11 +1237,11 @@ def is_morphism(self): :: - sage: R. = PolynomialRing(GF(5)) # optional - sage.rings.finite_rings - sage: P. = ProjectiveSpace(R, 2) # optional - sage.rings.finite_rings - sage: H = Hom(P, P) # optional - sage.rings.finite_rings - sage: f = H([x*z - t*y^2, x^2 - y^2, t*z^2]) # optional - sage.rings.finite_rings - sage: f.is_morphism() # optional - sage.rings.finite_rings + sage: R. = PolynomialRing(GF(5)) # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(R, 2) # optional - sage.rings.finite_rings + sage: H = Hom(P, P) # optional - sage.rings.finite_rings + sage: f = H([x*z - t*y^2, x^2 - y^2, t*z^2]) # optional - sage.rings.finite_rings + sage: f.is_morphism() # optional - sage.rings.finite_rings True Map that is not morphism on projective space, but is over a subscheme:: @@ -1308,21 +1309,21 @@ def global_height(self, prec=None): :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(z^2 - 2) # optional - sage.rings.number_field - sage: O = K.maximal_order() # optional - sage.rings.number_field - sage: P. = ProjectiveSpace(O, 1) # optional - sage.rings.number_field - sage: H = Hom(P, P) # optional - sage.rings.number_field - sage: f = H([2*x^2 + 3*O(w)*y^2, O(w)*y^2]) # optional - sage.rings.number_field - sage: f.global_height() # optional - sage.rings.number_field + sage: K. = NumberField(z^2 - 2) # optional - sage.rings.number_field + sage: O = K.maximal_order() # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(O, 1) # optional - sage.rings.number_field + sage: H = Hom(P, P) # optional - sage.rings.number_field + sage: f = H([2*x^2 + 3*O(w)*y^2, O(w)*y^2]) # optional - sage.rings.number_field + sage: f.global_height() # optional - sage.rings.number_field 1.09861228866811 :: - sage: P. = ProjectiveSpace(QQbar, 1) # optional - sage.rings.number_field - sage: P2. = ProjectiveSpace(QQbar, 2) # optional - sage.rings.number_field - sage: H = Hom(P, P2) # optional - sage.rings.number_field - sage: f = H([x^2 + QQbar(I)*x*y + 3*y^2, y^2, QQbar(sqrt(5))*x*y]) # optional - sage.rings.number_field - sage: f.global_height() # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(QQbar, 1) # optional - sage.rings.number_field + sage: P2. = ProjectiveSpace(QQbar, 2) # optional - sage.rings.number_field + sage: H = Hom(P, P2) # optional - sage.rings.number_field + sage: f = H([x^2 + QQbar(I)*x*y + 3*y^2, y^2, QQbar(sqrt(5))*x*y]) # optional - sage.rings.number_field + sage: f.global_height() # optional - sage.rings.number_field 1.09861228866811 :: @@ -1414,11 +1415,11 @@ def local_height(self, v, prec=None): :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(z^2 - 2) # optional - sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field - sage: H = Hom(P, P) # optional - sage.rings.number_field - sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) # optional - sage.rings.number_field - sage: f.local_height(K.ideal(3)) # optional - sage.rings.number_field + sage: K. = NumberField(z^2 - 2) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: H = Hom(P, P) # optional - sage.rings.number_field + sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) # optional - sage.rings.number_field + sage: f.local_height(K.ideal(3)) # optional - sage.rings.number_field 1.09861228866811 """ K = FractionField(self.domain().base_ring()) @@ -1461,11 +1462,11 @@ def local_height_arch(self, i, prec=None): :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(z^2 - 2) # optional - sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field - sage: H = Hom(P, P) # optional - sage.rings.number_field - sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) # optional - sage.rings.number_field - sage: f.local_height_arch(1) # optional - sage.rings.number_field + sage: K. = NumberField(z^2 - 2) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: H = Hom(P, P) # optional - sage.rings.number_field + sage: f = H([2*x^2 + w/3*y^2, 1/w*y^2]) # optional - sage.rings.number_field + sage: f.local_height_arch(1) # optional - sage.rings.number_field 0.6931471805599453094172321214582 """ K = FractionField(self.domain().base_ring()) @@ -1488,11 +1489,11 @@ def wronskian_ideal(self): EXAMPLES:: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2 + 11) # optional - sage.rings.number_field - sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field - sage: H = End(P) # optional - sage.rings.number_field - sage: f = H([x^2 - w*y^2, w*y^2]) # optional - sage.rings.number_field - sage: f.wronskian_ideal() # optional - sage.rings.number_field + sage: K. = NumberField(x^2 + 11) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field + sage: H = End(P) # optional - sage.rings.number_field + sage: f = H([x^2 - w*y^2, w*y^2]) # optional - sage.rings.number_field + sage: f.wronskian_ideal() # optional - sage.rings.number_field Ideal ((4*w)*x*y) of Multivariate Polynomial Ring in x, y over Number Field in w with defining polynomial x^2 + 11 diff --git a/src/sage/schemes/projective/projective_space.py b/src/sage/schemes/projective/projective_space.py index 9301202f4d4..5c3adad9bea 100644 --- a/src/sage/schemes/projective/projective_space.py +++ b/src/sage/schemes/projective/projective_space.py @@ -28,7 +28,7 @@ Projective Space of dimension 5 over Complex Field with 53 bits of precision The third argument specifies the printing names of the generators of the -homogeneous coordinate ring. Using the method `.objgens()` you can obtain both +homogeneous coordinate ring. Using the method :meth:`objgens` you can obtain both the space and the generators as ready to use variables. :: sage: P2, vars = ProjectiveSpace(10, QQ, 't').objgens() @@ -1334,14 +1334,14 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr INPUT: - - ``points_source`` -- points in source projective space. + - ``points_source`` -- points in source projective space. - - ``points_target`` -- points in target projective space. + - ``points_target`` -- points in target projective space. - - ``normalize`` -- (default: `True`) If the returned matrix should be normalized. - Only works over exact rings. If the base ring is a field, the matrix is normalized so - that the last nonzero entry in the last row is 1. If the base ring is a ring, then - the matrix is normalized so that the entries are elements of the base ring. + - ``normalize`` -- (default: ``True``) If the returned matrix should be normalized. + Only works over exact rings. If the base ring is a field, the matrix is normalized so + that the last nonzero entry in the last row is 1. If the base ring is a ring, then + the matrix is normalized so that the entries are elements of the base ring. OUTPUT: Transformation matrix - element of PGL. @@ -1387,8 +1387,8 @@ def point_transformation_matrix(self, points_source, points_target, normalize=Tr sage: points_source = [P([-6*t, 7]), P([1, 4]), P([3, 2])] sage: points_target = [P([-1, 2*t]), P([0, 2]), P([-1, 6])] sage: P.point_transformation_matrix(points_source, points_target) - [ (1/3*t + 7/12)/(t^2 - 53/24*t) (-1/12*t - 7/48)/(t^2 - 53/24*t)] - [(-2/3*t^2 - 7/36*t - 35/12)/(t^2 - 53/24*t) 1] + [ (1/3*t + 7/12)/(t^2 - 53/24*t) (-1/12*t - 7/48)/(t^2 - 53/24*t)] + [(-2/3*t^2 - 7/36*t - 35/12)/(t^2 - 53/24*t) 1] :: diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index c37d2b1b8d8..9934b49899b 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -1319,22 +1319,14 @@ def Chow_form(self): sage: Y = P.subscheme_from_Chow_form(Ch, 1); Y Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: - x2^2*x3 - x1*x3^2, - -x2^3 + x0*x3^2, - -x2^2*x3 + x1*x3^2, - x1*x2*x3 - x0*x3^2, - 3*x1*x2^2 - 3*x0*x2*x3, - -2*x1^2*x3 + 2*x0*x2*x3, - -3*x1^2*x2 + 3*x0*x1*x3, - x1^3 - x0^2*x3, - x2^3 - x1*x2*x3, - -3*x1*x2^2 + 2*x1^2*x3 + x0*x2*x3, - 2*x0*x2^2 - 2*x0*x1*x3, - 3*x1^2*x2 - 2*x0*x2^2 - x0*x1*x3, - -x0*x1*x2 + x0^2*x3, - -x0*x1^2 + x0^2*x2, - -x1^3 + x0*x1*x2, - x0*x1^2 - x0^2*x2 + x2^2*x3 - x1*x3^2, -x2^3 + x0*x3^2, + -x2^2*x3 + x1*x3^2, x1*x2*x3 - x0*x3^2, + 3*x1*x2^2 - 3*x0*x2*x3, -2*x1^2*x3 + 2*x0*x2*x3, + -3*x1^2*x2 + 3*x0*x1*x3, x1^3 - x0^2*x3, + x2^3 - x1*x2*x3, -3*x1*x2^2 + 2*x1^2*x3 + x0*x2*x3, + 2*x0*x2^2 - 2*x0*x1*x3, 3*x1^2*x2 - 2*x0*x2^2 - x0*x1*x3, + -x0*x1*x2 + x0^2*x3, -x0*x1^2 + x0^2*x2, + -x1^3 + x0*x1*x2, x0*x1^2 - x0^2*x2 sage: I = Y.defining_ideal() sage: I.saturation(I.ring().ideal(list(I.ring().gens())))[0] Ideal (x2^2 - x1*x3, x1*x2 - x0*x3, x1^2 - x0*x2) of Multivariate diff --git a/src/sage/schemes/toric/chow_group.py b/src/sage/schemes/toric/chow_group.py index 3ca2843a2ae..7e5bc8fa2bb 100644 --- a/src/sage/schemes/toric/chow_group.py +++ b/src/sage/schemes/toric/chow_group.py @@ -274,8 +274,7 @@ def project_to_degree(self, degree): EXAMPLES:: sage: A = toric_varieties.P2().Chow_group() - sage: cycle = 10*A.gen(0) + 11*A.gen(1) + 12*A.gen(2) - sage: cycle + sage: cycle = 10*A.gen(0) + 11*A.gen(1) + 12*A.gen(2); cycle ( 12 | 11 | 10 ) sage: cycle.project_to_degree(2) ( 0 | 0 | 10 ) @@ -873,8 +872,8 @@ def degree(self, k=None): Third, an example with `A_2(X)=\ZZ^5`:: - sage: cube = [[ 1,0,0],[0, 1,0],[0,0, 1],[-1, 1, 1], - ....: [-1,0,0],[0,-1,0],[0,0,-1],[ 1,-1,-1]] + sage: cube = [[ 1,0,0], [0, 1,0], [0,0, 1], [-1, 1, 1], + ....: [-1,0,0], [0,-1,0], [0,0,-1], [ 1,-1,-1]] sage: lat_cube = LatticePolytope(cube) sage: X = ToricVariety(FaceFan((LatticePolytope(lat_cube)))) sage: X.Chow_group().degree(2) @@ -887,23 +886,25 @@ def degree(self, k=None): cube, so the variety is "more singular". Its Chow group has torsion, `A_2(X)=\ZZ^5 \oplus \ZZ/2`:: - sage: rays = [[ 1, 2, 3],[ 1,-1, 1],[-1, 1, 1],[-1,-1, 1], - ....: [-1,-1,-1],[-1, 1,-1],[ 1,-1,-1],[ 1, 1,-1]] - sage: cones = [[0,1,2,3],[4,5,6,7],[0,1,7,6], - ....: [4,5,3,2],[0,2,5,7],[4,6,1,3]] + sage: rays = [[ 1, 2, 3], [ 1,-1, 1], [-1, 1, 1], [-1,-1, 1], + ....: [-1,-1,-1], [-1, 1,-1], [ 1,-1,-1], [ 1, 1,-1]] + sage: cones = [[0,1,2,3], [4,5,6,7], [0,1,7,6], + ....: [4,5,3,2], [0,2,5,7], [4,6,1,3]] sage: X = ToricVariety(Fan(cones, rays)) sage: X.Chow_group().degree(2) # long time (2s on sage.math, 2011) C2 x Z^5 Finally, Example 1.3 of [FS1994]_:: - sage: points_mod = lambda k: matrix([[ 1, 1, 2*k+1],[ 1,-1, 1], - ....: [-1, 1, 1],[-1,-1, 1],[-1,-1,-1], - ....: [-1, 1,-1],[ 1,-1,-1],[ 1, 1,-1]]) - sage: rays = lambda k: matrix([[1,1,1],[1,-1,1],[-1,1,1]] - ....: ).solve_left(points_mod(k)).rows() - sage: cones = [[0,1,2,3],[4,5,6,7],[0,1,7,6], - ....: [4,5,3,2],[0,2,5,7],[4,6,1,3]] + sage: def points_mod(k): + ....: return matrix([[ 1, 1, 2*k+1], [ 1,-1, 1], + ....: [-1, 1, 1], [-1,-1, 1], [-1,-1,-1], + ....: [-1, 1,-1], [ 1,-1,-1], [ 1, 1,-1]]) + sage: def rays(k): + ....: return matrix([[ 1, 1, 1], + ....: [ 1, -1, 1], + ....: [-1, 1, 1]]).solve_left(points_mod(k)).rows() + sage: cones = [[0,1,2,3], [4,5,6,7], [0,1,7,6], [4,5,3,2], [0,2,5,7], [4,6,1,3]] sage: X_Delta = lambda k: ToricVariety(Fan(cones=cones, rays=rays(k))) sage: X_Delta(0).Chow_group().degree() # long time (3s on sage.math, 2011) (Z, Z, Z^5, Z) @@ -1027,8 +1028,7 @@ def relation_gens(self): sage: P2 = toric_varieties.P2() sage: A = P2.Chow_group() - sage: first = A.relation_gens()[0] - sage: first + sage: first = A.relation_gens()[0]; first ( 0 | 0 | 0 ) sage: first.is_zero() True @@ -1051,8 +1051,7 @@ class ChowGroup_degree_class(SageObject): EXAMPLES:: sage: P2 = toric_varieties.P2() - sage: A = P2.Chow_group() - sage: A + sage: A = P2.Chow_group(); A Chow group of 2-d CPR-Fano toric variety covered by 3 affine patches sage: A.degree() (Z, Z, Z) diff --git a/src/sage/schemes/toric/divisor.py b/src/sage/schemes/toric/divisor.py index 99dde801895..c0f7e58dbd2 100644 --- a/src/sage/schemes/toric/divisor.py +++ b/src/sage/schemes/toric/divisor.py @@ -1286,17 +1286,10 @@ def Kodaira_map(self, names='z'): From: 2-d CPR-Fano toric variety covered by 6 affine patches To: Closed subscheme of Projective Space of dimension 6 over Rational Field defined by: - -x1*x5 + x0*x6, - -x2*x3 + x0*x5, - -x1*x3 + x0*x4, - x4*x5 - x3*x6, - -x1*x2 + x0*x3, - x3*x5 - x2*x6, - x3*x4 - x1*x6, - x3^2 - x1*x5, - x2*x4 - x1*x5, - -x1*x5^2 + x2*x3*x6, - -x1*x5^3 + x2^2*x6^2 + -x1*x5 + x0*x6, -x2*x3 + x0*x5, -x1*x3 + x0*x4, + x4*x5 - x3*x6, -x1*x2 + x0*x3, x3*x5 - x2*x6, + x3*x4 - x1*x6, x3^2 - x1*x5, x2*x4 - x1*x5, + -x1*x5^2 + x2*x3*x6, -x1*x5^3 + x2^2*x6^2 Defn: Defined on coordinates by sending [x : u : y : v : z : w] to (x*u^2*y^2*v : x^2*u^2*y*w : u*y^2*v^2*z : x*u*y*v*z*w : x^2*u*z*w^2 : y*v^2*z^2*w : x*v*z^2*w^2) diff --git a/src/sage/schemes/toric/divisor_class.pyx b/src/sage/schemes/toric/divisor_class.pyx index 50e23646087..63f21d55b5c 100644 --- a/src/sage/schemes/toric/divisor_class.pyx +++ b/src/sage/schemes/toric/divisor_class.pyx @@ -80,13 +80,11 @@ def is_ToricRationalDivisorClass(x): EXAMPLES:: - sage: from sage.schemes.toric.divisor_class import ( - ....: is_ToricRationalDivisorClass) + sage: from sage.schemes.toric.divisor_class import is_ToricRationalDivisorClass sage: is_ToricRationalDivisorClass(1) False sage: dP6 = toric_varieties.dP6() - sage: D = dP6.rational_class_group().gen(0) - sage: D + sage: D = dP6.rational_class_group().gen(0); D Divisor class [1, 0, 0, 0] sage: is_ToricRationalDivisorClass(D) True diff --git a/src/sage/schemes/toric/fano_variety.py b/src/sage/schemes/toric/fano_variety.py index 05a074d55c4..ef58f689336 100644 --- a/src/sage/schemes/toric/fano_variety.py +++ b/src/sage/schemes/toric/fano_variety.py @@ -53,31 +53,24 @@ Its anticanonical "hypersurface" is a one-dimensional Calabi-Yau manifold:: - sage: P2.anticanonical_hypersurface( - ....: monomial_points="all") - Closed subscheme of 2-d CPR-Fano toric variety - covered by 3 affine patches defined by: + sage: P2.anticanonical_hypersurface(monomial_points="all") + Closed subscheme of 2-d CPR-Fano toric variety covered by 3 affine patches defined by: a0*z0^3 + a9*z0^2*z1 + a7*z0*z1^2 + a1*z1^3 + a8*z0^2*z2 + a6*z0*z1*z2 + a4*z1^2*z2 + a5*z0*z2^2 + a3*z1*z2^2 + a2*z2^3 In many cases it is sufficient to work with the "simplified polynomial moduli space" of anticanonical hypersurfaces:: - sage: P2.anticanonical_hypersurface( - ....: monomial_points="simplified") - Closed subscheme of 2-d CPR-Fano toric variety - covered by 3 affine patches defined by: + sage: P2.anticanonical_hypersurface(monomial_points="simplified") + Closed subscheme of 2-d CPR-Fano toric variety covered by 3 affine patches defined by: a0*z0^3 + a1*z1^3 + a6*z0*z1*z2 + a2*z2^3 The mirror family to these hypersurfaces lives inside the Fano toric variety obtained using ``simplex`` as ``Delta`` instead of ``Delta_polar``:: - sage: FTV = CPRFanoToricVariety(Delta=simplex, - ....: coordinate_points="all") - sage: FTV.anticanonical_hypersurface( - ....: monomial_points="simplified") - Closed subscheme of 2-d CPR-Fano toric variety - covered by 9 affine patches defined by: + sage: FTV = CPRFanoToricVariety(Delta=simplex, coordinate_points="all") + sage: FTV.anticanonical_hypersurface(monomial_points="simplified") + Closed subscheme of 2-d CPR-Fano toric variety covered by 9 affine patches defined by: a2*z2^3*z3^2*z4*z5^2*z8 + a1*z1^3*z3*z4^2*z7^2*z9 + a3*z0*z1*z2*z3*z4*z5*z7*z8*z9 + a0*z0^3*z5*z7*z8^2*z9^2 @@ -86,12 +79,9 @@ corresponding to the interior points of facets - they are singular points which do not lie on a generic anticanonical hypersurface:: - sage: FTV = CPRFanoToricVariety(Delta=simplex, - ....: coordinate_points="all but facets") - sage: FTV.anticanonical_hypersurface( - ....: monomial_points="simplified") - Closed subscheme of 2-d CPR-Fano toric variety - covered by 3 affine patches defined by: + sage: FTV = CPRFanoToricVariety(Delta=simplex, coordinate_points="all but facets") + sage: FTV.anticanonical_hypersurface(monomial_points="simplified") + Closed subscheme of 2-d CPR-Fano toric variety covered by 3 affine patches defined by: a0*z0^3 + a1*z1^3 + a3*z0*z1*z2 + a2*z2^3 This looks very similar to our second version of the anticanonical @@ -104,8 +94,7 @@ sage: p4318 = ReflexivePolytope(3, 4318) sage: FTV = CPRFanoToricVariety(Delta_polar=p4318) sage: FTV.anticanonical_hypersurface() - Closed subscheme of 3-d CPR-Fano toric variety - covered by 4 affine patches defined by: + Closed subscheme of 3-d CPR-Fano toric variety covered by 4 affine patches defined by: a0*z2^12 + a4*z2^6*z3^6 + a3*z3^12 + a8*z0*z1*z2*z3 + a2*z1^3 + a1*z0^2 Below you will find detailed descriptions of available functions. Current @@ -285,10 +274,8 @@ def CPRFanoToricVariety(Delta=None, sage: diamond = lattice_polytope.cross_polytope(2) sage: diamond.vertices() - M( 1, 0), - M( 0, 1), - M(-1, 0), - M( 0, -1) + M( 1, 0), M( 0, 1), + M(-1, 0), M( 0, -1) in 2-d lattice M sage: P1xP1 = CPRFanoToricVariety(Delta_polar=diamond) sage: P1xP1 @@ -296,10 +283,8 @@ def CPRFanoToricVariety(Delta=None, sage: P1xP1.fan() Rational polyhedral fan in 2-d lattice M sage: P1xP1.fan().rays() - M( 1, 0), - M( 0, 1), - M(-1, 0), - M( 0, -1) + M( 1, 0), M( 0, 1), + M(-1, 0), M( 0, -1) in 2-d lattice M "Unfortunately," this variety is smooth to start with and we cannot @@ -309,72 +294,50 @@ def CPRFanoToricVariety(Delta=None, sage: square = diamond.polar() sage: square.vertices() - N( 1, 1), - N( 1, -1), - N(-1, -1), - N(-1, 1) + N( 1, 1), N( 1, -1), + N(-1, -1), N(-1, 1) in 2-d lattice N sage: square.points() - N( 1, 1), - N( 1, -1), - N(-1, -1), - N(-1, 1), - N(-1, 0), - N( 0, -1), - N( 0, 0), - N( 0, 1), - N( 1, 0) + N( 1, 1), N( 1, -1), N(-1, -1), + N(-1, 1), N(-1, 0), N( 0, -1), + N( 0, 0), N( 0, 1), N( 1, 0) in 2-d lattice N We will construct several varieties associated to it:: sage: FTV = CPRFanoToricVariety(Delta_polar=square) sage: FTV.fan().rays() - N( 1, 1), - N( 1, -1), - N(-1, -1), - N(-1, 1) + N( 1, 1), N( 1, -1), + N(-1, -1), N(-1, 1) in 2-d lattice N sage: FTV.gens() (z0, z1, z2, z3) sage: FTV = CPRFanoToricVariety(Delta_polar=square, - ....: coordinate_points=[0,1,2,3,8]) + ....: coordinate_points=[0,1,2,3,8]) sage: FTV.fan().rays() - N( 1, 1), - N( 1, -1), - N(-1, -1), - N(-1, 1), - N( 1, 0) + N( 1, 1), N( 1, -1), N(-1, -1), + N(-1, 1), N( 1, 0) in 2-d lattice N sage: FTV.gens() (z0, z1, z2, z3, z8) sage: FTV = CPRFanoToricVariety(Delta_polar=square, - ....: coordinate_points=[8,0,2,1,3], - ....: coordinate_names="x+") + ....: coordinate_points=[8,0,2,1,3], + ....: coordinate_names="x+") sage: FTV.fan().rays() - N( 1, 0), - N( 1, 1), - N(-1, -1), - N( 1, -1), - N(-1, 1) + N( 1, 0), N( 1, 1), N(-1, -1), + N( 1, -1), N(-1, 1) in 2-d lattice N sage: FTV.gens() (x8, x0, x2, x1, x3) sage: FTV = CPRFanoToricVariety(Delta_polar=square, - ....: coordinate_points="all", - ....: coordinate_names="x y Z+") + ....: coordinate_points="all", + ....: coordinate_names="x y Z+") sage: FTV.fan().rays() - N( 1, 1), - N( 1, -1), - N(-1, -1), - N(-1, 1), - N(-1, 0), - N( 0, -1), - N( 0, 1), - N( 1, 0) + N( 1, 1), N( 1, -1), N(-1, -1), N(-1, 1), + N(-1, 0), N( 0, -1), N( 0, 1), N( 1, 0) in 2-d lattice N sage: FTV.gens() (x, y, Z2, Z3, Z4, Z5, Z7, Z8) @@ -388,9 +351,9 @@ def CPRFanoToricVariety(Delta=None, you want:: sage: FTV = CPRFanoToricVariety(Delta_polar=square, - ....: coordinate_points="all", - ....: coordinate_names="x y Z+", - ....: coordinate_name_indices=list(range(8))) + ....: coordinate_points="all", + ....: coordinate_names="x y Z+", + ....: coordinate_name_indices=list(range(8))) sage: FTV.gens() (x, y, Z2, Z3, Z4, Z5, Z6, Z7) @@ -400,9 +363,9 @@ def CPRFanoToricVariety(Delta=None, much "automatic" ones:: sage: FTV = CPRFanoToricVariety(Delta_polar=square, - ....: coordinate_points="all", - ....: coordinate_names="x Z+", - ....: coordinate_name_indices=list(range(8))) + ....: coordinate_points="all", + ....: coordinate_names="x Z+", + ....: coordinate_name_indices=list(range(8))) sage: FTV.gens() (x, Z1, Z2, Z3, Z4, Z5, Z6, Z7) @@ -410,16 +373,16 @@ def CPRFanoToricVariety(Delta=None, accordingly:: sage: FTV = CPRFanoToricVariety(Delta_polar=square, - ....: coordinate_points="all", - ....: coordinate_names="x Z+", - ....: coordinate_name_indices=[0] + list(range(7))) + ....: coordinate_points="all", + ....: coordinate_names="x Z+", + ....: coordinate_name_indices=[0] + list(range(7))) sage: FTV.gens() (x, Z0, Z1, Z2, Z3, Z4, Z5, Z6) sage: FTV = CPRFanoToricVariety(Delta_polar=square, - ....: coordinate_points="all", - ....: coordinate_names="x y Z+", - ....: coordinate_name_indices=[0]*2 + list(range(6))) + ....: coordinate_points="all", + ....: coordinate_names="x y Z+", + ....: coordinate_name_indices=[0]*2 + list(range(6))) sage: FTV.gens() (x, y, Z0, Z1, Z2, Z3, Z4, Z5) @@ -434,14 +397,11 @@ def CPRFanoToricVariety(Delta=None, (these charts actually form exactly the face fan of our square) :: sage: FTV = CPRFanoToricVariety(Delta_polar=square, - ....: coordinate_points=[0,1,2,3,4], - ....: charts=charts) + ....: coordinate_points=[0,1,2,3,4], + ....: charts=charts) sage: FTV.fan().rays() - N( 1, 1), - N( 1, -1), - N(-1, -1), - N(-1, 1), - N(-1, 0) + N( 1, 1), N( 1, -1), N(-1, -1), + N(-1, 1), N(-1, 0) in 2-d lattice N sage: [cone.ambient_ray_indices() for cone in FTV.fan()] [(0, 1), (1, 2), (2, 4), (3, 4), (0, 3)] @@ -450,8 +410,8 @@ def CPRFanoToricVariety(Delta=None, sage: bad_charts = charts + [(3,0)] sage: FTV = CPRFanoToricVariety(Delta_polar=square, - ....: coordinate_points=[0,1,2,3,4], - ....: charts=bad_charts) + ....: coordinate_points=[0,1,2,3,4], + ....: charts=bad_charts) Traceback (most recent call last): ... ValueError: you have provided 5 cones, but only 4 of them are maximal! @@ -462,9 +422,9 @@ def CPRFanoToricVariety(Delta=None, especially important when you try to speed up your code:: sage: FTV = CPRFanoToricVariety(Delta_polar=square, - ....: coordinate_points=[0,1,2,3,4], - ....: charts=bad_charts, - ....: check=False) + ....: coordinate_points=[0,1,2,3,4], + ....: charts=bad_charts, + ....: check=False) Traceback (most recent call last): ... IndexError: list assignment index out of range @@ -478,8 +438,8 @@ def CPRFanoToricVariety(Delta=None, sage: bad_charts = charts + [(0,2)] sage: FTV = CPRFanoToricVariety(Delta_polar=square, - ....: coordinate_points=[0,1,2,3,4], - ....: charts=bad_charts) + ....: coordinate_points=[0,1,2,3,4], + ....: charts=bad_charts) Traceback (most recent call last): ... ValueError: (0, 2) does not form a chart of a subdivision of @@ -487,28 +447,28 @@ def CPRFanoToricVariety(Delta=None, sage: bad_charts = charts[:-1] sage: FTV = CPRFanoToricVariety(Delta_polar=square, - ....: coordinate_points=[0,1,2,3,4], - ....: charts=bad_charts) + ....: coordinate_points=[0,1,2,3,4], + ....: charts=bad_charts) Traceback (most recent call last): ... ValueError: given charts do not form a complete fan! sage: FTV = CPRFanoToricVariety(Delta_polar=square, - ....: coordinate_points=[1,2,3,4]) + ....: coordinate_points=[1,2,3,4]) Traceback (most recent call last): ... ValueError: all 4 vertices of Delta_polar must be used for coordinates! Got: [1, 2, 3, 4] sage: FTV = CPRFanoToricVariety(Delta_polar=square, - ....: coordinate_points=[0,0,1,2,3,4]) + ....: coordinate_points=[0,0,1,2,3,4]) Traceback (most recent call last): ... ValueError: no repetitions are allowed for coordinate points! Got: [0, 0, 1, 2, 3, 4] sage: FTV = CPRFanoToricVariety(Delta_polar=square, - ....: coordinate_points=[0,1,2,3,6]) + ....: coordinate_points=[0,1,2,3,6]) Traceback (most recent call last): ... ValueError: the origin (point #6) cannot be used for a coordinate! @@ -939,8 +899,7 @@ def coordinate_point_to_coordinate(self, point): EXAMPLES:: sage: diamond = lattice_polytope.cross_polytope(2) - sage: FTV = CPRFanoToricVariety(diamond, - ....: coordinate_points=[0,1,2,3,8]) + sage: FTV = CPRFanoToricVariety(diamond, coordinate_points=[0,1,2,3,8]) sage: FTV.coordinate_points() (0, 1, 2, 3, 8) sage: FTV.gens() @@ -1097,8 +1056,7 @@ def nef_complete_intersection(self, nef_partition, **kwds): nef-partition of the 3-dimensional reflexive polytope #2254:: sage: p = ReflexivePolytope(3, 2254) - sage: np = p.nef_partitions()[1] - sage: np + sage: np = p.nef_partitions()[1]; np Nef-partition {2, 3, 4, 7, 8} ⊔ {0, 1, 5, 6} sage: X = CPRFanoToricVariety(Delta_polar=p) sage: X.nef_complete_intersection(np) @@ -1137,7 +1095,7 @@ def nef_complete_intersection(self, nef_partition, **kwds): intersections in a completely resolved ambient toric variety:: sage: X = CPRFanoToricVariety(Delta_polar=p, - ....: coordinate_points="all") + ....: coordinate_points="all") sage: X.nef_complete_intersection(np) Closed subscheme of 3-d CPR-Fano toric variety covered by 22 affine patches defined by: @@ -1184,11 +1142,8 @@ def cartesian_product(self, other, sage: P1xP2 = P1.cartesian_product(P2); P1xP2 3-d CPR-Fano toric variety covered by 6 affine patches sage: P1xP2.fan().rays() - N+N( 1, 0, 0), - N+N(-1, 0, 0), - N+N( 0, 1, 0), - N+N( 0, 0, 1), - N+N( 0, -1, -1) + N+N( 1, 0, 0), N+N(-1, 0, 0), N+N( 0, 1, 0), + N+N( 0, 0, 1), N+N( 0, -1, -1) in 3-d lattice N+N sage: P1xP2.Delta_polar() 3-d reflexive polytope in 3-d lattice N+N @@ -1248,16 +1203,14 @@ def resolve(self, **kwds): ... ValueError: the origin (point #6) cannot be used for subdivision! - sage: FTV_res = FTV.resolve(new_points=[8,5]) - sage: FTV_res + sage: FTV_res = FTV.resolve(new_points=[8,5]); FTV_res 2-d CPR-Fano toric variety covered by 6 affine patches sage: FTV_res.coordinate_points() (0, 1, 2, 3, 8, 5) sage: FTV_res.gens() (z0, z1, z2, z3, z8, z5) - sage: TV_res = FTV.resolve(new_rays=[(1,2)]) - sage: TV_res + sage: TV_res = FTV.resolve(new_rays=[(1,2)]); TV_res 2-d toric variety covered by 5 affine patches sage: TV_res.gens() (z0, z1, z2, z3, z4) @@ -1446,17 +1399,14 @@ class NefCompleteIntersection(AlgebraicScheme_subscheme_toric): EXAMPLES:: sage: o = lattice_polytope.cross_polytope(3) - sage: np = o.nef_partitions()[0] - sage: np + sage: np = o.nef_partitions()[0]; np Nef-partition {0, 1, 3} ⊔ {2, 4, 5} sage: X = CPRFanoToricVariety(Delta_polar=o) sage: X.nef_complete_intersection(np) Closed subscheme of 3-d CPR-Fano toric variety covered by 8 affine patches defined by: - a2*z0^2*z1 + a5*z0*z1*z3 + a1*z1*z3^2 - + a3*z0^2*z4 + a4*z0*z3*z4 + a0*z3^2*z4, - b1*z1*z2^2 + b2*z2^2*z4 + b5*z1*z2*z5 - + b4*z2*z4*z5 + b3*z1*z5^2 + b0*z4*z5^2 + a2*z0^2*z1 + a5*z0*z1*z3 + a1*z1*z3^2 + a3*z0^2*z4 + a4*z0*z3*z4 + a0*z3^2*z4, + b1*z1*z2^2 + b2*z2^2*z4 + b5*z1*z2*z5 + b4*z2*z4*z5 + b3*z1*z5^2 + b0*z4*z5^2 See :meth:`CPRFanoToricVariety_field.nef_complete_intersection` for a more elaborate example. @@ -1569,18 +1519,14 @@ def cohomology_class(self): EXAMPLES:: sage: o = lattice_polytope.cross_polytope(3) - sage: np = o.nef_partitions()[0] - sage: np + sage: np = o.nef_partitions()[0]; np Nef-partition {0, 1, 3} ⊔ {2, 4, 5} sage: X = CPRFanoToricVariety(Delta_polar=o) - sage: CI = X.nef_complete_intersection(np) - sage: CI + sage: CI = X.nef_complete_intersection(np); CI Closed subscheme of 3-d CPR-Fano toric variety covered by 8 affine patches defined by: - a2*z0^2*z1 + a5*z0*z1*z3 + a1*z1*z3^2 - + a3*z0^2*z4 + a4*z0*z3*z4 + a0*z3^2*z4, - b1*z1*z2^2 + b2*z2^2*z4 + b5*z1*z2*z5 - + b4*z2*z4*z5 + b3*z1*z5^2 + b0*z4*z5^2 + a2*z0^2*z1 + a5*z0*z1*z3 + a1*z1*z3^2 + a3*z0^2*z4 + a4*z0*z3*z4 + a0*z3^2*z4, + b1*z1*z2^2 + b2*z2^2*z4 + b5*z1*z2*z5 + b4*z2*z4*z5 + b3*z1*z5^2 + b0*z4*z5^2 sage: CI.cohomology_class() [2*z3*z4 + 4*z3*z5 + 2*z4*z5] """ @@ -1602,18 +1548,14 @@ def nef_partition(self): EXAMPLES:: sage: o = lattice_polytope.cross_polytope(3) - sage: np = o.nef_partitions()[0] - sage: np + sage: np = o.nef_partitions()[0]; np Nef-partition {0, 1, 3} ⊔ {2, 4, 5} sage: X = CPRFanoToricVariety(Delta_polar=o) - sage: CI = X.nef_complete_intersection(np) - sage: CI + sage: CI = X.nef_complete_intersection(np); CI Closed subscheme of 3-d CPR-Fano toric variety covered by 8 affine patches defined by: - a2*z0^2*z1 + a5*z0*z1*z3 + a1*z1*z3^2 - + a3*z0^2*z4 + a4*z0*z3*z4 + a0*z3^2*z4, - b1*z1*z2^2 + b2*z2^2*z4 + b5*z1*z2*z5 - + b4*z2*z4*z5 + b3*z1*z5^2 + b0*z4*z5^2 + a2*z0^2*z1 + a5*z0*z1*z3 + a1*z1*z3^2 + a3*z0^2*z4 + a4*z0*z3*z4 + a0*z3^2*z4, + b1*z1*z2^2 + b2*z2^2*z4 + b5*z1*z2*z5 + b4*z2*z4*z5 + b3*z1*z5^2 + b0*z4*z5^2 sage: CI.nef_partition() Nef-partition {0, 1, 3} ⊔ {2, 4, 5} sage: CI.nef_partition() is np @@ -1649,11 +1591,9 @@ def add_variables(field, variables): sage: F = add_variables(F, ["a"]); F Fraction Field of Univariate Polynomial Ring in a over Rational Field sage: F = add_variables(F, ["b", "c"]); F - Fraction Field of Multivariate Polynomial Ring - in a, b, c over Rational Field + Fraction Field of Multivariate Polynomial Ring in a, b, c over Rational Field sage: F = add_variables(F, ["c", "d", "b", "c", "d"]); F - Fraction Field of Multivariate Polynomial Ring - in a, b, c, d over Rational Field + Fraction Field of Multivariate Polynomial Ring in a, b, c, d over Rational Field """ if not variables: return field diff --git a/src/sage/schemes/toric/ideal.py b/src/sage/schemes/toric/ideal.py index ba40a461047..2a2e02dfdbc 100644 --- a/src/sage/schemes/toric/ideal.py +++ b/src/sage/schemes/toric/ideal.py @@ -50,7 +50,7 @@ quadric and `d` binomials of degree `d`:: sage: def I(d): - ....: return ToricIdeal(matrix([[1,1,1,1,1],[0,1,1,0,0],[0,0,1,1,d]])) + ....: return ToricIdeal(matrix([[1,1,1,1,1], [0,1,1,0,0], [0,0,1,1,d]])) sage: I(2) Ideal (-z3^2 + z0*z4, z0*z2 - z1*z3, diff --git a/src/sage/schemes/toric/library.py b/src/sage/schemes/toric/library.py index 393baa2b47f..9d2587df187 100644 --- a/src/sage/schemes/toric/library.py +++ b/src/sage/schemes/toric/library.py @@ -297,16 +297,11 @@ def dP6(self, names='x u y v z w', base_ring=QQ): EXAMPLES:: - sage: dP6 = toric_varieties.dP6() - sage: dP6 + sage: dP6 = toric_varieties.dP6(); dP6 2-d CPR-Fano toric variety covered by 6 affine patches sage: dP6.fan().rays() - N( 0, 1), - N(-1, 0), - N(-1, -1), - N( 0, -1), - N( 1, 0), - N( 1, 1) + N( 0, 1), N(-1, 0), N(-1, -1), + N( 0, -1), N( 1, 0), N( 1, 1) in 2-d lattice N sage: dP6.gens() (x, u, y, v, z, w) @@ -335,15 +330,11 @@ def dP7(self, names='x u y v z', base_ring=QQ): EXAMPLES:: - sage: dP7 = toric_varieties.dP7() - sage: dP7 + sage: dP7 = toric_varieties.dP7(); dP7 2-d CPR-Fano toric variety covered by 5 affine patches sage: dP7.fan().rays() - N( 0, 1), - N(-1, 0), - N(-1, -1), - N( 0, -1), - N( 1, 0) + N( 0, 1), N(-1, 0), N(-1, -1), + N( 0, -1), N( 1, 0) in 2-d lattice N sage: dP7.gens() (x, u, y, v, z) @@ -372,14 +363,11 @@ def dP8(self, names='t x y z', base_ring=QQ): EXAMPLES:: - sage: dP8 = toric_varieties.dP8() - sage: dP8 + sage: dP8 = toric_varieties.dP8(); dP8 2-d CPR-Fano toric variety covered by 4 affine patches sage: dP8.fan().rays() - N( 1, 1), - N( 0, 1), - N(-1, -1), - N( 1, 0) + N( 1, 1), N( 0, 1), + N(-1, -1), N( 1, 0) in 2-d lattice N sage: dP8.gens() (t, x, y, z) @@ -408,14 +396,11 @@ def P1xP1(self, names='s t x y', base_ring=QQ): EXAMPLES:: - sage: P1xP1 = toric_varieties.P1xP1() - sage: P1xP1 + sage: P1xP1 = toric_varieties.P1xP1(); P1xP1 2-d CPR-Fano toric variety covered by 4 affine patches sage: P1xP1.fan().rays() - N( 1, 0), - N(-1, 0), - N( 0, 1), - N( 0, -1) + N( 1, 0), N(-1, 0), + N( 0, 1), N( 0, -1) in 2-d lattice N sage: P1xP1.gens() (s, t, x, y) @@ -444,14 +429,11 @@ def P1xP1_Z2(self, names='s t x y', base_ring=QQ): EXAMPLES:: - sage: P1xP1_Z2 = toric_varieties.P1xP1_Z2() - sage: P1xP1_Z2 + sage: P1xP1_Z2 = toric_varieties.P1xP1_Z2(); P1xP1_Z2 2-d CPR-Fano toric variety covered by 4 affine patches sage: P1xP1_Z2.fan().rays() - N( 1, 1), - N(-1, -1), - N(-1, 1), - N( 1, -1) + N( 1, 1), N(-1, -1), + N(-1, 1), N( 1, -1) in 2-d lattice N sage: P1xP1_Z2.gens() (s, t, x, y) @@ -482,8 +464,7 @@ def P1(self, names='s t', base_ring=QQ): EXAMPLES:: - sage: P1 = toric_varieties.P1() - sage: P1 + sage: P1 = toric_varieties.P1(); P1 1-d CPR-Fano toric variety covered by 2 affine patches sage: P1.fan().rays() N( 1), @@ -516,8 +497,7 @@ def P2(self, names='x y z', base_ring=QQ): EXAMPLES:: - sage: P2 = toric_varieties.P2() - sage: P2 + sage: P2 = toric_varieties.P2(); P2 2-d CPR-Fano toric variety covered by 3 affine patches sage: P2.fan().rays() N( 1, 0), @@ -552,8 +532,7 @@ def P(self, n, names='z+', base_ring=QQ): EXAMPLES:: - sage: P3 = toric_varieties.P(3) - sage: P3 + sage: P3 = toric_varieties.P(3); P3 3-d CPR-Fano toric variety covered by 4 affine patches sage: P3.fan().rays() N( 1, 0, 0), @@ -603,8 +582,7 @@ def A1(self, names='z', base_ring=QQ): EXAMPLES:: - sage: A1 = toric_varieties.A1() - sage: A1 + sage: A1 = toric_varieties.A1(); A1 1-d affine toric variety sage: A1.fan().rays() N(1) @@ -635,8 +613,7 @@ def A2(self, names='x y', base_ring=QQ): EXAMPLES:: - sage: A2 = toric_varieties.A2() - sage: A2 + sage: A2 = toric_varieties.A2(); A2 2-d affine toric variety sage: A2.fan().rays() N(1, 0), @@ -670,8 +647,7 @@ def A(self, n, names='z+', base_ring=QQ): EXAMPLES:: - sage: A3 = toric_varieties.A(3) - sage: A3 + sage: A3 = toric_varieties.A(3); A3 3-d affine toric variety sage: A3.fan().rays() N(1, 0, 0), @@ -718,8 +694,7 @@ def A2_Z2(self, names='x y', base_ring=QQ): EXAMPLES:: - sage: A2_Z2 = toric_varieties.A2_Z2() - sage: A2_Z2 + sage: A2_Z2 = toric_varieties.A2_Z2(); A2_Z2 2-d affine toric variety sage: A2_Z2.fan().rays() N(1, 0), @@ -752,8 +727,7 @@ def P1xA1(self, names='s t z', base_ring=QQ): EXAMPLES:: - sage: P1xA1 = toric_varieties.P1xA1() - sage: P1xA1 + sage: P1xA1 = toric_varieties.P1xA1(); P1xA1 2-d toric variety covered by 2 affine patches sage: P1xA1.fan().rays() N( 1, 0), @@ -786,14 +760,11 @@ def Conifold(self, names='u x y v', base_ring=QQ): EXAMPLES:: - sage: Conifold = toric_varieties.Conifold() - sage: Conifold + sage: Conifold = toric_varieties.Conifold(); Conifold 3-d affine toric variety sage: Conifold.fan().rays() - N(0, 0, 1), - N(0, 1, 1), - N(1, 0, 1), - N(1, 1, 1) + N(0, 0, 1), N(0, 1, 1), + N(1, 0, 1), N(1, 1, 1) in 3-d lattice N sage: Conifold.gens() (u, x, y, v) @@ -822,22 +793,13 @@ def dP6xdP6(self, names='x0 x1 x2 x3 x4 x5 y0 y1 y2 y3 y4 y5', base_ring=QQ): EXAMPLES:: - sage: dP6xdP6 = toric_varieties.dP6xdP6() - sage: dP6xdP6 + sage: dP6xdP6 = toric_varieties.dP6xdP6(); dP6xdP6 4-d CPR-Fano toric variety covered by 36 affine patches sage: dP6xdP6.fan().rays() - N( 0, 1, 0, 0), - N(-1, 0, 0, 0), - N(-1, -1, 0, 0), - N( 0, -1, 0, 0), - N( 1, 0, 0, 0), - N( 1, 1, 0, 0), - N( 0, 0, 0, 1), - N( 0, 0, -1, 0), - N( 0, 0, -1, -1), - N( 0, 0, 0, -1), - N( 0, 0, 1, 0), - N( 0, 0, 1, 1) + N( 0, 1, 0, 0), N(-1, 0, 0, 0), N(-1, -1, 0, 0), + N( 0, -1, 0, 0), N( 1, 0, 0, 0), N( 1, 1, 0, 0), + N( 0, 0, 0, 1), N( 0, 0, -1, 0), N( 0, 0, -1, -1), + N( 0, 0, 0, -1), N( 0, 0, 1, 0), N( 0, 0, 1, 1) in 4-d lattice N sage: dP6xdP6.gens() (x0, x1, x2, x3, x4, x5, y0, y1, y2, y3, y4, y5) @@ -869,18 +831,11 @@ def Cube_face_fan(self, names='z+', base_ring=QQ): EXAMPLES:: - sage: Cube_face_fan = toric_varieties.Cube_face_fan() - sage: Cube_face_fan + sage: Cube_face_fan = toric_varieties.Cube_face_fan(); Cube_face_fan 3-d CPR-Fano toric variety covered by 6 affine patches sage: Cube_face_fan.fan().rays() - N( 1, 1, 1), - N( 1, -1, 1), - N(-1, 1, 1), - N(-1, -1, 1), - N(-1, -1, -1), - N(-1, 1, -1), - N( 1, -1, -1), - N( 1, 1, -1) + N( 1, 1, 1), N( 1, -1, 1), N(-1, 1, 1), N(-1, -1, 1), + N(-1, -1, -1), N(-1, 1, -1), N( 1, -1, -1), N( 1, 1, -1) in 3-d lattice N sage: Cube_face_fan.gens() (z0, z1, z2, z3, z4, z5, z6, z7) @@ -913,18 +868,11 @@ def Cube_sublattice(self, names='z+', base_ring=QQ): EXAMPLES:: - sage: Cube_sublattice = toric_varieties.Cube_sublattice() - sage: Cube_sublattice + sage: Cube_sublattice = toric_varieties.Cube_sublattice(); Cube_sublattice 3-d CPR-Fano toric variety covered by 6 affine patches sage: Cube_sublattice.fan().rays() - N( 1, 0, 0), - N( 0, 1, 0), - N( 0, 0, 1), - N(-1, 1, 1), - N(-1, 0, 0), - N( 0, -1, 0), - N( 0, 0, -1), - N( 1, -1, -1) + N( 1, 0, 0), N( 0, 1, 0), N( 0, 0, 1), N(-1, 1, 1), + N(-1, 0, 0), N( 0, -1, 0), N( 0, 0, -1), N( 1, -1, -1) in 3-d lattice N sage: Cube_sublattice.gens() (z0, z1, z2, z3, z4, z5, z6, z7) @@ -967,14 +915,8 @@ def Cube_nonpolyhedral(self, names='z+', base_ring=QQ): sage: Cube_nonpolyhedral 3-d toric variety covered by 6 affine patches sage: Cube_nonpolyhedral.fan().rays() - N( 1, 2, 3), - N( 1, -1, 1), - N(-1, 1, 1), - N(-1, -1, 1), - N(-1, -1, -1), - N(-1, 1, -1), - N( 1, -1, -1), - N( 1, 1, -1) + N( 1, 2, 3), N( 1, -1, 1), N(-1, 1, 1), N(-1, -1, 1), + N(-1, -1, -1), N(-1, 1, -1), N( 1, -1, -1), N( 1, 1, -1) in 3-d lattice N sage: Cube_nonpolyhedral.gens() (z0, z1, z2, z3, z4, z5, z6, z7) @@ -1012,18 +954,11 @@ def Cube_deformation(self,k, names=None, base_ring=QQ): EXAMPLES:: - sage: X_2 = toric_varieties.Cube_deformation(2) - sage: X_2 + sage: X_2 = toric_varieties.Cube_deformation(2); X_2 3-d toric variety covered by 6 affine patches sage: X_2.fan().rays() - N( 1, 1, 5), - N( 1, -1, 1), - N(-1, 1, 1), - N(-1, -1, 1), - N(-1, -1, -1), - N(-1, 1, -1), - N( 1, -1, -1), - N( 1, 1, -1) + N( 1, 1, 5), N( 1, -1, 1), N(-1, 1, 1), N(-1, -1, 1), + N(-1, -1, -1), N(-1, 1, -1), N( 1, -1, -1), N( 1, 1, -1) in 3-d lattice N sage: X_2.gens() (z0, z1, z2, z3, z4, z5, z6, z7) @@ -1066,22 +1001,15 @@ def BCdlOG(self, names='v1 v2 c1 c2 v4 v5 b e1 e2 e3 f g v6', base_ring=QQ): EXAMPLES:: - sage: X = toric_varieties.BCdlOG() - sage: X + sage: X = toric_varieties.BCdlOG(); X 5-d CPR-Fano toric variety covered by 54 affine patches sage: X.fan().rays() - N(-1, 0, 0, 2, 3), - N( 0, -1, 0, 2, 3), - N( 0, 0, -1, 2, 3), - N( 0, 0, -1, 1, 2), - N( 0, 0, 0, -1, 0), - N( 0, 0, 0, 0, -1), - N( 0, 0, 0, 2, 3), - N( 0, 0, 1, 2, 3), - N( 0, 0, 2, 2, 3), - N( 0, 0, 1, 1, 1), - N( 0, 1, 2, 2, 3), - N( 0, 1, 3, 2, 3), + N(-1, 0, 0, 2, 3), N( 0, -1, 0, 2, 3), + N( 0, 0, -1, 2, 3), N( 0, 0, -1, 1, 2), + N( 0, 0, 0, -1, 0), N( 0, 0, 0, 0, -1), + N( 0, 0, 0, 2, 3), N( 0, 0, 1, 2, 3), + N( 0, 0, 2, 2, 3), N( 0, 0, 1, 1, 1), + N( 0, 1, 2, 2, 3), N( 0, 1, 3, 2, 3), N( 1, 0, 4, 2, 3) in 5-d lattice N sage: X.gens() @@ -1111,17 +1039,11 @@ def BCdlOG_base(self, names='d4 d3 r2 r1 d2 u d1', base_ring=QQ): EXAMPLES:: - sage: base = toric_varieties.BCdlOG_base() - sage: base + sage: base = toric_varieties.BCdlOG_base(); base 3-d toric variety covered by 10 affine patches sage: base.fan().rays() - N(-1, 0, 0), - N( 0, -1, 0), - N( 0, 0, -1), - N( 0, 0, 1), - N( 0, 1, 2), - N( 0, 1, 3), - N( 1, 0, 4) + N(-1, 0, 0), N( 0, -1, 0), N( 0, 0, -1), N( 0, 0, 1), + N( 0, 1, 2), N( 0, 1, 3), N( 1, 0, 4) in 3-d lattice N sage: base.gens() (d4, d3, r2, r1, d2, u, d1) @@ -1150,8 +1072,7 @@ def P2_112(self, names='z+', base_ring=QQ): EXAMPLES:: - sage: P2_112 = toric_varieties.P2_112() - sage: P2_112 + sage: P2_112 = toric_varieties.P2_112(); P2_112 2-d CPR-Fano toric variety covered by 3 affine patches sage: P2_112.fan().rays() N( 1, 0), @@ -1185,8 +1106,7 @@ def P2_123(self, names='z+', base_ring=QQ): EXAMPLES:: - sage: P2_123 = toric_varieties.P2_123() - sage: P2_123 + sage: P2_123 = toric_varieties.P2_123(); P2_123 2-d CPR-Fano toric variety covered by 3 affine patches sage: P2_123.fan().rays() N( 1, 0), @@ -1220,15 +1140,11 @@ def P4_11169(self, names='z+', base_ring=QQ): EXAMPLES:: - sage: P4_11169 = toric_varieties.P4_11169() - sage: P4_11169 + sage: P4_11169 = toric_varieties.P4_11169(); P4_11169 4-d CPR-Fano toric variety covered by 5 affine patches sage: P4_11169.fan().rays() - N( 1, 0, 0, 0), - N( 0, 1, 0, 0), - N( 0, 0, 1, 0), - N( 0, 0, 0, 1), - N(-9, -6, -1, -1) + N( 1, 0, 0, 0), N( 0, 1, 0, 0), N( 0, 0, 1, 0), + N( 0, 0, 0, 1), N(-9, -6, -1, -1) in 4-d lattice N sage: P4_11169.gens() (z0, z1, z2, z3, z4) @@ -1262,12 +1178,8 @@ def P4_11169_resolved(self, names='z+', base_ring=QQ): sage: P4_11169_resolved 4-d CPR-Fano toric variety covered by 9 affine patches sage: P4_11169_resolved.fan().rays() - N( 1, 0, 0, 0), - N( 0, 1, 0, 0), - N( 0, 0, 1, 0), - N( 0, 0, 0, 1), - N(-9, -6, -1, -1), - N(-3, -2, 0, 0) + N( 1, 0, 0, 0), N( 0, 1, 0, 0), N( 0, 0, 1, 0), + N( 0, 0, 0, 1), N(-9, -6, -1, -1), N(-3, -2, 0, 0) in 4-d lattice N sage: P4_11169_resolved.gens() (z0, z1, z2, z3, z4, z5) @@ -1296,15 +1208,11 @@ def P4_11133(self, names='z+', base_ring=QQ): EXAMPLES:: - sage: P4_11133 = toric_varieties.P4_11133() - sage: P4_11133 + sage: P4_11133 = toric_varieties.P4_11133(); P4_11133 4-d CPR-Fano toric variety covered by 5 affine patches sage: P4_11133.fan().rays() - N( 1, 0, 0, 0), - N( 0, 1, 0, 0), - N( 0, 0, 1, 0), - N( 0, 0, 0, 1), - N(-3, -3, -1, -1) + N( 1, 0, 0, 0), N( 0, 1, 0, 0), N( 0, 0, 1, 0), + N( 0, 0, 0, 1), N(-3, -3, -1, -1) in 4-d lattice N sage: P4_11133.gens() (z0, z1, z2, z3, z4) @@ -1337,12 +1245,8 @@ def P4_11133_resolved(self, names='z+', base_ring=QQ): sage: P4_11133_resolved 4-d CPR-Fano toric variety covered by 9 affine patches sage: P4_11133_resolved.fan().rays() - N( 1, 0, 0, 0), - N( 0, 1, 0, 0), - N( 0, 0, 1, 0), - N( 0, 0, 0, 1), - N(-3, -3, -1, -1), - N(-1, -1, 0, 0) + N( 1, 0, 0, 0), N( 0, 1, 0, 0), N( 0, 0, 1, 0), + N( 0, 0, 0, 1), N(-3, -3, -1, -1), N(-1, -1, 0, 0) in 4-d lattice N sage: P4_11133_resolved.gens() (z0, z1, z2, z3, z4, z5) diff --git a/src/sage/schemes/toric/morphism.py b/src/sage/schemes/toric/morphism.py index 3f11cf8cd21..7b85c3f5d32 100644 --- a/src/sage/schemes/toric/morphism.py +++ b/src/sage/schemes/toric/morphism.py @@ -1045,8 +1045,7 @@ def factor(self): Scheme morphism: From: 2-d toric variety covered by 3 affine patches To: 3-d CPR-Fano toric variety covered by 4 affine patches - Defn: Defined on coordinates by sending [z0 : z1 : z2] to - [z2 : z1 : z0 : z0] + Defn: Defined on coordinates by sending [z0 : z1 : z2] to [z2 : z1 : z0 : z0] """ phi_i, phi_b, phi_s = self.fan_morphism().factor() from sage.schemes.toric.all import ToricVariety diff --git a/src/sage/schemes/toric/sheaf/klyachko.py b/src/sage/schemes/toric/sheaf/klyachko.py index bf15fc4c29f..9ccf070cf5e 100644 --- a/src/sage/schemes/toric/sheaf/klyachko.py +++ b/src/sage/schemes/toric/sheaf/klyachko.py @@ -331,8 +331,7 @@ def get_degree(self, ray, i): sage: TX = toric_varieties.dP6().sheaves.tangent_bundle() sage: TX.get_degree(0, 1) Vector space of degree 2 and dimension 1 over Rational Field - Basis matrix: - [0 1] + Basis matrix: [0 1] """ return self.get_filtration(ray).get_degree(i) @@ -363,12 +362,10 @@ def filtration_intersection(self, sigma, i): sage: V = X.sheaves.tangent_bundle() sage: V.filtration_intersection(fan(1)[0], 1) Vector space of degree 2 and dimension 1 over Rational Field - Basis matrix: - [1 0] + Basis matrix: [1 0] sage: V.filtration_intersection(fan(2)[0], 1) Vector space of degree 2 and dimension 0 over Rational Field - Basis matrix: - [] + Basis matrix: [] """ sigma = self._variety.fan().embed(sigma) V = self.fiber() @@ -401,16 +398,13 @@ def E_degree(self, alpha, m): sage: V = X.sheaves.tangent_bundle() sage: V.E_degree(X.fan().ray(0), (1,0)) Vector space of degree 2 and dimension 1 over Rational Field - Basis matrix: - [1 0] + Basis matrix: [1 0] sage: V.E_degree(X.fan(1)[0], (1,0)) Vector space of degree 2 and dimension 1 over Rational Field - Basis matrix: - [1 0] + Basis matrix: [1 0] sage: V.E_degree(0, (1,0)) Vector space of degree 2 and dimension 1 over Rational Field - Basis matrix: - [1 0] + Basis matrix: [1 0] """ fan = self.variety().fan() N = fan.lattice() @@ -452,12 +446,10 @@ def E_intersection(self, sigma, m): sage: V = X.sheaves.tangent_bundle() sage: V.E_intersection(fan(1)[0], (1,0)) Vector space of degree 2 and dimension 1 over Rational Field - Basis matrix: - [1 0] + Basis matrix: [1 0] sage: V.E_intersection(fan(2)[0], (-1,1)) Vector space of degree 2 and dimension 1 over Rational Field - Basis matrix: - [0 1] + Basis matrix: [0 1] For the empty cone, this is always the whole vector space:: @@ -499,17 +491,16 @@ def E_quotient(self, sigma, m): sage: m.set_immutable() sage: V.E_quotient(cone, m) Vector space quotient V/W of dimension 1 over Rational Field where - V: Vector space of dimension 2 over Rational Field - W: Vector space of degree 2 and dimension 1 over Rational Field - Basis matrix: - [1 0] + V: Vector space of dimension 2 over Rational Field + W: Vector space of degree 2 and dimension 1 over Rational Field + Basis matrix: [1 0] sage: V.E_quotient(fan(2)[0], (-1,1)) Vector space quotient V/W of dimension 0 over Rational Field where - V: Vector space of dimension 2 over Rational Field - W: Vector space of degree 2 and dimension 2 over Rational Field - Basis matrix: - [1 0] - [0 1] + V: Vector space of dimension 2 over Rational Field + W: Vector space of degree 2 and dimension 2 over Rational Field + Basis matrix: + [1 0] + [0 1] """ sigma = self._variety.fan().embed(sigma) V = self.fiber() @@ -556,30 +547,26 @@ def E_quotient_projection(self, sigma, tau, m): sage: m.set_immutable() sage: V.E_quotient(sigma, m) Vector space quotient V/W of dimension 2 over Rational Field where - V: Vector space of dimension 3 over Rational Field - W: Vector space of degree 3 and dimension 1 over Rational Field - Basis matrix: - [0 1 0] + V: Vector space of dimension 3 over Rational Field + W: Vector space of degree 3 and dimension 1 over Rational Field + Basis matrix: [0 1 0] sage: V.E_quotient(tau, m) Vector space quotient V/W of dimension 2 over Rational Field where - V: Vector space of dimension 3 over Rational Field - W: Vector space of degree 3 and dimension 1 over Rational Field - Basis matrix: - [0 1 0] + V: Vector space of dimension 3 over Rational Field + W: Vector space of degree 3 and dimension 1 over Rational Field + Basis matrix: [0 1 0] sage: V.E_quotient_projection(sigma, tau, m) Vector space morphism represented by the matrix: - [1 0] - [0 1] - Domain: Vector space quotient V/W of dimension 2 over Rational Field where - V: Vector space of dimension 3 over Rational Field - W: Vector space of degree 3 and dimension 1 over Rational Field - Basis matrix: - [0 1 0] - Codomain: Vector space quotient V/W of dimension 2 over Rational Field where - V: Vector space of dimension 3 over Rational Field - W: Vector space of degree 3 and dimension 1 over Rational Field - Basis matrix: - [0 1 0] + [1 0] + [0 1] + Domain: Vector space quotient V/W of dimension 2 over Rational Field where + V: Vector space of dimension 3 over Rational Field + W: Vector space of degree 3 and dimension 1 over Rational Field + Basis matrix: [0 1 0] + Codomain: Vector space quotient V/W of dimension 2 over Rational Field where + V: Vector space of dimension 3 over Rational Field + W: Vector space of degree 3 and dimension 1 over Rational Field + Basis matrix: [0 1 0] """ if not sigma.is_face_of(tau): raise ValueError('the cone sigma is not a face of the cone tau') diff --git a/src/sage/schemes/toric/toric_subscheme.py b/src/sage/schemes/toric/toric_subscheme.py index 8dcb292e692..920bcaff30e 100644 --- a/src/sage/schemes/toric/toric_subscheme.py +++ b/src/sage/schemes/toric/toric_subscheme.py @@ -462,8 +462,7 @@ def neighborhood(self, point): From: Closed subscheme of 2-d affine toric variety defined by: 3*x0 To: Closed subscheme of 2-d CPR-Fano toric variety covered by 6 affine patches defined by: x0*x3 - Defn: Defined on coordinates by sending [x0 : x1] to - [0 : x1 : 2 : 3 : 4 : 5] + Defn: Defined on coordinates by sending [x0 : x1] to [0 : x1 : 2 : 3 : 4 : 5] sage: patch.embedding_center() [0 : 1] sage: patch.embedding_morphism()(patch.embedding_center()) @@ -709,7 +708,7 @@ def is_schon(self): r""" Check if ``self`` is schon (nondegenerate). - See `is_nondegenerate` for further documentation. + See :meth:`is_nondegenerate` for further documentation. EXAMPLES:: diff --git a/src/sage/schemes/toric/variety.py b/src/sage/schemes/toric/variety.py index 84666ebe9ef..523ccfcbbbb 100644 --- a/src/sage/schemes/toric/variety.py +++ b/src/sage/schemes/toric/variety.py @@ -85,20 +85,16 @@ sage: diamond = lattice_polytope.cross_polytope(2) sage: diamond.vertices() - M( 1, 0), - M( 0, 1), - M(-1, 0), - M( 0, -1) + M( 1, 0), M( 0, 1), + M(-1, 0), M( 0, -1) in 2-d lattice M sage: fan = FaceFan(diamond) sage: P1xP1 = ToricVariety(fan) sage: P1xP1 2-d toric variety covered by 4 affine patches sage: P1xP1.fan().rays() - M( 1, 0), - M( 0, 1), - M(-1, 0), - M( 0, -1) + M( 1, 0), M( 0, 1), + M(-1, 0), M( 0, -1) in 2-d lattice M sage: P1xP1.gens() (z0, z1, z2, z3) @@ -166,10 +162,8 @@ True sage: TV = ToricVariety(NormalFan(diamond)) sage: TV.fan().rays() - N( 1, 1), - N( 1, -1), - N(-1, -1), - N(-1, 1) + N( 1, 1), N( 1, -1), + N(-1, -1), N(-1, 1) in 2-d lattice N sage: TV.is_orbifold() True @@ -180,14 +174,8 @@ sage: TV3 = ToricVariety(NormalFan(lattice_polytope.cross_polytope(3))) sage: TV3.fan().rays() - N( 1, -1, -1), - N( 1, 1, -1), - N( 1, 1, 1), - N( 1, -1, 1), - N(-1, -1, 1), - N(-1, -1, -1), - N(-1, 1, -1), - N(-1, 1, 1) + N( 1, -1, -1), N( 1, 1, -1), N( 1, 1, 1), N( 1, -1, 1), + N(-1, -1, 1), N(-1, -1, -1), N(-1, 1, -1), N(-1, 1, 1) in 3-d lattice N sage: TV3.is_orbifold() False @@ -417,10 +405,8 @@ def ToricVariety(fan, sage: fan = FaceFan(lattice_polytope.cross_polytope(2)) sage: fan.rays() - M( 1, 0), - M( 0, 1), - M(-1, 0), - M( 0, -1) + M( 1, 0), M( 0, 1), + M(-1, 0), M( 0, -1) in 2-d lattice M sage: P1xP1 = ToricVariety(fan) sage: P1xP1.gens() @@ -1675,10 +1661,8 @@ def cartesian_product(self, other, sage: P1xP1 = P1.cartesian_product(P1); P1xP1 2-d toric variety covered by 4 affine patches sage: P1xP1.fan().rays() - N+N(-1, 0), - N+N( 1, 0), - N+N( 0, -1), - N+N( 0, 1) + N+N(-1, 0), N+N( 1, 0), + N+N( 0, -1), N+N( 0, 1) in 2-d lattice N+N """ return ToricVariety(self.fan().cartesian_product(other.fan()), @@ -2597,7 +2581,7 @@ def Spec(self, cone=None, names=None): formats. If not given, indexed variable names will be created automatically. - Output: + OUTPUT: The spectrum of the semigroup ring `\CC[\sigma^\vee \cap M]`. @@ -2792,10 +2776,10 @@ def count_points(self): sage: o = lattice_polytope.cross_polytope(3) sage: V = ToricVariety(FaceFan(o)) - sage: V2 = V.change_ring(GF(2)) # optional - sage.rings.finite_rings - sage: V2.point_set().cardinality() # optional - sage.rings.finite_rings + sage: V2 = V.change_ring(GF(2)) # optional - sage.rings.finite_rings + sage: V2.point_set().cardinality() # optional - sage.rings.finite_rings 27 - sage: V2.count_points() # optional - sage.rings.finite_rings + sage: V2.count_points() # optional - sage.rings.finite_rings 27 """ return self.point_set().cardinality() From 9c7ae71af6590176d0f8b215b9907bb83d8bc35c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 25 Mar 2023 01:57:06 -0700 Subject: [PATCH 091/135] sage.schemes: Yet more cosmetic doctest changes --- src/sage/schemes/affine/affine_morphism.py | 2 +- .../schemes/berkovich/berkovich_cp_element.py | 6 +- src/sage/schemes/berkovich/berkovich_space.py | 2 +- src/sage/schemes/curves/affine_curve.py | 28 +- src/sage/schemes/curves/projective_curve.py | 36 +- .../cyclic_covers/charpoly_frobenius.py | 2 +- .../cyclic_covers/cycliccover_finite_field.py | 1 - .../cyclic_covers/cycliccover_generic.py | 1 - src/sage/schemes/elliptic_curves/BSD.py | 10 +- src/sage/schemes/elliptic_curves/Qcurves.py | 34 +- .../schemes/elliptic_curves/constructor.py | 19 +- .../schemes/elliptic_curves/ec_database.py | 7 +- .../elliptic_curves/ell_curve_isogeny.py | 16 +- src/sage/schemes/elliptic_curves/ell_field.py | 37 +- .../elliptic_curves/ell_finite_field.py | 30 +- .../schemes/elliptic_curves/ell_generic.py | 22 +- .../schemes/elliptic_curves/ell_local_data.py | 209 +++--- .../elliptic_curves/ell_modular_symbols.py | 3 +- .../elliptic_curves/ell_number_field.py | 702 ++++++++++-------- src/sage/schemes/elliptic_curves/ell_point.py | 71 +- .../elliptic_curves/ell_rational_field.py | 56 +- .../schemes/elliptic_curves/ell_tate_curve.py | 31 +- .../schemes/elliptic_curves/ell_torsion.py | 57 +- src/sage/schemes/elliptic_curves/ell_wp.py | 16 +- .../schemes/elliptic_curves/formal_group.py | 8 +- src/sage/schemes/elliptic_curves/gal_reps.py | 44 +- .../elliptic_curves/gal_reps_number_field.py | 16 +- src/sage/schemes/elliptic_curves/heegner.py | 480 ++++++------ src/sage/schemes/elliptic_curves/height.py | 91 +-- .../schemes/elliptic_curves/hom_composite.py | 31 +- .../schemes/elliptic_curves/hom_frobenius.py | 4 +- .../schemes/elliptic_curves/isogeny_class.py | 82 +- .../elliptic_curves/isogeny_small_degree.py | 99 ++- src/sage/schemes/elliptic_curves/jacobian.py | 33 +- .../schemes/elliptic_curves/lseries_ell.py | 3 +- .../schemes/elliptic_curves/mod_sym_num.pyx | 3 +- .../modular_parametrization.py | 11 +- .../schemes/elliptic_curves/period_lattice.py | 141 ++-- .../schemes/elliptic_curves/saturation.py | 6 +- src/sage/schemes/elliptic_curves/sha_tate.py | 40 +- .../elliptic_curves/weierstrass_morphism.py | 2 +- src/sage/schemes/generic/algebraic_scheme.py | 28 +- src/sage/schemes/generic/homset.py | 2 +- src/sage/schemes/generic/hypersurface.py | 4 +- src/sage/schemes/generic/morphism.py | 18 +- .../hyperelliptic_finite_field.py | 4 +- .../hyperelliptic_generic.py | 13 +- .../schemes/jacobians/abstract_jacobian.py | 16 +- src/sage/schemes/plane_conics/con_field.py | 74 +- .../schemes/plane_conics/con_number_field.py | 41 +- .../plane_conics/con_rational_field.py | 28 +- .../plane_quartics/quartic_constructor.py | 8 +- .../schemes/plane_quartics/quartic_generic.py | 6 +- src/sage/schemes/product_projective/homset.py | 14 +- .../schemes/product_projective/morphism.py | 10 +- src/sage/schemes/product_projective/point.py | 12 +- .../schemes/product_projective/subscheme.py | 8 +- .../schemes/projective/projective_homset.py | 12 +- .../schemes/projective/projective_morphism.py | 12 +- .../schemes/projective/projective_point.py | 41 +- .../projective/projective_rational_point.py | 8 +- .../schemes/projective/projective_space.py | 16 +- .../projective/projective_subscheme.py | 3 +- .../riemann_surfaces/riemann_surface.py | 50 +- src/sage/schemes/toric/chow_group.py | 40 +- src/sage/schemes/toric/divisor.py | 34 +- src/sage/schemes/toric/fano_variety.py | 27 +- src/sage/schemes/toric/homset.py | 20 +- src/sage/schemes/toric/ideal.py | 12 +- src/sage/schemes/toric/library.py | 116 +-- src/sage/schemes/toric/morphism.py | 52 +- src/sage/schemes/toric/points.py | 38 +- src/sage/schemes/toric/sheaf/klyachko.py | 58 +- src/sage/schemes/toric/toric_subscheme.py | 24 +- src/sage/schemes/toric/variety.py | 84 +-- src/sage/schemes/toric/weierstrass.py | 25 +- .../schemes/toric/weierstrass_covering.py | 2 +- 77 files changed, 1680 insertions(+), 1772 deletions(-) diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py index 0ffa144fca9..4025f2085fc 100644 --- a/src/sage/schemes/affine/affine_morphism.py +++ b/src/sage/schemes/affine/affine_morphism.py @@ -846,7 +846,7 @@ def jacobian(self): Return the Jacobian matrix of partial derivative of this map. The `(i, j)` entry of the Jacobian matrix is the partial derivative - `diff(functions[i], variables[j])`. + ``diff(functions[i], variables[j])``. OUTPUT: diff --git a/src/sage/schemes/berkovich/berkovich_cp_element.py b/src/sage/schemes/berkovich/berkovich_cp_element.py index 262e44db4f7..4611d396fce 100644 --- a/src/sage/schemes/berkovich/berkovich_cp_element.py +++ b/src/sage/schemes/berkovich/berkovich_cp_element.py @@ -48,7 +48,7 @@ class Berkovich_Element(Element): """ - The parent class for any element of a Berkovich space + The parent class for any element of a Berkovich space. """ pass @@ -687,7 +687,7 @@ def path_distance_metric(self, other): INPUT: - - ``other`` -- A point of the same Berkovich space as this point. + - ``other`` -- A point of the same Berkovich space as this point. OUTPUT: A finite or infinite real number. @@ -1181,7 +1181,7 @@ class Berkovich_Element_Cp_Affine(Berkovich_Element_Cp): Type IV point of precision 100 with centers given by ((t^2 + 2*t + 1) + O(3^20))*x and radii given by (y + 1.00000000000000)/y - For increased performance, error_check can be set to ``False``. WARNING: with error check set + For increased performance, ``error_check`` can be set to ``False``. WARNING: with error check set to ``False``, any error in the input will lead to incorrect results:: sage: B(f, g, prec=100, error_check=False) # optional - sage.rings.padics diff --git a/src/sage/schemes/berkovich/berkovich_space.py b/src/sage/schemes/berkovich/berkovich_space.py index 2b0c792c7e2..251d9f8c6c3 100644 --- a/src/sage/schemes/berkovich/berkovich_space.py +++ b/src/sage/schemes/berkovich/berkovich_space.py @@ -19,7 +19,7 @@ AUTHORS: - - Alexander Galarraga (2020-06-22): initial implementation +- Alexander Galarraga (2020-06-22): initial implementation """ diff --git a/src/sage/schemes/curves/affine_curve.py b/src/sage/schemes/curves/affine_curve.py index 811d49dba8f..7ce3f291461 100644 --- a/src/sage/schemes/curves/affine_curve.py +++ b/src/sage/schemes/curves/affine_curve.py @@ -229,9 +229,7 @@ def projective_closure(self, i=0, PP=None): - ``PP`` -- (default: None) ambient projective space to compute the projective closure in. This is constructed if it is not given. - OUTPUT: - - - a curve in projective space. + OUTPUT: A curve in projective space. EXAMPLES:: @@ -483,7 +481,7 @@ def is_transverse(self, C, P): - ``P`` -- a point in the intersection of both curves. - OUTPUT: Boolean. + OUTPUT: A boolean. EXAMPLES:: @@ -538,9 +536,7 @@ def multiplicity(self, P): - ``P`` -- a point in the ambient space of this curve. - OUTPUT: - - An integer. + OUTPUT: An integer. EXAMPLES:: @@ -606,7 +602,7 @@ def tangents(self, P, factor=True): curve, or to just return the polynomial corresponding to the union of the tangent lines (which requires fewer computations) - OUTPUT: a list of polynomials in the coordinate ring of the ambient space + OUTPUT: A list of polynomials in the coordinate ring of the ambient space. EXAMPLES:: @@ -874,7 +870,7 @@ def projection(self, indices, AS=None): this curve, and must have dimension equal to the length of ``indices``. This space is constructed if not specified. - OUTPUT: a tuple of + OUTPUT: A tuple of - a scheme morphism from this curve to affine space of dimension equal to the number of coordinates specified in ``indices`` @@ -1035,7 +1031,7 @@ def plane_projection(self, AP=None): curve, and must have dimension two. This space will be constructed if not specified. - OUTPUT: a tuple of + OUTPUT: A tuple of - a scheme morphism from this curve into an affine plane @@ -1099,7 +1095,7 @@ def blowup(self, P=None): - ``P`` -- (default: None) a point on this curve at which to blow up; if ``None``, then ``P`` is taken to be the origin. - OUTPUT: a tuple of + OUTPUT: A tuple of - a tuple of curves in affine space of the same dimension as the ambient space of this curve, which define the blow up in each affine @@ -1408,7 +1404,7 @@ def resolution_of_singularities(self, extend=False): resolved. However, setting ``extend`` to ``True`` will slow down computations. - OUTPUT: a tuple of + OUTPUT: A tuple of - a tuple of curves in affine space of the same dimension as the ambient space of this curve, which represent affine patches of the @@ -1817,9 +1813,7 @@ def riemann_surface(self, **kwargs): r""" Return the complex Riemann surface determined by this curve - OUTPUT: - - - RiemannSurface object + OUTPUT: A :class:`~sage.schemes.riemann_surfaces.riemann_surface.RiemannSurface` object. EXAMPLES:: @@ -1860,7 +1854,7 @@ def riemann_roch_basis(self, D): divisor `Div = d_1P_1 + \dots + d_nP_n`, where `X(F) = \{P_1, \dots, P_n\}`. The ordering is that dictated by ``places_on_curve``. - OUTPUT: a basis of `L(Div)` + OUTPUT: A basis of `L(Div)`. EXAMPLES:: @@ -2461,7 +2455,7 @@ def places_on(self, point): - ``point`` -- a closed point of the curve - OUTPUT: a list of the places of the function field of the curve + OUTPUT: A list of the places of the function field of the curve. EXAMPLES:: diff --git a/src/sage/schemes/curves/projective_curve.py b/src/sage/schemes/curves/projective_curve.py index 275d7e2498c..971fa4cb553 100644 --- a/src/sage/schemes/curves/projective_curve.py +++ b/src/sage/schemes/curves/projective_curve.py @@ -241,7 +241,7 @@ def affine_patch(self, i, AA=None): - ``AA`` -- (default: None) ambient affine space, this is constructed if it is not given - OUTPUT: a curve in affine space + OUTPUT: A curve in affine space. EXAMPLES:: @@ -289,7 +289,7 @@ def projection(self, P=None, PS=None): ambient space of this curve. This space will be constructed if not specified. - OUTPUT: a tuple of + OUTPUT: A tuple of - a scheme morphism from this curve into a projective space of dimension one less than that of the ambient space of this curve @@ -503,7 +503,7 @@ def plane_projection(self, PP=None): as this curve, and must have dimension two. This space is constructed if not specified. - OUTPUT: a tuple of + OUTPUT: A tuple of - a scheme morphism from this curve into a projective plane @@ -635,13 +635,11 @@ def divisor_of_function(self, r): """ Return the divisor of a function on a curve. - INPUT: r is a rational function on X + INPUT: ``r`` is a rational function on X - OUTPUT: - - - ``list`` -- The divisor of r represented as a list of coefficients and - points. (TODO: This will change to a more structural output in the - future.) + OUTPUT: A list. The divisor of r represented as a list of coefficients and + points. (TODO: This will change to a more structural output in the + future.) EXAMPLES:: @@ -895,7 +893,7 @@ def degree(self): For a plane curve, this is just the degree of its defining polynomial. - OUTPUT: integer. + OUTPUT: An integer. EXAMPLES:: @@ -924,7 +922,7 @@ def tangents(self, P, factor=True): OUTPUT: - a list of polynomials in the coordinate ring of the ambient space of + A list of polynomials in the coordinate ring of the ambient space of this curve. EXAMPLES:: @@ -1520,7 +1518,7 @@ def is_transverse(self, C, P): - ``P`` -- a point in the intersection of both curves. - OUTPUT: Boolean. + OUTPUT: A boolean. EXAMPLES:: @@ -1828,9 +1826,7 @@ def riemann_surface(self,**kwargs): r""" Return the complex Riemann surface determined by this curve - OUTPUT: - - - RiemannSurface object + OUTPUT: A :class:`~sage.schemes.riemann_surfaces.riemann_surface.RiemannSurface` object. EXAMPLES:: @@ -2039,8 +2035,8 @@ def riemann_roch_basis(self, D): - ``D`` - a divisor - OUTPUT: a list of function field elements that form a basis of the - Riemann-Roch space + OUTPUT: A list of function field elements that form a basis of the + Riemann-Roch space. EXAMPLES:: @@ -2124,7 +2120,7 @@ def rational_points(self, algorithm="enum", sort=True): points should be sorted. If False, the order of the output is non-deterministic. - OUTPUT: a list of all the rational points on the curve, possibly sorted. + OUTPUT: A list of all the rational points on the curve, possibly sorted. .. NOTE:: @@ -2826,9 +2822,7 @@ def Hasse_bounds(q, genus=1): - ``genus`` (int, default 1) -- a non-negative integer, - OUTPUT: - - (tuple) The Hasse bounds (lb,ub) for the cardinality of a curve of + OUTPUT: A tuple. The Hasse bounds (lb,ub) for the cardinality of a curve of genus ``genus`` defined over `\GF{q}`. EXAMPLES:: diff --git a/src/sage/schemes/cyclic_covers/charpoly_frobenius.py b/src/sage/schemes/cyclic_covers/charpoly_frobenius.py index f2aabe5ad4e..fc5cc3b1c3e 100644 --- a/src/sage/schemes/cyclic_covers/charpoly_frobenius.py +++ b/src/sage/schemes/cyclic_covers/charpoly_frobenius.py @@ -32,7 +32,7 @@ def charpoly_frobenius(frob_matrix, charpoly_prec, p, weight, a=1, known_factor= OUTPUT: - A list of integers corresponding to the characteristic polynomial of the Frobenius action + A list of integers corresponding to the characteristic polynomial of the Frobenius action. EXAMPLES:: diff --git a/src/sage/schemes/cyclic_covers/cycliccover_finite_field.py b/src/sage/schemes/cyclic_covers/cycliccover_finite_field.py index 54c1519a90b..d2bdefa5e3a 100644 --- a/src/sage/schemes/cyclic_covers/cycliccover_finite_field.py +++ b/src/sage/schemes/cyclic_covers/cycliccover_finite_field.py @@ -23,7 +23,6 @@ sage: C.frobenius_polynomial().reverse()(t)/((1-t)*(1-p*t)) + O(t^5) 1 + 8*t + 102*t^2 + 1384*t^3 + 18089*t^4 + O(t^5) - sage: p = 49999 sage: x = PolynomialRing(GF(p),"x").gen() sage: CyclicCover(5, x^5 + x).frobenius_polynomial() # long time diff --git a/src/sage/schemes/cyclic_covers/cycliccover_generic.py b/src/sage/schemes/cyclic_covers/cycliccover_generic.py index ff5d492b41f..d9cb5f4c406 100644 --- a/src/sage/schemes/cyclic_covers/cycliccover_generic.py +++ b/src/sage/schemes/cyclic_covers/cycliccover_generic.py @@ -17,7 +17,6 @@ ... ValueError: As the characteristic divides the order of the cover, this model is not smooth. - sage: GF7x. = GF(7)[] # optional - sage.rings.finite_rings sage: C = CyclicCover(3, x^9 + x + 1) # optional - sage.rings.finite_rings sage: C # optional - sage.rings.finite_rings diff --git a/src/sage/schemes/elliptic_curves/BSD.py b/src/sage/schemes/elliptic_curves/BSD.py index a707d1bee06..a9f8e537797 100644 --- a/src/sage/schemes/elliptic_curves/BSD.py +++ b/src/sage/schemes/elliptic_curves/BSD.py @@ -249,9 +249,9 @@ def prove_BSD(E, verbosity=0, two_desc='mwrank', proof=None, secs_hi=5, - ``verbosity`` -- int, how much information about the proof to print. - - 0: print nothing - - 1: print sketch of proof - - 2: print information about remaining primes + - 0: print nothing + - 1: print sketch of proof + - 2: print information about remaining primes - ``two_desc`` -- string (default ``'mwrank'``), what to use for the two-descent. Options are ``'mwrank', 'simon', 'sage'`` @@ -353,7 +353,9 @@ def prove_BSD(E, verbosity=0, two_desc='mwrank', proof=None, secs_hi=5, sage: E.prove_BSD() Traceback (most recent call last): ... - RuntimeError: It seems that the rank conjecture does not hold for this curve (Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field)! This may be a counterexample to BSD, but is more likely a bug. + RuntimeError: It seems that the rank conjecture does not hold for this curve + (Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field)! + This may be a counterexample to BSD, but is more likely a bug. We test the consistency check for the 2-part of Sha:: diff --git a/src/sage/schemes/elliptic_curves/Qcurves.py b/src/sage/schemes/elliptic_curves/Qcurves.py index 23749f20cf5..df577822cc2 100644 --- a/src/sage/schemes/elliptic_curves/Qcurves.py +++ b/src/sage/schemes/elliptic_curves/Qcurves.py @@ -53,19 +53,19 @@ def is_Q_curve(E, maxp=100, certificate=False, verbose=False): - when the flag is ``True``, so `E` is a `\QQ`-curve: - - either {'CM':`D`} where `D` is a negative discriminant, when - `E` has potential CM with discriminant `D`; - - - otherwise {'CM': `0`, 'core_poly': `f`, 'rho': `\rho`, 'r': - `r`, 'N': `N`}, when `E` is a non-CM `\QQ`-curve, where the - core polynomial `f` is an irreducible monic polynomial over - `QQ` of degree `2^\rho`, all of whose roots are - `j`-invariants of curves isogenous to `E`, the core level - `N` is a square-free integer with `r` prime factors which is - the LCM of the degrees of the isogenies between these - conjugates. For example, if there exists a curve `E'` - isogenous to `E` with `j(E')=j\in\QQ`, then the certificate - is {'CM':0, 'r':0, 'rho':0, 'core_poly': x-j, 'N':1}. + - either {'CM':`D`} where `D` is a negative discriminant, when + `E` has potential CM with discriminant `D`; + + - otherwise {'CM': `0`, 'core_poly': `f`, 'rho': `\rho`, 'r': + `r`, 'N': `N`}, when `E` is a non-CM `\QQ`-curve, where the + core polynomial `f` is an irreducible monic polynomial over + `QQ` of degree `2^\rho`, all of whose roots are + `j`-invariants of curves isogenous to `E`, the core level + `N` is a square-free integer with `r` prime factors which is + the LCM of the degrees of the isogenies between these + conjugates. For example, if there exists a curve `E'` + isogenous to `E` with `j(E')=j\in\QQ`, then the certificate + is {'CM':0, 'r':0, 'rho':0, 'core_poly': x-j, 'N':1}. - when the flag is ``False``, so `E` is not a `\QQ`-curve, the certificate is a prime `p` such that the reductions of `E` at @@ -405,9 +405,9 @@ def Step4Test(E, B, oldB=0, verbose=False): - `B` (integer): upper bound on primes to test - - `oldB` (integer, default 0): lower bound on primes to test + - ``oldB`` (integer, default 0): lower bound on primes to test - - `verbose` (boolean, default ``False``): verbosity flag + - ``verbose`` (boolean, default ``False``): verbosity flag OUTPUT: @@ -495,9 +495,9 @@ def conjugacy_test(jlist, verbose=False): INPUT: - - `jlist` (list): a list of algebraic numbers in the same field + - ``jlist`` (list): a list of algebraic numbers in the same field - - `verbose` (boolean, default ``False``): verbosity flag + - ``verbose`` (boolean, default ``False``): verbosity flag OUTPUT: diff --git a/src/sage/schemes/elliptic_curves/constructor.py b/src/sage/schemes/elliptic_curves/constructor.py index e8c71899c19..d36020d6650 100644 --- a/src/sage/schemes/elliptic_curves/constructor.py +++ b/src/sage/schemes/elliptic_curves/constructor.py @@ -146,7 +146,8 @@ class EllipticCurveFactory(UniqueFactory): sage: E = EllipticCurve(CC, [0,0,1,-1,0]) sage: E - Elliptic Curve defined by y^2 + 1.00000000000000*y = x^3 + (-1.00000000000000)*x over Complex Field with 53 bits of precision + Elliptic Curve defined by y^2 + 1.00000000000000*y = x^3 + (-1.00000000000000)*x + over Complex Field with 53 bits of precision sage: E.j_invariant() 2988.97297297297 @@ -310,9 +311,7 @@ def create_key_and_extra_args(self, x=None, y=None, j=None, minimal_twist=True, """ Return a ``UniqueFactory`` key and possibly extra parameters. - INPUT: - - See the documentation for :class:`EllipticCurveFactory`. + INPUT: See the documentation for :class:`EllipticCurveFactory`. OUTPUT: @@ -504,9 +503,7 @@ def EllipticCurve_from_Weierstrass_polynomial(f): - ``f`` -- a inhomogeneous cubic polynomial in long Weierstrass form. - OUTPUT: - - The elliptic curve defined by it. + OUTPUT: The elliptic curve defined by it. EXAMPLES:: @@ -671,9 +668,7 @@ def coefficients_from_j(j, minimal_twist=True): Return Weierstrass coefficients `(a_1, a_2, a_3, a_4, a_6)` for an elliptic curve with given `j`-invariant. - INPUT: - - See :func:`EllipticCurve_from_j`. + INPUT: See :func:`EllipticCurve_from_j`. EXAMPLES:: @@ -1395,9 +1390,7 @@ def are_projectively_equivalent(P, Q, base_ring): - ``base_ring`` -- the base ring. - OUTPUT: - - Boolean. + OUTPUT: A boolean. EXAMPLES:: diff --git a/src/sage/schemes/elliptic_curves/ec_database.py b/src/sage/schemes/elliptic_curves/ec_database.py index 4c221715432..375e01fa93a 100644 --- a/src/sage/schemes/elliptic_curves/ec_database.py +++ b/src/sage/schemes/elliptic_curves/ec_database.py @@ -58,10 +58,12 @@ which are not included in the tables. AUTHORS: + - William Stein (2007-10-07): initial version + - Simon Spicer (2014-10-24): Added examples of more high-rank curves -See also the functions cremona_curves() and cremona_optimal_curves() +See also the functions :func:`cremona_curves` and :func:`cremona_optimal_curves` which enable easy looping through the Cremona elliptic curve database. """ @@ -125,7 +127,8 @@ def rank(self, rank, tors=0, n=10, labels=False): sage: L[0].cremona_label() Traceback (most recent call last): ... - LookupError: Cremona database does not contain entry for Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 2582*x + 48720 over Rational Field + LookupError: Cremona database does not contain entry for Elliptic Curve + defined by y^2 + x*y = x^3 + x^2 - 2582*x + 48720 over Rational Field sage: elliptic_curves.rank(6, n=3, labels=True) [] """ diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index 3464c9c2a51..768cbeaa965 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -782,8 +782,7 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: ker_poly = phi_v.kernel_polynomial() # optional - sage.rings.number_field sage: ker_poly # optional - sage.rings.number_field x^2 - 21*x + 80 - sage: phi_k = EllipticCurveIsogeny(EK, ker_poly) # optional - sage.rings.number_field - sage: phi_k # optional - sage.rings.number_field + sage: phi_k = EllipticCurveIsogeny(EK, ker_poly); phi_k # optional - sage.rings.number_field Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in alpha with defining polynomial x^3 - 2*x^2 - 40*x - 158 @@ -808,8 +807,7 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: f = x^2 - 21*x + 80 sage: phi = E.isogeny(f) sage: E2 = phi.codomain() - sage: phi_s = EllipticCurveIsogeny(E, None, E2, 5) - sage: phi_s + sage: phi_s = EllipticCurveIsogeny(E, None, E2, 5); phi_s Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field @@ -3680,18 +3678,16 @@ def compute_sequence_of_maps(E1, E2, ell): To: Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field Via: (u,r,s,t) = (1, -1/3, 0, 1/2), - Elliptic Curve defined by y^2 = x^3 - 31/3*x - 2501/108 - over Rational Field, - Elliptic Curve defined by y^2 = x^3 - 23461/3*x - 28748141/108 - over Rational Field, + Elliptic Curve defined by y^2 = x^3 - 31/3*x - 2501/108 over Rational Field, + Elliptic Curve defined by y^2 = x^3 - 23461/3*x - 28748141/108 over Rational Field, x^2 - 61/3*x + 658/9) - sage: K. = NumberField(x^2 + 1) + sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field sage: E = EllipticCurve(K, [0,0,0,1,0]) # optional - sage.rings.number_field sage: E2 = EllipticCurve(K, [0,0,0,16,0]) # optional - sage.rings.number_field sage: compute_sequence_of_maps(E, E2, 4) # optional - sage.rings.number_field (Elliptic-curve endomorphism of Elliptic Curve defined by y^2 = x^3 + x - over Number Field in i with defining polynomial x^2 + 1 + over Number Field in i with defining polynomial x^2 + 1 Via: (u,r,s,t) = (1, 0, 0, 0), Elliptic-curve endomorphism of Elliptic Curve defined by y^2 = x^3 + 16*x over Number Field in i with defining polynomial x^2 + 1 diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py index 322058415c1..3fca7a4acb6 100644 --- a/src/sage/schemes/elliptic_curves/ell_field.py +++ b/src/sage/schemes/elliptic_curves/ell_field.py @@ -1,8 +1,8 @@ r""" Elliptic curves over a general field -This module defines the class ``EllipticCurve_field``, based on -``EllipticCurve_generic``, for elliptic curves over general fields. +This module defines the class :class:`EllipticCurve_field`, based on +:class:`EllipticCurve_generic`, for elliptic curves over general fields. """ #***************************************************************************** # Copyright (C) 2006 William Stein @@ -1114,12 +1114,12 @@ def isogeny(self, kernel, codomain=None, degree=None, model=None, check=True, al - ``degree`` -- an integer (default: ``None``). - - If ``kernel`` is ``None``, then this is the degree of the isogeny - from this curve to ``codomain``. + - If ``kernel`` is ``None``, then this is the degree of the isogeny + from this curve to ``codomain``. - - If ``kernel`` is not ``None``, then this is used to determine - whether or not to skip a `\gcd` of the given kernel polynomial - with the two-torsion polynomial of this curve. + - If ``kernel`` is not ``None``, then this is used to determine + whether or not to skip a `\gcd` of the given kernel polynomial + with the two-torsion polynomial of this curve. - ``model`` -- a string (default: ``None``). Supported values (cf. :func:`~sage.schemes.elliptic_curves.ell_field.compute_model`): @@ -1261,8 +1261,7 @@ def isogeny_codomain(self, kernel, degree=None): INPUT: - ``kernel`` -- Either a list of points in the kernel of the isogeny, - or a kernel polynomial (specified as either a - univariate polynomial or a coefficient list.) + or a kernel polynomial (specified as either a univariate polynomial or a coefficient list.) OUTPUT: @@ -1597,7 +1596,7 @@ def is_isogenous(self, other, field=None): - ``field`` (default None) -- Currently not implemented. A field containing the base fields of the two elliptic curves onto which the two curves may be extended to test if they - are isogenous over this field. By default is_isogenous will + are isogenous over this field. By default ``is_isogenous`` will not try to find this field unless one of the curves can be be extended into the base field of the other, in which case it will test over the larger base field. @@ -1659,7 +1658,7 @@ def weierstrass_p(self, prec=20, algorithm=None): OUTPUT: - a Laurent series in one variable `z` with coefficients in the + A Laurent series in one variable `z` with coefficients in the base field `k` of `E`. EXAMPLES:: @@ -1699,7 +1698,7 @@ def hasse_invariant(self): characteristic, and is an element of the field which is zero if and only if the curve is supersingular. Over a field of characteristic zero, where the Hasse invariant is undefined, - a ``ValueError`` is returned. + a ``ValueError`` is raised. EXAMPLES:: @@ -1783,9 +1782,7 @@ class of curves. If the j-invariant is not unique in the isogeny class, append ``*`` to it to indicate a twist. Otherwise, if ``False`` label vertices by the equation of a representative curve. - OUTPUT: - - A ``Graph`` or ``Digraph`` + OUTPUT: A :class:`Graph` or :class:`DiGraph`. EXAMPLES: @@ -1878,11 +1875,11 @@ class of curves. If the j-invariant is not unique in the isogeny 'y^2 + x*y + y = x^3 + 4*x + (-6)'] sage: G2.edges(sort=True) # optional - sage.graphs sage.rings.number_field [('y^2 + x*y + y = x^3 + (-130*e-356)*x + (-2000*e-2038)', - 'y^2 + x*y + y = x^3 + (-36)*x + (-70)', None), + 'y^2 + x*y + y = x^3 + (-36)*x + (-70)', None), ('y^2 + x*y + y = x^3 + (-36)*x + (-70)', - 'y^2 + x*y + y = x^3 + (130*e-356)*x + (2000*e-2038)', None), + 'y^2 + x*y + y = x^3 + (130*e-356)*x + (2000*e-2038)', None), ('y^2 + x*y + y = x^3 + (-36)*x + (-70)', - 'y^2 + x*y + y = x^3 + 4*x + (-6)', None)] + 'y^2 + x*y + y = x^3 + 4*x + (-6)', None)] sage: G3 = E.isogeny_ell_graph(3, directed=False) # optional - sage.graphs sage.rings.number_field sage: G3.vertices(sort=True) # optional - sage.graphs sage.rings.number_field ['y^2 + x*y + y = x^3 + (-1)*x', @@ -1890,9 +1887,9 @@ class of curves. If the j-invariant is not unique in the isogeny 'y^2 + x*y + y = x^3 + 4*x + (-6)'] sage: G3.edges(sort=True) # optional - sage.graphs sage.rings.number_field [('y^2 + x*y + y = x^3 + (-1)*x', - 'y^2 + x*y + y = x^3 + 4*x + (-6)', None), + 'y^2 + x*y + y = x^3 + 4*x + (-6)', None), ('y^2 + x*y + y = x^3 + (-171)*x + (-874)', - 'y^2 + x*y + y = x^3 + 4*x + (-6)', None)] + 'y^2 + x*y + y = x^3 + 4*x + (-6)', None)] TESTS:: diff --git a/src/sage/schemes/elliptic_curves/ell_finite_field.py b/src/sage/schemes/elliptic_curves/ell_finite_field.py index cc914f59830..09d6fcab7f3 100644 --- a/src/sage/schemes/elliptic_curves/ell_finite_field.py +++ b/src/sage/schemes/elliptic_curves/ell_finite_field.py @@ -940,7 +940,9 @@ def abelian_group(self): sage: E = EllipticCurve(GF(11),[2,5]) sage: E.abelian_group() - Additive abelian group isomorphic to Z/10 embedded in Abelian group of points on Elliptic Curve defined by y^2 = x^3 + 2*x + 5 over Finite Field of size 11 + Additive abelian group isomorphic to Z/10 embedded in + Abelian group of points on Elliptic Curve defined by y^2 = x^3 + 2*x + 5 + over Finite Field of size 11 :: @@ -966,7 +968,8 @@ def abelian_group(self): sage: E = EllipticCurve(GF(2),[0,0,1,1,1]) sage: E.abelian_group() - Trivial group embedded in Abelian group of points on Elliptic Curve defined by y^2 + y = x^3 + x + 1 over Finite Field of size 2 + Trivial group embedded in Abelian group of points on + Elliptic Curve defined by y^2 + y = x^3 + x + 1 over Finite Field of size 2 Of course, there are plenty of points if we extend the field:: @@ -991,7 +994,8 @@ def abelian_group(self): sage: OKmodP = OK.residue_field(P) sage: E = EllipticCurve([0,0,0,i,i+3]) sage: Emod = E.change_ring(OKmodP); Emod - Elliptic Curve defined by y^2 = x^3 + ibar*x + (ibar+3) over Residue field in ibar of Fractional ideal (10007) + Elliptic Curve defined by y^2 = x^3 + ibar*x + (ibar+3) + over Residue field in ibar of Fractional ideal (10007) sage: Emod.abelian_group() #random generators (Multiplicative Abelian group isomorphic to C50067594 x C2, ((3152*ibar + 7679 : 7330*ibar + 7913 : 1), (8466*ibar + 1770 : 0 : 1))) @@ -1037,7 +1041,9 @@ def torsion_basis(self, n): sage: E = EllipticCurve(GF(62207^2), [1,0]) sage: E.abelian_group() - Additive abelian group isomorphic to Z/62208 + Z/62208 embedded in Abelian group of points on Elliptic Curve defined by y^2 = x^3 + x over Finite Field in z2 of size 62207^2 + Additive abelian group isomorphic to Z/62208 + Z/62208 embedded in + Abelian group of points on Elliptic Curve defined by y^2 = x^3 + x + over Finite Field in z2 of size 62207^2 sage: PA,QA = E.torsion_basis(2^8) sage: PA.weil_pairing(QA, 2^8).multiplicative_order() 256 @@ -1268,7 +1274,7 @@ def is_ordinary(self, proof=True): def set_order(self, value, *, check=True, num_checks=8): r""" - Set the value of self._order to value. + Set the value of ``self._order`` to ``value``. Use this when you know a priori the order of the curve to avoid a potentially expensive order calculation. @@ -1341,7 +1347,7 @@ def set_order(self, value, *, check=True, num_checks=8): It is also very likely an error to pass a value which is not the actual order of this curve. How unlikely is determined by - num_checks, the factorization of the actual order, and the + ``num_checks``, the factorization of the actual order, and the actual group structure:: sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 6 @@ -1359,7 +1365,7 @@ def set_order(self, value, *, check=True, num_checks=8): sage: E.order() 12 - Or, the order can be set incorrectly along with num_checks set + Or, the order can be set incorrectly along with ``num_checks`` set too small:: sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 6 @@ -1367,7 +1373,7 @@ def set_order(self, value, *, check=True, num_checks=8): sage: E.order() 4 - The value of num_checks must be an integer. Negative values + The value of ``num_checks`` must be an integer. Negative values are interpreted as zero, which means don't do any checking:: sage: E = EllipticCurve(GF(7), [0, 1]) # This curve has order 6 @@ -1843,9 +1849,9 @@ def curves_with_j_1728(K): ``curves_with_j_0_char3``. Otherwise there are either 2 or 4 curves, parametrised by `K^*/(K^*)^4`. - Examples: + EXAMPLES: - For `K=\GF{q}` where `q\equiv1\mod{4} there are four curves, the quartic twists of `y^2=x^3+x`:: + For `K=\GF{q}` where `q\equiv1\mod{4}`, there are four curves, the quartic twists of `y^2=x^3+x`:: sage: from sage.schemes.elliptic_curves.ell_finite_field import curves_with_j_1728 sage: sorted(curves_with_j_1728(GF(5)), key = lambda E: E.a_invariants()) @@ -1859,7 +1865,7 @@ def curves_with_j_1728(K): Elliptic Curve defined by y^2 = x^3 + (z2+4)*x over Finite Field in z2 of size 7^2, Elliptic Curve defined by y^2 = x^3 + (5*z2+4)*x over Finite Field in z2 of size 7^2] - For `K=\GF{q}` where `q\equiv3\mod{4} there are two curves, + For `K=\GF{q}` where `q\equiv3\mod{4}`, there are two curves, quadratic twists of each other by `-1`: `y^2=x^3+x` and `y^2=x^3-x`:: @@ -2144,7 +2150,7 @@ def supersingular_j_polynomial(p, use_cache=True): - `p` (integer) -- a prime number. - - `use_cache` (boolean, default ``True``) -- use cached coefficients if they exist + - ``use_cache`` (boolean, default ``True``) -- use cached coefficients if they exist ALGORITHM: diff --git a/src/sage/schemes/elliptic_curves/ell_generic.py b/src/sage/schemes/elliptic_curves/ell_generic.py index 0a542588e4c..1025ec5a44b 100644 --- a/src/sage/schemes/elliptic_curves/ell_generic.py +++ b/src/sage/schemes/elliptic_curves/ell_generic.py @@ -1477,7 +1477,7 @@ def rst_transform(self, r, s, t): OUTPUT: - The elliptic curve obtained from self by the standard + The elliptic curve obtained from ``self`` by the standard Weierstrass transformation `(u,r,s,t)` with `u=1`. .. NOTE:: @@ -1507,7 +1507,7 @@ def scale_curve(self, u): OUTPUT: - The elliptic curve obtained from self by the standard + The elliptic curve obtained from ``self`` by the standard Weierstrass transformation `(u,r,s,t)` with `r=s=t=0`. .. NOTE:: @@ -2354,8 +2354,8 @@ def multiplication_by_m_isogeny(self, m): multiplication-by-`m` map on this elliptic curve. The resulting isogeny will - have the associated rational maps (i.e. those returned by - `self.multiplication_by_m()`) already computed. + have the associated rational maps (i.e., those returned by + :meth:`multiplication_by_m`) already computed. NOTE: This function is currently *much* slower than the result of ``self.multiplication_by_m()``, because @@ -2504,8 +2504,8 @@ def frobenius_isogeny(self, n=1): def isomorphism_to(self, other): """ - Given another weierstrass model ``other`` of self, return an - isomorphism from self to ``other``. + Given another weierstrass model ``other`` of ``self``, return an + isomorphism from ``self`` to ``other``. INPUT: @@ -2513,7 +2513,7 @@ def isomorphism_to(self, other): OUTPUT: - (Weierstrassmorphism) An isomorphism from self to other. + (Weierstrassmorphism) An isomorphism from ``self`` to ``other``. .. NOTE:: @@ -2553,7 +2553,7 @@ def isomorphism_to(self, other): def automorphisms(self, field=None): """ - Return the set of isomorphisms from self to itself (as a list). + Return the set of isomorphisms from ``self`` to itself (as a list). The identity and negation morphisms are guaranteed to appear as the first and second entry of the returned list. @@ -2637,7 +2637,7 @@ def automorphisms(self, field=None): def isomorphisms(self, other, field=None): """ - Return the set of isomorphisms from self to other (as a list). + Return the set of isomorphisms from ``self`` to ``other`` (as a list). INPUT: @@ -2693,7 +2693,7 @@ def isomorphisms(self, other, field=None): def is_isomorphic(self, other, field=None): """ - Return whether or not self is isomorphic to other. + Return whether or not ``self`` is isomorphic to ``other``. INPUT: @@ -2737,7 +2737,7 @@ def is_isomorphic(self, other, field=None): def change_weierstrass_model(self, *urst): r""" - Return a new Weierstrass model of self under the standard transformation `(u,r,s,t)` + Return a new Weierstrass model of ``self`` under the standard transformation `(u,r,s,t)` .. MATH:: diff --git a/src/sage/schemes/elliptic_curves/ell_local_data.py b/src/sage/schemes/elliptic_curves/ell_local_data.py index ff0847d871e..2031ee08fde 100644 --- a/src/sage/schemes/elliptic_curves/ell_local_data.py +++ b/src/sage/schemes/elliptic_curves/ell_local_data.py @@ -16,8 +16,8 @@ EXAMPLES:: - sage: K. = NumberField(x^2+1) - sage: E = EllipticCurve([(2+i)^2,(2+i)^7]) + sage: K. = NumberField(x^2 + 1) + sage: E = EllipticCurve([(2+i)^2, (2+i)^7]) sage: pp = K.fractional_ideal(2+i) sage: da = E.local_data(pp) sage: da.has_bad_reduction() @@ -29,29 +29,31 @@ sage: da.tamagawa_number() 4 sage: da.minimal_model() - Elliptic Curve defined by y^2 = x^3 + (4*i+3)*x + (-29*i-278) over Number Field in i with defining polynomial x^2 + 1 + Elliptic Curve defined by y^2 = x^3 + (4*i+3)*x + (-29*i-278) + over Number Field in i with defining polynomial x^2 + 1 An example to show how the Neron model can change as one extends the field:: sage: E = EllipticCurve([0,-1]) sage: E.local_data(2) Local data at Principal ideal (2) of Integer Ring: - Reduction type: bad additive - Local minimal model: Elliptic Curve defined by y^2 = x^3 - 1 over Rational Field - Minimal discriminant valuation: 4 - Conductor exponent: 4 - Kodaira Symbol: II - Tamagawa Number: 1 + Reduction type: bad additive + Local minimal model: Elliptic Curve defined by y^2 = x^3 - 1 over Rational Field + Minimal discriminant valuation: 4 + Conductor exponent: 4 + Kodaira Symbol: II + Tamagawa Number: 1 sage: EK = E.base_extend(K) sage: EK.local_data(1+i) Local data at Fractional ideal (i + 1): - Reduction type: bad additive - Local minimal model: Elliptic Curve defined by y^2 = x^3 + (-1) over Number Field in i with defining polynomial x^2 + 1 - Minimal discriminant valuation: 8 - Conductor exponent: 2 - Kodaira Symbol: IV* - Tamagawa Number: 3 + Reduction type: bad additive + Local minimal model: Elliptic Curve defined by y^2 = x^3 + (-1) + over Number Field in i with defining polynomial x^2 + 1 + Minimal discriminant valuation: 8 + Conductor exponent: 2 + Kodaira Symbol: IV* + Tamagawa Number: 3 Or how the minimal equation changes:: @@ -61,7 +63,8 @@ sage: EK = E.base_extend(K) sage: da = EK.local_data(1+i) sage: da.minimal_model() - Elliptic Curve defined by y^2 = x^3 + (-i) over Number Field in i with defining polynomial x^2 + 1 + Elliptic Curve defined by y^2 = x^3 + (-i) + over Number Field in i with defining polynomial x^2 + 1 AUTHORS: @@ -140,12 +143,13 @@ class EllipticCurveLocalData(SageObject): sage: E = EllipticCurve('14a1') sage: EllipticCurveLocalData(E,2) Local data at Principal ideal (2) of Integer Ring: - Reduction type: bad non-split multiplicative - Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field - Minimal discriminant valuation: 6 - Conductor exponent: 1 - Kodaira Symbol: I6 - Tamagawa Number: 2 + Reduction type: bad non-split multiplicative + Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 + over Rational Field + Minimal discriminant valuation: 6 + Conductor exponent: 1 + Kodaira Symbol: I6 + Tamagawa Number: 2 """ def __init__(self, E, P, proof=None, algorithm="pari", globally=False): @@ -184,65 +188,70 @@ def __init__(self, E, P, proof=None, algorithm="pari", globally=False): sage: from sage.schemes.elliptic_curves.ell_local_data import EllipticCurveLocalData sage: E = EllipticCurve('14a1') - sage: EllipticCurveLocalData(E,2) + sage: EllipticCurveLocalData(E, 2) Local data at Principal ideal (2) of Integer Ring: - Reduction type: bad non-split multiplicative - Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field - Minimal discriminant valuation: 6 - Conductor exponent: 1 - Kodaira Symbol: I6 - Tamagawa Number: 2 + Reduction type: bad non-split multiplicative + Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 + over Rational Field + Minimal discriminant valuation: 6 + Conductor exponent: 1 + Kodaira Symbol: I6 + Tamagawa Number: 2 :: - sage: EllipticCurveLocalData(E,2,algorithm="generic") + sage: EllipticCurveLocalData(E, 2, algorithm="generic") Local data at Principal ideal (2) of Integer Ring: - Reduction type: bad non-split multiplicative - Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field - Minimal discriminant valuation: 6 - Conductor exponent: 1 - Kodaira Symbol: I6 - Tamagawa Number: 2 + Reduction type: bad non-split multiplicative + Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 + over Rational Field + Minimal discriminant valuation: 6 + Conductor exponent: 1 + Kodaira Symbol: I6 + Tamagawa Number: 2 :: - sage: EllipticCurveLocalData(E,2,algorithm="pari") + sage: EllipticCurveLocalData(E, 2, algorithm="pari") Local data at Principal ideal (2) of Integer Ring: - Reduction type: bad non-split multiplicative - Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field - Minimal discriminant valuation: 6 - Conductor exponent: 1 - Kodaira Symbol: I6 - Tamagawa Number: 2 + Reduction type: bad non-split multiplicative + Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 + over Rational Field + Minimal discriminant valuation: 6 + Conductor exponent: 1 + Kodaira Symbol: I6 + Tamagawa Number: 2 :: - sage: EllipticCurveLocalData(E,2,algorithm="unknown") + sage: EllipticCurveLocalData(E, 2, algorithm="unknown") Traceback (most recent call last): ... ValueError: algorithm must be one of 'pari', 'generic' :: - sage: EllipticCurveLocalData(E,3) + sage: EllipticCurveLocalData(E, 3) Local data at Principal ideal (3) of Integer Ring: - Reduction type: good - Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field - Minimal discriminant valuation: 0 - Conductor exponent: 0 - Kodaira Symbol: I0 - Tamagawa Number: 1 + Reduction type: good + Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 + over Rational Field + Minimal discriminant valuation: 0 + Conductor exponent: 0 + Kodaira Symbol: I0 + Tamagawa Number: 1 :: - sage: EllipticCurveLocalData(E,7) + sage: EllipticCurveLocalData(E, 7) Local data at Principal ideal (7) of Integer Ring: - Reduction type: bad split multiplicative - Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field - Minimal discriminant valuation: 3 - Conductor exponent: 1 - Kodaira Symbol: I3 - Tamagawa Number: 3 + Reduction type: bad split multiplicative + Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 + over Rational Field + Minimal discriminant valuation: 3 + Conductor exponent: 1 + Kodaira Symbol: I3 + Tamagawa Number: 3 """ self._curve = E K = E.base_field() @@ -313,8 +322,8 @@ def minimal_model(self, reduce=True): sage: from sage.schemes.elliptic_curves.ell_local_data import EllipticCurveLocalData sage: E = EllipticCurve([0,0,0,0,64]); E - Elliptic Curve defined by y^2 = x^3 + 64 over Rational Field - sage: data = EllipticCurveLocalData(E,2) + Elliptic Curve defined by y^2 = x^3 + 64 over Rational Field + sage: data = EllipticCurveLocalData(E, 2) sage: data.minimal_model() Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field sage: data.minimal_model() == E.local_minimal_model(2) @@ -322,12 +331,14 @@ def minimal_model(self, reduce=True): To demonstrate the behaviour of the parameter ``reduce``:: - sage: K. = NumberField(x^3+x+1) + sage: K. = NumberField(x^3 + x + 1) sage: E = EllipticCurve(K, [0, 0, a, 0, 1]) sage: E.local_data(K.ideal(a-1)).minimal_model() - Elliptic Curve defined by y^2 + a*y = x^3 + 1 over Number Field in a with defining polynomial x^3 + x + 1 + Elliptic Curve defined by y^2 + a*y = x^3 + 1 + over Number Field in a with defining polynomial x^3 + x + 1 sage: E.local_data(K.ideal(a-1)).minimal_model(reduce=False) - Elliptic Curve defined by y^2 + (a+2)*y = x^3 + 3*x^2 + 3*x + (-a+1) over Number Field in a with defining polynomial x^3 + x + 1 + Elliptic Curve defined by y^2 + (a+2)*y = x^3 + 3*x^2 + 3*x + (-a+1) + over Number Field in a with defining polynomial x^3 + x + 1 sage: E = EllipticCurve([2, 1, 0, -2, -1]) sage: E.local_data(ZZ.ideal(2), algorithm="generic").minimal_model(reduce=False) @@ -345,10 +356,15 @@ def minimal_model(self, reduce=True): sage: t = QQ['t'].0 sage: K. = NumberField(t^4 - t^3-3*t^2 - t +1) - sage: E = EllipticCurve([-2*g^3 + 10/3*g^2 + 3*g - 2/3, -11/9*g^3 + 34/9*g^2 - 7/3*g + 4/9, -11/9*g^3 + 34/9*g^2 - 7/3*g + 4/9, 0, 0]) + sage: E = EllipticCurve([-2*g^3 + 10/3*g^2 + 3*g - 2/3, + ....: -11/9*g^3 + 34/9*g^2 - 7/3*g + 4/9, + ....: -11/9*g^3 + 34/9*g^2 - 7/3*g + 4/9, 0, 0]) sage: vv = K.fractional_ideal(g^2 - g - 2) sage: E.local_data(vv).minimal_model() - Elliptic Curve defined by y^2 + (-2*g^3+10/3*g^2+3*g-2/3)*x*y + (-11/9*g^3+34/9*g^2-7/3*g+4/9)*y = x^3 + (-11/9*g^3+34/9*g^2-7/3*g+4/9)*x^2 over Number Field in g with defining polynomial t^4 - t^3 - 3*t^2 - t + 1 + Elliptic Curve defined by + y^2 + (-2*g^3+10/3*g^2+3*g-2/3)*x*y + (-11/9*g^3+34/9*g^2-7/3*g+4/9)*y + = x^3 + (-11/9*g^3+34/9*g^2-7/3*g+4/9)*x^2 + over Number Field in g with defining polynomial t^4 - t^3 - 3*t^2 - t + 1 """ if reduce: try: @@ -455,7 +471,7 @@ def tamagawa_exponent(self): sage: from sage.schemes.elliptic_curves.ell_local_data import EllipticCurveLocalData sage: E = EllipticCurve('816a1') - sage: data = EllipticCurveLocalData(E,2) + sage: data = EllipticCurveLocalData(E, 2) sage: data.kodaira_symbol() I2* sage: data.tamagawa_number() @@ -464,7 +480,7 @@ def tamagawa_exponent(self): 2 sage: E = EllipticCurve('200c4') - sage: data = EllipticCurveLocalData(E,5) + sage: data = EllipticCurveLocalData(E, 5) sage: data.kodaira_symbol() I4* sage: data.tamagawa_number() @@ -499,9 +515,9 @@ def bad_reduction_type(self): sage: [(p,E.local_data(p).bad_reduction_type()) for p in prime_range(15)] [(2, -1), (3, None), (5, None), (7, 1), (11, None), (13, None)] - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] - sage: E = EllipticCurve([0,0,0,0,2*a+1]) + sage: E = EllipticCurve([0, 0, 0, 0, 2*a+1]) sage: [(p,E.local_data(p).bad_reduction_type()) for p in [P17a,P17b]] [(Fractional ideal (4*a^2 - 2*a + 1), None), (Fractional ideal (2*a + 1), 0)] """ @@ -517,12 +533,12 @@ def has_good_reduction(self): sage: [(p,E.local_data(p).has_good_reduction()) for p in prime_range(15)] [(2, False), (3, True), (5, True), (7, False), (11, True), (13, True)] - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] - sage: E = EllipticCurve([0,0,0,0,2*a+1]) + sage: E = EllipticCurve([0, 0, 0, 0, 2*a+1]) sage: [(p,E.local_data(p).has_good_reduction()) for p in [P17a,P17b]] [(Fractional ideal (4*a^2 - 2*a + 1), True), - (Fractional ideal (2*a + 1), False)] + (Fractional ideal (2*a + 1), False)] """ return self._reduction_type is None @@ -538,12 +554,12 @@ def has_bad_reduction(self): :: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] - sage: E = EllipticCurve([0,0,0,0,2*a+1]) + sage: E = EllipticCurve([0, 0, 0, 0, 2*a+1]) sage: [(p,E.local_data(p).has_bad_reduction()) for p in [P17a,P17b]] [(Fractional ideal (4*a^2 - 2*a + 1), False), - (Fractional ideal (2*a + 1), True)] + (Fractional ideal (2*a + 1), True)] """ return self._reduction_type is not None @@ -559,14 +575,14 @@ def has_multiplicative_reduction(self): EXAMPLES:: sage: E = EllipticCurve('14a1') - sage: [(p,E.local_data(p).has_multiplicative_reduction()) for p in prime_range(15)] + sage: [(p, E.local_data(p).has_multiplicative_reduction()) for p in prime_range(15)] [(2, True), (3, False), (5, False), (7, True), (11, False), (13, False)] :: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] - sage: E = EllipticCurve([0,0,0,0,2*a+1]) + sage: E = EllipticCurve([0, 0, 0, 0, 2*a+1]) sage: [(p,E.local_data(p).has_multiplicative_reduction()) for p in [P17a,P17b]] [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)] """ @@ -579,17 +595,19 @@ def has_split_multiplicative_reduction(self): EXAMPLES:: sage: E = EllipticCurve('14a1') - sage: [(p,E.local_data(p).has_split_multiplicative_reduction()) for p in prime_range(15)] + sage: [(p, E.local_data(p).has_split_multiplicative_reduction()) + ....: for p in prime_range(15)] [(2, False), (3, False), (5, False), (7, True), (11, False), (13, False)] :: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] - sage: E = EllipticCurve([0,0,0,0,2*a+1]) - sage: [(p,E.local_data(p).has_split_multiplicative_reduction()) for p in [P17a,P17b]] + sage: E = EllipticCurve([0, 0, 0, 0, 2*a+1]) + sage: [(p,E .local_data(p).has_split_multiplicative_reduction()) + ....: for p in [P17a,P17b]] [(Fractional ideal (4*a^2 - 2*a + 1), False), - (Fractional ideal (2*a + 1), False)] + (Fractional ideal (2*a + 1), False)] """ return self._reduction_type == +1 @@ -600,15 +618,17 @@ def has_nonsplit_multiplicative_reduction(self): EXAMPLES:: sage: E = EllipticCurve('14a1') - sage: [(p,E.local_data(p).has_nonsplit_multiplicative_reduction()) for p in prime_range(15)] + sage: [(p, E.local_data(p).has_nonsplit_multiplicative_reduction()) + ....: for p in prime_range(15)] [(2, True), (3, False), (5, False), (7, False), (11, False), (13, False)] :: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] - sage: E = EllipticCurve([0,0,0,0,2*a+1]) - sage: [(p,E.local_data(p).has_nonsplit_multiplicative_reduction()) for p in [P17a,P17b]] + sage: E = EllipticCurve([0, 0, 0, 0, 2*a+1]) + sage: [(p, E.local_data(p).has_nonsplit_multiplicative_reduction()) + ....: for p in [P17a,P17b]] [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)] """ return self._reduction_type == -1 @@ -625,12 +645,12 @@ def has_additive_reduction(self): :: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] - sage: E = EllipticCurve([0,0,0,0,2*a+1]) - sage: [(p,E.local_data(p).has_additive_reduction()) for p in [P17a,P17b]] + sage: E = EllipticCurve([0, 0, 0, 0, 2*a+1]) + sage: [(p, E.local_data(p).has_additive_reduction()) for p in [P17a,P17b]] [(Fractional ideal (4*a^2 - 2*a + 1), False), - (Fractional ideal (2*a + 1), True)] + (Fractional ideal (2*a + 1), True)] """ return self._reduction_type == 0 @@ -1122,11 +1142,14 @@ def check_prime(K, P): sage: check_prime(K, L.ideal(5)) Traceback (most recent call last): ... - TypeError: The ideal Fractional ideal (5) is not a prime ideal of Number Field in a with defining polynomial x^2 - 5 + TypeError: The ideal Fractional ideal (5) is not a prime ideal of + Number Field in a with defining polynomial x^2 - 5 sage: check_prime(K, L.ideal(b)) Traceback (most recent call last): ... - TypeError: No compatible natural embeddings found for Number Field in a with defining polynomial x^2 - 5 and Number Field in b with defining polynomial x^2 + 3 + TypeError: No compatible natural embeddings found for + Number Field in a with defining polynomial x^2 - 5 and + Number Field in b with defining polynomial x^2 + 3 """ if K is QQ: if P in ZZ or isinstance(P, (Integer, int)): diff --git a/src/sage/schemes/elliptic_curves/ell_modular_symbols.py b/src/sage/schemes/elliptic_curves/ell_modular_symbols.py index 73497225511..ac321635328 100644 --- a/src/sage/schemes/elliptic_curves/ell_modular_symbols.py +++ b/src/sage/schemes/elliptic_curves/ell_modular_symbols.py @@ -48,7 +48,8 @@ sage: V = E.modular_symbol_space() sage: V - Modular Symbols subspace of dimension 1 of Modular Symbols space of dimension 2 for Gamma_0(19) of weight 2 with sign 1 over Rational Field + Modular Symbols subspace of dimension 1 of Modular Symbols space of dimension 2 + for Gamma_0(19) of weight 2 with sign 1 over Rational Field sage: V.q_eigenform(30) q - 2*q^3 - 2*q^4 + 3*q^5 - q^7 + q^9 + 3*q^11 + 4*q^12 - 4*q^13 - 6*q^15 + 4*q^16 - 3*q^17 + q^19 - 6*q^20 + 2*q^21 + 4*q^25 + 4*q^27 + 2*q^28 + 6*q^29 + O(q^30) diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py index 6848b4b34ea..0509c20bf52 100644 --- a/src/sage/schemes/elliptic_curves/ell_number_field.py +++ b/src/sage/schemes/elliptic_curves/ell_number_field.py @@ -19,8 +19,8 @@ EXAMPLES:: - sage: K. = NumberField(x^2+1) - sage: E = EllipticCurve([0,4+i]) + sage: K. = NumberField(x^2 + 1) + sage: E = EllipticCurve([0, 4+i]) sage: E.discriminant() -3456*i - 6480 sage: P= E([i,2]) @@ -34,7 +34,8 @@ sage: E.local_data(4+i) Local data at Fractional ideal (i + 4): Reduction type: bad additive - Local minimal model: Elliptic Curve defined by y^2 = x^3 + (i+4) over Number Field in i with defining polynomial x^2 + 1 + Local minimal model: Elliptic Curve defined by y^2 = x^3 + (i+4) + over Number Field in i with defining polynomial x^2 + 1 Minimal discriminant valuation: 2 Conductor exponent: 2 Kodaira Symbol: II @@ -55,7 +56,11 @@ :: sage: E.isogenies_prime_degree(3) - [Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + (i+4) over Number Field in i with defining polynomial x^2 + 1 to Elliptic Curve defined by y^2 = x^3 + (-27*i-108) over Number Field in i with defining polynomial x^2 + 1] + [Isogeny of degree 3 + from Elliptic Curve defined by y^2 = x^3 + (i+4) + over Number Field in i with defining polynomial x^2 + 1 + to Elliptic Curve defined by y^2 = x^3 + (-27*i-108) + over Number Field in i with defining polynomial x^2 + 1] AUTHORS: @@ -106,7 +111,9 @@ class EllipticCurve_number_field(EllipticCurve_field): sage: K. = NumberField(x^2+1) sage: EllipticCurve([i, i - 1, i + 1, 24*i + 15, 14*i + 35]) - Elliptic Curve defined by y^2 + i*x*y + (i+1)*y = x^3 + (i-1)*x^2 + (24*i+15)*x + (14*i+35) over Number Field in i with defining polynomial x^2 + 1 + Elliptic Curve defined by + y^2 + i*x*y + (i+1)*y = x^3 + (i-1)*x^2 + (24*i+15)*x + (14*i+35) + over Number Field in i with defining polynomial x^2 + 1 """ def __init__(self, K, ainvs): r""" @@ -116,12 +123,14 @@ def __init__(self, K, ainvs): sage: K. = NumberField(x^2+1) sage: EllipticCurve(K,'389a1') - Elliptic Curve defined by y^2 + y = x^3 + x^2 + (-2)*x over Number Field in i with defining polynomial x^2 + 1 + Elliptic Curve defined by y^2 + y = x^3 + x^2 + (-2)*x + over Number Field in i with defining polynomial x^2 + 1 Making the field of definition explicitly larger:: sage: EllipticCurve(K,[0,-1,1,0,0]) - Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 over Number Field in i with defining polynomial x^2 + 1 + Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + over Number Field in i with defining polynomial x^2 + 1 """ self._known_points = [] EllipticCurve_field.__init__(self, K, ainvs) @@ -137,7 +146,8 @@ def base_extend(self, R): sage: E = EllipticCurve('11a3') sage: K = QuadraticField(-5, 'a') sage: E.base_extend(K) - Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 over Number Field in a with defining polynomial x^2 + 5 with a = 2.236067977499790?*I + Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 over Number Field in a + with defining polynomial x^2 + 5 with a = 2.236067977499790?*I Check that non-torsion points are remembered when extending the base field (see :trac:`16034`):: @@ -226,7 +236,8 @@ def simon_two_descent(self, verbose=0, lim1=2, lim3=4, limtriv=2, sage: K. = NumberField(x^2 + 7, 'a') sage: E = EllipticCurve(K, [0,0,0,1,a]); E - Elliptic Curve defined by y^2 = x^3 + x + a over Number Field in a with defining polynomial x^2 + 7 + Elliptic Curve defined by y^2 = x^3 + x + a + over Number Field in a with defining polynomial x^2 + 7 sage: v = E.simon_two_descent(verbose=1); v elliptic curve: Y^2 = x^3 + Mod(1, y^2 + 7)*x + Mod(y, y^2 + 7) @@ -265,7 +276,7 @@ def simon_two_descent(self, verbose=0, lim1=2, lim3=4, limtriv=2, sage: R. = QQ[] sage: L. = NumberField(t^3 - 9*t^2 + 13*t - 4) - sage: E1 = EllipticCurve(L,[1-g*(g-1),-g^2*(g-1),-g^2*(g-1),0,0]) + sage: E1 = EllipticCurve(L, [1-g*(g-1), -g^2*(g-1), -g^2*(g-1), 0, 0]) sage: E1.rank() # long time (about 5 s) 0 @@ -341,7 +352,7 @@ def height_pairing_matrix(self, points=None, precision=None, normalised=True): sage: E = EllipticCurve('389a1') sage: E = EllipticCurve('389a1') - sage: P,Q = E.point([-1,1,1]),E.point([0,-1,1]) + sage: P, Q = E.point([-1,1,1]), E.point([0,-1,1]) sage: E.height_pairing_matrix([P,Q]) [0.686667083305587 0.268478098806726] [0.268478098806726 0.327000773651605] @@ -349,7 +360,7 @@ def height_pairing_matrix(self, points=None, precision=None, normalised=True): Over a number field:: sage: x = polygen(QQ) - sage: K. = NumberField(x^2+47) + sage: K. = NumberField(x^2 + 47) sage: EK = E.base_extend(K) sage: EK.height_pairing_matrix([EK(P),EK(Q)]) [0.686667083305587 0.268478098806726] @@ -359,7 +370,7 @@ def height_pairing_matrix(self, points=None, precision=None, normalised=True): sage: K. = QuadraticField(-1) sage: E = EllipticCurve([0,0,0,i,i]) - sage: P = E(-9+4*i,-18-25*i) + sage: P = E(-9+4*i, -18-25*i) sage: Q = E(i,-i) sage: E.height_pairing_matrix([P,Q]) [ 2.16941934493768 -0.870059380421505] @@ -430,7 +441,7 @@ def regulator_of_points(self, points=[], precision=None, normalised=True): sage: points = [E.lift_x(x) for x in [-2,-7/4,1]] sage: E.regulator_of_points(points) 0.417143558758384 - sage: E.regulator_of_points(points,precision=100) + sage: E.regulator_of_points(points, precision=100) 0.41714355875838396981711954462 :: @@ -438,7 +449,7 @@ def regulator_of_points(self, points=[], precision=None, normalised=True): sage: E = EllipticCurve('389a') sage: E.regulator_of_points() 1.00000000000000 - sage: points = [P,Q] = [E(-1,1),E(0,-1)] + sage: points = [P,Q] = [E(-1,1), E(0,-1)] sage: E.regulator_of_points(points) 0.152460177943144 sage: E.regulator_of_points(points, precision=100) @@ -451,7 +462,7 @@ def regulator_of_points(self, points=[], precision=None, normalised=True): Examples over number fields:: sage: K. = QuadraticField(97) - sage: E = EllipticCurve(K,[1,1]) + sage: E = EllipticCurve(K, [1,1]) sage: P = E(0,1) sage: P.height() 0.476223106404866 @@ -471,9 +482,9 @@ def regulator_of_points(self, points=[], precision=None, normalised=True): sage: E = EllipticCurve('11a1') sage: x = polygen(QQ) - sage: K. = NumberField(x^2+47) + sage: K. = NumberField(x^2 + 47) sage: EK = E.base_extend(K) - sage: T = EK(5,5) + sage: T = EK(5, 5) sage: T.order() 5 sage: P = EK(-2, -1/2*t - 1/2) @@ -490,7 +501,7 @@ def regulator_of_points(self, points=[], precision=None, normalised=True): sage: P,Q = E.gens() sage: E.regulator_of_points([P,Q]) 0.152460177943144 - sage: K. = NumberField(x^2+47) + sage: K. = NumberField(x^2 + 47) sage: EK = E.base_extend(K) sage: EK.regulator_of_points([EK(P),EK(Q)]) 0.152460177943144 @@ -499,8 +510,8 @@ def regulator_of_points(self, points=[], precision=None, normalised=True): sage: K. = QuadraticField(-1) sage: E = EllipticCurve([0,0,0,i,i]) - sage: P = E(-9+4*i,-18-25*i) - sage: Q = E(i,-i) + sage: P = E(-9+4*i, -18-25*i) + sage: Q = E(i, -i) sage: E.height_pairing_matrix([P,Q]) [ 2.16941934493768 -0.870059380421505] [-0.870059380421505 0.424585837470709] @@ -523,13 +534,13 @@ def is_local_integral_model(self, *P): EXAMPLES:: - sage: K. = NumberField(x^2+1) - sage: P1,P2 = K.primes_above(5) + sage: K. = NumberField(x^2 + 1) + sage: P1, P2 = K.primes_above(5) sage: E = EllipticCurve([i/5,i/5,i/5,i/5,i/5]) - sage: E.is_local_integral_model(P1,P2) + sage: E.is_local_integral_model(P1, P2) False - sage: Emin = E.local_integral_model(P1,P2) - sage: Emin.is_local_integral_model(P1,P2) + sage: Emin = E.local_integral_model(P1, P2) + sage: Emin.is_local_integral_model(P1, P2) True """ if len(P) == 1: @@ -540,8 +551,7 @@ def is_local_integral_model(self, *P): def local_integral_model(self,*P): r""" - Return a model of self which is integral at the prime ideal - `P`. + Return a model of self which is integral at the prime ideal `P`. .. NOTE:: @@ -554,11 +564,13 @@ def local_integral_model(self,*P): EXAMPLES:: - sage: K. = NumberField(x^2+1) - sage: P1,P2 = K.primes_above(5) + sage: K. = NumberField(x^2 + 1) + sage: P1, P2 = K.primes_above(5) sage: E = EllipticCurve([i/5,i/5,i/5,i/5,i/5]) sage: E.local_integral_model((P1,P2)) - Elliptic Curve defined by y^2 + (-i)*x*y + (-25*i)*y = x^3 + 5*i*x^2 + 125*i*x + 3125*i over Number Field in i with defining polynomial x^2 + 1 + Elliptic Curve defined by + y^2 + (-i)*x*y + (-25*i)*y = x^3 + 5*i*x^2 + 125*i*x + 3125*i + over Number Field in i with defining polynomial x^2 + 1 """ if len(P) == 1: P = P[0] @@ -579,9 +591,9 @@ def is_global_integral_model(self): EXAMPLES:: - sage: K. = NumberField(x^2+1) + sage: K. = NumberField(x^2 + 1) sage: E = EllipticCurve([i/5,i/5,i/5,i/5,i/5]) - sage: P1,P2 = K.primes_above(5) + sage: P1, P2 = K.primes_above(5) sage: Emin = E.global_integral_model() sage: Emin.is_global_integral_model() True @@ -594,33 +606,39 @@ def global_integral_model(self): EXAMPLES:: - sage: K. = NumberField(x^2+1) + sage: K. = NumberField(x^2 + 1) sage: E = EllipticCurve([i/5,i/5,i/5,i/5,i/5]) - sage: P1,P2 = K.primes_above(5) + sage: P1, P2 = K.primes_above(5) sage: E.global_integral_model() - Elliptic Curve defined by y^2 + (-i)*x*y + (-25*i)*y = x^3 + 5*i*x^2 + 125*i*x + 3125*i over Number Field in i with defining polynomial x^2 + 1 + Elliptic Curve defined by + y^2 + (-i)*x*y + (-25*i)*y = x^3 + 5*i*x^2 + 125*i*x + 3125*i + over Number Field in i with defining polynomial x^2 + 1 :trac:`7935`:: - sage: K. = NumberField(x^2-38) + sage: K. = NumberField(x^2 - 38) sage: E = EllipticCurve([a,1/2]) sage: E.global_integral_model() - Elliptic Curve defined by y^2 = x^3 + 1444*a*x + 27436 over Number Field in a with defining polynomial x^2 - 38 + Elliptic Curve defined by y^2 = x^3 + 1444*a*x + 27436 + over Number Field in a with defining polynomial x^2 - 38 :trac:`9266`:: - sage: K. = NumberField(x^2-5) + sage: K. = NumberField(x^2 - 5) sage: w = (1+s)/2 - sage: E = EllipticCurve(K,[2,w]) + sage: E = EllipticCurve(K, [2,w]) sage: E.global_integral_model() - Elliptic Curve defined by y^2 = x^3 + 2*x + (1/2*s+1/2) over Number Field in s with defining polynomial x^2 - 5 + Elliptic Curve defined by y^2 = x^3 + 2*x + (1/2*s+1/2) + over Number Field in s with defining polynomial x^2 - 5 :trac:`12151`:: sage: K. = NumberField(x^2 + 161*x - 150) sage: E = EllipticCurve([25105/216*v - 3839/36, 634768555/7776*v - 98002625/1296, 634768555/7776*v - 98002625/1296, 0, 0]) sage: M = E.global_integral_model(); M # choice varies, not tested - Elliptic Curve defined by y^2 + (2094779518028859*v-1940492905300351)*x*y + (477997268472544193101178234454165304071127500*v-442791377441346852919930773849502871958097500)*y = x^3 + (26519784690047674853185542622500*v-24566525306469707225840460652500)*x^2 over Number Field in v with defining polynomial x^2 + 161*x - 150 + Elliptic Curve defined by + y^2 + (2094779518028859*v-1940492905300351)*x*y + (477997268472544193101178234454165304071127500*v-442791377441346852919930773849502871958097500)*y = x^3 + (26519784690047674853185542622500*v-24566525306469707225840460652500)*x^2 + over Number Field in v with defining polynomial x^2 + 161*x - 150 :trac:`14476`:: @@ -628,7 +646,9 @@ def global_integral_model(self): sage: K. = NumberField(t^4 - t^3 - 3*t^2 - t + 1) sage: E = EllipticCurve([ -43/625*g^3 + 14/625*g^2 - 4/625*g + 706/625, -4862/78125*g^3 - 4074/78125*g^2 - 711/78125*g + 10304/78125, -4862/78125*g^3 - 4074/78125*g^2 - 711/78125*g + 10304/78125, 0,0]) sage: E.global_integral_model() - Elliptic Curve defined by y^2 + (15*g^3-48*g-42)*x*y + (-111510*g^3-162162*g^2-44145*g+37638)*y = x^3 + (-954*g^3-1134*g^2+81*g+576)*x^2 over Number Field in g with defining polynomial t^4 - t^3 - 3*t^2 - t + 1 + Elliptic Curve defined by + y^2 + (15*g^3-48*g-42)*x*y + (-111510*g^3-162162*g^2-44145*g+37638)*y = x^3 + (-954*g^3-1134*g^2+81*g+576)*x^2 + over Number Field in g with defining polynomial t^4 - t^3 - 3*t^2 - t + 1 TESTS: @@ -694,10 +714,10 @@ def _reduce_model(self): 8456608930180227786550494643437985949781*a - 52130038506835491453281450568107193773505) sage: E._reduce_model().ainvs() (a, - a + 1, - a + 1, - 368258520200522046806318444*a - 2270097978636731786720859345, - 8456608930173478039472018047583706316424*a - 52130038506793883217874390501829588391299) + a + 1, + a + 1, + 368258520200522046806318444*a - 2270097978636731786720859345, + 8456608930173478039472018047583706316424*a - 52130038506793883217874390501829588391299) sage: EllipticCurve([101,202,303,404,505])._reduce_model().ainvs() (1, 1, 0, -2509254, 1528863051) sage: EllipticCurve([-101,-202,-303,-404,-505])._reduce_model().ainvs() @@ -855,51 +875,56 @@ def local_data(self, P=None, proof=None, algorithm="pari", globally=False): EXAMPLES:: - sage: K. = NumberField(x^2+1) + sage: K. = NumberField(x^2 + 1) sage: E = EllipticCurve([1 + i, 0, 1, 0, 0]) sage: E.local_data() [Local data at Fractional ideal (2*i + 1): - Reduction type: bad non-split multiplicative - Local minimal model: Elliptic Curve defined by y^2 + (i+1)*x*y + y = x^3 over Number Field in i with defining polynomial x^2 + 1 - Minimal discriminant valuation: 1 - Conductor exponent: 1 - Kodaira Symbol: I1 - Tamagawa Number: 1, - Local data at Fractional ideal (-2*i + 3): - Reduction type: bad split multiplicative - Local minimal model: Elliptic Curve defined by y^2 + (i+1)*x*y + y = x^3 over Number Field in i with defining polynomial x^2 + 1 - Minimal discriminant valuation: 2 - Conductor exponent: 1 - Kodaira Symbol: I2 - Tamagawa Number: 2] + Reduction type: bad non-split multiplicative + Local minimal model: Elliptic Curve defined by y^2 + (i+1)*x*y + y = x^3 + over Number Field in i with defining polynomial x^2 + 1 + Minimal discriminant valuation: 1 + Conductor exponent: 1 + Kodaira Symbol: I1 + Tamagawa Number: 1, + Local data at Fractional ideal (-2*i + 3): + Reduction type: bad split multiplicative + Local minimal model: Elliptic Curve defined by y^2 + (i+1)*x*y + y = x^3 + over Number Field in i with defining polynomial x^2 + 1 + Minimal discriminant valuation: 2 + Conductor exponent: 1 + Kodaira Symbol: I2 + Tamagawa Number: 2] sage: E.local_data(K.ideal(3)) Local data at Fractional ideal (3): - Reduction type: good - Local minimal model: Elliptic Curve defined by y^2 + (i+1)*x*y + y = x^3 over Number Field in i with defining polynomial x^2 + 1 - Minimal discriminant valuation: 0 - Conductor exponent: 0 - Kodaira Symbol: I0 - Tamagawa Number: 1 + Reduction type: good + Local minimal model: Elliptic Curve defined by y^2 + (i+1)*x*y + y = x^3 + over Number Field in i with defining polynomial x^2 + 1 + Minimal discriminant valuation: 0 + Conductor exponent: 0 + Kodaira Symbol: I0 + Tamagawa Number: 1 sage: E.local_data(2*i + 1) Local data at Fractional ideal (2*i + 1): - Reduction type: bad non-split multiplicative - Local minimal model: Elliptic Curve defined by y^2 + (i+1)*x*y + y = x^3 over Number Field in i with defining polynomial x^2 + 1 - Minimal discriminant valuation: 1 - Conductor exponent: 1 - Kodaira Symbol: I1 - Tamagawa Number: 1 + Reduction type: bad non-split multiplicative + Local minimal model: Elliptic Curve defined by y^2 + (i+1)*x*y + y = x^3 + over Number Field in i with defining polynomial x^2 + 1 + Minimal discriminant valuation: 1 + Conductor exponent: 1 + Kodaira Symbol: I1 + Tamagawa Number: 1 An example raised in :trac:`3897`:: sage: E = EllipticCurve([1,1]) sage: E.local_data(3) Local data at Principal ideal (3) of Integer Ring: - Reduction type: good - Local minimal model: Elliptic Curve defined by y^2 = x^3 + x + 1 over Rational Field - Minimal discriminant valuation: 0 - Conductor exponent: 0 - Kodaira Symbol: I0 - Tamagawa Number: 1 + Reduction type: good + Local minimal model: Elliptic Curve defined by y^2 = x^3 + x + 1 + over Rational Field + Minimal discriminant valuation: 0 + Conductor exponent: 0 + Kodaira Symbol: I0 + Tamagawa Number: 1 """ if proof is None: import sage.structure.proof.proof @@ -947,17 +972,19 @@ def _get_local_data(self, P, proof, algorithm="pari", globally=False): EXAMPLES:: - sage: K. = NumberField(x^2+1) - sage: E = EllipticCurve(K,[0,1,0,-160,308]) - sage: p = K.ideal(i+1) + sage: K. = NumberField(x^2 + 1) + sage: E = EllipticCurve(K, [0,1,0,-160,308]) + sage: p = K.ideal(i + 1) sage: E._get_local_data(p, False) Local data at Fractional ideal (i + 1): - Reduction type: good - Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 + (-10)*x + (-10) over Number Field in i with defining polynomial x^2 + 1 - Minimal discriminant valuation: 0 - Conductor exponent: 0 - Kodaira Symbol: I0 - Tamagawa Number: 1 + Reduction type: good + Local minimal model: Elliptic Curve defined by + y^2 + x*y + y = x^3 + x^2 + (-10)*x + (-10) + over Number Field in i with defining polynomial x^2 + 1 + Minimal discriminant valuation: 0 + Conductor exponent: 0 + Kodaira Symbol: I0 + Tamagawa Number: 1 Verify that we cache based on the proof value and the algorithm choice:: @@ -1012,7 +1039,7 @@ def local_minimal_model(self, P, proof=None, algorithm="pari"): EXAMPLES:: - sage: K. = NumberField(x^2-5) + sage: K. = NumberField(x^2 - 5) sage: E = EllipticCurve([20, 225, 750, 1250*a + 6250, 62500*a + 15625]) sage: P = K.ideal(a) sage: E.local_minimal_model(P).ainvs() @@ -1050,12 +1077,12 @@ def has_good_reduction(self, P): sage: [(p,E.has_good_reduction(p)) for p in prime_range(15)] [(2, False), (3, True), (5, True), (7, False), (11, True), (13, True)] - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] sage: E = EllipticCurve([0,0,0,0,2*a+1]) - sage: [(p,E.has_good_reduction(p)) for p in [P17a,P17b]] + sage: [(p, E.has_good_reduction(p)) for p in [P17a,P17b]] [(Fractional ideal (4*a^2 - 2*a + 1), True), - (Fractional ideal (2*a + 1), False)] + (Fractional ideal (2*a + 1), False)] """ return self.local_data(P).has_good_reduction() @@ -1084,12 +1111,12 @@ def has_bad_reduction(self, P): sage: [(p,E.has_bad_reduction(p)) for p in prime_range(15)] [(2, True), (3, False), (5, False), (7, True), (11, False), (13, False)] - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] sage: E = EllipticCurve([0,0,0,0,2*a+1]) - sage: [(p,E.has_bad_reduction(p)) for p in [P17a,P17b]] + sage: [(p, E.has_bad_reduction(p)) for p in [P17a,P17b]] [(Fractional ideal (4*a^2 - 2*a + 1), False), - (Fractional ideal (2*a + 1), True)] + (Fractional ideal (2*a + 1), True)] """ return self.local_data(P).has_bad_reduction() @@ -1105,7 +1132,7 @@ def has_multiplicative_reduction(self, P): INPUT: - ``P`` -- a prime ideal of the base field of self, or a field - element generating such an ideal. + element generating such an ideal. OUTPUT: @@ -1115,14 +1142,15 @@ def has_multiplicative_reduction(self, P): EXAMPLES:: sage: E = EllipticCurve('14a1') - sage: [(p,E.has_multiplicative_reduction(p)) for p in prime_range(15)] + sage: [(p, E.has_multiplicative_reduction(p)) for p in prime_range(15)] [(2, True), (3, False), (5, False), (7, True), (11, False), (13, False)] - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] sage: E = EllipticCurve([0,0,0,0,2*a+1]) sage: [(p,E.has_multiplicative_reduction(p)) for p in [P17a,P17b]] - [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)] + [(Fractional ideal (4*a^2 - 2*a + 1), False), + (Fractional ideal (2*a + 1), False)] """ return self.local_data(P).has_multiplicative_reduction() @@ -1146,11 +1174,12 @@ def has_split_multiplicative_reduction(self, P): sage: [(p,E.has_split_multiplicative_reduction(p)) for p in prime_range(15)] [(2, False), (3, False), (5, False), (7, True), (11, False), (13, False)] - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] sage: E = EllipticCurve([0,0,0,0,2*a+1]) sage: [(p,E.has_split_multiplicative_reduction(p)) for p in [P17a,P17b]] - [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)] + [(Fractional ideal (4*a^2 - 2*a + 1), False), + (Fractional ideal (2*a + 1), False)] """ return self.local_data(P).has_split_multiplicative_reduction() @@ -1174,11 +1203,12 @@ def has_nonsplit_multiplicative_reduction(self, P): sage: [(p,E.has_nonsplit_multiplicative_reduction(p)) for p in prime_range(15)] [(2, True), (3, False), (5, False), (7, False), (11, False), (13, False)] - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] sage: E = EllipticCurve([0,0,0,0,2*a+1]) - sage: [(p,E.has_nonsplit_multiplicative_reduction(p)) for p in [P17a,P17b]] - [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)] + sage: [(p, E.has_nonsplit_multiplicative_reduction(p)) for p in [P17a,P17b]] + [(Fractional ideal (4*a^2 - 2*a + 1), False), + (Fractional ideal (2*a + 1), False)] """ return self.local_data(P).has_nonsplit_multiplicative_reduction() @@ -1201,12 +1231,12 @@ def has_additive_reduction(self, P): sage: [(p,E.has_additive_reduction(p)) for p in prime_range(15)] [(2, False), (3, True), (5, False), (7, False), (11, False), (13, False)] - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] sage: E = EllipticCurve([0,0,0,0,2*a+1]) sage: [(p,E.has_additive_reduction(p)) for p in [P17a,P17b]] [(Fractional ideal (4*a^2 - 2*a + 1), False), - (Fractional ideal (2*a + 1), True)] + (Fractional ideal (2*a + 1), True)] """ return self.local_data(P).has_additive_reduction() @@ -1257,7 +1287,7 @@ def tamagawa_numbers(self): [2, 3, 1] sage: vector(e.tamagawa_numbers()) (2, 3, 1) - sage: K. = NumberField(x^2+3) + sage: K. = NumberField(x^2 + 3) sage: eK = e.base_extend(K) sage: eK.tamagawa_numbers() [4, 6, 1] @@ -1284,7 +1314,7 @@ def tamagawa_exponent(self, P, proof=None): EXAMPLES:: - sage: K. = NumberField(x^2-5) + sage: K. = NumberField(x^2 - 5) sage: E = EllipticCurve([20, 225, 750, 625*a + 6875, 31250*a + 46875]) sage: [E.tamagawa_exponent(P) for P in E.discriminant().support()] [1, 1, 1, 1] @@ -1316,12 +1346,12 @@ def tamagawa_product(self): EXAMPLES:: - sage: K. = NumberField(x^2+1) - sage: E = EllipticCurve([0,2+i]) + sage: K. = NumberField(x^2 + 1) + sage: E = EllipticCurve([0, 2+i]) sage: E.tamagawa_product() 1 - sage: E = EllipticCurve([(2*i+1)^2,i*(2*i+1)^7]) + sage: E = EllipticCurve([(2*i+1)^2, i*(2*i+1)^7]) sage: E.tamagawa_product() 4 @@ -1371,19 +1401,19 @@ def tamagawa_product_bsd(self): EXAMPLES:: - sage: K. = NumberField(x^2+1) - sage: E = EllipticCurve([0,2+i]) + sage: K. = NumberField(x^2 + 1) + sage: E = EllipticCurve([0, 2+i]) sage: E.tamagawa_product_bsd() 1 - sage: E = EllipticCurve([(2*i+1)^2,i*(2*i+1)^7]) + sage: E = EllipticCurve([(2*i+1)^2, i*(2*i+1)^7]) sage: E.tamagawa_product_bsd() 4 An example where the Neron model changes over K:: - sage: K. = NumberField(x^5-10*x^3+5*x^2+10*x+1) - sage: E = EllipticCurve(K,'75a1') + sage: K. = NumberField(x^5 - 10*x^3 + 5*x^2 + 10*x + 1) + sage: E = EllipticCurve(K, '75a1') sage: E.tamagawa_product_bsd() 5 sage: da = E.local_data() @@ -1430,14 +1460,15 @@ def kodaira_symbol(self, P, proof=None): OUTPUT: - The Kodaira Symbol of the curve at P, represented as a string. + The Kodaira Symbol of the curve at ``P``, represented as a string. EXAMPLES:: - sage: K. = NumberField(x^2-5) + sage: K. = NumberField(x^2 - 5) sage: E = EllipticCurve([20, 225, 750, 625*a + 6875, 31250*a + 46875]) sage: bad_primes = E.discriminant().support(); bad_primes - [Fractional ideal (-a), Fractional ideal (7/2*a - 81/2), Fractional ideal (-a - 52), Fractional ideal (2)] + [Fractional ideal (-a), Fractional ideal (7/2*a - 81/2), + Fractional ideal (-a - 52), Fractional ideal (2)] sage: [E.kodaira_symbol(P) for P in bad_primes] [I0, I1, I1, II] sage: K. = QuadraticField(-11) @@ -1463,32 +1494,32 @@ def conductor(self): EXAMPLES:: - sage: K. = NumberField(x^2+1) + sage: K. = NumberField(x^2 + 1) sage: EllipticCurve([i, i - 1, i + 1, 24*i + 15, 14*i + 35]).conductor() Fractional ideal (21*i - 3) - sage: K. = NumberField(x^2-x+3) - sage: EllipticCurve([1 + a , -1 + a , 1 + a , -11 + a , 5 -9*a ]).conductor() + sage: K. = NumberField(x^2 - x + 3) + sage: EllipticCurve([1 + a, -1 + a, 1 + a, -11 + a, 5 - 9*a]).conductor() Fractional ideal (-6*a) A not so well known curve with everywhere good reduction:: - sage: K. = NumberField(x^2-38) + sage: K. = NumberField(x^2 - 38) sage: E = EllipticCurve([0,0,0, 21796814856932765568243810*a - 134364590724198567128296995, 121774567239345229314269094644186997594*a - 750668847495706904791115375024037711300]) sage: E.conductor() Fractional ideal (1) An example which used to fail (see :trac:`5307`):: - sage: K. = NumberField(x^2+x+6) - sage: E = EllipticCurve([w,-1,0,-w-6,0]) + sage: K. = NumberField(x^2 + x + 6) + sage: E = EllipticCurve([w, -1, 0, -w-6, 0]) sage: E.conductor() Fractional ideal (86304, w + 5898) An example raised in :trac:`11346`:: sage: K. = NumberField(x^2 - x - 1) - sage: E1 = EllipticCurve(K,[0,0,0,-1/48,-161/864]) - sage: [(p.smallest_integer(),e) for p,e in E1.conductor().factor()] + sage: E1 = EllipticCurve(K, [0, 0, 0, -1/48, -161/864]) + sage: [(p.smallest_integer(), e) for p,e in E1.conductor().factor()] [(2, 4), (3, 1), (5, 1)] """ try: @@ -1520,10 +1551,10 @@ def minimal_discriminant_ideal(self): EXAMPLES:: - sage: K. = NumberField(x^2-x-57) + sage: K. = NumberField(x^2 - x - 57) sage: K.class_number() 3 - sage: E = EllipticCurve([a,-a,a,-5692-820*a,-259213-36720*a]) + sage: E = EllipticCurve([a, -a, a, -5692-820*a, -259213-36720*a]) sage: K.ideal(E.discriminant()) Fractional ideal (90118662980*a + 636812084644) sage: K.ideal(E.discriminant()).factor() @@ -1541,8 +1572,8 @@ def minimal_discriminant_ideal(self): If (and only if) the curve has everywhere good reduction the result is the unit ideal:: - sage: K. = NumberField(x^2-26) - sage: E = EllipticCurve([a,a-1,a+1,4*a+10,2*a+6]) + sage: K. = NumberField(x^2 - 26) + sage: E = EllipticCurve([a, a-1, a+1, 4*a+10, 2*a+6]) sage: E.conductor() Fractional ideal (1) sage: E.discriminant() @@ -1576,7 +1607,7 @@ def non_minimal_primes(self): EXAMPLES:: - sage: K. = NumberField(x^2-10) + sage: K. = NumberField(x^2 - 10) sage: E = EllipticCurve([0, 0, 0, -22500, 750000*a]) sage: E.non_minimal_primes() [Fractional ideal (2, a), Fractional ideal (5, a)] @@ -1587,7 +1618,7 @@ def non_minimal_primes(self): Over `\QQ`, the primes returned are integers, not ideals:: - sage: E = EllipticCurve([0,0,0,-3024,46224]) + sage: E = EllipticCurve([0, 0, 0, -3024, 46224]) sage: E.non_minimal_primes() [2, 3] sage: Emin = E.global_minimal_model() @@ -1597,7 +1628,7 @@ def non_minimal_primes(self): If the model is not globally integral, a ``ValueError`` is raised:: - sage: E = EllipticCurve([0,0,0,1/2,1/3]) + sage: E = EllipticCurve([0, 0, 0, 1/2, 1/3]) sage: E.non_minimal_primes() Traceback (most recent call last): ... @@ -1624,14 +1655,14 @@ def is_global_minimal_model(self): EXAMPLES:: - sage: K. = NumberField(x^2-10) + sage: K. = NumberField(x^2 - 10) sage: E = EllipticCurve([0, 0, 0, -22500, 750000*a]) sage: E.is_global_minimal_model() False sage: E.non_minimal_primes() [Fractional ideal (2, a), Fractional ideal (5, a)] - sage: E = EllipticCurve([0,0,0,-3024,46224]) + sage: E = EllipticCurve([0, 0, 0, -3024, 46224]) sage: E.is_global_minimal_model() False sage: E.non_minimal_primes() @@ -1671,7 +1702,7 @@ def global_minimality_class(self): A curve defined over a field of class number 2 with no global minimal model was a nontrivial minimality class:: - sage: K. = NumberField(x^2-10) + sage: K. = NumberField(x^2 - 10) sage: K.class_number() 2 sage: E = EllipticCurve([0, 0, 0, -22500, 750000*a]) @@ -1684,8 +1715,8 @@ def global_minimality_class(self): has trivial class, showing that a global minimal model does exist:: - sage: K. = NumberField(x^2-10) - sage: E = EllipticCurve([0,0,0,4536*a+14148,-163728*a- 474336]) + sage: K. = NumberField(x^2 - 10) + sage: E = EllipticCurve([0, 0, 0, 4536*a+14148, -163728*a-474336]) sage: E.is_global_minimal_model() False sage: E.global_minimality_class() @@ -1694,7 +1725,7 @@ def global_minimality_class(self): Over a field of class number 1 the result is always the trivial class:: - sage: K. = NumberField(x^2-5) + sage: K. = NumberField(x^2 - 5) sage: E = EllipticCurve([0, 0, 0, K(16), K(64)]) sage: E.global_minimality_class() Trivial principal fractional ideal class @@ -1728,8 +1759,8 @@ def has_global_minimal_model(self): EXAMPLES:: - sage: K. = NumberField(x^2-10) - sage: E = EllipticCurve([0,0,0,4536*a+14148,-163728*a-474336]) + sage: K. = NumberField(x^2 - 10) + sage: E = EllipticCurve([0, 0, 0, 4536*a+14148, -163728*a-474336]) sage: E.is_global_minimal_model() False sage: E.has_global_minimal_model() @@ -1768,41 +1799,46 @@ def global_minimal_model(self, proof=None, semi_global=False): EXAMPLES:: - sage: K. = NumberField(x^2-38) + sage: K. = NumberField(x^2 - 38) sage: E = EllipticCurve([0,0,0, 21796814856932765568243810*a - 134364590724198567128296995, 121774567239345229314269094644186997594*a - 750668847495706904791115375024037711300]) sage: E2 = E.global_minimal_model() sage: E2 - Elliptic Curve defined by y^2 + a*x*y + (a+1)*y = x^3 + (a+1)*x^2 + (4*a+15)*x + (4*a+21) over Number Field in a with defining polynomial x^2 - 38 + Elliptic Curve defined by + y^2 + a*x*y + (a+1)*y = x^3 + (a+1)*x^2 + (4*a+15)*x + (4*a+21) + over Number Field in a with defining polynomial x^2 - 38 sage: E2.local_data() [] See :trac:`11347`:: sage: K. = NumberField(x^2 - x - 1) - sage: E = EllipticCurve(K,[0,0,0,-1/48,161/864]).integral_model().global_minimal_model(); E - Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 over Number Field in g with defining polynomial x^2 - x - 1 - sage: [(p.norm(), e) for p, e in E.conductor().factor()] + sage: E = EllipticCurve(K, [0, 0, 0, -1/48, 161/864]) + sage: E2 = E.integral_model().global_minimal_model(); E2 + Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 + over Number Field in g with defining polynomial x^2 - x - 1 + sage: [(p.norm(), e) for p, e in E2.conductor().factor()] [(9, 1), (5, 1)] - sage: [(p.norm(), e) for p, e in E.discriminant().factor()] + sage: [(p.norm(), e) for p, e in E2.discriminant().factor()] [(-5, 2), (9, 1)] See :trac:`14472`, this used not to work over a relative extension:: - sage: K1. = NumberField(x^2+x+1) + sage: K1. = NumberField(x^2 + x + 1) sage: m = polygen(K1) - sage: K2. = K1.extension(m^2-w+1) - sage: E = EllipticCurve([0*v,-432]) + sage: K2. = K1.extension(m^2 - w + 1) + sage: E = EllipticCurve([0*v, -432]) sage: E.global_minimal_model() - Elliptic Curve defined by y^2 + y = x^3 over Number Field in v with defining polynomial x^2 - w + 1 over its base field + Elliptic Curve defined by y^2 + y = x^3 + over Number Field in v with defining polynomial x^2 - w + 1 over its base field See :trac:`18662`: for fields of class number greater than 1, even when global minimal models did exist, their computation was not implemented. Now it is:: - sage: K. = NumberField(x^2-10) + sage: K. = NumberField(x^2 - 10) sage: K.class_number() 2 - sage: E = EllipticCurve([0,0,0,-186408*a - 589491, 78055704*a + 246833838]) + sage: E = EllipticCurve([0, 0, 0, -186408*a - 589491, 78055704*a + 246833838]) sage: E.discriminant().norm() 16375845905239507992576 sage: E.discriminant().norm().factor() @@ -1810,7 +1846,9 @@ def global_minimal_model(self, proof=None, semi_global=False): sage: E.has_global_minimal_model() True sage: Emin = E.global_minimal_model(); Emin - Elliptic Curve defined by y^2 + (a+1)*x*y + (a+1)*y = x^3 + (-a)*x^2 + (a-12)*x + (-2*a+2) over Number Field in a with defining polynomial x^2 - 10 + Elliptic Curve defined by + y^2 + (a+1)*x*y + (a+1)*y = x^3 + (-a)*x^2 + (a-12)*x + (-2*a+2) + over Number Field in a with defining polynomial x^2 - 10 sage: Emin.discriminant().norm() 3456 sage: Emin.discriminant().norm().factor() @@ -1819,23 +1857,28 @@ def global_minimal_model(self, proof=None, semi_global=False): If there is no global minimal model, this method will raise an error unless you set the parameter ``semi_global`` to ``True``:: - sage: K. = NumberField(x^2-10) + sage: K. = NumberField(x^2 - 10) sage: K.class_number() 2 - sage: E = EllipticCurve([a,a,0,3*a+8,4*a+3]) + sage: E = EllipticCurve([a, a, 0, 3*a+8, 4*a+3]) sage: E.has_global_minimal_model() False sage: E.global_minimal_model() Traceback (most recent call last): ... - ValueError: Elliptic Curve defined by y^2 + a*x*y = x^3 + a*x^2 + (3*a+8)*x + (4*a+3) over Number Field in a with defining polynomial x^2 - 10 has no global minimal model! For a semi-global minimal model use semi_global=True + ValueError: Elliptic Curve defined by + y^2 + a*x*y = x^3 + a*x^2 + (3*a+8)*x + (4*a+3) over Number Field + in a with defining polynomial x^2 - 10 has no global minimal model! + For a semi-global minimal model use semi_global=True sage: E.global_minimal_model(semi_global=True) - Elliptic Curve defined by y^2 + a*x*y = x^3 + a*x^2 + (3*a+8)*x + (4*a+3) over Number Field in a with defining polynomial x^2 - 10 + Elliptic Curve defined by + y^2 + a*x*y = x^3 + a*x^2 + (3*a+8)*x + (4*a+3) over Number Field in a + with defining polynomial x^2 - 10 An example of a curve with everywhere good reduction but which has no model with unit discriminant:: - sage: K. = NumberField(x^2-x-16) + sage: K. = NumberField(x^2 - x - 16) sage: K.class_number() 2 sage: E = EllipticCurve([0,0,0,-15221331*a - 53748576, -79617688290*a - 281140318368]) @@ -1883,10 +1926,11 @@ def reduction(self,place): EXAMPLES:: sage: K. = QuadraticField(-1) - sage: EK = EllipticCurve([0,0,0,i,i+3]) + sage: EK = EllipticCurve([0, 0, 0, i, i+3]) sage: v = K.fractional_ideal(2*i+3) sage: EK.reduction(v) - Elliptic Curve defined by y^2 = x^3 + 5*x + 8 over Residue field of Fractional ideal (2*i + 3) + Elliptic Curve defined by y^2 = x^3 + 5*x + 8 + over Residue field of Fractional ideal (2*i + 3) sage: EK.reduction(K.ideal(1+i)) Traceback (most recent call last): ... @@ -1895,10 +1939,11 @@ def reduction(self,place): Traceback (most recent call last): ... ValueError: The ideal must be prime. - sage: K=QQ.extension(x^2+x+1,"a") - sage: E = EllipticCurve([1024*K.0,1024*K.0]) + sage: K = QQ.extension(x^2 + x + 1, "a") + sage: E = EllipticCurve([1024*K.0, 1024*K.0]) sage: E.reduction(2*K) - Elliptic Curve defined by y^2 + (abar+1)*y = x^3 over Residue field in abar of Fractional ideal (2) + Elliptic Curve defined by y^2 + (abar+1)*y = x^3 + over Residue field in abar of Fractional ideal (2) """ K = self.base_field() OK = K.ring_of_integers() @@ -1923,10 +1968,7 @@ def torsion_subgroup(self): r""" Return the torsion subgroup of this elliptic curve. - OUTPUT: - - (``EllipticCurveTorsionSubgroup``) The - ``EllipticCurveTorsionSubgroup`` associated to this elliptic + OUTPUT: The :class:`EllipticCurveTorsionSubgroup` associated to this elliptic curve. EXAMPLES:: @@ -1936,7 +1978,9 @@ def torsion_subgroup(self): sage: EK = E.base_extend(K) sage: tor = EK.torsion_subgroup() # long time (2s on sage.math, 2014) sage: tor # long time - Torsion Subgroup isomorphic to Z/5 + Z/5 associated to the Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in t with defining polynomial x^4 + x^3 + 11*x^2 + 41*x + 101 + Torsion Subgroup isomorphic to Z/5 + Z/5 associated to the Elliptic Curve + defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field + in t with defining polynomial x^4 + x^3 + 11*x^2 + 41*x + 101 sage: tor.gens() # long time ((16 : 60 : 1), (t : 1/11*t^3 + 6/11*t^2 + 19/11*t + 48/11 : 1)) @@ -1946,7 +1990,9 @@ def torsion_subgroup(self): sage: K. = NumberField(x^2 + 2*x + 10) sage: EK = E.base_extend(K) sage: EK.torsion_subgroup() - Torsion Subgroup isomorphic to Z/4 + Z/4 associated to the Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 + (-10)*x + (-10) over Number Field in t with defining polynomial x^2 + 2*x + 10 + Torsion Subgroup isomorphic to Z/4 + Z/4 associated to the + Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 + (-10)*x + (-10) + over Number Field in t with defining polynomial x^2 + 2*x + 10 :: @@ -1954,14 +2000,18 @@ def torsion_subgroup(self): sage: K. = NumberField(x^9-3*x^8-4*x^7+16*x^6-3*x^5-21*x^4+5*x^3+7*x^2-7*x+1) sage: EK = E.base_extend(K) sage: EK.torsion_subgroup() - Torsion Subgroup isomorphic to Z/9 associated to the Elliptic Curve defined by y^2 + y = x^3 + x^2 + (-9)*x + (-15) over Number Field in t with defining polynomial x^9 - 3*x^8 - 4*x^7 + 16*x^6 - 3*x^5 - 21*x^4 + 5*x^3 + 7*x^2 - 7*x + 1 + Torsion Subgroup isomorphic to Z/9 associated to the Elliptic Curve defined + by y^2 + y = x^3 + x^2 + (-9)*x + (-15) over Number Field in t with defining + polynomial x^9 - 3*x^8 - 4*x^7 + 16*x^6 - 3*x^5 - 21*x^4 + 5*x^3 + 7*x^2 - 7*x + 1 :: sage: K. = QuadraticField(-1) - sage: EK = EllipticCurve([0,0,0,i,i+3]) + sage: EK = EllipticCurve([0, 0, 0, i, i+3]) sage: EK.torsion_subgroup () - Torsion Subgroup isomorphic to Trivial group associated to the Elliptic Curve defined by y^2 = x^3 + i*x + (i+3) over Number Field in i with defining polynomial x^2 + 1 with i = 1*I + Torsion Subgroup isomorphic to Trivial group associated to the + Elliptic Curve defined by y^2 = x^3 + i*x + (i+3) + over Number Field in i with defining polynomial x^2 + 1 with i = 1*I .. SEEALSO:: @@ -2081,8 +2131,8 @@ def torsion_points(self): :: sage: K. = QuadraticField(-1) - sage: EK = EllipticCurve(K,[0,0,0,0,-1]) - sage: EK.torsion_points () + sage: EK = EllipticCurve(K, [0,0,0,0,-1]) + sage: EK.torsion_points() [(-2 : -3*i : 1), (-2 : 3*i : 1), (0 : -i : 1), (0 : i : 1), (0 : 1 : 0), (1 : 0 : 1)] """ T = self.torsion_subgroup() # cached @@ -2138,8 +2188,8 @@ def rank_bounds(self, **kwds): Here is a curve with two-torsion, again the bounds coincide:: - sage: Qrt5. = NumberField(x^2-5) - sage: E = EllipticCurve([0,5-rt5,0,rt5,0]) + sage: Qrt5. = NumberField(x^2 - 5) + sage: E = EllipticCurve([0, 5-rt5, 0, rt5, 0]) sage: E.rank_bounds() (1, 1) @@ -2148,9 +2198,9 @@ def rank_bounds(self, **kwds): give bounds:: sage: E = EllipticCurve("15a5") - sage: K. = NumberField(x^2-6) + sage: K. = NumberField(x^2 - 6) sage: EK = E.base_extend(K) - sage: EK.rank_bounds(lim1=1,lim3=1,limtriv=1) + sage: EK.rank_bounds(lim1=1, lim3=1, limtriv=1) (0, 2) IMPLEMENTATION: @@ -2220,7 +2270,7 @@ def rank(self, **kwds): determine the rank:: sage: E = EllipticCurve("15a5") - sage: K. = NumberField(x^2-6) + sage: K. = NumberField(x^2 - 6) sage: EK = E.base_extend(K) sage: EK.rank(lim1=1, lim3=1, limtriv=1) Traceback (most recent call last): @@ -2314,8 +2364,8 @@ def gens(self, **kwds): Here is a curve of rank 2:: - sage: K. = NumberField(x^2-17) - sage: E = EllipticCurve(K,[-4,0]) + sage: K. = NumberField(x^2 - 17) + sage: E = EllipticCurve(K, [-4, 0]) sage: E.gens() [(-1/2*t + 1/2 : -1/2*t + 1/2 : 1), (-t + 3 : -2*t + 10 : 1)] sage: E.rank() @@ -2324,7 +2374,7 @@ def gens(self, **kwds): Test that points of finite order are not included (see :trac:`13593`):: sage: E = EllipticCurve("17a3") - sage: K. = NumberField(x^2+3) + sage: K. = NumberField(x^2 + 3) sage: EK = E.base_extend(K) sage: EK.rank() 0 @@ -2365,7 +2415,7 @@ def period_lattice(self, embedding): First define a field with two real embeddings:: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: E = EllipticCurve([0,0,0,a,2]) sage: embs = K.embeddings(CC); len(embs) 3 @@ -2373,33 +2423,40 @@ def period_lattice(self, embedding): For each embedding we have a different period lattice:: sage: E.period_lattice(embs[0]) - Period lattice associated to Elliptic Curve defined by y^2 = x^3 + a*x + 2 over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism: - From: Number Field in a with defining polynomial x^3 - 2 - To: Algebraic Field - Defn: a |--> -0.6299605249474365? - 1.091123635971722?*I + Period lattice associated to Elliptic Curve defined by y^2 = x^3 + a*x + 2 + over Number Field in a with defining polynomial x^3 - 2 + with respect to the embedding Ring morphism: + From: Number Field in a with defining polynomial x^3 - 2 + To: Algebraic Field + Defn: a |--> -0.6299605249474365? - 1.091123635971722?*I sage: E.period_lattice(embs[1]) - Period lattice associated to Elliptic Curve defined by y^2 = x^3 + a*x + 2 over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism: - From: Number Field in a with defining polynomial x^3 - 2 - To: Algebraic Field - Defn: a |--> -0.6299605249474365? + 1.091123635971722?*I + Period lattice associated to Elliptic Curve defined by y^2 = x^3 + a*x + 2 + over Number Field in a with defining polynomial x^3 - 2 + with respect to the embedding Ring morphism: + From: Number Field in a with defining polynomial x^3 - 2 + To: Algebraic Field + Defn: a |--> -0.6299605249474365? + 1.091123635971722?*I sage: E.period_lattice(embs[2]) - Period lattice associated to Elliptic Curve defined by y^2 = x^3 + a*x + 2 over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism: - From: Number Field in a with defining polynomial x^3 - 2 - To: Algebraic Field - Defn: a |--> 1.259921049894873? + Period lattice associated to Elliptic Curve defined by y^2 = x^3 + a*x + 2 + over Number Field in a with defining polynomial x^3 - 2 + with respect to the embedding Ring morphism: + From: Number Field in a with defining polynomial x^3 - 2 + To: Algebraic Field + Defn: a |--> 1.259921049894873? Although the original embeddings have only the default precision, we can obtain the basis with higher precision later:: - sage: L=E.period_lattice(embs[0]) + sage: L = E.period_lattice(embs[0]) sage: L.basis() (1.86405007647981 - 0.903761485143226*I, -0.149344633143919 - 2.06619546272945*I) sage: L.basis(prec=100) - (1.8640500764798108425920506200 - 0.90376148514322594749786960975*I, -0.14934463314391922099120107422 - 2.0661954627294548995621225062*I) + (1.8640500764798108425920506200 - 0.90376148514322594749786960975*I, + -0.14934463314391922099120107422 - 2.0661954627294548995621225062*I) """ from sage.schemes.elliptic_curves.period_lattice import PeriodLattice_ell return PeriodLattice_ell(self,embedding) @@ -2466,7 +2523,9 @@ def height_function(self): sage: K. = NumberField(x^2 - 5) sage: E = EllipticCurve(K, '11a3') sage: E.height_function() - EllipticCurveCanonicalHeight object associated to Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 over Number Field in a with defining polynomial x^2 - 5 + EllipticCurveCanonicalHeight object associated to + Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + over Number Field in a with defining polynomial x^2 - 5 """ if not hasattr(self, '_height_function'): from sage.schemes.elliptic_curves.height import EllipticCurveCanonicalHeight @@ -2487,10 +2546,10 @@ def isogeny_class(self, reducible_primes=None, algorithm='Billerey', minimal_mod the isogeny class, only composites isogenies of these degrees will be used. - - ``algorithm`` (string, default 'Billerey') -- the algorithm + - ``algorithm`` (string, default ``'Billerey'``) -- the algorithm to use to compute the reducible primes. Ignored for CM curves or if ``reducible_primes`` is provided. Values are - 'Billerey' (default), 'Larson', and 'heuristic'. + ``'Billerey'`` (default), ``'Larson'``, and ``'heuristic'``. - ``minimal_models`` (bool, default ``True``) -- if ``True``, all curves in the class will be minimal or semi-minimal @@ -2507,7 +2566,7 @@ def isogeny_class(self, reducible_primes=None, algorithm='Billerey', minimal_mod .. NOTE:: - If using the algorithm 'heuristic' for non-CM curves, the + If using the algorithm ``'heuristic'`` for non-CM curves, the result is not guaranteed to be the complete isogeny class, since only reducible primes up to the default bound in :meth:`reducible_primes_naive` (currently 1000) are @@ -2529,7 +2588,8 @@ def isogeny_class(self, reducible_primes=None, algorithm='Billerey', minimal_mod sage: K. = QuadraticField(-1) sage: E = EllipticCurve(K, [0,0,0,0,1]) sage: C = E.isogeny_class(); C - Isogeny class of Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in i with defining polynomial x^2 + 1 with i = 1*I + Isogeny class of Elliptic Curve defined by y^2 = x^3 + 1 + over Number Field in i with defining polynomial x^2 + 1 with i = 1*I The curves in the class (sorted):: @@ -2555,16 +2615,18 @@ class :class:`EllipticCurveIsogeny` allowed composition. In to 3, and `3`-isogenies to go from 0 to 1 and from 2 to 3:: sage: isogs = C.isogenies() - sage: [((i,j),isogs[i][j].degree()) for i in range(4) for j in range(4) if isogs[i][j]!=0] + sage: [((i,j), isogs[i][j].degree()) + ....: for i in range(4) for j in range(4) if isogs[i][j] != 0] [((0, 1), 3), - ((0, 3), 2), - ((1, 0), 3), - ((1, 2), 2), - ((2, 1), 2), - ((2, 3), 3), - ((3, 0), 2), - ((3, 2), 3)] - sage: [((i,j),isogs[i][j].x_rational_map()) for i in range(4) for j in range(4) if isogs[i][j]!=0] + ((0, 3), 2), + ((1, 0), 3), + ((1, 2), 2), + ((2, 1), 2), + ((2, 3), 3), + ((3, 0), 2), + ((3, 2), 3)] + sage: [((i,j), isogs[i][j].x_rational_map()) + ....: for i in range(4) for j in range(4) if isogs[i][j] != 0] [((0, 1), (1/9*x^3 - 12)/x^2), ((0, 3), (-1/2*i*x^2 + i*x - 12*i)/(x - 3)), ((1, 0), (x^3 + 4)/x^2), @@ -2583,7 +2645,9 @@ class :class:`EllipticCurveIsogeny` allowed composition. In sage: K. = QuadraticField(-1) sage: E = EllipticCurve([1+i, -i, i, 1, 0]) sage: C = E.isogeny_class(); C # long time - Isogeny class of Elliptic Curve defined by y^2 + (i+1)*x*y + i*y = x^3 + (-i)*x^2 + x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I + Isogeny class of + Elliptic Curve defined by y^2 + (i+1)*x*y + i*y = x^3 + (-i)*x^2 + x + over Number Field in i with defining polynomial x^2 + 1 with i = 1*I sage: len(C) # long time 6 sage: C.matrix() # long time @@ -2595,17 +2659,17 @@ class :class:`EllipticCurveIsogeny` allowed composition. In [ 2 6 18 9 3 1] sage: [E1.ainvs() for E1 in C] # long time [(i + 1, i - 1, i, -i - 1, -i + 1), - (i + 1, i - 1, i, 14*i + 4, 7*i + 14), - (i + 1, i - 1, i, 59*i + 99, 372*i - 410), - (i + 1, -i, i, -240*i - 399, 2869*i + 2627), - (i + 1, -i, i, -5*i - 4, 2*i + 5), - (i + 1, -i, i, 1, 0)] + (i + 1, i - 1, i, 14*i + 4, 7*i + 14), + (i + 1, i - 1, i, 59*i + 99, 372*i - 410), + (i + 1, -i, i, -240*i - 399, 2869*i + 2627), + (i + 1, -i, i, -5*i - 4, 2*i + 5), + (i + 1, -i, i, 1, 0)] An example with CM by `\sqrt{-5}`:: sage: pol = PolynomialRing(QQ,'x')([1,0,3,0,1]) sage: K. = NumberField(pol) - sage: j = 1480640+565760*c^2 + sage: j = 1480640 + 565760*c^2 sage: E = EllipticCurve(j=j) sage: E.has_cm() True @@ -2623,7 +2687,13 @@ class :class:`EllipticCurveIsogeny` allowed composition. In [(0, 0, 0, 83490*c^2 - 147015, -64739840*c^2 - 84465260), (0, 0, 0, -161535*c^2 + 70785, -62264180*c^3 + 6229080*c)] sage: C.isogenies()[0][1] - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + (83490*c^2-147015)*x + (-64739840*c^2-84465260) over Number Field in c with defining polynomial x^4 + 3*x^2 + 1 to Elliptic Curve defined by y^2 = x^3 + (-161535*c^2+70785)*x + (-62264180*c^3+6229080*c) over Number Field in c with defining polynomial x^4 + 3*x^2 + 1 + Isogeny of degree 2 + from Elliptic Curve defined by + y^2 = x^3 + (83490*c^2-147015)*x + (-64739840*c^2-84465260) + over Number Field in c with defining polynomial x^4 + 3*x^2 + 1 + to Elliptic Curve defined by + y^2 = x^3 + (-161535*c^2+70785)*x + (-62264180*c^3+6229080*c) + over Number Field in c with defining polynomial x^4 + 3*x^2 + 1 An example with CM by `\sqrt{-23}` (class number `3`):: @@ -2724,9 +2794,9 @@ class number is only `3` is that the class also contains three defines the same field as ``pol26`` but is simpler:: sage: pol26 = hilbert_class_polynomial(-4*26) - sage: pol = x^6-x^5+2*x^4+x^3-2*x^2-x-1 + sage: pol = x^6 - x^5 + 2*x^4 + x^3 - 2*x^2 - x - 1 sage: K. = NumberField(pol) - sage: L. = K.extension(x^2+26) + sage: L. = K.extension(x^2 + 26) Only `2` of the `j`-invariants with discriminant -104 are in `K`, though all are in `L`:: @@ -2769,7 +2839,7 @@ class number is only `3` is that the class also contains three sage: len(CL) # long time 6 sage: s1 = Set([EE.j_invariant() for EE in CL.curves]) # long time - sage: s2 = Set(pol26.roots(L,multiplicities=False)) # long time + sage: s2 = Set(pol26.roots(L, multiplicities=False)) # long time sage: s1 == s2 # long time True @@ -2823,17 +2893,20 @@ class number is only `3` is that the class also contains three sage: K. = CyclotomicField(53) sage: E = EllipticCurve(K,[0,6,0,2,0]) sage: C = E.isogeny_class(algorithm='heuristic', minimal_models=False); C # long time (10s) - Isogeny class of Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 2*x over Cyclotomic Field of order 53 and degree 52 + Isogeny class of Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 2*x + over Cyclotomic Field of order 53 and degree 52 sage: C.curves # long time - [Elliptic Curve defined by y^2 = x^3 + 6*x^2 + (-8)*x + (-48) over Cyclotomic Field of order 53 and degree 52, - Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 2*x over Cyclotomic Field of order 53 and degree 52] + [Elliptic Curve defined by y^2 = x^3 + 6*x^2 + (-8)*x + (-48) + over Cyclotomic Field of order 53 and degree 52, + Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 2*x + over Cyclotomic Field of order 53 and degree 52] TESTS: An example which failed until fixed at :trac:`19229`:: - sage: K. = NumberField(x^2-x+1) - sage: E = EllipticCurve([a+1,1,1,0,0]) + sage: K. = NumberField(x^2 - x + 1) + sage: E = EllipticCurve([a+1, 1, 1, 0, 0]) sage: C = E.isogeny_class(); len(C) # long time 4 """ @@ -2893,7 +2966,7 @@ def isogenies_prime_degree(self, l=None, algorithm='Billerey', minimal_models=Tr sage: pol = PolynomialRing(QQ,'x')([1,-3,5,-5,5,-3,1]) sage: L. = NumberField(pol) - sage: js = hilbert_class_polynomial(-23).roots(L,multiplicities=False); len(js) + sage: js = hilbert_class_polynomial(-23).roots(L, multiplicities=False); len(js) 3 sage: E = EllipticCurve(j=js[0]) sage: len(E.isogenies_prime_degree()) # long time @@ -2906,11 +2979,19 @@ def isogenies_prime_degree(self, l=None, algorithm='Billerey', minimal_models=Tr sage: proof.number_field(False) sage: K. = CyclotomicField(53) - sage: E = EllipticCurve(K,[0,6,0,2,0]) + sage: E = EllipticCurve(K, [0,6,0,2,0]) sage: E.isogenies_prime_degree(2, minimal_models=False) - [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 2*x over Cyclotomic Field of order 53 and degree 52 to Elliptic Curve defined by y^2 = x^3 + 6*x^2 + (-8)*x + (-48) over Cyclotomic Field of order 53 and degree 52] + [Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 2*x + over Cyclotomic Field of order 53 and degree 52 + to Elliptic Curve defined by y^2 = x^3 + 6*x^2 + (-8)*x + (-48) + over Cyclotomic Field of order 53 and degree 52] sage: E.isogenies_prime_degree(2, minimal_models=True) # not tested (10s) - [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 2*x over Cyclotomic Field of order 53 and degree 52 to Elliptic Curve defined by y^2 = x^3 + (-20)*x + (-16) over Cyclotomic Field of order 53 and degree 52] + [Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 2*x + over Cyclotomic Field of order 53 and degree 52 + to Elliptic Curve defined by y^2 = x^3 + (-20)*x + (-16) + over Cyclotomic Field of order 53 and degree 52] TESTS:: @@ -2978,7 +3059,7 @@ def is_isogenous(self, other, proof=True, maxnorm=100): EXAMPLES:: sage: x = polygen(QQ, 'x') - sage: F = NumberField(x^2 -2, 's'); F + sage: F = NumberField(x^2 - 2, 's'); F Number Field in s with defining polynomial x^2 - 2 sage: E1 = EllipticCurve(F, [7,8]) sage: E2 = EllipticCurve(F, [0,5,0,1,0]) @@ -2997,7 +3078,7 @@ def is_isogenous(self, other, proof=True, maxnorm=100): :: sage: x = polygen(QQ, 'x') - sage: F = NumberField(x^2 -2, 's'); F + sage: F = NumberField(x^2 - 2, 's'); F Number Field in s with defining polynomial x^2 - 2 sage: E = EllipticCurve('14a1') sage: EE = EllipticCurve('14a2') @@ -3009,9 +3090,9 @@ def is_isogenous(self, other, proof=True, maxnorm=100): :: sage: x = polygen(QQ, 'x') - sage: F = NumberField(x^2 -2, 's'); F + sage: F = NumberField(x^2 - 2, 's'); F Number Field in s with defining polynomial x^2 - 2 - sage: k. = NumberField(x^3+7) + sage: k. = NumberField(x^3 + 7) sage: E = EllipticCurve(F, [7,8]) sage: EE = EllipticCurve(k, [2, 2]) sage: E.is_isogenous(EE) @@ -3145,7 +3226,7 @@ def isogeny_degree(self, other): EXAMPLES:: sage: x = QQ['x'].0 - sage: F = NumberField(x^2 -2, 's'); F + sage: F = NumberField(x^2 - 2, 's'); F Number Field in s with defining polynomial x^2 - 2 sage: E = EllipticCurve('14a1') sage: EE = EllipticCurve('14a2') @@ -3305,30 +3386,30 @@ def lll_reduce(self, points, height_matrix=None, precision=None): :: sage: E = EllipticCurve([1,0,1,-120039822036992245303534619191166796374,504224992484910670010801799168082726759443756222911415116]) - sage: xi = [2005024558054813068,\ - -4690836759490453344,\ - 4700156326649806635,\ - 6785546256295273860,\ - 6823803569166584943,\ - 7788809602110240789,\ - 27385442304350994620556,\ - 54284682060285253719/4,\ - -94200235260395075139/25,\ - -3463661055331841724647/576,\ - -6684065934033506970637/676,\ - -956077386192640344198/2209,\ - -27067471797013364392578/2809,\ - -25538866857137199063309/3721,\ - -1026325011760259051894331/108241,\ - 9351361230729481250627334/1366561,\ - 10100878635879432897339615/1423249,\ - 11499655868211022625340735/17522596,\ - 110352253665081002517811734/21353641,\ - 414280096426033094143668538257/285204544,\ - 36101712290699828042930087436/4098432361,\ - 45442463408503524215460183165/5424617104,\ - 983886013344700707678587482584/141566320009,\ - 1124614335716851053281176544216033/152487126016] + sage: xi = [2005024558054813068, + ....: -4690836759490453344, + ....: 4700156326649806635, + ....: 6785546256295273860, + ....: 6823803569166584943, + ....: 7788809602110240789, + ....: 27385442304350994620556, + ....: 54284682060285253719/4, + ....: -94200235260395075139/25, + ....: -3463661055331841724647/576, + ....: -6684065934033506970637/676, + ....: -956077386192640344198/2209, + ....: -27067471797013364392578/2809, + ....: -25538866857137199063309/3721, + ....: -1026325011760259051894331/108241, + ....: 9351361230729481250627334/1366561, + ....: 10100878635879432897339615/1423249, + ....: 11499655868211022625340735/17522596, + ....: 110352253665081002517811734/21353641, + ....: 414280096426033094143668538257/285204544, + ....: 36101712290699828042930087436/4098432361, + ....: 45442463408503524215460183165/5424617104, + ....: 983886013344700707678587482584/141566320009, + ....: 1124614335716851053281176544216033/152487126016] sage: points = [E.lift_x(x) for x in xi] sage: newpoints, U = E.lll_reduce(points) # long time (35s on sage.math, 2011) sage: [P[0] for P in newpoints] # long time @@ -3351,7 +3432,7 @@ def lll_reduce(self, points, height_matrix=None, precision=None): sage: K. = QuadraticField(-23, 'a') sage: E = EllipticCurve(K, [0,0,1,-1,0]) - sage: P = E(-2,-(a+1)/2) + sage: P = E(-2, -(a+1)/2) sage: Q = E(0,-1) sage: E.lll_reduce([P,Q]) ( @@ -3362,8 +3443,9 @@ def lll_reduce(self, points, height_matrix=None, precision=None): :: sage: K. = QuadraticField(-5) - sage: E = EllipticCurve(K,[0,a]) - sage: points = [E.point([-211/841*a - 6044/841,-209584/24389*a + 53634/24389]),E.point([-17/18*a - 1/9, -109/108*a - 277/108]) ] + sage: E = EllipticCurve(K, [0,a]) + sage: points = [E.point([-211/841*a - 6044/841,-209584/24389*a + 53634/24389]), + ....: E.point([-17/18*a - 1/9, -109/108*a - 277/108])] sage: E.lll_reduce(points) ( [(-a + 4 : -3*a + 7 : 1), (-17/18*a - 1/9 : 109/108*a + 277/108 : 1)], @@ -3399,7 +3481,9 @@ def galois_representation(self): sage: E = EllipticCurve('11a1').change_ring(K) sage: rho = E.galois_representation() sage: rho - Compatible family of Galois representations associated to the Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in a with defining polynomial x^2 + 1 + Compatible family of Galois representations associated to the + Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) + over Number Field in a with defining polynomial x^2 + 1 sage: rho.is_surjective(3) True sage: rho.is_surjective(5) # long time (4s on sage.math, 2014) @@ -3435,7 +3519,8 @@ def cm_discriminant(self): sage: EllipticCurve(j=1).cm_discriminant() Traceback (most recent call last): ... - ValueError: Elliptic Curve defined by y^2 + x*y = x^3 + 36*x + 3455 over Rational Field does not have CM + ValueError: Elliptic Curve defined by y^2 + x*y = x^3 + 36*x + 3455 + over Rational Field does not have CM sage: EllipticCurve(j=1728).cm_discriminant() -4 sage: EllipticCurve(j=8000).cm_discriminant() @@ -3553,7 +3638,7 @@ def has_rational_cm(self, field=None): False sage: E.cm_discriminant() -20 - sage: E.has_rational_cm(K.extension(x^2+5,'b')) + sage: E.has_rational_cm(K.extension(x^2 + 5, 'b')) True An error is raised if a field is given which is not an extension of the base field:: @@ -3561,7 +3646,10 @@ def has_rational_cm(self, field=None): sage: E.has_rational_cm(QuadraticField(-20)) Traceback (most recent call last): ... - ValueError: Error in has_rational_cm: Number Field in a with defining polynomial x^2 + 20 with a = 4.472135954999579?*I is not an extension field of Number Field in a with defining polynomial x^2 - 5 with a = 2.236067977499790? + ValueError: Error in has_rational_cm: Number Field in a + with defining polynomial x^2 + 20 with a = 4.472135954999579?*I + is not an extension field of Number Field in a + with defining polynomial x^2 - 5 with a = 2.236067977499790? sage: K. = NumberField(x^3 - 2) sage: E = EllipticCurve(j=31710790944000*a^2 + 39953093016000*a + 50337742902000) @@ -3571,7 +3659,7 @@ def has_rational_cm(self, field=None): False sage: D = E.cm_discriminant(); D -108 - sage: E.has_rational_cm(K.extension(x^2+108,'b')) + sage: E.has_rational_cm(K.extension(x^2 + 108,'b')) True """ D = self.cm_discriminant() @@ -3611,20 +3699,20 @@ def is_Q_curve(self, maxp=100, certificate=False, verbose=False): - when the flag is ``True``, so `E` is a `\QQ`-curve: - - either {'CM':`D`} where `D` is a negative discriminant, when - `E` has potential CM with discriminant `D`; - - - otherwise {'CM': `0`, 'core_poly': `f`, 'rho': `\rho`, - 'r': `r`, 'N': `N`}, when `E` is a non-CM `\QQ`-curve, - where the core polynomial `f` is an irreducible monic - polynomial over `QQ` of degree `2^\rho`, all of whose - roots are `j`-invariants of curves isogenous to `E`, the - core level `N` is a square-free integer with `r` prime - factors which is the LCM of the degrees of the isogenies - between these conjugates. For example, if there exists - a curve `E'` isogenous to `E` with `j(E')=j\in\QQ`, then - the certificate is {'CM':0, 'r':0, 'rho':0, 'core_poly': - x-j, 'N':1}. + - either {'CM':`D`} where `D` is a negative discriminant, when + `E` has potential CM with discriminant `D`; + + - otherwise {'CM': `0`, 'core_poly': `f`, 'rho': `\rho`, + 'r': `r`, 'N': `N`}, when `E` is a non-CM `\QQ`-curve, + where the core polynomial `f` is an irreducible monic + polynomial over `QQ` of degree `2^\rho`, all of whose + roots are `j`-invariants of curves isogenous to `E`, the + core level `N` is a square-free integer with `r` prime + factors which is the LCM of the degrees of the isogenies + between these conjugates. For example, if there exists + a curve `E'` isogenous to `E` with `j(E')=j\in\QQ`, then + the certificate is {'CM':0, 'r':0, 'rho':0, 'core_poly': + x-j, 'N':1}. - when the flag is ``False``, so `E` is not a `\QQ`-curve, the certificate is a prime `p` such that the reductions of `E` @@ -3663,7 +3751,7 @@ def is_Q_curve(self, maxp=100, certificate=False, verbose=False): sage: R. = PolynomialRing(QQ) sage: K. = NumberField(R([3, 0, -5, 0, 1])) - sage: E = EllipticCurve([K([-3,-4,1,1]),K([4,-1,-1,0]),K([-2,0,1,0]),K([-621,778,138,-178]),K([9509,2046,-24728,10380])]) + sage: E = EllipticCurve([K([-3,-4,1,1]), K([4,-1,-1,0]), K([-2,0,1,0]), K([-621,778,138,-178]), K([9509,2046,-24728,10380])]) sage: E.is_Q_curve(certificate=True, verbose=True) Checking whether Elliptic Curve defined by y^2 + (a^3+a^2-4*a-3)*x*y + (a^2-2)*y = x^3 + (-a^2-a+4)*x^2 + (-178*a^3+138*a^2+778*a-621)*x + (10380*a^3-24728*a^2+2046*a+9509) over Number Field in a with defining polynomial x^4 - 5*x^2 + 3 is a Q-curve No: inconsistency at the 2 primes dividing 3 @@ -3675,7 +3763,7 @@ def is_Q_curve(self, maxp=100, certificate=False, verbose=False): is not:: sage: K. = NumberField(R([-10, 0, 1])) - sage: E = EllipticCurve([K([0,1]),K([-1,-1]),K([0,0]),K([-236,40]),K([-1840,464])]) + sage: E = EllipticCurve([K([0,1]), K([-1,-1]), K([0,0]), K([-236,40]), K([-1840,464])]) sage: E.is_Q_curve(certificate=True, verbose=True) Checking whether Elliptic Curve defined by y^2 + a*x*y = x^3 + (-a-1)*x^2 + (40*a-236)*x + (464*a-1840) over Number Field in a with defining polynomial x^2 - 10 is a Q-curve Applying local tests at good primes above p<=100 @@ -3689,7 +3777,7 @@ def is_Q_curve(self, maxp=100, certificate=False, verbose=False): sage: R. = PolynomialRing(QQ) sage: K. = NumberField(R([-1, -1, 1])) - sage: E = EllipticCurve([K([1,0]),K([-1,0]),K([0,1]),K([0,-2]),K([0,1])]) + sage: E = EllipticCurve([K([1,0]), K([-1,0]), K([0,1]), K([0,-2]), K([0,1])]) sage: E.is_Q_curve(certificate=True, verbose=True) Checking whether Elliptic Curve defined by y^2 + x*y + a*y = x^3 + (-1)*x^2 + (-2*a)*x + a over Number Field in a with defining polynomial x^2 - x - 1 is a Q-curve Yes: E is CM (discriminant -15) @@ -3701,7 +3789,7 @@ def is_Q_curve(self, maxp=100, certificate=False, verbose=False): `j`, so we have a so-called rational `\QQ`-curve:: sage: K. = NumberField(R([1, 0, -4, 0, 1])) - sage: E = EllipticCurve([K([-2,-4,1,1]),K([0,1,0,0]),K([0,1,0,0]),K([-4780,9170,1265,-2463]),K([163923,-316598,-43876,84852])]) + sage: E = EllipticCurve([K([-2,-4,1,1]), K([0,1,0,0]), K([0,1,0,0]), K([-4780,9170,1265,-2463]), K([163923,-316598,-43876,84852])]) sage: flag, cert = E.is_Q_curve(certificate=True) # long time sage: flag # long time True @@ -3715,7 +3803,7 @@ def is_Q_curve(self, maxp=100, certificate=False, verbose=False): with quadratic conjugate `j`-invariants in `\QQ(\sqrt{3})` (but which are not base-changes from the quadratic subfield):: - sage: E = EllipticCurve([K([0,-3,0,1]),K([1,4,0,-1]),K([0,0,0,0]),K([-2,-16,0,4]),K([-19,-32,4,8])]) + sage: E = EllipticCurve([K([0,-3,0,1]), K([1,4,0,-1]), K([0,0,0,0]), K([-2,-16,0,4]), K([-19,-32,4,8])]) sage: flag, cert = E.is_Q_curve(certificate=True) # long time sage: flag # long time True @@ -3795,13 +3883,13 @@ def saturation(self, points, verbose=False, ([(-1 : 1 : 1)], 12, 0.686667083305587) sage: EK.saturation([2*P, Q], max_prime=2) ([(-1 : 1 : 1), (0 : -1 : 1)], 2, 0.152460177943144) - sage: EK.saturation([P+Q, P-Q], lower_ht_bound=.1, debug=2) + sage: EK.saturation([P + Q, P - Q], lower_ht_bound=.1, debug=2) ([(-1 : 1 : 1), (1 : 0 : 1)], 2, 0.152460177943144) - sage: EK.saturation([P+Q, 17*Q], lower_ht_bound=0.1) # long time + sage: EK.saturation([P + Q, 17*Q], lower_ht_bound=0.1) # long time ([(4 : 8 : 1), (0 : -1 : 1)], 17, 0.152460177943143) sage: R = EK(i-2,-i-3) - sage: EK.saturation([P+R, P+Q, Q+R], lower_ht_bound=0.1) + sage: EK.saturation([P + R, P + Q, Q + R], lower_ht_bound=0.1) ([(841/1369*i - 171/1369 : 41334/50653*i - 74525/50653 : 1), (4 : 8 : 1), (-1/25*i + 18/25 : -69/125*i - 58/125 : 1)], @@ -3813,12 +3901,12 @@ def saturation(self, points, verbose=False, Another number field:: sage: E = EllipticCurve('389a1') - sage: K. = NumberField(x^3-x+1) + sage: K. = NumberField(x^3 - x + 1) sage: EK = E.change_ring(K) sage: P = EK(-1,1); Q = EK(0,-1) - sage: EK.saturation([P+Q, P-Q], lower_ht_bound=0.1) + sage: EK.saturation([P + Q, P - Q], lower_ht_bound=0.1) ([(-1 : 1 : 1), (1 : 0 : 1)], 2, 0.152460177943144) - sage: EK.saturation([3*P, P+5*Q], lower_ht_bound=0.1) + sage: EK.saturation([3*P, P + 5*Q], lower_ht_bound=0.1) ([(-185/2209 : -119510/103823 : 1), (80041/34225 : -26714961/6331625 : 1)], 15, 0.152460177943144) @@ -3828,8 +3916,8 @@ def saturation(self, points, verbose=False, sage: K. = QuadraticField(3) sage: E = EllipticCurve('37a1') sage: EK = E.change_ring(K) - sage: P = EK(0,0); Q = EK(2-a,2*a-4) - sage: EK.saturation([3*P-Q, 3*P+Q], lower_ht_bound=.01) + sage: P = EK(0,0); Q = EK(2-a, 2*a-4) + sage: EK.saturation([3*P - Q, 3*P + Q], lower_ht_bound=.01) ([(0 : 0 : 1), (1/2*a : -1/4*a - 1/4 : 1)], 6, 0.0317814530725985) The points must be linearly independent:: @@ -3862,21 +3950,21 @@ def saturation(self, points, verbose=False, sage: EK.saturation([P+Q, P-Q], lower_ht_bound=.1, debug=2) ([(-1 : 1 : 1), (1 : 0 : 1)], 2, 0.152460177943144) - sage: EK.saturation([5*P+6*Q, 5*P-3*Q], lower_ht_bound=.1) + sage: EK.saturation([5*P + 6*Q, 5*P - 3*Q], lower_ht_bound=.1) ([(-3/4 : -15/8 : 1), (159965/16129 : -67536260/2048383 : 1)], - 45, - 0.152460177943144) - sage: EK.saturation([5*P+6*Q, 5*P-3*Q], lower_ht_bound=.1, debug=2) + 45, + 0.152460177943144) + sage: EK.saturation([5*P + 6*Q, 5*P - 3*Q], lower_ht_bound=.1, debug=2) ([(-3/4 : -15/8 : 1), (159965/16129 : -67536260/2048383 : 1)], - 45, - 0.152460177943144) + 45, + 0.152460177943144) See :trac:`27387`:: - sage: K. = NumberField(x^2-x-26) - sage: E = EllipticCurve([a,1-a,0,93-16*a, 3150-560*a]) + sage: K. = NumberField(x^2 - x - 26) + sage: E = EllipticCurve([a, 1-a, 0, 93-16*a, 3150-560*a]) sage: P = E([65-35*a/3, (959*a-5377)/9]) - sage: E.saturation([P],one_prime=2) + sage: E.saturation([P], one_prime=2) ([(-1/4*a + 3/4 : 59/8*a - 317/8 : 1)], 2, 0.344624259712631) """ full_saturation = (max_prime == 0) and (one_prime == 0) @@ -4053,7 +4141,7 @@ def rational_points(self, **kwds): An example over a number field:: sage: E = EllipticCurve([1,0]) - sage: pts = E.rational_points(bound = 2, F = QuadraticField(-1)) + sage: pts = E.rational_points(bound=2, F=QuadraticField(-1)) sage: pts [(-a : 0 : 1), (0 : 0 : 1), (0 : 1 : 0), (a : 0 : 1)] sage: pts[0] + pts[1] diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py index 5d57a4d8d93..83204482368 100644 --- a/src/sage/schemes/elliptic_curves/ell_point.py +++ b/src/sage/schemes/elliptic_curves/ell_point.py @@ -76,7 +76,7 @@ Arithmetic over `\ZZ/N\ZZ` with composite `N` is supported. When an operation tries to invert a non-invertible element, a -ZeroDivisionError is raised and a factorization of the modulus appears +:class:`ZeroDivisionError` is raised and a factorization of the modulus appears in the error message:: sage: N = 1715761513 @@ -462,7 +462,7 @@ def order(self): Return the order of this point on the elliptic curve. If the point is zero, returns 1, otherwise raise a - NotImplementedError. + :class:`NotImplementedError`. For curves over number fields and finite fields, see below. @@ -748,7 +748,7 @@ def __neg__(self): def xy(self): """ Return the `x` and `y` coordinates of this point, as a 2-tuple. - If this is the point at infinity a ZeroDivisionError is raised. + If this is the point at infinity, a :class:`ZeroDivisionError` is raised. EXAMPLES:: @@ -890,7 +890,7 @@ def is_divisible_by(self, m): def division_points(self, m, poly_only=False): r""" - Return a list of all points `Q` such that `mQ=P` where `P` = self. + Return a list of all points `Q` such that `mQ=P` where `P` = ``self``. Only points on the elliptic curve containing self and defined over the base field are included. @@ -901,7 +901,7 @@ def division_points(self, m, poly_only=False): - ``poly_only`` -- bool (default: False); if True return polynomial whose roots give all possible `x`-coordinates of - `m`-th roots of self. + `m`-th roots of ``self``. OUTPUT: @@ -1183,7 +1183,7 @@ def _divide_out(self, p): def set_order(self, value, *, check=True): r""" - Set the value of self._order to value. + Set the value of ``self._order`` to ``value``. Use this when you know a priori the order of this point to avoid a potentially expensive order calculation. @@ -1192,9 +1192,7 @@ def set_order(self, value, *, check=True): - ``value`` -- positive integer - OUTPUT: - - ``None`` + OUTPUT: ``None`` EXAMPLES: @@ -1252,7 +1250,7 @@ def set_order(self, value, *, check=True): ... ValueError: Value 11 illegal: 11 * (5 : 0 : 1) is not the identity - However, set_order can be fooled, though it's not likely in "real cases + However, ``set_order`` can be fooled, though it's not likely in "real cases of interest". For instance, the order can be set to a multiple the actual order:: @@ -1264,7 +1262,7 @@ def set_order(self, value, *, check=True): AUTHORS: - - Mariah Lenox (2011-02-16) + - Mariah Lenox (2011-02-16) """ value = Integer(value) @@ -1371,8 +1369,8 @@ def _miller_(self, Q, n): OUTPUT: - An element in the base field self.curve().base_field() - A ValueError is raised if `Q` is zero. + An element in the base field ``self.curve().base_field()``. + A :class:`ValueError` is raised if `Q` is zero. EXAMPLES:: @@ -1628,7 +1626,7 @@ def weil_pairing(self, Q, n, algorithm=None): - For ``algorithm='sage'``: Implemented using Proposition 8 in [Mil2004]_. The value 1 is returned for linearly dependent input points. This condition - is caught via a DivisionByZeroError, since the use of a + is caught via a :class:`ZeroDivisionError`, since the use of a discrete logarithm test for linear dependence is much too slow for large `n`. @@ -1728,7 +1726,7 @@ def tate_pairing(self, Q, n, k, q=None): OUTPUT: - An `n`'th root of unity in the base field self.curve().base_field() + An `n`'th root of unity in the base field ``self.curve().base_field()`` EXAMPLES: @@ -1749,7 +1747,7 @@ def tate_pairing(self, Q, n, k, q=None): sage: P.tate_pairing(P, n, k) # optional - sage.rings.finite_rings 1 - We now let Q be a point on the same curve as above, but defined over + We now let `Q` be a point on the same curve as above, but defined over the pairing extension field, and we also demonstrate the bilinearity of the pairing:: @@ -1819,7 +1817,7 @@ def tate_pairing(self, Q, n, k, q=None): exponentiation. It does not do anything fancy. In the case that there is an issue with `Q` being on one of the lines generated in the `r*P` calculation, `Q` is offset by a random - point `R` and P.tate_pairing(Q+R,n,k)/P.tate_pairing(R,n,k) + point `R` and ``P.tate_pairing(Q+R,n,k)/P.tate_pairing(R,n,k)`` is returned. AUTHORS: @@ -1860,7 +1858,7 @@ def tate_pairing(self, Q, n, k, q=None): def ate_pairing(self, Q, n, k, t, q=None): r""" - Return ate pairing of `n`-torsion points `P=self` and `Q`. + Return ate pairing of `n`-torsion points `P` (``=self``) and `Q`. Also known as the `n`-th modified ate pairing. `P` is `GF(q)`-rational, and `Q` must be an element of `Ker(\pi-p)`, where `\pi` is the @@ -1868,8 +1866,8 @@ def ate_pairing(self, Q, n, k, t, q=None): INPUT: - - ``P=self`` -- a point of order `n`, in `ker(\pi-1)`, where - `\pi` is the `q`-Frobenius map (e.g., `P` is `q-rational`). + - `P` (``=self``) -- a point of order `n`, in `ker(\pi-1)`, where + `\pi` is the `q`-Frobenius map (e.g., `P` is `q`-rational). - ``Q`` -- a point of order `n` in `ker(\pi-q)` @@ -2068,7 +2066,7 @@ class EllipticCurvePoint_number_field(EllipticCurvePoint_field): A point on an elliptic curve over a number field. Most of the functionality is derived from the parent class - ``EllipticCurvePoint_field``. In addition we have support for + :class:`EllipticCurvePoint_field`. In addition we have support for orders, heights, reduction modulo primes, and elliptic logarithms. EXAMPLES:: @@ -2236,7 +2234,7 @@ def has_infinite_order(self): def is_on_identity_component(self, embedding=None): r""" - Returns True iff this point is on the identity component of + Return True iff this point is on the identity component of its curve with respect to a given (real or complex) embedding. INPUT: @@ -2497,8 +2495,8 @@ def height(self, precision=None, normalised=True, algorithm='pari'): return this normalised height multiplied by the degree of `K`. - - ``algorithm`` -- string: either 'pari' (default) or 'sage'. - If 'pari' and the base field is `\QQ`, use the PARI library + - ``algorithm`` -- string: either ``'pari'`` (default) or ``'sage'``. + If ``'pari'`` and the base field is `\QQ`, use the PARI library function; otherwise use the Sage implementation. OUTPUT: @@ -2576,7 +2574,7 @@ def height(self, precision=None, normalised=True, algorithm='pari'): sage: E = EllipticCurve('389a1'); E Elliptic Curve defined by y^2 + y = x^3 + x^2 - 2*x over Rational Field - sage: [P,Q] = [E(-1,1),E(0,-1)] + sage: P, Q = E(-1,1), E(0,-1) sage: P.height(precision=100) 0.68666708330558658572355210295 sage: (3*Q).height(precision=100)/Q.height(precision=100) @@ -2603,7 +2601,7 @@ def height(self, precision=None, normalised=True, algorithm='pari'): sage: (100*P).height() / P.height() # optional - sage.rings.number_field 10000.0000000000 - Setting normalised=False multiplies the height by the degree of `K`:: + Setting ``normalised=False`` multiplies the height by the degree of `K`:: sage: E = EllipticCurve('37a') sage: P = E([0,0]) @@ -2759,7 +2757,7 @@ def archimedean_local_height(self, v=None, prec=None, weighted=False): archimedean contribution to the global height. - ``prec`` -- integer, or None (default). The precision of the - computation. If None, the precision is deduced from v. + computation. If None, the precision is deduced from `v`. - ``weighted`` -- boolean. If False (default), the height is normalised to be invariant under extension of `K`. If True, @@ -3173,8 +3171,8 @@ def elliptic_logarithm(self, embedding=None, precision=100, - ``precision``: a positive integer (default 100) setting the number of bits of precision for the computation - - ``algorithm``: either 'pari' (default for real embeddings) - to use PARI's :pari:`ellpointtoz`, or 'sage' for a native + - ``algorithm``: either ``'pari'`` (default for real embeddings) + to use PARI's :pari:`ellpointtoz`, or ``'sage'`` for a native implementation. Ignored for complex embeddings. ALGORITHM: @@ -3225,7 +3223,7 @@ def elliptic_logarithm(self, embedding=None, precision=100, sage: P.elliptic_logarithm() # 100 bits 0.27656204014107061464076203097 - The native algorithm 'sage' used to have trouble with + The native algorithm ``'sage'`` used to have trouble with precision in this example, but no longer:: sage: P.elliptic_logarithm(algorithm='sage') # 100 bits @@ -3270,9 +3268,12 @@ def elliptic_logarithm(self, embedding=None, precision=100, ....: E(5/4*a^2 - 1/2*a , -a^2 - 1/4*a + 9/4 ), ....: E(2*a^2 + 3*a + 4 , -7*a^2 - 10*a - 12 )] sage: [[L.elliptic_logarithm(P) for P in pts] for L in Ls] # optional - sage.rings.number_field - [[0.250819591818930 - 0.411963479992219*I, -0.290994550611374 - 1.37239400324105*I, -0.693473752205595 - 2.45028458830342*I, -0.151659609775291 - 1.48985406505459*I], - [1.33444787667954 - 1.50889756650544*I, 0.792633734249234 - 0.548467043256610*I, 0.390154532655013 + 0.529423541805758*I, 0.931968675085317 - 0.431006981443071*I], - [1.14758249500109 + 0.853389664016075*I, 2.59823462472518 + 0.853389664016075*I, 1.75372176444709, 0.303069634723001]] + [[0.250819591818930 - 0.411963479992219*I, -0.290994550611374 - 1.37239400324105*I, + -0.693473752205595 - 2.45028458830342*I, -0.151659609775291 - 1.48985406505459*I], + [1.33444787667954 - 1.50889756650544*I, 0.792633734249234 - 0.548467043256610*I, + 0.390154532655013 + 0.529423541805758*I, 0.931968675085317 - 0.431006981443071*I], + [1.14758249500109 + 0.853389664016075*I, 2.59823462472518 + 0.853389664016075*I, + 1.75372176444709, 0.303069634723001]] :: @@ -3682,8 +3683,8 @@ def padic_elliptic_logarithm(self,Q, p): INPUT: - - ``Q`` (point) -- another point on the same curve as ``self``. - - ``p`` (integer) -- a prime equals the order of the curve. + - ``Q`` (point) -- another point on the same curve as ``self``. + - ``p`` (integer) -- a prime equal to the order of the curve. OUTPUT: diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py index 3c72b31fa2f..b3e3e5a010e 100644 --- a/src/sage/schemes/elliptic_curves/ell_rational_field.py +++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py @@ -659,7 +659,7 @@ def database_attributes(self): the elliptic curve database. If there is no elliptic curve isomorphic to ``self`` in the - database, a ``LookupError`` is raised. + database, a :class:`LookupError` is raised. EXAMPLES:: @@ -678,7 +678,8 @@ def database_attributes(self): sage: E.database_attributes() Traceback (most recent call last): ... - LookupError: Cremona database does not contain entry for Elliptic Curve defined by y^2 + 8*x*y + 21*y = x^3 + 13*x^2 + 34*x + 55 over Rational Field + LookupError: Cremona database does not contain entry for Elliptic Curve + defined by y^2 + 8*x*y + 21*y = x^3 + 13*x^2 + 34*x + 55 over Rational Field """ from sage.databases.cremona import CremonaDatabase ainvs = self.minimal_model().ainvs() @@ -776,7 +777,7 @@ def mwrank_curve(self, verbose=False): sage: EE.isogeny_class() ([[0, -1, 1, -10, -20], [0, -1, 1, -7820, -263580], [0, -1, 1, 0, 0]], - [[0, 5, 5], [5, 0, 0], [5, 0, 0]]) + [[0, 5, 5], [5, 0, 0], [5, 0, 0]]) """ try: return self.__mwrank_curve @@ -1031,11 +1032,14 @@ def modular_symbol_space(self, sign=1, base_ring=Q, bound=None): sage: f = EllipticCurve('37b') sage: f.modular_symbol_space() - Modular Symbols subspace of dimension 1 of Modular Symbols space of dimension 3 for Gamma_0(37) of weight 2 with sign 1 over Rational Field + Modular Symbols subspace of dimension 1 of Modular Symbols space + of dimension 3 for Gamma_0(37) of weight 2 with sign 1 over Rational Field sage: f.modular_symbol_space(-1) - Modular Symbols subspace of dimension 1 of Modular Symbols space of dimension 2 for Gamma_0(37) of weight 2 with sign -1 over Rational Field + Modular Symbols subspace of dimension 1 of Modular Symbols space + of dimension 2 for Gamma_0(37) of weight 2 with sign -1 over Rational Field sage: f.modular_symbol_space(0, bound=3) - Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 5 for Gamma_0(37) of weight 2 with sign 0 over Rational Field + Modular Symbols subspace of dimension 2 of Modular Symbols space + of dimension 5 for Gamma_0(37) of weight 2 with sign 0 over Rational Field .. NOTE:: @@ -1179,7 +1183,8 @@ def modular_symbol(self, sign=+1, normalize=None, implementation='eclib', nap=0) sage: E = EllipticCurve('37a1') sage: M = E.modular_symbol(); M - Modular symbol with sign 1 over Rational Field attached to Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field + Modular symbol with sign 1 over Rational Field attached to + Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field sage: M(1/2) 0 sage: M(1/5) @@ -1189,7 +1194,8 @@ def modular_symbol(self, sign=+1, normalize=None, implementation='eclib', nap=0) sage: E = EllipticCurve('121b1') sage: M = E.modular_symbol(implementation="sage") - Warning : Could not normalize the modular symbols, maybe all further results will be multiplied by -1 and a power of 2 + Warning : Could not normalize the modular symbols, maybe all further results + will be multiplied by -1 and a power of 2 sage: M(1/7) -1/2 @@ -1255,11 +1261,13 @@ def modular_symbol(self, sign=+1, normalize=None, implementation='eclib', nap=0) sage: E = EllipticCurve('11a1') sage: Mplus = E.modular_symbol(+1); Mplus - Modular symbol with sign 1 over Rational Field attached to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Modular symbol with sign 1 over Rational Field attached to + Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: [Mplus(1/i) for i in [1..11]] [1/5, -4/5, -3/10, 7/10, 6/5, 6/5, 7/10, -3/10, -4/5, 1/5, 0] sage: Mminus = E.modular_symbol(-1); Mminus - Modular symbol with sign -1 over Rational Field attached to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Modular symbol with sign -1 over Rational Field attached to + Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: [Mminus(1/i) for i in [1..11]] [0, 0, 1/2, 1/2, 0, 0, -1/2, -1/2, 0, 0, 0] @@ -1439,7 +1447,7 @@ def analytic_rank(self, algorithm="pari", leading_coefficient=False): - ``'rubinstein'`` -- use Rubinstein's L-function C++ program lcalc. - ``'magma'`` -- use MAGMA - ``'zero_sum'`` -- Use the rank bounding zero sum method implemented - in self.analytic_rank_upper_bound() + in :meth:`analytic_rank_upper_bound` - ``'all'`` -- compute with PARI, sympow and lcalc, check that the answers agree, and return the common answer. @@ -2228,7 +2236,8 @@ def gens(self, proof=None, **kwds): sage: E = EllipticCurve('389a1') sage: E1 = E.change_weierstrass_model([1/20,0,0,0]); E1 - Elliptic Curve defined by y^2 + 8000*y = x^3 + 400*x^2 - 320000*x over Rational Field + Elliptic Curve defined by y^2 + 8000*y = x^3 + 400*x^2 - 320000*x + over Rational Field sage: E1.gens() # random (if database not used) [(-400 : 8000 : 1), (0 : -8000 : 1)] """ @@ -3256,15 +3265,16 @@ def period_lattice(self, embedding=None): OUTPUT: - (period lattice) The PeriodLattice_ell object associated to - this elliptic curve (with respect to the natural embedding of + (period lattice) The :class:`~sage.schemes.elliptic_curves.period_lattice.PeriodLattice_ell` + object associated to this elliptic curve (with respect to the natural embedding of `\QQ` into `\RR`). EXAMPLES:: sage: E = EllipticCurve('37a') sage: E.period_lattice() - Period lattice associated to Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field + Period lattice associated to + Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field """ try: return self._period_lattice @@ -3789,7 +3799,7 @@ def modular_parametrization(self): We can also get a series expansion of this modular parameterization:: sage: E = EllipticCurve('389a1') - sage: X,Y=E.modular_parametrization().power_series() + sage: X, Y = E.modular_parametrization().power_series() sage: X q^-2 + 2*q^-1 + 4 + 7*q + 13*q^2 + 18*q^3 + 31*q^4 + 49*q^5 + 74*q^6 + 111*q^7 + 173*q^8 + 251*q^9 + 379*q^10 + 560*q^11 + 824*q^12 + 1199*q^13 + 1773*q^14 + 2548*q^15 + 3722*q^16 + 5374*q^17 + O(q^18) sage: Y @@ -4251,7 +4261,7 @@ def cm_discriminant(self): Return the associated quadratic discriminant if this elliptic curve has Complex Multiplication over the algebraic closure. - A ValueError is raised if the curve does not have CM (see the + A :class:`ValueError` is raised if the curve does not have CM (see the function :meth:`has_cm()`). EXAMPLES:: @@ -5052,9 +5062,7 @@ def manin_constant(self): that in each class there is at least one, more precisely the so-called strong Weil curve or `X_0(N)`-optimal curve, that has Manin constant `1`. - OUTPUT: - - an integer + OUTPUT: An integer. This function only works if the curve is in the installed Cremona database. Sage includes by default a small database; @@ -5745,7 +5753,7 @@ def antilogarithm(self, z, max_denominator=None): - point on the curve: the rational point which is the image of `z` under the Weierstrass parametrization, if it exists and can be determined from `z` and the given value - of max_denominator (if any); otherwise a ``ValueError`` exception + of max_denominator (if any); otherwise a :class:`ValueError` exception is raised. EXAMPLES:: @@ -5848,8 +5856,8 @@ def integral_points(self, mw_base='auto', both_signs=False, verbose=False): .. NOTE:: The complexity increases exponentially in the rank of curve - E. The computation time (but not the output!) depends on - the Mordell-Weil basis. If mw_base is given but is not a + `E`. The computation time (but not the output!) depends on + the Mordell-Weil basis. If ``mw_base`` is given but is not a basis for the Mordell-Weil group (modulo torsion), integral points which are not in the subgroup generated by the given points will almost certainly not be listed. @@ -5879,7 +5887,7 @@ def integral_points(self, mw_base='auto', both_signs=False, verbose=False): [2, 3, 4, 8, 11, 14, 21, 37, 52, 93, 342, 406, 816] Total number of integral points: 18 - It is not necessary to specify mw_base; if it is not provided, + It is not necessary to specify ``mw_base``; if it is not provided, then the Mordell-Weil basis must be computed, which may take much longer. diff --git a/src/sage/schemes/elliptic_curves/ell_tate_curve.py b/src/sage/schemes/elliptic_curves/ell_tate_curve.py index 4b7cd3e82c5..de5e43c01a1 100644 --- a/src/sage/schemes/elliptic_curves/ell_tate_curve.py +++ b/src/sage/schemes/elliptic_curves/ell_tate_curve.py @@ -68,7 +68,8 @@ class TateCurve(SageObject): sage: e = EllipticCurve('130a1') sage: eq = e.tate_curve(5); eq - 5-adic Tate curve associated to the Elliptic Curve defined by y^2 + x*y + y = x^3 - 33*x + 68 over Rational Field + 5-adic Tate curve associated to the Elliptic Curve + defined by y^2 + x*y + y = x^3 - 33*x + 68 over Rational Field sage: eq == loads(dumps(eq)) True @@ -87,7 +88,8 @@ def __init__(self, E, p): sage: e = EllipticCurve('130a1') sage: eq = e.tate_curve(2); eq - 2-adic Tate curve associated to the Elliptic Curve defined by y^2 + x*y + y = x^3 - 33*x + 68 over Rational Field + 2-adic Tate curve associated to the Elliptic Curve + defined by y^2 + x*y + y = x^3 - 33*x + 68 over Rational Field """ if not p.is_prime(): raise ValueError("p (=%s) must be a prime" % p) @@ -213,10 +215,9 @@ def curve(self, prec=20): sage: eq = EllipticCurve('130a1').tate_curve(5) sage: eq.curve(prec=5) - Elliptic Curve defined by y^2 + (1+O(5^5))*x*y = x^3 + - (2*5^4+5^5+2*5^6+5^7+3*5^8+O(5^9))*x + - (2*5^3+5^4+2*5^5+5^7+O(5^8)) over 5-adic - Field with capped relative precision 5 + Elliptic Curve defined by y^2 + (1+O(5^5))*x*y = + x^3 + (2*5^4+5^5+2*5^6+5^7+3*5^8+O(5^9))*x + (2*5^3+5^4+2*5^5+5^7+O(5^8)) + over 5-adic Field with capped relative precision 5 """ Eq = getattr(self, "__curve", None) if Eq and Eq.a6().precision_relative() >= prec: @@ -321,9 +322,11 @@ def parametrisation_onto_tate_curve(self, u, prec=None): sage: eq = EllipticCurve('130a1').tate_curve(5) sage: eq.parametrisation_onto_tate_curve(1+5+5^2+O(5^10), prec=10) - (5^-2 + 4*5^-1 + 1 + 2*5 + 3*5^2 + 2*5^5 + 3*5^6 + O(5^7) : 4*5^-3 + 2*5^-1 + 4 + 2*5 + 3*5^4 + 2*5^5 + O(5^6) : 1 + O(5^10)) + (5^-2 + 4*5^-1 + 1 + 2*5 + 3*5^2 + 2*5^5 + 3*5^6 + O(5^7) + : 4*5^-3 + 2*5^-1 + 4 + 2*5 + 3*5^4 + 2*5^5 + O(5^6) : 1 + O(5^10)) sage: eq.parametrisation_onto_tate_curve(1+5+5^2+O(5^10)) - (5^-2 + 4*5^-1 + 1 + 2*5 + 3*5^2 + 2*5^5 + 3*5^6 + O(5^7) : 4*5^-3 + 2*5^-1 + 4 + 2*5 + 3*5^4 + 2*5^5 + O(5^6) : 1 + O(5^10)) + (5^-2 + 4*5^-1 + 1 + 2*5 + 3*5^2 + 2*5^5 + 3*5^6 + O(5^7) + : 4*5^-3 + 2*5^-1 + 4 + 2*5 + 3*5^4 + 2*5^5 + O(5^6) : 1 + O(5^10)) sage: eq.parametrisation_onto_tate_curve(1+5+5^2+O(5^10), prec=20) Traceback (most recent call last): ... @@ -447,7 +450,7 @@ def _inverse_isomorphism(self, prec=20): sage: eq = EllipticCurve('130a1').tate_curve(5) sage: eq._inverse_isomorphism(prec=5) [3 + 2*5 + 3*5^3 + O(5^5), 4 + 2*5 + 4*5^3 + 3*5^4 + O(5^5), - 1 + 5 + 4*5^3 + 2*5^4 + O(5^5), 5 + 2*5^2 + 3*5^4 + O(5^5)] + 1 + 5 + 4*5^3 + 2*5^4 + O(5^5), 5 + 2*5^2 + 3*5^4 + O(5^5)] """ if not self.is_split(): raise RuntimeError("the curve must have split multiplicative " @@ -478,10 +481,12 @@ def lift(self, P, prec=20): Now we map the lift l back and check that it is indeed right.:: sage: eq.parametrisation_onto_original_curve(l) - (4*5^-2 + 2*5^-1 + 4*5 + 3*5^3 + 5^4 + 2*5^5 + 4*5^6 + O(5^7) : 2*5^-3 + 5^-1 + 4 + 4*5 + 5^2 + 3*5^3 + 4*5^4 + O(5^6) : 1 + O(5^10)) + (4*5^-2 + 2*5^-1 + 4*5 + 3*5^3 + 5^4 + 2*5^5 + 4*5^6 + O(5^7) + : 2*5^-3 + 5^-1 + 4 + 4*5 + 5^2 + 3*5^3 + 4*5^4 + O(5^6) : 1 + O(5^10)) sage: e5 = e.change_ring(Qp(5,9)) sage: e5(12*P) - (4*5^-2 + 2*5^-1 + 4*5 + 3*5^3 + 5^4 + 2*5^5 + 4*5^6 + O(5^7) : 2*5^-3 + 5^-1 + 4 + 4*5 + 5^2 + 3*5^3 + 4*5^4 + O(5^6) : 1 + O(5^9)) + (4*5^-2 + 2*5^-1 + 4*5 + 3*5^3 + 5^4 + 2*5^5 + 4*5^6 + O(5^7) + : 2*5^-3 + 5^-1 + 4 + 4*5 + 5^2 + 3*5^3 + 4*5^4 + O(5^6) : 1 + O(5^9)) """ p = self._p R = Qp(self._p, prec) @@ -527,8 +532,8 @@ def parametrisation_onto_original_curve(self, u, prec=None): sage: eq = EllipticCurve('130a1').tate_curve(5) sage: eq.parametrisation_onto_original_curve(1+5+5^2+O(5^10)) (4*5^-2 + 4*5^-1 + 4 + 2*5^3 + 3*5^4 + 2*5^6 + O(5^7) : - 3*5^-3 + 5^-2 + 4*5^-1 + 1 + 4*5 + 5^2 + 3*5^5 + O(5^6) : - 1 + O(5^10)) + 3*5^-3 + 5^-2 + 4*5^-1 + 1 + 4*5 + 5^2 + 3*5^5 + O(5^6) : + 1 + O(5^10)) sage: eq.parametrisation_onto_original_curve(1+5+5^2+O(5^10), prec=20) Traceback (most recent call last): ... diff --git a/src/sage/schemes/elliptic_curves/ell_torsion.py b/src/sage/schemes/elliptic_curves/ell_torsion.py index 7bfda81486a..aa16e32a660 100644 --- a/src/sage/schemes/elliptic_curves/ell_torsion.py +++ b/src/sage/schemes/elliptic_curves/ell_torsion.py @@ -7,7 +7,7 @@ - Nick Alexander: original implementation over `\QQ` - Chris Wuthrich: original implementation over number fields - John Cremona: rewrote p-primary part to use division - polynomials, added some features, unified Number Field and `\QQ` code. + polynomials, added some features, unified Number Field and `\QQ` code. """ # **************************************************************************** @@ -43,7 +43,8 @@ class EllipticCurveTorsionSubgroup(groups.AdditiveAbelianGroupWrapper): sage: E = EllipticCurve([-4, 0]); E Elliptic Curve defined by y^2 = x^3 - 4*x over Rational Field sage: G = E.torsion_subgroup(); G - Torsion Subgroup isomorphic to Z/2 + Z/2 associated to the Elliptic Curve defined by y^2 = x^3 - 4*x over Rational Field + Torsion Subgroup isomorphic to Z/2 + Z/2 associated to the + Elliptic Curve defined by y^2 = x^3 - 4*x over Rational Field sage: G.order() 4 sage: G.gen(0) @@ -58,12 +59,13 @@ class EllipticCurveTorsionSubgroup(groups.AdditiveAbelianGroupWrapper): sage: E = EllipticCurve([17, -120, -60, 0, 0]); E Elliptic Curve defined by y^2 + 17*x*y - 60*y = x^3 - 120*x^2 over Rational Field sage: G = E.torsion_subgroup(); G - Torsion Subgroup isomorphic to Trivial group associated to the Elliptic Curve defined by y^2 + 17*x*y - 60*y = x^3 - 120*x^2 over Rational Field + Torsion Subgroup isomorphic to Trivial group associated to the + Elliptic Curve defined by y^2 + 17*x*y - 60*y = x^3 - 120*x^2 over Rational Field sage: G.gens() () - sage: e = EllipticCurve([0, 33076156654533652066609946884,0,\ - 347897536144342179642120321790729023127716119338758604800,\ - 1141128154369274295519023032806804247788154621049857648870032370285851781352816640000]) + sage: e = EllipticCurve([0, 33076156654533652066609946884, 0, + ....: 347897536144342179642120321790729023127716119338758604800, + ....: 1141128154369274295519023032806804247788154621049857648870032370285851781352816640000]) sage: e.torsion_order() 16 @@ -73,11 +75,11 @@ class EllipticCurveTorsionSubgroup(groups.AdditiveAbelianGroupWrapper): sage: T = E.torsion_subgroup() sage: [E(t) for t in T] [(0 : 1 : 0), - (9 : 23 : 1), - (2 : 2 : 1), - (1 : -1 : 1), - (2 : -5 : 1), - (9 : -33 : 1)] + (9 : 23 : 1), + (2 : 2 : 1), + (1 : -1 : 1), + (2 : -5 : 1), + (9 : -33 : 1)] An example where the torsion subgroup is not cyclic:: @@ -91,21 +93,24 @@ class EllipticCurveTorsionSubgroup(groups.AdditiveAbelianGroupWrapper): sage: E = EllipticCurve('37a1') sage: T = E.torsion_subgroup() sage: T - Torsion Subgroup isomorphic to Trivial group associated to the Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field + Torsion Subgroup isomorphic to Trivial group associated to the + Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field sage: [E(t) for t in T] [(0 : 1 : 0)] Examples over other Number Fields:: sage: E = EllipticCurve('11a1') - sage: K. = NumberField(x^2+1) + sage: K. = NumberField(x^2 + 1) sage: EK = E.change_ring(K) sage: from sage.schemes.elliptic_curves.ell_torsion import EllipticCurveTorsionSubgroup sage: EllipticCurveTorsionSubgroup(EK) - Torsion Subgroup isomorphic to Z/5 associated to the Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in i with defining polynomial x^2 + 1 + Torsion Subgroup isomorphic to Z/5 associated to the + Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) + over Number Field in i with defining polynomial x^2 + 1 sage: E = EllipticCurve('11a1') - sage: K. = NumberField(x^2+1) + sage: K. = NumberField(x^2 + 1) sage: EK = E.change_ring(K) sage: T = EK.torsion_subgroup() sage: T.ngens() @@ -116,7 +121,9 @@ class EllipticCurveTorsionSubgroup(groups.AdditiveAbelianGroupWrapper): Note: this class is normally constructed indirectly as follows:: sage: T = EK.torsion_subgroup(); T - Torsion Subgroup isomorphic to Z/5 associated to the Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in i with defining polynomial x^2 + 1 + Torsion Subgroup isomorphic to Z/5 associated to the + Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) + over Number Field in i with defining polynomial x^2 + 1 sage: type(T) @@ -141,12 +148,16 @@ def __init__(self, E): sage: K. = NumberField(x^2+1) sage: EK = E.change_ring(K) sage: EllipticCurveTorsionSubgroup(EK) - Torsion Subgroup isomorphic to Z/5 associated to the Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in i with defining polynomial x^2 + 1 + Torsion Subgroup isomorphic to Z/5 associated to the + Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) + over Number Field in i with defining polynomial x^2 + 1 Note: this class is normally constructed indirectly as follows:: sage: T = EK.torsion_subgroup(); T - Torsion Subgroup isomorphic to Z/5 associated to the Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in i with defining polynomial x^2 + 1 + Torsion Subgroup isomorphic to Z/5 associated to the + Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) + over Number Field in i with defining polynomial x^2 + 1 sage: type(T) @@ -234,7 +245,7 @@ def curve(self): EXAMPLES:: sage: E = EllipticCurve('11a1') - sage: K. = NumberField(x^2+1) + sage: K. = NumberField(x^2 + 1) sage: EK = E.change_ring(K) sage: T = EK.torsion_subgroup() sage: T.curve() is EK @@ -252,7 +263,7 @@ def points(self): EXAMPLES:: sage: K. = NumberField(x^2 + 1) - sage: E = EllipticCurve(K,[0,0,0,1,0]) + sage: E = EllipticCurve(K, [0,0,0,1,0]) sage: tor = E.torsion_subgroup() sage: tor.points() [(0 : 1 : 0), (0 : 0 : 1), (-i : 0 : 1), (i : 0 : 1)] @@ -269,7 +280,7 @@ def torsion_bound(E, number_of_places=20): - ``E`` -- an elliptic curve over `\QQ` or a number field - ``number_of_places`` (positive integer, default = 20) -- the - number of places that will be used to find the bound + number of places that will be used to find the bound OUTPUT: @@ -301,8 +312,8 @@ def torsion_bound(E, number_of_places=20): sage: R. = QQ[] sage: F. = QuadraticField(5) - sage: K. = F.extension(x^2-3) - sage: E = EllipticCurve(K,[0,0,0,b,1]) + sage: K. = F.extension(x^2 - 3) + sage: E = EllipticCurve(K, [0,0,0,b,1]) sage: E.torsion_subgroup().order() 1 diff --git a/src/sage/schemes/elliptic_curves/ell_wp.py b/src/sage/schemes/elliptic_curves/ell_wp.py index 4fc3bdd503b..b9c0d624537 100644 --- a/src/sage/schemes/elliptic_curves/ell_wp.py +++ b/src/sage/schemes/elliptic_curves/ell_wp.py @@ -205,10 +205,10 @@ def compute_wp_quadratic(k, A, B, prec): INPUT: - - ``k`` -- the field of definition of the curve - - ``A`` -- and - - ``B`` -- the coefficients of the elliptic curve - - ``prec`` -- the precision to which we compute the series. + - ``k`` -- the field of definition of the curve + - ``A`` -- and + - ``B`` -- the coefficients of the elliptic curve + - ``prec`` -- the precision to which we compute the series. OUTPUT: @@ -261,10 +261,10 @@ def compute_wp_fast(k, A, B, m): INPUT: - - ``k`` -- the base field of the curve - - ``A`` -- and - - ``B`` -- as the coefficients of the short Weierstrass model `y^2 = x^3 +Ax +B`, and - - ``m`` -- the precision to which the function is computed to. + - ``k`` -- the base field of the curve + - ``A`` -- and + - ``B`` -- as the coefficients of the short Weierstrass model `y^2 = x^3 +Ax +B`, and + - ``m`` -- the precision to which the function is computed to. OUTPUT: diff --git a/src/sage/schemes/elliptic_curves/formal_group.py b/src/sage/schemes/elliptic_curves/formal_group.py index 3e481809da5..a47ab2d58cf 100644 --- a/src/sage/schemes/elliptic_curves/formal_group.py +++ b/src/sage/schemes/elliptic_curves/formal_group.py @@ -396,7 +396,7 @@ def log(self, prec=20): def inverse(self, prec=20): r""" - Return the formal group inverse law i(t), which satisfies F(t, i(t)) = 0. + Return the formal group inverse law `i(t)`, which satisfies `F(t, i(t)) = 0`. INPUT: @@ -455,8 +455,8 @@ def group_law(self, prec=10): - ``prec`` -- integer (default: 10) - OUTPUT: a power series with given precision in R[['t1','t2']], where - the curve is defined over R. + OUTPUT: a power series with given precision in `R[[t_1,t_2]]`, where + the curve is defined over `R`. Return the formal power series @@ -464,7 +464,7 @@ def group_law(self, prec=10): F(t_1, t_2) = t_1 + t_2 - a_1 t_1 t_2 - \cdots - to precision `O(t1,t2)^{prec}` of page 115 of [Sil2009]_. + to precision `O(t_1,t_2)^{prec}` of page 115 of [Sil2009]_. The result is cached, and a cached version is returned if possible. diff --git a/src/sage/schemes/elliptic_curves/gal_reps.py b/src/sage/schemes/elliptic_curves/gal_reps.py index 056268eb230..8809d8d2990 100644 --- a/src/sage/schemes/elliptic_curves/gal_reps.py +++ b/src/sage/schemes/elliptic_curves/gal_reps.py @@ -262,9 +262,7 @@ def is_reducible(self, p): - ``p`` -- a prime number - OUTPUT: - - - a boolean + OUTPUT: A boolean. The answer is cached. @@ -315,9 +313,7 @@ def is_irreducible(self, p): - ``p`` -- a prime number - OUTPUT: - - - a boolean + OUTPUT: A boolean. EXAMPLES:: @@ -715,9 +711,7 @@ def image_type(self, p): - ``p`` a prime number - OUTPUT: - - - a string. + OUTPUT: A string. EXAMPLES:: @@ -1254,9 +1248,7 @@ def is_unramified(self,p,ell): - ``p`` a prime - ``ell`` another prime - OUTPUT: - - - Boolean + OUTPUT: A boolean. EXAMPLES:: @@ -1289,9 +1281,7 @@ def is_unipotent(self,p,ell): - ``p`` a prime - ``ell`` a different prime - OUTPUT: - - - Boolean + OUTPUT: A boolean. EXAMPLES:: @@ -1328,9 +1318,7 @@ def is_quasi_unipotent(self,p,ell): - ``p`` a prime - ``ell`` a different prime - OUTPUT: - - - Boolean + OUTPUT: A boolean. EXAMPLES:: @@ -1360,9 +1348,7 @@ def is_ordinary(self,p): - ``p`` a prime - OUTPUT: - - - a Boolean + OUTPUT: A boolean. EXAMPLES:: @@ -1390,9 +1376,7 @@ def is_crystalline(self,p): - ``p`` a prime - OUTPUT: - - - a Boolean + OUTPUT: A boolean. EXAMPLES:: @@ -1417,9 +1401,7 @@ def is_potentially_crystalline(self,p): - ``p`` a prime - OUTPUT: - - - a Boolean + OUTPUT: A boolean. EXAMPLES:: @@ -1444,9 +1426,7 @@ def is_semistable(self,p): - ``p`` a prime - OUTPUT: - - - a Boolean + OUTPUT: A boolean. EXAMPLES:: @@ -1472,9 +1452,7 @@ def is_potentially_semistable(self,p): - ``p`` a prime - OUTPUT: - - - a Boolean + OUTPUT: A boolean. EXAMPLES:: diff --git a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py index 82127860fd3..39ae6a8878e 100644 --- a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py +++ b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py @@ -1154,9 +1154,9 @@ def Billerey_P_l(E, l): sage: from sage.schemes.elliptic_curves.gal_reps_number_field import Billerey_P_l sage: [Billerey_P_l(E,l) for l in primes(10)] [x^2 + 8143*x + 16777216, - x^2 + 451358*x + 282429536481, - x^4 - 664299076*x^3 + 205155493652343750*x^2 - 39595310449600219726562500*x + 3552713678800500929355621337890625, - x^4 - 207302404*x^3 - 377423798538689366394*x^2 - 39715249826471656586987520004*x + 36703368217294125441230211032033660188801] + x^2 + 451358*x + 282429536481, + x^4 - 664299076*x^3 + 205155493652343750*x^2 - 39595310449600219726562500*x + 3552713678800500929355621337890625, + x^4 - 207302404*x^3 - 377423798538689366394*x^2 - 39715249826471656586987520004*x + 36703368217294125441230211032033660188801] """ K = E.base_field() qq = K.primes_above(l) @@ -1190,11 +1190,11 @@ def Billerey_B_l(E,l,B=0): sage: from sage.schemes.elliptic_curves.gal_reps_number_field import Billerey_B_l sage: [Billerey_B_l(E,l) for l in primes(15)] [1123077552537600, - 227279663773903886745600, - 0, - 0, - 269247154818492941287713746693964214802283882086400, - 0] + 227279663773903886745600, + 0, + 0, + 269247154818492941287713746693964214802283882086400, + 0] """ d = E.base_field().absolute_degree() P = Billerey_P_l(E, l) diff --git a/src/sage/schemes/elliptic_curves/heegner.py b/src/sage/schemes/elliptic_curves/heegner.py index f75315a6d45..3b000ac86dc 100644 --- a/src/sage/schemes/elliptic_curves/heegner.py +++ b/src/sage/schemes/elliptic_curves/heegner.py @@ -240,16 +240,16 @@ def __init__(self, D, c, check=True): """ INPUT: - - `D` -- discriminant of quadratic imaginary field + - `D` -- discriminant of quadratic imaginary field - - `c` -- conductor (positive integer coprime to `D`) + - `c` -- conductor (positive integer coprime to `D`) - - ``check`` -- bool (default: ``True``); whether to check - validity of input + - ``check`` -- bool (default: ``True``); whether to check + validity of input EXAMPLES:: - sage: sage.schemes.elliptic_curves.heegner.RingClassField(-7,5, False) + sage: sage.schemes.elliptic_curves.heegner.RingClassField(-7, 5, False) Ring class field extension of QQ[sqrt(-7)] of conductor 5 """ if check: @@ -531,7 +531,7 @@ def galois_group(self, base=QQ): INPUT: - - ``base`` -- (default: `\QQ`) a subfield of ``self`` or `\QQ` + - ``base`` -- (default: `\QQ`) a subfield of ``self`` or `\QQ` EXAMPLES:: @@ -623,9 +623,9 @@ def __init__(self, field, base=QQ): r""" INPUT: - - ``field`` -- a ring class field + - ``field`` -- a ring class field - - ``base`` -- subfield of field (default: `\QQ`) + - ``base`` -- subfield of field (default: `\QQ`) EXAMPLES:: @@ -699,11 +699,9 @@ def __call__(self, x): INPUT: - - `x` -- automorphism or quadratic field element + - `x` -- automorphism or quadratic field element - OUTPUT: - - - automorphism (or TypeError) + OUTPUT: An automorphism (or ``TypeError``) EXAMPLES:: @@ -814,7 +812,7 @@ def kolyvagin_generators(self): OUTPUT: - - list of elements of ``self`` + - list of elements of ``self`` EXAMPLES:: @@ -854,7 +852,7 @@ def lift_of_hilbert_class_field_galois_group(self): OUTPUT: - - tuple of elements of self + - tuple of elements of self EXAMPLES:: @@ -891,14 +889,14 @@ def _list(self): Example with order 1 (a special case):: - sage: E = EllipticCurve('389a'); F= E.heegner_point(-7,1).ring_class_field() + sage: E = EllipticCurve('389a'); F = E.heegner_point(-7,1).ring_class_field() sage: G = F.galois_group(F.quadratic_field()) sage: G._list() (Class field automorphism defined by x^2 + x*y + 2*y^2,) Example over quadratic imaginary field:: - sage: E = EllipticCurve('389a'); F= E.heegner_point(-7,5).ring_class_field() + sage: E = EllipticCurve('389a'); F = E.heegner_point(-7,5).ring_class_field() sage: G = F.galois_group(F.quadratic_field()) sage: G._list() (Class field automorphism defined by x^2 + x*y + 44*y^2, @@ -961,12 +959,11 @@ def _quadratic_form_to_alpha(self, f): """ INPUT: - - `f` -- a binary quadratic form with discriminant `c^2 D` + - `f` -- a binary quadratic form with discriminant `c^2 D` OUTPUT: - - an element of the ring of integers of the quadratic - imaginary field + - an element of the ring of integers of the quadratic imaginary field EXAMPLES:: @@ -1000,7 +997,7 @@ def _alpha_to_automorphism(self, alpha): INPUT: - - `\alpha` -- element of quadratic imaginary field coprime to conductor + - `\alpha` -- element of quadratic imaginary field coprime to conductor EXAMPLES:: @@ -1032,12 +1029,11 @@ def _alpha_to_p1_element(self, alpha): INPUT: - - `\alpha` -- element of the ring of integers of the - quadratic imaginary field + - `\alpha` -- element of the ring of integers of the quadratic imaginary field OUTPUT: - - 2-tuple of integers + - 2-tuple of integers EXAMPLES:: @@ -1078,11 +1074,11 @@ def _p1_element_to_alpha(self, uv): INPUT: - - ``uv`` -- pair of integers + - ``uv`` -- pair of integers OUTPUT: - - element of maximal order of quadratic field + - element of maximal order of quadratic field EXAMPLES:: @@ -1269,7 +1265,7 @@ def __init__(self, parent): """ INPUT: - - ``parent`` -- a group of automorphisms of a ring class field + - ``parent`` -- a group of automorphisms of a ring class field EXAMPLES:: @@ -1454,15 +1450,14 @@ def __init__(self, parent, quadratic_form, alpha=None): r""" INPUT: - - ``parent`` -- a group of automorphisms of a ring class field + - ``parent`` -- a group of automorphisms of a ring class field - - ``quadratic_form`` -- a binary quadratic form that - defines an element of the Galois group of `K_c` over `K`. + - ``quadratic_form`` -- a binary quadratic form that + defines an element of the Galois group of `K_c` over `K`. - - ``\alpha`` -- (default: ``None``) optional data that specified - element corresponding element of `(\mathcal{O}_K / - c\mathcal{O}_K)^* / (\ZZ/c\ZZ)^*`, via class field - theory. + - ``\alpha`` -- (default: ``None``) optional data that specified + element corresponding element of `(\mathcal{O}_K / + c\mathcal{O}_K)^* / (\ZZ/c\ZZ)^*`, via class field theory. EXAMPLES:: @@ -1980,7 +1975,7 @@ def __init__(self, N): """ INPUT: - - `N` -- level, a positive integer + - `N` -- level, a positive integer EXAMPLES:: @@ -2068,7 +2063,7 @@ def reduce_mod(self, ell): INPUT: - - `\ell` -- prime + - `\ell` -- prime EXAMPLES:: @@ -2084,11 +2079,11 @@ def discriminants(self, n=10, weak=False): INPUT: - - `n` -- nonnegative integer + - `n` -- nonnegative integer - - ``weak`` -- bool (default: ``False``); if ``True`` only require - weak Heegner hypothesis, which is the same as usual but - without the condition that `\gcd(D,N)=1`. + - ``weak`` -- bool (default: ``False``); if ``True`` only require + weak Heegner hypothesis, which is the same as usual but + without the condition that `\gcd(D,N)=1`. EXAMPLES:: @@ -2150,9 +2145,9 @@ def __init__(self, N, D): """ INPUT: - - `N` -- positive integer + - `N` -- positive integer - - `D` -- negative fundamental discriminant + - `D` -- negative fundamental discriminant EXAMPLES:: @@ -2250,13 +2245,13 @@ def kolyvagin_conductors(self, r=None, n=10, E=None, m=None): INPUT: - - `r` -- (default: ``None``) nonnegative integer or ``None`` + - `r` -- (default: ``None``) nonnegative integer or ``None`` - - `n` -- positive integer + - `n` -- positive integer - - `E` -- an elliptic curve + - `E` -- an elliptic curve - - `m` -- a positive integer + - `m` -- a positive integer EXAMPLES:: @@ -2312,17 +2307,17 @@ def is_kolyvagin_conductor(N, E, D, r, n, c): INPUT: - - `N` -- level (positive integer) + - `N` -- level (positive integer) - - `E` -- elliptic curve or ``None`` + - `E` -- elliptic curve or ``None`` - - `D` -- negative fundamental discriminant + - `D` -- negative fundamental discriminant - - `r` -- number of prime factors (nonnegative integer) or ``None`` + - `r` -- number of prime factors (nonnegative integer) or ``None`` - - `n` -- torsion order (i.e., do we get class in `(E(K_c)/n E(K_c))^{Gal(K_c/K)}`?) + - `n` -- torsion order (i.e., do we get class in `(E(K_c)/n E(K_c))^{Gal(K_c/K)}`?) - - `c` -- conductor (positive integer) + - `c` -- conductor (positive integer) EXAMPLES:: @@ -2400,11 +2395,11 @@ def __init__(self, N, D, c=ZZ(1)): INPUT: - - `N` -- positive integer (the level) + - `N` -- positive integer (the level) - - `D` -- negative fundamental discriminant + - `D` -- negative fundamental discriminant - - `c` -- conductor (default: 1) + - `c` -- conductor (default: 1) EXAMPLES:: @@ -2690,18 +2685,18 @@ def __init__(self, N, D, c=ZZ(1), f=None, check=True): r""" INPUT: - - `N` -- positive integer + - `N` -- positive integer - - `D` -- fundamental discriminant, a negative integer + - `D` -- fundamental discriminant, a negative integer - - `c` -- conductor, a positive integer coprime to `N` + - `c` -- conductor, a positive integer coprime to `N` - - `f` -- binary quadratic form, 3-tuple `(A,B,C)` of coefficients - of `AX^2 + BXY + CY^2`, or element of quadratic imaginary - field `\QQ(\sqrt{D})` in the upper half plan. + - `f` -- binary quadratic form, 3-tuple `(A,B,C)` of coefficients + of `AX^2 + BXY + CY^2`, or element of quadratic imaginary + field `\QQ(\sqrt{D})` in the upper half plan. - - ``check`` -- bool, default: ``True``. should not be used - except internally. + - ``check`` -- bool, default: ``True``. should not be used + except internally. EXAMPLES:: @@ -2812,7 +2807,7 @@ def atkin_lehner_act(self, Q=None): INPUT: - - `Q` -- positive divisor of `N`; if not given, default to `N` + - `Q` -- positive divisor of `N`; if not given, default to `N` EXAMPLES:: @@ -3040,7 +3035,7 @@ def satisfies_kolyvagin_hypothesis(self, n=None): INPUT: - `n` -- positive integer + - `n` -- positive integer EXAMPLES:: @@ -3230,7 +3225,7 @@ def _trace_index(self, *args, **kwds): OUTPUT: - - ``Integer`` -- returns an integer + - ``Integer`` -- returns an integer EXAMPLES:: @@ -3308,7 +3303,7 @@ def numerical_approx(self, prec=53, algorithm=None): INPUT: - - prec -- (default: ``None``) the working precision + - prec -- (default: ``None``) the working precision EXAMPLES:: @@ -3397,15 +3392,15 @@ def x_poly_exact(self, prec=53, algorithm='lll'): INPUT: - - ``prec`` -- integer (default: 53) + - ``prec`` -- integer (default: 53) - - ``algorithm`` -- 'conjugates' or 'lll' (default); if - 'conjugates', compute numerically all the - conjugates ``y[i]`` of the Heegner point and construct - the characteristic polynomial as the product - `f(X)=(X-y[i])`. If 'lll', compute only one of the - conjugates ``y[0]``, then uses the LLL algorithm to - guess `f(X)`. + - ``algorithm`` -- 'conjugates' or 'lll' (default); if + 'conjugates', compute numerically all the + conjugates ``y[i]`` of the Heegner point and construct + the characteristic polynomial as the product + `f(X)=(X-y[i])`. If 'lll', compute only one of the + conjugates ``y[0]``, then uses the LLL algorithm to + guess `f(X)`. EXAMPLES: @@ -3425,7 +3420,8 @@ def x_poly_exact(self, prec=53, algorithm='lll'): sage: P.x_poly_exact() Traceback (most recent call last): ... - ValueError: insufficient precision to determine Heegner point (fails discriminant test) + ValueError: insufficient precision to determine Heegner point + (fails discriminant test) sage: P.x_poly_exact(120) x^6 + 10/7*x^5 - 867/49*x^4 - 76/245*x^3 + 3148/35*x^2 - 25944/245*x + 48771/1225 sage: E.heegner_point(-7,11).x_poly_exact(500) @@ -3471,7 +3467,7 @@ def _check_poly_discriminant(self, f): INPUT: - - `f` -- a polynomial + - `f` -- a polynomial EXAMPLES:: @@ -3518,17 +3514,17 @@ def point_exact(self, prec=53, algorithm='lll', var='a', optimize=False): INPUT: - - ``prec`` -- integer (default: 53) + - ``prec`` -- integer (default: 53) - - ``algorithm`` -- see the description of the algorithm - parameter for the ``x_poly_exact`` method. + - ``algorithm`` -- see the description of the algorithm + parameter for the ``x_poly_exact`` method. - - ``var`` -- string (default: 'a') + - ``var`` -- string (default: 'a') - - ``optimize`` -- bool (default; False) if ``True``, try to - optimize defining polynomial for the number field that - the point is defined over. Off by default, since this - can be very expensive. + - ``optimize`` -- bool (default; False) if ``True``, try to + optimize defining polynomial for the number field that + the point is defined over. Off by default, since this + can be very expensive. EXAMPLES:: @@ -3630,7 +3626,7 @@ def _numerical_approx_conjugates_over_QQ(self, prec=53): INPUT: - - ``prec`` -- positive integer (default: 53) + - ``prec`` -- positive integer (default: 53) EXAMPLES:: @@ -3661,11 +3657,11 @@ def _numerical_approx_xy_poly(self, prec=53): INPUT: - - ``prec`` -- positive integer (default: 53) + - ``prec`` -- positive integer (default: 53) OUTPUT: - - 2-tuple of polynomials with floating point coefficients + - 2-tuple of polynomials with floating point coefficients EXAMPLES:: @@ -3693,13 +3689,13 @@ def _xy_poly_nearby(self, prec=53, max_error=10**(-10)): INPUT: - - ``prec`` -- positive integer (default: 53) + - ``prec`` -- positive integer (default: 53) - - ``max_error`` -- very small floating point number + - ``max_error`` -- very small floating point number OUTPUT: - - 2-tuple of polynomials with rational coefficients + - 2-tuple of polynomials with rational coefficients EXAMPLES:: @@ -3721,9 +3717,9 @@ def _xy_poly_simplest(self, prec=53, prec2=None): INPUT: - - ``prec`` -- positive integer (default: 53) + - ``prec`` -- positive integer (default: 53) - - ``prec2`` -- passed into simplest_rational_poly function + - ``prec2`` -- passed into simplest_rational_poly function EXAMPLES:: @@ -3765,7 +3761,7 @@ def _trace_numerical_conductor_1(self, prec=53): INPUT: - - `prec` -- bits precision (default: 53) + - `prec` -- bits precision (default: 53) EXAMPLES:: @@ -3879,7 +3875,7 @@ def _qf_to_tau(self, f): INPUT: - - `f` -- binary quadratic form + - `f` -- binary quadratic form EXAMPLES:: @@ -3902,7 +3898,7 @@ def _qf_from_tau(self, tau): INPUT: - - `\tau` -- quadratic element of the upper half plane + - `\tau` -- quadratic element of the upper half plane EXAMPLES:: @@ -3933,13 +3929,13 @@ def _qf_atkin_lehner_act(self, Q, f): INPUT: - - `Q` -- integer that divides the level `N` + - `Q` -- integer that divides the level `N` - - `f` -- quadratic form + - `f` -- quadratic form OUTPUT: - - quadratic form + - quadratic form EXAMPLES:: @@ -3987,9 +3983,9 @@ def kolyvagin_cohomology_class(self, n=None): INPUT: - - `n` -- positive integer that divides the gcd of `a_p` - and `p+1` for all `p` dividing the conductor. If `n` is - ``None``, choose the largest valid `n`. + - `n` -- positive integer that divides the gcd of `a_p` + and `p+1` for all `p` dividing the conductor. If `n` is + ``None``, choose the largest valid `n`. EXAMPLES:: @@ -4147,7 +4143,7 @@ def numerical_approx(self, prec=53): INPUT: - - ``prec`` -- precision in bits (default: 53) + - ``prec`` -- precision in bits (default: 53) EXAMPLES:: @@ -4176,7 +4172,7 @@ def point_exact(self, prec=53): """ INPUT: - - ``prec`` -- precision in bits (default: 53) + - ``prec`` -- precision in bits (default: 53) EXAMPLES: @@ -4346,9 +4342,9 @@ def _recognize_point_over_QQ(self, P, n): INPUT: - - `P` -- numerical approximation for a point on `E` + - `P` -- numerical approximation for a point on `E` - - `n` -- upper bound on divisibility index of `P` in group `E(\QQ)` + - `n` -- upper bound on divisibility index of `P` in group `E(\QQ)` EXAMPLES:: @@ -4465,9 +4461,9 @@ def kolyvagin_cohomology_class(self, n=None): """ INPUT: - - `n` -- positive integer that divides the gcd of `a_p` - and `p+1` for all `p` dividing the conductor. If `n` is - ``None``, choose the largest valid `n`. + - `n` -- positive integer that divides the gcd of `a_p` + and `p+1` for all `p` dividing the conductor. If `n` is + ``None``, choose the largest valid `n`. EXAMPLES:: @@ -4657,9 +4653,9 @@ def __init__(self, level, ell): r""" INPUT: - - ``level`` -- the level (a positive integer) + - ``level`` -- the level (a positive integer) - - `\ell` -- the characteristic, a prime coprime to the level + - `\ell` -- the characteristic, a prime coprime to the level EXAMPLES:: @@ -4747,13 +4743,11 @@ def satisfies_heegner_hypothesis(self, D, c=ZZ(1)): INPUT: - - `D` -- negative integer - - - `c` -- positive integer (default: 1) + - `D` -- negative integer - OUTPUT: + - `c` -- positive integer (default: 1) - - bool + OUTPUT: A boolean. EXAMPLES:: @@ -4786,11 +4780,9 @@ def heegner_discriminants(self, n=5): INPUT: - - `n` -- positive integer (default: 5) - - OUTPUT: + - `n` -- positive integer (default: 5) - - list + OUTPUT: A list. EXAMPLES:: @@ -4817,14 +4809,11 @@ def heegner_conductors(self, D, n=5): INPUT: - - `D` -- negative integer; a fundamental Heegner - discriminant - - - `n` -- positive integer (default: 5) + - `D` -- negative integer; a fundamental Heegner discriminant - OUTPUT: + - `n` -- positive integer (default: 5) - - list + OUTPUT: A list. EXAMPLES:: @@ -4928,8 +4917,10 @@ def left_orders(self): EXAMPLES:: sage: heegner_points(11).reduce_mod(3).left_orders() - [Order of Quaternion Algebra (-1, -3) with base ring Rational Field with basis (1/2 + 1/2*j + 7*k, 1/2*i + 13/2*k, j + 3*k, 11*k), - Order of Quaternion Algebra (-1, -3) with base ring Rational Field with basis (1/2 + 1/2*j + 7*k, 1/4*i + 1/2*j + 63/4*k, j + 14*k, 22*k)] + [Order of Quaternion Algebra (-1, -3) with base ring Rational Field + with basis (1/2 + 1/2*j + 7*k, 1/2*i + 13/2*k, j + 3*k, 11*k), + Order of Quaternion Algebra (-1, -3) with base ring Rational Field + with basis (1/2 + 1/2*j + 7*k, 1/4*i + 1/2*j + 63/4*k, j + 14*k, 22*k)] """ return [I.left_order() for I in self.right_ideals()] @@ -4947,13 +4938,11 @@ def heegner_divisor(self, D, c=ZZ(1)): INPUT: - - `D` -- discriminant (negative integer) - - - `c` -- conductor (positive integer) + - `D` -- discriminant (negative integer) - OUTPUT: + - `c` -- conductor (positive integer) - - Brandt module element + OUTPUT: A Brandt module element. EXAMPLES:: @@ -5013,11 +5002,9 @@ def modp_splitting_data(self, p): INPUT: - - `p` -- unramified odd prime + - `p` -- unramified odd prime - OUTPUT: - - - 2-tuple of matrices over finite field + OUTPUT: A 2-tuple of matrices over finite field. EXAMPLES:: @@ -5100,7 +5087,7 @@ def modp_splitting_map(self, p): INPUT: - - `p` -- prime number + - `p` -- prime number EXAMPLES:: @@ -5133,11 +5120,10 @@ def cyclic_subideal_p1(self, I, c): INPUT: - - `I` -- right ideal of Eichler order or in quaternion algebra + - `I` -- right ideal of Eichler order or in quaternion algebra - - `c` -- square free integer (currently must be odd prime - and coprime to level, discriminant, characteristic, - etc. + - `c` -- square free integer (currently must be odd prime + and coprime to level, discriminant, characteristic, etc. OUTPUT: @@ -5190,16 +5176,17 @@ def galois_group_over_hilbert_class_field(self, D, c): INPUT: - - `D` -- fundamental discriminant + - `D` -- fundamental discriminant - - `c` -- conductor (square-free integer) + - `c` -- conductor (square-free integer) EXAMPLES:: sage: N = 37; D = -7; ell = 17; c = 41; p = 3 sage: H = heegner_points(N).reduce_mod(ell) sage: H.galois_group_over_hilbert_class_field(D, c) - Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 41 over Hilbert class field of QQ[sqrt(-7)] + Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 41 + over Hilbert class field of QQ[sqrt(-7)] """ Kc = heegner_points(self.level(), D, c).ring_class_field() K1 = heegner_points(self.level(), D, 1).ring_class_field() @@ -5213,16 +5200,18 @@ def galois_group_over_quadratic_field(self, D, c): INPUT: - - `D` -- fundamental discriminant + - `D` -- fundamental discriminant - - `c` -- conductor (square-free integer) + - `c` -- conductor (square-free integer) EXAMPLES:: sage: N = 37; D = -7; ell = 17; c = 41; p = 3 sage: H = heegner_points(N).reduce_mod(ell) sage: H.galois_group_over_quadratic_field(D, c) - Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 41 over Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 with sqrt_minus_7 = 2.645751311064591?*I + Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 41 + over Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 + with sqrt_minus_7 = 2.645751311064591?*I """ Kc = heegner_points(self.level(), D, c).ring_class_field() return Kc.galois_group(Kc.quadratic_field()) @@ -5235,11 +5224,9 @@ def quadratic_field(self, D): INPUT: - - `D` -- fundamental discriminant - - OUTPUT: + - `D` -- fundamental discriminant - - a quadratic number field + OUTPUT: A quadratic number field. EXAMPLES:: @@ -5259,17 +5246,14 @@ def kolyvagin_cyclic_subideals(self, I, p, alpha_quaternion): INPUT: - - `I` -- right ideal of the quaternion algebra - - - `p` -- prime number + - `I` -- right ideal of the quaternion algebra - - ``alpha_quaternion`` -- image in the quaternion algebra - of generator `\alpha` for - `(\mathcal{O}_K / c\mathcal{O}_K)^* / (\ZZ/c\ZZ)^*`. + - `p` -- prime number - OUTPUT: + - ``alpha_quaternion`` -- image in the quaternion algebra + of generator `\alpha` for `(\mathcal{O}_K / c\mathcal{O}_K)^* / (\ZZ/c\ZZ)^*`. - - list of 2-tuples + OUTPUT: A list of 2-tuples. EXAMPLES:: @@ -5303,9 +5287,9 @@ def kolyvagin_generator(self, K, p): INPUT: - - `K` -- quadratic imaginary field + - `K` -- quadratic imaginary field - - `p` -- inert prime + - `p` -- inert prime EXAMPLES:: @@ -5316,7 +5300,7 @@ def kolyvagin_generator(self, K, p): sage: H.kolyvagin_generator(f.domain().number_field(), 5) a + 1 - This function requires that p be prime, but kolyvagin_generators works in general:: + This function requires that `p` be prime, but ``kolyvagin_generators`` works in general:: sage: H.kolyvagin_generator(f.domain().number_field(), 5*17) Traceback (most recent call last): @@ -5354,9 +5338,9 @@ def kolyvagin_generators(self, K, c): INPUT: - - `K` -- quadratic imaginary field + - `K` -- quadratic imaginary field - - `c` -- square free product of inert prime + - `c` -- square free product of inert prime EXAMPLES:: @@ -5395,15 +5379,15 @@ def kolyvagin_sigma_operator(self, D, c, r, bound=None): INPUT: - - `D` -- fundamental discriminant + - `D` -- fundamental discriminant - - `c` -- conductor (square-free integer, need not be prime) + - `c` -- conductor (square-free integer, need not be prime) - - `r` -- nonnegative integer + - `r` -- nonnegative integer - - ``bound`` -- (default: ``None``), if given, controls - precision of computation of theta series, which could - impact performance, but does not impact correctness + - ``bound`` -- (default: ``None``), if given, controls + precision of computation of theta series, which could + impact performance, but does not impact correctness EXAMPLES: @@ -5517,11 +5501,11 @@ def modp_dual_elliptic_curve_factor(self, E, p, bound=10): INPUT: - - `E` -- elliptic curve of conductor equal to the level of self + - `E` -- elliptic curve of conductor equal to the level of ``self`` - - `p` -- prime number + - `p` -- prime number - - `bound` -- positive integer (default: 10) + - ``bound`` -- positive integer (default: 10) EXAMPLES:: @@ -5565,13 +5549,11 @@ def rational_kolyvagin_divisor(self, D, c): INPUT: - - `D` -- discriminant (negative integer) + - `D` -- discriminant (negative integer) - - `c` -- conductor (positive integer) - - OUTPUT: + - `c` -- conductor (positive integer) - - Brandt module element (or tuple of them) + OUTPUT: Brandt module element (or tuple of them). EXAMPLES:: @@ -5610,16 +5592,16 @@ def kolyvagin_point_on_curve(self, D, c, E, p, bound=10): INPUT: - - `D` -- fundamental negative discriminant + - `D` -- fundamental negative discriminant - - `c` -- conductor + - `c` -- conductor - - `E` -- elliptic curve of conductor the level of self + - `E` -- elliptic curve of conductor the level of self - - `p` -- odd prime number such that we consider image in - `E(\GF{\ell^2}) / p E(\GF{\ell^2})` + - `p` -- odd prime number such that we consider image in + `E(\GF{\ell^2}) / p E(\GF{\ell^2})` - - ``bound`` -- integer (default: 10) + - ``bound`` -- integer (default: 10) EXAMPLES:: @@ -5641,51 +5623,51 @@ def kolyvagin_reduction_data(E, q, first_only=True): INPUT: - - `E` -- elliptic curve over `\QQ` of rank 1 or 2 + - `E` -- elliptic curve over `\QQ` of rank 1 or 2 - - `q` -- an odd prime that does not divide the order of the - rational torsion subgroup of `E` + - `q` -- an odd prime that does not divide the order of the + rational torsion subgroup of `E` - - ``first_only`` -- bool (default: ``True``) whether two only return - the first prime that one can work modulo to get data about - the Euler system + - ``first_only`` -- bool (default: ``True``) whether two only return + the first prime that one can work modulo to get data about + the Euler system OUTPUT in the rank 1 case or when the default flag ``first_only=True``: - - `\ell` -- first good odd prime satisfying the Kolyvagin - condition that `q` divides \gcd(a_{\ell},\ell+1)` and the - reduction map is surjective to `E(\GF{\ell}) / q - E(\GF{\ell})` + - `\ell` -- first good odd prime satisfying the Kolyvagin + condition that `q` divides \gcd(a_{\ell},\ell+1)` and the + reduction map is surjective to `E(\GF{\ell}) / q + E(\GF{\ell})` - - `D` -- discriminant of the first quadratic imaginary field - `K` that satisfies the Heegner hypothesis for `E` such that - both `\ell` is inert in `K`, and the twist `E^D` has analytic - rank `\leq 1` + - `D` -- discriminant of the first quadratic imaginary field + `K` that satisfies the Heegner hypothesis for `E` such that + both `\ell` is inert in `K`, and the twist `E^D` has analytic + rank `\leq 1` - - `h_D` -- the class number of `K` + - `h_D` -- the class number of `K` - - the dimension of the Brandt module `B(\ell,N)`, where `N` is - the conductor of `E` + - the dimension of the Brandt module `B(\ell,N)`, where `N` is + the conductor of `E` OUTPUT in the rank 2 case: - - `\ell_1` -- first prime (as above in the rank 1 case) where - reduction map is surjective + - `\ell_1` -- first prime (as above in the rank 1 case) where + reduction map is surjective - - `\ell_2` -- second prime (as above) where reduction map is - surjective + - `\ell_2` -- second prime (as above) where reduction map is + surjective - - `D` -- discriminant of the first quadratic imaginary field - `K` that satisfies the Heegner hypothesis for `E` such that - both `\ell_1` and `\ell_2` are simultaneously inert in `K`, - and the twist `E^D` has analytic rank `\leq 1` + - `D` -- discriminant of the first quadratic imaginary field + `K` that satisfies the Heegner hypothesis for `E` such that + both `\ell_1` and `\ell_2` are simultaneously inert in `K`, + and the twist `E^D` has analytic rank `\leq 1` - - `h_D` -- the class number of `K` + - `h_D` -- the class number of `K` - - the dimension of the Brandt module `B(\ell_1,N)`, where `N` is - the conductor of `E` + - the dimension of the Brandt module `B(\ell_1,N)`, where `N` is + the conductor of `E` - - the dimension of the Brandt module `B(\ell_2,N)` + - the dimension of the Brandt module `B(\ell_2,N)` EXAMPLES: @@ -5859,14 +5841,14 @@ def __init__(self, D, c, R, beta): r""" INPUT: - - `D` -- negative fundamental discriminant + - `D` -- negative fundamental discriminant - - `c` -- positive integer coprime to `D` + - `c` -- positive integer coprime to `D` - - `R` -- Eichler order in a rational quaternion algebra + - `R` -- Eichler order in a rational quaternion algebra - - `\beta` -- element of `R` such that the homomorphism - sends `c\sqrt{D}` to `\beta` + - `\beta` -- element of `R` such that the homomorphism + sends `c\sqrt{D}` to `\beta` EXAMPLES:: @@ -6088,17 +6070,17 @@ def quadratic_order(D, c, names='a'): INPUT: - - `D` -- fundamental discriminant + - `D` -- fundamental discriminant - - `c` -- conductor + - `c` -- conductor - - ``names`` -- string (default: 'a') + - ``names`` -- string (default: 'a') OUTPUT: - - order `R` of conductor `c` in an imaginary quadratic field + - order `R` of conductor `c` in an imaginary quadratic field - - the element `c\sqrt{D}` as an element of `R` + - the element `c\sqrt{D}` as an element of `R` The generator for the field is named 'a' by default. @@ -6124,7 +6106,7 @@ def class_number(D): INPUT: - - `D` -- integer + - `D` -- integer EXAMPLES:: @@ -6135,7 +6117,7 @@ def class_number(D): sage: sage.schemes.elliptic_curves.heegner.class_number(-163) 1 - A ValueError is raised when `D` is not a fundamental + A :class:`ValueError` is raised when `D` is not a fundamental discriminant:: sage: sage.schemes.elliptic_curves.heegner.class_number(-5) @@ -6153,9 +6135,9 @@ def is_inert(D, p): INPUT: - - `D` -- fundamental discriminant + - `D` -- fundamental discriminant - - `p` -- prime integer + - `p` -- prime integer EXAMPLES:: @@ -6176,9 +6158,9 @@ def is_split(D, p): INPUT: - - `D` -- fundamental discriminant + - `D` -- fundamental discriminant - - `p` -- prime integer + - `p` -- prime integer EXAMPLES:: @@ -6199,9 +6181,9 @@ def is_ramified(D, p): INPUT: - - `D` -- fundamental discriminant + - `D` -- fundamental discriminant - - `p` -- prime integer + - `p` -- prime integer EXAMPLES:: @@ -6221,9 +6203,9 @@ def nearby_rational_poly(f, **kwds): INPUT: - - `f` -- polynomial with real floating point entries + - `f` -- polynomial with real floating point entries - - ``**kwds`` -- passed on to ``nearby_rational`` method + - ``**kwds`` -- passed on to ``nearby_rational`` method EXAMPLES:: @@ -6245,9 +6227,9 @@ def simplest_rational_poly(f, prec): INPUT: - - `f` -- polynomial with real floating point entries + - `f` -- polynomial with real floating point entries - - ``prec`` -- positive integer + - ``prec`` -- positive integer EXAMPLES:: @@ -6271,9 +6253,9 @@ def satisfies_weak_heegner_hypothesis(N, D): INPUT: - - `N` -- positive integer + - `N` -- positive integer - - `D` -- negative integer + - `D` -- negative integer EXAMPLES:: @@ -6314,11 +6296,9 @@ def make_monic(f): INPUT: - - f -- polynomial over the rational numbers + - `f` -- polynomial over the rational numbers - OUTPUT: - - a monic integral polynomial and an integer + OUTPUT: A monic integral polynomial and an integer. EXAMPLES:: @@ -6390,9 +6370,7 @@ def ell_heegner_point(self, D, c=ZZ(1), f=None, check=True): - ``check`` -- bool (default: ``True``) - OUTPUT: - - The Heegner point `y_c`. + OUTPUT: The Heegner point `y_c`. EXAMPLES:: @@ -6444,15 +6422,13 @@ def kolyvagin_point(self, D, c=ZZ(1), check=True): INPUT: - - `D` -- a Heegner discriminant - - - `c` -- (default: 1) conductor, must be coprime to `DN` + - `D` -- a Heegner discriminant - - ``check`` -- bool (default: ``True``) + - `c` -- (default: 1) conductor, must be coprime to `DN` - OUTPUT: + - ``check`` -- bool (default: ``True``) - The Kolyvagin point `P` of conductor `c`. + OUTPUT: The Kolyvagin point `P` of conductor `c`. EXAMPLES:: @@ -6960,9 +6936,7 @@ def _heegner_index_in_EK(self, D): - `D` -- negative integer; the Heegner discriminant - OUTPUT: - - a power of 2 -- the given index + OUTPUT: A power of 2 -- the given index. EXAMPLES: diff --git a/src/sage/schemes/elliptic_curves/height.py b/src/sage/schemes/elliptic_curves/height.py index 929eb056b35..105262b6d57 100644 --- a/src/sage/schemes/elliptic_curves/height.py +++ b/src/sage/schemes/elliptic_curves/height.py @@ -757,12 +757,14 @@ class EllipticCurveCanonicalHeight: sage: from sage.schemes.elliptic_curves.height import EllipticCurveCanonicalHeight sage: E = EllipticCurve([0,0,0,0,1]) sage: EllipticCurveCanonicalHeight(E) - EllipticCurveCanonicalHeight object associated to Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field + EllipticCurveCanonicalHeight object associated to + Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field Normally this object would be created like this:: sage: E.height_function() - EllipticCurveCanonicalHeight object associated to Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field + EllipticCurveCanonicalHeight object associated to + Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field """ def __init__(self, E): @@ -778,14 +780,17 @@ def __init__(self, E): sage: from sage.schemes.elliptic_curves.height import EllipticCurveCanonicalHeight sage: E = EllipticCurve([0,0,0,0,1]) sage: EllipticCurveCanonicalHeight(E) - EllipticCurveCanonicalHeight object associated to Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field + EllipticCurveCanonicalHeight object associated to + Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field An example over a number field:: - sage: K.=QuadraticField(-1) + sage: K. = QuadraticField(-1) sage: E = EllipticCurve([0,i,0,i,i]) sage: EllipticCurveCanonicalHeight(E) - EllipticCurveCanonicalHeight object associated to Elliptic Curve defined by y^2 = x^3 + i*x^2 + i*x + i over Number Field in i with defining polynomial x^2 + 1 with i = 1*I + EllipticCurveCanonicalHeight object associated to + Elliptic Curve defined by y^2 = x^3 + i*x^2 + i*x + i + over Number Field in i with defining polynomial x^2 + 1 with i = 1*I TESTS: @@ -796,7 +801,8 @@ def __init__(self, E): sage: EllipticCurveCanonicalHeight(E) Traceback (most recent call last): ... - ValueError: EllipticCurveCanonicalHeight class can only be created from an elliptic curve defined over a number field + ValueError: EllipticCurveCanonicalHeight class can only be created + from an elliptic curve defined over a number field """ from sage.schemes.elliptic_curves.ell_generic import is_EllipticCurve if is_EllipticCurve(E): @@ -818,7 +824,8 @@ def __repr__(self): sage: E = EllipticCurve([0,0,0,0,1]) sage: E.height_function() - EllipticCurveCanonicalHeight object associated to Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field + EllipticCurveCanonicalHeight object associated to + Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field """ return "EllipticCurveCanonicalHeight object associated to %s" % self.E @@ -905,7 +912,7 @@ def alpha(self, v, tol=0.01): Example 1 from [CPS2006]_:: - sage: K.=QuadraticField(-1) + sage: K. = QuadraticField(-1) sage: E = EllipticCurve([0,0,0,1+5*i,3+i]) sage: H = E.height_function() sage: alpha = H.alpha(K.places()[0]) @@ -976,7 +983,7 @@ def e_p(self, p): EXAMPLES:: - sage: K.=QuadraticField(-1) + sage: K. = QuadraticField(-1) sage: E = EllipticCurve([0,0,0,1+5*i,3+i]) sage: H = E.height_function() sage: H.e_p(K.prime_above(2)) @@ -1028,8 +1035,8 @@ def DE(self, n): EXAMPLES:: - sage: K.=QuadraticField(-1) - sage: E = EllipticCurve([0,0,0,1+5*i,3+i]) + sage: K. = QuadraticField(-1) + sage: E = EllipticCurve([0, 0, 0, 1+5*i, 3+i]) sage: H = E.height_function() sage: [H.DE(n) for n in srange(1,6)] [0, 2*log(5) + 2*log(2), 0, 2*log(13) + 2*log(5) + 4*log(2), 0] @@ -1056,8 +1063,8 @@ def ME(self): EXAMPLES:: - sage: K.=QuadraticField(-1) - sage: E = EllipticCurve([0,0,0,1+5*i,3+i]) + sage: K. = QuadraticField(-1) + sage: E = EllipticCurve([0, 0, 0, 1+5*i, 3+i]) sage: H = E.height_function() sage: H.ME() 1 @@ -1095,8 +1102,8 @@ def B(self, n, mu): Example 10.2 from [Tho2010]_:: - sage: K.=QuadraticField(-1) - sage: E = EllipticCurve([0,1-i,i,-i,0]) + sage: K. = QuadraticField(-1) + sage: E = EllipticCurve([0, 1-i, i, -i, 0]) sage: H = E.height_function() In [Tho2010]_ the value is given as 0.772:: @@ -1154,7 +1161,7 @@ def psi(self, xi, v): An example over a number field:: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: E = EllipticCurve([0,0,0,0,a]) sage: P = E.lift_x(1/3*a^2 + a + 5/3) sage: v = K.real_places()[0] @@ -1260,13 +1267,13 @@ def Sn(self, xi1, xi2, n, v): An example over a number field:: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: E = EllipticCurve([0,0,0,0,a]) sage: v = K.real_places()[0] sage: H = E.height_function() - sage: H.S(2,3,v) , H.Sn(2,3,1,v) + sage: H.S(2,3,v), H.Sn(2,3,1,v) (([0.142172065860075, 0.172845716928584] U [0.827154283071416, 0.857827934139925]), - ([0.142172065860075, 0.172845716928584] U [0.827154283071416, 0.857827934139925])) + ([0.142172065860075, 0.172845716928584] U [0.827154283071416, 0.857827934139925])) sage: H.Sn(2,3,6,v) ([0.0236953443100124, 0.0288076194880974] U [0.137859047178569, 0.142971322356654] U [0.190362010976679, 0.195474286154764] U [0.304525713845236, 0.309637989023321] U [0.357028677643346, 0.362140952821431] U [0.471192380511903, 0.476304655689988] U [0.523695344310012, 0.528807619488097] U [0.637859047178569, 0.642971322356654] U [0.690362010976679, 0.695474286154764] U [0.804525713845236, 0.809637989023321] U [0.857028677643346, 0.862140952821431] U [0.971192380511903, 0.976304655689988]) """ @@ -1306,14 +1313,14 @@ def real_intersection_is_empty(self, Bk, v): height strictly greater than 0.2, but fail to prove the same for 0.3:: - sage: H.real_intersection_is_empty([H.B(n,0.2) for n in srange(1,10)],v) + sage: H.real_intersection_is_empty([H.B(n,0.2) for n in srange(1,10)], v) True - sage: H.real_intersection_is_empty([H.B(n,0.3) for n in srange(1,10)],v) + sage: H.real_intersection_is_empty([H.B(n,0.3) for n in srange(1,10)], v) False An example over a number field:: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: E = EllipticCurve([0,0,0,0,a]) sage: v = K.real_places()[0] sage: H = E.height_function() @@ -1663,7 +1670,7 @@ def complex_intersection_is_empty(self, Bk, v, verbose=False, use_half=True): EXAMPLES:: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: E = EllipticCurve([0,0,0,0,a]) sage: v = K.complex_embeddings()[0] sage: H = E.height_function() @@ -1674,18 +1681,18 @@ def complex_intersection_is_empty(self, Bk, v, verbose=False, use_half=True): for 0.03. For the first proof, using only `n=1,2,3` is not sufficient:: - sage: H.complex_intersection_is_empty([H.B(n,0.02) for n in [1,2,3]],v) # long time (~6s) + sage: H.complex_intersection_is_empty([H.B(n,0.02) for n in [1,2,3]], v) # long time (~6s) False - sage: H.complex_intersection_is_empty([H.B(n,0.02) for n in [1,2,3,4]],v) + sage: H.complex_intersection_is_empty([H.B(n,0.02) for n in [1,2,3,4]], v) True - sage: H.complex_intersection_is_empty([H.B(n,0.03) for n in [1,2,3,4]],v) # long time (4s) + sage: H.complex_intersection_is_empty([H.B(n,0.03) for n in [1,2,3,4]], v) # long time (4s) False Using `n\le6` enables us to prove the lower bound 0.03. Note that it takes longer when the result is ``False`` than when it is ``True``:: - sage: H.complex_intersection_is_empty([H.B(n,0.03) for n in [1..6]],v) + sage: H.complex_intersection_is_empty([H.B(n,0.03) for n in [1..6]], v) True """ from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion @@ -1781,7 +1788,7 @@ def test_mu(self, mu, N, verbose=True): EXAMPLES:: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: E = EllipticCurve([0,0,0,0,a]) sage: H = E.height_function() @@ -1890,15 +1897,15 @@ def min_gr(self, tol, n_max, verbose=False): given):: sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0,0,0,91-26*i,-144-323*i]) + sage: E = EllipticCurve([0, 0, 0, 91-26*i, -144-323*i]) sage: H = E.height_function() - sage: H.min_gr(0.1,4) # long time (8.1s) + sage: H.min_gr(0.1, 4) # long time (8.1s) 0.1621049443313762 Example 10.2 from [Tho2010]_:: sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0,1-i,i,-i,0]) + sage: E = EllipticCurve([0, 1-i, i, -i, 0]) sage: H = E.height_function() sage: H.min_gr(0.01, 5) # long time 0.020153685521979152 @@ -1915,17 +1922,17 @@ def min_gr(self, tol, n_max, verbose=False): Example 10.3 from [Tho2010]_ (where the same bound of 0.25 is given):: - sage: K. = NumberField(x^3-2) - sage: E = EllipticCurve([0,0,0,-3*a-a^2,a^2]) + sage: K. = NumberField(x^3 - 2) + sage: E = EllipticCurve([0, 0, 0, -3*a-a^2, a^2]) sage: H = E.height_function() - sage: H.min_gr(0.1,5) # long time (7.2s) + sage: H.min_gr(0.1, 5) # long time (7.2s) 0.25 TESTS: This example from the LMFDB gave problems before the fix in :trac:`8829`:: - sage: K. = NumberField(x^2-x-1) + sage: K. = NumberField(x^2 - x - 1) sage: E = EllipticCurve([phi + 1, -phi + 1, 1, 20*phi - 39, 196*phi + 237]) sage: H = E.height_function() sage: H.min_gr(.1, 5, verbose=True) # long time (~22s) @@ -2011,17 +2018,17 @@ def min(self, tol, n_max, verbose=False): given):: sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0,0,0,91-26*i,-144-323*i]) + sage: E = EllipticCurve([0, 0, 0, 91-26*i, -144-323*i]) sage: H = E.height_function() - sage: H.min(0.1,4) # long time (8.1s) + sage: H.min(0.1, 4) # long time (8.1s) 0.1621049443313762 Example 10.2 from [Tho2010]_:: sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0,1-i,i,-i,0]) + sage: E = EllipticCurve([0, 1-i, i, -i, 0]) sage: H = E.height_function() - sage: H.min(0.01,5) # long time (4s) + sage: H.min(0.01, 5) # long time (4s) 0.020153685521979152 In this example the point `P=(0,0)` has height 0.023 so our @@ -2034,10 +2041,10 @@ def min(self, tol, n_max, verbose=False): Example 10.3 from [Tho2010]_ (where the same bound of 0.0625 is given):: - sage: K. = NumberField(x^3-2) - sage: E = EllipticCurve([0,0,0,-3*a-a^2,a^2]) + sage: K. = NumberField(x^3 - 2) + sage: E = EllipticCurve([0, 0, 0, -3*a-a^2, a^2]) sage: H = E.height_function() - sage: H.min(0.1,5) # long time (7s) + sage: H.min(0.1, 5) # long time (7s) 0.0625 More examples over `\QQ`:: diff --git a/src/sage/schemes/elliptic_curves/hom_composite.py b/src/sage/schemes/elliptic_curves/hom_composite.py index 576107582db..0ed4b22739d 100644 --- a/src/sage/schemes/elliptic_curves/hom_composite.py +++ b/src/sage/schemes/elliptic_curves/hom_composite.py @@ -23,10 +23,11 @@ 2^143 sage: EllipticCurveHom_composite(E, P) Composite morphism of degree 11150372599265311570767859136324180752990208 = 2^143: - From: Elliptic Curve defined by y^2 = x^3 + x over Finite Field in z2 of size 33451117797795934712303577408972542258970623^2 + From: Elliptic Curve defined by y^2 = x^3 + x + over Finite Field in z2 of size 33451117797795934712303577408972542258970623^2 To: Elliptic Curve defined by y^2 = x^3 + (18676616716352953484576727486205473216172067*z2+32690199585974925193292786311814241821808308)*x - + (3369702436351367403910078877591946300201903*z2+15227558615699041241851978605002704626689722) - over Finite Field in z2 of size 33451117797795934712303577408972542258970623^2 + + (3369702436351367403910078877591946300201903*z2+15227558615699041241851978605002704626689722) + over Finite Field in z2 of size 33451117797795934712303577408972542258970623^2 Yet, the interface provided by :class:`EllipticCurveHom_composite` is identical to :class:`EllipticCurveIsogeny` and other instantiations @@ -68,8 +69,12 @@ We can easily obtain the individual factors of the composite map:: sage: psi.factors() - (Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 419 to Elliptic Curve defined by y^2 = x^3 + 140*x + 214 over Finite Field of size 419, - Isogeny of degree 7 from Elliptic Curve defined by y^2 = x^3 + 140*x + 214 over Finite Field of size 419 to Elliptic Curve defined by y^2 = x^3 + 101*x + 285 over Finite Field of size 419) + (Isogeny of degree 5 + from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 419 + to Elliptic Curve defined by y^2 = x^3 + 140*x + 214 over Finite Field of size 419, + Isogeny of degree 7 + from Elliptic Curve defined by y^2 = x^3 + 140*x + 214 over Finite Field of size 419 + to Elliptic Curve defined by y^2 = x^3 + 101*x + 285 over Finite Field of size 419) AUTHORS: @@ -228,7 +233,9 @@ def __init__(self, E, kernel, codomain=None, model=None): sage: K. = NumberField(x^2 - x - 5) sage: E = EllipticCurve('210.b6').change_ring(K) sage: E.torsion_subgroup() - Torsion Subgroup isomorphic to Z/12 + Z/2 associated to the Elliptic Curve defined by y^2 + x*y + y = x^3 + (-578)*x + 2756 over Number Field in a with defining polynomial x^2 - x - 5 + Torsion Subgroup isomorphic to Z/12 + Z/2 associated to the Elliptic Curve + defined by y^2 + x*y + y = x^3 + (-578)*x + 2756 over Number Field in a + with defining polynomial x^2 - x - 5 sage: EllipticCurveHom_composite(E, E.torsion_points()) Composite morphism of degree 24 = 2^3*3: From: Elliptic Curve defined by y^2 + x*y + y = x^3 + (-578)*x + 2756 over Number Field in a with defining polynomial x^2 - x - 5 @@ -484,9 +491,15 @@ def factors(self): sage: P, = E.gens() sage: phi = EllipticCurveHom_composite(E, P) sage: phi.factors() - (Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 43 to Elliptic Curve defined by y^2 = x^3 + 39*x over Finite Field of size 43, - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 39*x over Finite Field of size 43 to Elliptic Curve defined by y^2 = x^3 + 42*x + 26 over Finite Field of size 43, - Isogeny of degree 11 from Elliptic Curve defined by y^2 = x^3 + 42*x + 26 over Finite Field of size 43 to Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 43) + (Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 43 + to Elliptic Curve defined by y^2 = x^3 + 39*x over Finite Field of size 43, + Isogeny of degree 2 + from Elliptic Curve defined by y^2 = x^3 + 39*x over Finite Field of size 43 + to Elliptic Curve defined by y^2 = x^3 + 42*x + 26 over Finite Field of size 43, + Isogeny of degree 11 + from Elliptic Curve defined by y^2 = x^3 + 42*x + 26 over Finite Field of size 43 + to Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 43) """ return self._phis diff --git a/src/sage/schemes/elliptic_curves/hom_frobenius.py b/src/sage/schemes/elliptic_curves/hom_frobenius.py index 430f8a3f417..3499e3a8194 100644 --- a/src/sage/schemes/elliptic_curves/hom_frobenius.py +++ b/src/sage/schemes/elliptic_curves/hom_frobenius.py @@ -55,7 +55,9 @@ sage: E = EllipticCurve([GF(17^6).gen(), 0]) sage: pi = EllipticCurveHom_frobenius(E) sage: pihat = pi.dual(); pihat - Isogeny of degree 17 from Elliptic Curve defined by y^2 = x^3 + (15*z6^5+5*z6^4+8*z6^3+12*z6^2+11*z6+7)*x over Finite Field in z6 of size 17^6 to Elliptic Curve defined by y^2 = x^3 + z6*x over Finite Field in z6 of size 17^6 + Isogeny of degree 17 + from Elliptic Curve defined by y^2 = x^3 + (15*z6^5+5*z6^4+8*z6^3+12*z6^2+11*z6+7)*x over Finite Field in z6 of size 17^6 + to Elliptic Curve defined by y^2 = x^3 + z6*x over Finite Field in z6 of size 17^6 sage: pihat.is_separable() True sage: pihat * pi == EllipticCurveHom_scalar(E,17) # known bug -- #6413 diff --git a/src/sage/schemes/elliptic_curves/isogeny_class.py b/src/sage/schemes/elliptic_curves/isogeny_class.py index 0d50a9863ef..bf514741929 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_class.py +++ b/src/sage/schemes/elliptic_curves/isogeny_class.py @@ -322,7 +322,7 @@ class (CM case only). sage: pol = PolynomialRing(QQ,'x')([1,0,3,0,1]) sage: K. = NumberField(pol) - sage: j = 1480640+565760*c^2 + sage: j = 1480640 + 565760*c^2 sage: E = EllipticCurve(j=j) sage: C = E.isogeny_class() sage: C.qf_matrix() @@ -362,7 +362,9 @@ def isogenies(self, fill=False): sage: isocls = EllipticCurve('15a3').isogeny_class() sage: f = isocls.isogenies()[0][1]; f - Isogeny of degree 2 from Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 5*x + 2 over Rational Field to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 80*x + 242 over Rational Field + Isogeny of degree 2 + from Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 5*x + 2 over Rational Field + to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 80*x + 242 over Rational Field sage: f.domain() == isocls.curves[0] and f.codomain() == isocls.curves[1] True """ @@ -591,10 +593,10 @@ def __init__(self, E, reducible_primes=None, algorithm='Billerey', minimal_model the isogeny class, only composites isogenies of these degrees will be used. - - ``algorithm`` (string, default 'Billerey') -- the algorithm + - ``algorithm`` (string, default ``'Billerey'``) -- the algorithm to use to compute the reducible primes. Ignored for CM curves or if ``reducible_primes`` is provided. Values are - 'Billerey' (default), 'Larson', and 'heuristic'. + ``'Billerey'`` (default), ``'Larson'``, and ``'heuristic'``. - ``minimal_models`` (bool, default ``True``) -- if ``True``, all curves in the class will be minimal or semi-minimal @@ -606,15 +608,16 @@ def __init__(self, E, reducible_primes=None, algorithm='Billerey', minimal_model sage: K. = QuadraticField(-1) sage: E = EllipticCurve(K, [0,0,0,0,1]) sage: C = E.isogeny_class(); C - Isogeny class of Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in i with defining polynomial x^2 + 1 with i = 1*I + Isogeny class of Elliptic Curve defined by y^2 = x^3 + 1 + over Number Field in i with defining polynomial x^2 + 1 with i = 1*I The curves in the class (sorted):: sage: [E1.ainvs() for E1 in C] [(0, 0, 0, 0, -27), - (0, 0, 0, 0, 1), - (i + 1, i, i + 1, -i + 3, 4*i), - (i + 1, i, i + 1, -i + 33, -58*i)] + (0, 0, 0, 0, 1), + (i + 1, i, i + 1, -i + 3, 4*i), + (i + 1, i, i + 1, -i + 33, -58*i)] The matrix of degrees of cyclic isogenies between curves:: @@ -632,16 +635,18 @@ class :class:`EllipticCurveIsogeny` allowed composition. In to 3, and `3`-isogenies to go from 0 to 1 and from 2 to 3:: sage: isogs = C.isogenies() - sage: [((i,j),isogs[i][j].degree()) for i in range(4) for j in range(4) if isogs[i][j]!=0] + sage: [((i,j), isogs[i][j].degree()) + ....: for i in range(4) for j in range(4) if isogs[i][j] != 0] [((0, 1), 3), - ((0, 3), 2), - ((1, 0), 3), - ((1, 2), 2), - ((2, 1), 2), - ((2, 3), 3), - ((3, 0), 2), - ((3, 2), 3)] - sage: [((i,j),isogs[i][j].x_rational_map()) for i in range(4) for j in range(4) if isogs[i][j]!=0] + ((0, 3), 2), + ((1, 0), 3), + ((1, 2), 2), + ((2, 1), 2), + ((2, 3), 3), + ((3, 0), 2), + ((3, 2), 3)] + sage: [((i,j), isogs[i][j].x_rational_map()) + ....: for i in range(4) for j in range(4) if isogs[i][j] != 0] [((0, 1), (1/9*x^3 - 12)/x^2), ((0, 3), (-1/2*i*x^2 + i*x - 12*i)/(x - 3)), ((1, 0), (x^3 + 4)/x^2), @@ -654,7 +659,9 @@ class :class:`EllipticCurveIsogeny` allowed composition. In sage: K. = QuadraticField(-1) sage: E = EllipticCurve([1+i, -i, i, 1, 0]) sage: C = E.isogeny_class(); C - Isogeny class of Elliptic Curve defined by y^2 + (i+1)*x*y + i*y = x^3 + (-i)*x^2 + x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I + Isogeny class of Elliptic Curve defined + by y^2 + (i+1)*x*y + i*y = x^3 + (-i)*x^2 + x + over Number Field in i with defining polynomial x^2 + 1 with i = 1*I sage: len(C) 6 sage: C.matrix() @@ -676,7 +683,7 @@ class :class:`EllipticCurveIsogeny` allowed composition. In sage: pol = PolynomialRing(QQ,'x')([1,0,3,0,1]) sage: K. = NumberField(pol) - sage: j = 1480640+565760*c^2 + sage: j = 1480640 + 565760*c^2 sage: E = EllipticCurve(j=j) sage: E.has_cm() True @@ -692,9 +699,15 @@ class :class:`EllipticCurveIsogeny` allowed composition. In [2 1] sage: [E.ainvs() for E in C] [(0, 0, 0, 83490*c^2 - 147015, -64739840*c^2 - 84465260), - (0, 0, 0, -161535*c^2 + 70785, -62264180*c^3 + 6229080*c)] + (0, 0, 0, -161535*c^2 + 70785, -62264180*c^3 + 6229080*c)] sage: C.isogenies()[0][1] - Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + (83490*c^2-147015)*x + (-64739840*c^2-84465260) over Number Field in c with defining polynomial x^4 + 3*x^2 + 1 to Elliptic Curve defined by y^2 = x^3 + (-161535*c^2+70785)*x + (-62264180*c^3+6229080*c) over Number Field in c with defining polynomial x^4 + 3*x^2 + 1 + Isogeny of degree 2 + from Elliptic Curve defined by + y^2 = x^3 + (83490*c^2-147015)*x + (-64739840*c^2-84465260) + over Number Field in c with defining polynomial x^4 + 3*x^2 + 1 + to Elliptic Curve defined by + y^2 = x^3 + (-161535*c^2+70785)*x + (-62264180*c^3+6229080*c) + over Number Field in c with defining polynomial x^4 + 3*x^2 + 1 TESTS:: @@ -986,13 +999,13 @@ def __init__(self, E, algorithm="sage", label=None, empty=False): - ``E`` -- an elliptic curve over `\QQ`. - - ``algorithm`` -- a string (default "sage"). One of the + - ``algorithm`` -- a string (default ``"sage"``). One of the following: - - "sage" -- Use sage's implementation to compute the curves, + - ``"sage"`` -- Use sage's implementation to compute the curves, matrix and isogenies - - "database" -- Use the Cremona database (only works if the + - ``"database"`` -- Use the Cremona database (only works if the curve is in the database) - ``label`` -- a string, the label of this isogeny class @@ -1008,7 +1021,8 @@ def __init__(self, E, algorithm="sage", label=None, empty=False): sage: E.isogeny_class(order='database') Traceback (most recent call last): ... - LookupError: Cremona database does not contain entry for Elliptic Curve defined by y^2 = x^3 + 1001 over Rational Field + LookupError: Cremona database does not contain entry for + Elliptic Curve defined by y^2 = x^3 + 1001 over Rational Field sage: TestSuite(isocls).run() """ self._algorithm = algorithm @@ -1161,7 +1175,7 @@ def isogeny_degrees_cm(E, verbose=False): sage: pol = PolynomialRing(QQ,'x')([1,-3,5,-5,5,-3,1]) sage: L. = NumberField(pol) - sage: j = hilbert_class_polynomial(-23).roots(L,multiplicities=False)[0] + sage: j = hilbert_class_polynomial(-23).roots(L, multiplicities=False)[0] sage: E = EllipticCurve(j=j) sage: from sage.schemes.elliptic_curves.isogeny_class import isogeny_degrees_cm sage: isogeny_degrees_cm(E, verbose=True) @@ -1299,18 +1313,18 @@ def possible_isogeny_degrees(E, algorithm='Billerey', max_l=None, - ``E`` -- An elliptic curve defined over a number field. - - ``algorithm`` (string, default 'Billerey') -- Algorithm to be - used for non-CM curves: either 'Billerey', 'Larson', or - 'heuristic'. Only relevant for non-CM curves and base fields + - ``algorithm`` (string, default ``'Billerey'``) -- Algorithm to be + used for non-CM curves: either ``'Billerey'``, ``'Larson'``, or + ``'heuristic'``. Only relevant for non-CM curves and base fields other than `\QQ`. - ``max_l`` (int or ``None``) -- only relevant for non-CM curves - and algorithms 'Billerey' and 'heuristic. Controls the maximum + and algorithms ``'Billerey'`` and ``'heuristic'``. Controls the maximum prime used in either algorithm. If ``None``, use the default for that algorithm. - ``num_l`` (int or ``None``) -- only relevant for non-CM curves - and algorithm 'Billerey'. Controls the maximum number of primes + and algorithm ``'Billerey'``. Controls the maximum number of primes used in the algorithm. If ``None``, use the default for that algorithm. @@ -1373,7 +1387,9 @@ def possible_isogeny_degrees(E, algorithm='Billerey', max_l=None, A higher degree example (LMFDB curve 5.5.170701.1-4.1-b1):: sage: K. = NumberField(x^5 - x^4 - 6*x^3 + 4*x + 1) - sage: E = EllipticCurve(K, [a^3 - a^2 - 5*a + 1, a^4 - a^3 - 5*a^2 - a + 1, -a^4 + 2*a^3 + 5*a^2 - 5*a - 3, a^4 - a^3 - 5*a^2 - a, -3*a^4 + 4*a^3 + 17*a^2 - 6*a - 12]) + sage: E = EllipticCurve(K, [a^3 - a^2 - 5*a + 1, a^4 - a^3 - 5*a^2 - a + 1, + ....: -a^4 + 2*a^3 + 5*a^2 - 5*a - 3, a^4 - a^3 - 5*a^2 - a, + ....: -3*a^4 + 4*a^3 + 17*a^2 - 6*a - 12]) sage: possible_isogeny_degrees(E, algorithm='heuristic') [2] sage: possible_isogeny_degrees(E, algorithm='Billerey') @@ -1405,7 +1421,7 @@ def possible_isogeny_degrees(E, algorithm='Billerey', max_l=None, sage: pol = PolynomialRing(QQ,'x')([1,-3,5,-5,5,-3,1]) sage: L. = NumberField(pol) - sage: j = hilbert_class_polynomial(-23).roots(L,multiplicities=False)[0] + sage: j = hilbert_class_polynomial(-23).roots(L, multiplicities=False)[0] sage: E = EllipticCurve(j=j) sage: from sage.schemes.elliptic_curves.isogeny_class import possible_isogeny_degrees sage: possible_isogeny_degrees(E, verbose=True) diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py index 8f740751da4..4ce59658677 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py +++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py @@ -268,12 +268,18 @@ def isogenies_prime_degree_genus_0(E, l=None, minimal_models=True): sage: E = EllipticCurve('1450c1') sage: isogenies_prime_degree_genus_0(E) - [Isogeny of degree 3 from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 + 300*x - 1000 over Rational Field to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 5950*x - 182250 over Rational Field] + [Isogeny of degree 3 + from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 + 300*x - 1000 over Rational Field + to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 5950*x - 182250 over Rational Field] sage: E = EllipticCurve('50a1') sage: isogenies_prime_degree_genus_0(E) - [Isogeny of degree 3 from Elliptic Curve defined by y^2 + x*y + y = x^3 - x - 2 over Rational Field to Elliptic Curve defined by y^2 + x*y + y = x^3 - 126*x - 552 over Rational Field, - Isogeny of degree 5 from Elliptic Curve defined by y^2 + x*y + y = x^3 - x - 2 over Rational Field to Elliptic Curve defined by y^2 + x*y + y = x^3 - 76*x + 298 over Rational Field] + [Isogeny of degree 3 + from Elliptic Curve defined by y^2 + x*y + y = x^3 - x - 2 over Rational Field + to Elliptic Curve defined by y^2 + x*y + y = x^3 - 126*x - 552 over Rational Field, + Isogeny of degree 5 + from Elliptic Curve defined by y^2 + x*y + y = x^3 - x - 2 over Rational Field + to Elliptic Curve defined by y^2 + x*y + y = x^3 - 76*x + 298 over Rational Field] """ if l not in [2, 3, 5, 7, 13, None]: raise ValueError("%s is not a genus 0 prime."%l) @@ -588,19 +594,27 @@ def isogenies_sporadic_Q(E, l=None, minimal_models=True): sage: from sage.schemes.elliptic_curves.isogeny_small_degree import isogenies_sporadic_Q sage: E = EllipticCurve('121a1') sage: isogenies_sporadic_Q(E, 11) - [Isogeny of degree 11 from Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 30*x - 76 over Rational Field to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 305*x + 7888 over Rational Field] + [Isogeny of degree 11 + from Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 30*x - 76 over Rational Field + to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 305*x + 7888 over Rational Field] sage: isogenies_sporadic_Q(E, 13) [] sage: isogenies_sporadic_Q(E, 17) [] sage: isogenies_sporadic_Q(E) - [Isogeny of degree 11 from Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 30*x - 76 over Rational Field to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 305*x + 7888 over Rational Field] + [Isogeny of degree 11 + from Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 30*x - 76 over Rational Field + to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 305*x + 7888 over Rational Field] sage: E = EllipticCurve([1, 1, 0, -660, -7600]) sage: isogenies_sporadic_Q(E, 17) - [Isogeny of degree 17 from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 660*x - 7600 over Rational Field to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 878710*x + 316677750 over Rational Field] + [Isogeny of degree 17 + from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 660*x - 7600 over Rational Field + to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 878710*x + 316677750 over Rational Field] sage: isogenies_sporadic_Q(E) - [Isogeny of degree 17 from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 660*x - 7600 over Rational Field to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 878710*x + 316677750 over Rational Field] + [Isogeny of degree 17 + from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 660*x - 7600 over Rational Field + to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 878710*x + 316677750 over Rational Field] sage: isogenies_sporadic_Q(E, 11) [] @@ -608,39 +622,53 @@ def isogenies_sporadic_Q(E, l=None, minimal_models=True): sage: isogenies_sporadic_Q(E, 11) [] sage: isogenies_sporadic_Q(E, 19) - [Isogeny of degree 19 from Elliptic Curve defined by y^2 + y = x^3 - 1862*x - 30956 over Rational Field to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 over Rational Field] + [Isogeny of degree 19 + from Elliptic Curve defined by y^2 + y = x^3 - 1862*x - 30956 over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 over Rational Field] sage: isogenies_sporadic_Q(E) - [Isogeny of degree 19 from Elliptic Curve defined by y^2 + y = x^3 - 1862*x - 30956 over Rational Field to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 over Rational Field] + [Isogeny of degree 19 + from Elliptic Curve defined by y^2 + y = x^3 - 1862*x - 30956 over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 over Rational Field] sage: E = EllipticCurve([0, -1, 0, -6288, 211072]) sage: E.conductor() 19600 sage: isogenies_sporadic_Q(E,37) - [Isogeny of degree 37 from Elliptic Curve defined by y^2 = x^3 - x^2 - 6288*x + 211072 over Rational Field to Elliptic Curve defined by y^2 = x^3 - x^2 - 163137088*x - 801950801728 over Rational Field] + [Isogeny of degree 37 + from Elliptic Curve defined by y^2 = x^3 - x^2 - 6288*x + 211072 over Rational Field + to Elliptic Curve defined by y^2 = x^3 - x^2 - 163137088*x - 801950801728 over Rational Field] sage: E = EllipticCurve([1, 1, 0, -25178045, 48616918750]) sage: E.conductor() 148225 sage: isogenies_sporadic_Q(E,37) - [Isogeny of degree 37 from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 25178045*x + 48616918750 over Rational Field to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 970*x - 13075 over Rational Field] + [Isogeny of degree 37 + from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 25178045*x + 48616918750 over Rational Field + to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 970*x - 13075 over Rational Field] sage: E = EllipticCurve([-3440, 77658]) sage: E.conductor() 118336 sage: isogenies_sporadic_Q(E,43) - [Isogeny of degree 43 from Elliptic Curve defined by y^2 = x^3 - 3440*x + 77658 over Rational Field to Elliptic Curve defined by y^2 = x^3 - 6360560*x - 6174354606 over Rational Field] + [Isogeny of degree 43 + from Elliptic Curve defined by y^2 = x^3 - 3440*x + 77658 over Rational Field + to Elliptic Curve defined by y^2 = x^3 - 6360560*x - 6174354606 over Rational Field] sage: E = EllipticCurve([-29480, -1948226]) sage: E.conductor() 287296 sage: isogenies_sporadic_Q(E,67) - [Isogeny of degree 67 from Elliptic Curve defined by y^2 = x^3 - 29480*x - 1948226 over Rational Field to Elliptic Curve defined by y^2 = x^3 - 132335720*x + 585954296438 over Rational Field] + [Isogeny of degree 67 + from Elliptic Curve defined by y^2 = x^3 - 29480*x - 1948226 over Rational Field + to Elliptic Curve defined by y^2 = x^3 - 132335720*x + 585954296438 over Rational Field] sage: E = EllipticCurve([-34790720, -78984748304]) sage: E.conductor() 425104 sage: isogenies_sporadic_Q(E,163) - [Isogeny of degree 163 from Elliptic Curve defined by y^2 = x^3 - 34790720*x - 78984748304 over Rational Field to Elliptic Curve defined by y^2 = x^3 - 924354639680*x + 342062961763303088 over Rational Field] + [Isogeny of degree 163 + from Elliptic Curve defined by y^2 = x^3 - 34790720*x - 78984748304 over Rational Field + to Elliptic Curve defined by y^2 = x^3 - 924354639680*x + 342062961763303088 over Rational Field] """ j = E.j_invariant() j = QQ(j) @@ -796,13 +824,18 @@ def isogenies_5_0(E, minimal_models=True): sage: E = EllipticCurve(GF(13^2,'a'),[0,-3]) sage: isogenies_5_0(E) - [Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + (4*a+6)*x + (2*a+10) over Finite Field in a of size 13^2, Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + (12*a+5)*x + (2*a+10) over Finite Field in a of size 13^2, Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + (10*a+2)*x + (2*a+10) over Finite Field in a of size 13^2, Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + (3*a+12)*x + (11*a+12) over Finite Field in a of size 13^2, Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + (a+4)*x + (11*a+12) over Finite Field in a of size 13^2, Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + (9*a+10)*x + (11*a+12) over Finite Field in a of size 13^2] + [Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + (4*a+6)*x + (2*a+10) over Finite Field in a of size 13^2, + Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + (12*a+5)*x + (2*a+10) over Finite Field in a of size 13^2, + Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + (10*a+2)*x + (2*a+10) over Finite Field in a of size 13^2, + Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + (3*a+12)*x + (11*a+12) over Finite Field in a of size 13^2, + Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + (a+4)*x + (11*a+12) over Finite Field in a of size 13^2, + Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + (9*a+10)*x + (11*a+12) over Finite Field in a of size 13^2] sage: K. = NumberField(x**6-320*x**3-320) sage: E = EllipticCurve(K,[0,0,1,0,0]) sage: isogenies_5_0(E) [Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 over Number Field in a with defining polynomial x^6 - 320*x^3 - 320 to Elliptic Curve defined by y^2 + y = x^3 + (241565/32*a^5-362149/48*a^4+180281/24*a^3-9693307/4*a^2+14524871/6*a-7254985/3)*x + (1660391123/192*a^5-829315373/96*a^4+77680504/9*a^3-66622345345/24*a^2+33276655441/12*a-24931615912/9) over Number Field in a with defining polynomial x^6 - 320*x^3 - 320, - Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 over Number Field in a with defining polynomial x^6 - 320*x^3 - 320 to Elliptic Curve defined by y^2 + y = x^3 + (47519/32*a^5-72103/48*a^4+32939/24*a^3-1909753/4*a^2+2861549/6*a-1429675/3)*x + (-131678717/192*a^5+65520419/96*a^4-12594215/18*a^3+5280985135/24*a^2-2637787519/12*a+1976130088/9) over Number Field in a with defining polynomial x^6 - 320*x^3 - 320] + Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 over Number Field in a with defining polynomial x^6 - 320*x^3 - 320 to Elliptic Curve defined by y^2 + y = x^3 + (47519/32*a^5-72103/48*a^4+32939/24*a^3-1909753/4*a^2+2861549/6*a-1429675/3)*x + (-131678717/192*a^5+65520419/96*a^4-12594215/18*a^3+5280985135/24*a^2-2637787519/12*a+1976130088/9) over Number Field in a with defining polynomial x^6 - 320*x^3 - 320] """ F = E.base_field() if E.j_invariant() != 0: @@ -866,7 +899,7 @@ def isogenies_5_1728(E, minimal_models=True): sage: E = EllipticCurve(GF(13),[11,0]) sage: isogenies_5_1728(E) [Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 11*x over Finite Field of size 13 to Elliptic Curve defined by y^2 = x^3 + 11*x over Finite Field of size 13, - Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 11*x over Finite Field of size 13 to Elliptic Curve defined by y^2 = x^3 + 11*x over Finite Field of size 13] + Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 11*x over Finite Field of size 13 to Elliptic Curve defined by y^2 = x^3 + 11*x over Finite Field of size 13] An example of endomorphisms of degree 5:: @@ -887,7 +920,7 @@ def isogenies_5_1728(E, minimal_models=True): sage: E = EllipticCurve(K,[0,0,0,1,0]) sage: isogenies_5_1728(E) [Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + x over Number Field in a with defining polynomial x^4 + 20*x^2 - 80 to Elliptic Curve defined by y^2 = x^3 + (-753/4*a^2-4399)*x + (2779*a^3+65072*a) over Number Field in a with defining polynomial x^4 + 20*x^2 - 80, - Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + x over Number Field in a with defining polynomial x^4 + 20*x^2 - 80 to Elliptic Curve defined by y^2 = x^3 + (-753/4*a^2-4399)*x + (-2779*a^3-65072*a) over Number Field in a with defining polynomial x^4 + 20*x^2 - 80] + Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + x over Number Field in a with defining polynomial x^4 + 20*x^2 - 80 to Elliptic Curve defined by y^2 = x^3 + (-753/4*a^2-4399)*x + (-2779*a^3-65072*a) over Number Field in a with defining polynomial x^4 + 20*x^2 - 80] See :trac:`19840`:: @@ -1179,7 +1212,7 @@ def isogenies_13_0(E, minimal_models=True): Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2 sage: isogenies_13_0(E) [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2 to Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2, - Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2 to Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2] + Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2 to Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2] sage: isogenies_13_0(E)[0].rational_maps() ((6*x^13 - 6*x^10 - 3*x^7 + 6*x^4 + x)/(x^12 - 5*x^9 - 9*x^6 - 7*x^3 + 5), (-8*x^18*y - 9*x^15*y + 9*x^12*y - 5*x^9*y + 5*x^6*y - 7*x^3*y + 7*y)/(x^18 + 2*x^15 + 3*x^12 - x^9 + 8*x^6 - 9*x^3 + 7)) @@ -1188,7 +1221,8 @@ def isogenies_13_0(E, minimal_models=True): sage: K = GF(29) sage: E = EllipticCurve(j=K(0)) sage: isogenies_13_0(E) - [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 29 to Elliptic Curve defined by y^2 = x^3 + 26*x + 12 over Finite Field of size 29, Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 29 to Elliptic Curve defined by y^2 = x^3 + 16*x + 28 over Finite Field of size 29] + [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 29 to Elliptic Curve defined by y^2 = x^3 + 26*x + 12 over Finite Field of size 29, + Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 29 to Elliptic Curve defined by y^2 = x^3 + 16*x + 28 over Finite Field of size 29] :: @@ -1299,14 +1333,15 @@ def isogenies_13_1728(E, minimal_models=True): (0, 0, 0, 5, 0) sage: isogenies_13_1728(E) [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 89 to Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 89, - Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 89 to Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 89] + Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 89 to Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 89] :: sage: K = GF(23) sage: E = EllipticCurve(K, [1,0]) sage: isogenies_13_1728(E) - [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 23 to Elliptic Curve defined by y^2 = x^3 + 16 over Finite Field of size 23, Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 23 to Elliptic Curve defined by y^2 = x^3 + 7 over Finite Field of size 23] + [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 23 to Elliptic Curve defined by y^2 = x^3 + 16 over Finite Field of size 23, + Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 23 to Elliptic Curve defined by y^2 = x^3 + 7 over Finite Field of size 23] :: @@ -1652,7 +1687,8 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True): sage: E = EllipticCurve_from_j(GF(5)(1)) sage: isogenies_prime_degree_genus_plus_0(E, 41) - [Isogeny of degree 41 from Elliptic Curve defined by y^2 = x^3 + x + 2 over Finite Field of size 5 to Elliptic Curve defined by y^2 = x^3 + x + 3 over Finite Field of size 5, Isogeny of degree 41 from Elliptic Curve defined by y^2 = x^3 + x + 2 over Finite Field of size 5 to Elliptic Curve defined by y^2 = x^3 + x + 3 over Finite Field of size 5] + [Isogeny of degree 41 from Elliptic Curve defined by y^2 = x^3 + x + 2 over Finite Field of size 5 to Elliptic Curve defined by y^2 = x^3 + x + 3 over Finite Field of size 5, + Isogeny of degree 41 from Elliptic Curve defined by y^2 = x^3 + x + 2 over Finite Field of size 5 to Elliptic Curve defined by y^2 = x^3 + x + 3 over Finite Field of size 5] sage: K = QuadraticField(5,'a') sage: a = K.gen() @@ -1668,7 +1704,8 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True): sage: E = EllipticCurve_from_j(GF(13)(5)) sage: isogenies_prime_degree_genus_plus_0(E, 71) - [Isogeny of degree 71 from Elliptic Curve defined by y^2 = x^3 + x + 4 over Finite Field of size 13 to Elliptic Curve defined by y^2 = x^3 + 10*x + 7 over Finite Field of size 13, Isogeny of degree 71 from Elliptic Curve defined by y^2 = x^3 + x + 4 over Finite Field of size 13 to Elliptic Curve defined by y^2 = x^3 + 10*x + 7 over Finite Field of size 13] + [Isogeny of degree 71 from Elliptic Curve defined by y^2 = x^3 + x + 4 over Finite Field of size 13 to Elliptic Curve defined by y^2 = x^3 + 10*x + 7 over Finite Field of size 13, + Isogeny of degree 71 from Elliptic Curve defined by y^2 = x^3 + x + 4 over Finite Field of size 13 to Elliptic Curve defined by y^2 = x^3 + 10*x + 7 over Finite Field of size 13] sage: E = EllipticCurve(GF(13),[0,1,1,1,0]) sage: isogenies_prime_degree_genus_plus_0(E) @@ -1767,7 +1804,8 @@ def isogenies_prime_degree_genus_plus_0_j0(E, l, minimal_models=True): sage: K. = NumberField(u^4+228*u^3+486*u^2-540*u+225) sage: E = EllipticCurve(K,[0,-121/5*a^3-20691/5*a^2-29403/5*a+3267]) sage: isogenies_prime_degree_genus_plus_0_j0(E,11) - [Isogeny of degree 11 from Elliptic Curve defined by y^2 = x^3 + (-121/5*a^3-20691/5*a^2-29403/5*a+3267) over Number Field in a with defining polynomial x^4 + 228*x^3 + 486*x^2 - 540*x + 225 to Elliptic Curve defined by y^2 = x^3 + (-44286*a^2+178596*a-32670)*x + (-17863351/5*a^3+125072739/5*a^2-74353653/5*a-682803) over Number Field in a with defining polynomial x^4 + 228*x^3 + 486*x^2 - 540*x + 225, Isogeny of degree 11 from Elliptic Curve defined by y^2 = x^3 + (-121/5*a^3-20691/5*a^2-29403/5*a+3267) over Number Field in a with defining polynomial x^4 + 228*x^3 + 486*x^2 - 540*x + 225 to Elliptic Curve defined by y^2 = x^3 + (-3267*a^3-740157*a^2+600039*a-277695)*x + (-17863351/5*a^3-4171554981/5*a^2+3769467867/5*a-272366523) over Number Field in a with defining polynomial x^4 + 228*x^3 + 486*x^2 - 540*x + 225] + [Isogeny of degree 11 from Elliptic Curve defined by y^2 = x^3 + (-121/5*a^3-20691/5*a^2-29403/5*a+3267) over Number Field in a with defining polynomial x^4 + 228*x^3 + 486*x^2 - 540*x + 225 to Elliptic Curve defined by y^2 = x^3 + (-44286*a^2+178596*a-32670)*x + (-17863351/5*a^3+125072739/5*a^2-74353653/5*a-682803) over Number Field in a with defining polynomial x^4 + 228*x^3 + 486*x^2 - 540*x + 225, + Isogeny of degree 11 from Elliptic Curve defined by y^2 = x^3 + (-121/5*a^3-20691/5*a^2-29403/5*a+3267) over Number Field in a with defining polynomial x^4 + 228*x^3 + 486*x^2 - 540*x + 225 to Elliptic Curve defined by y^2 = x^3 + (-3267*a^3-740157*a^2+600039*a-277695)*x + (-17863351/5*a^3-4171554981/5*a^2+3769467867/5*a-272366523) over Number Field in a with defining polynomial x^4 + 228*x^3 + 486*x^2 - 540*x + 225] sage: E = EllipticCurve(GF(5^6,'a'),[0,1]) sage: isogenies_prime_degree_genus_plus_0_j0(E,17) @@ -1854,7 +1892,8 @@ def isogenies_prime_degree_genus_plus_0_j1728(E, l, minimal_models=True): sage: K. = NumberField(u^6 - 522*u^5 - 10017*u^4 + 2484*u^3 - 5265*u^2 + 12150*u - 5103) sage: E = EllipticCurve(K,[-75295/1335852*a^5+13066735/445284*a^4+44903485/74214*a^3+17086861/24738*a^2+11373021/16492*a-1246245/2356,0]) sage: isogenies_prime_degree_genus_plus_0_j1728(E,11) - [Isogeny of degree 11 from Elliptic Curve defined by y^2 = x^3 + (-75295/1335852*a^5+13066735/445284*a^4+44903485/74214*a^3+17086861/24738*a^2+11373021/16492*a-1246245/2356)*x over Number Field in a with defining polynomial x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103 to Elliptic Curve defined by y^2 = x^3 + (9110695/1335852*a^5-1581074935/445284*a^4-5433321685/74214*a^3-3163057249/24738*a^2+1569269691/16492*a+73825125/2356)*x + (-3540460*a^3+30522492*a^2-7043652*a-5031180) over Number Field in a with defining polynomial x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103, Isogeny of degree 11 from Elliptic Curve defined by y^2 = x^3 + (-75295/1335852*a^5+13066735/445284*a^4+44903485/74214*a^3+17086861/24738*a^2+11373021/16492*a-1246245/2356)*x over Number Field in a with defining polynomial x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103 to Elliptic Curve defined by y^2 = x^3 + (9110695/1335852*a^5-1581074935/445284*a^4-5433321685/74214*a^3-3163057249/24738*a^2+1569269691/16492*a+73825125/2356)*x + (3540460*a^3-30522492*a^2+7043652*a+5031180) over Number Field in a with defining polynomial x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103] + [Isogeny of degree 11 from Elliptic Curve defined by y^2 = x^3 + (-75295/1335852*a^5+13066735/445284*a^4+44903485/74214*a^3+17086861/24738*a^2+11373021/16492*a-1246245/2356)*x over Number Field in a with defining polynomial x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103 to Elliptic Curve defined by y^2 = x^3 + (9110695/1335852*a^5-1581074935/445284*a^4-5433321685/74214*a^3-3163057249/24738*a^2+1569269691/16492*a+73825125/2356)*x + (-3540460*a^3+30522492*a^2-7043652*a-5031180) over Number Field in a with defining polynomial x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103, + Isogeny of degree 11 from Elliptic Curve defined by y^2 = x^3 + (-75295/1335852*a^5+13066735/445284*a^4+44903485/74214*a^3+17086861/24738*a^2+11373021/16492*a-1246245/2356)*x over Number Field in a with defining polynomial x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103 to Elliptic Curve defined by y^2 = x^3 + (9110695/1335852*a^5-1581074935/445284*a^4-5433321685/74214*a^3-3163057249/24738*a^2+1569269691/16492*a+73825125/2356)*x + (3540460*a^3-30522492*a^2+7043652*a+5031180) over Number Field in a with defining polynomial x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103] sage: i = QuadraticField(-1,'i').gen() sage: E = EllipticCurve([-1-2*i,0]) sage: isogenies_prime_degree_genus_plus_0_j1728(E,17) @@ -2018,7 +2057,7 @@ def is_kernel_polynomial(E, m, f): See :trac:`22232`:: - sage: K =GF(47^2) + sage: K = GF(47^2) sage: E = EllipticCurve([0, K.gen()]) sage: psi7 = E.division_polynomial(7) sage: f = psi7.factor()[4][0] @@ -2097,7 +2136,8 @@ def isogenies_prime_degree_general(E, l, minimal_models=True): [Isogeny of degree 7 from Elliptic Curve defined by y^2 + x*y = x^3 + 1 over Finite Field in a of size 2^6 to Elliptic Curve defined by y^2 + x*y = x^3 + x over Finite Field in a of size 2^6] sage: E = EllipticCurve_from_j(GF(3^12,'a')(2)) sage: isogenies_prime_degree_general(E, 17) - [Isogeny of degree 17 from Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2 over Finite Field in a of size 3^12 to Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2*x over Finite Field in a of size 3^12, Isogeny of degree 17 from Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2 over Finite Field in a of size 3^12 to Elliptic Curve defined by y^2 = x^3 + 2*x^2 + x + 2 over Finite Field in a of size 3^12] + [Isogeny of degree 17 from Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2 over Finite Field in a of size 3^12 to Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2*x over Finite Field in a of size 3^12, + Isogeny of degree 17 from Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2 over Finite Field in a of size 3^12 to Elliptic Curve defined by y^2 = x^3 + 2*x^2 + x + 2 over Finite Field in a of size 3^12] sage: E = EllipticCurve('50a1') sage: isogenies_prime_degree_general(E, 3) [Isogeny of degree 3 from Elliptic Curve defined by y^2 + x*y + y = x^3 - x - 2 over Rational Field to Elliptic Curve defined by y^2 + x*y + y = x^3 - 126*x - 552 over Rational Field] @@ -2271,7 +2311,8 @@ def isogenies_prime_degree(E, l, minimal_models=True): [Isogeny of degree 7 from Elliptic Curve defined by y^2 + x*y = x^3 + 1 over Finite Field in a of size 2^6 to Elliptic Curve defined by y^2 + x*y = x^3 + x over Finite Field in a of size 2^6] sage: E = EllipticCurve_from_j(GF(3^12,'a')(2)) sage: isogenies_prime_degree(E, 17) - [Isogeny of degree 17 from Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2 over Finite Field in a of size 3^12 to Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2*x over Finite Field in a of size 3^12, Isogeny of degree 17 from Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2 over Finite Field in a of size 3^12 to Elliptic Curve defined by y^2 = x^3 + 2*x^2 + x + 2 over Finite Field in a of size 3^12] + [Isogeny of degree 17 from Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2 over Finite Field in a of size 3^12 to Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2*x over Finite Field in a of size 3^12, + Isogeny of degree 17 from Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2 over Finite Field in a of size 3^12 to Elliptic Curve defined by y^2 = x^3 + 2*x^2 + x + 2 over Finite Field in a of size 3^12] sage: E = EllipticCurve('50a1') sage: isogenies_prime_degree(E, 3) [Isogeny of degree 3 from Elliptic Curve defined by y^2 + x*y + y = x^3 - x - 2 over Rational Field to Elliptic Curve defined by y^2 + x*y + y = x^3 - 126*x - 552 over Rational Field] diff --git a/src/sage/schemes/elliptic_curves/jacobian.py b/src/sage/schemes/elliptic_curves/jacobian.py index 6cf48d0760a..750e0b7b5a7 100644 --- a/src/sage/schemes/elliptic_curves/jacobian.py +++ b/src/sage/schemes/elliptic_curves/jacobian.py @@ -76,15 +76,15 @@ def Jacobian(X, **kwds): EXAMPLES:: sage: R. = QQ[] - sage: Jacobian(u^3+v^3+w^3) + sage: Jacobian(u^3 + v^3 + w^3) Elliptic Curve defined by y^2 = x^3 - 27/4 over Rational Field - sage: C = Curve(u^3+v^3+w^3) + sage: C = Curve(u^3 + v^3 + w^3) sage: Jacobian(C) Elliptic Curve defined by y^2 = x^3 - 27/4 over Rational Field sage: P2. = ProjectiveSpace(2, QQ) - sage: C = P2.subscheme(u^3+v^3+w^3) + sage: C = P2.subscheme(u^3 + v^3 + w^3) sage: Jacobian(C) Elliptic Curve defined by y^2 = x^3 - 27/4 over Rational Field @@ -125,14 +125,12 @@ def Jacobian_of_curve(curve, morphism=False): - ``curve`` -- a one-dimensional algebraic variety of genus one. - OUTPUT: - - Its Jacobian elliptic curve. + OUTPUT: Its Jacobian elliptic curve. EXAMPLES:: sage: R. = QQ[] - sage: C = Curve(u^3+v^3+w^3) + sage: C = Curve(u^3 + v^3 + w^3) sage: Jacobian(C) Elliptic Curve defined by y^2 = x^3 - 27/4 over Rational Field """ @@ -178,22 +176,23 @@ def Jacobian_of_equation(polynomial, variables=None, curve=None): EXAMPLES:: sage: R. = QQ[] - sage: f = a^3+b^3+60*c^3 + sage: f = a^3 + b^3 + 60*c^3 sage: Jacobian(f) Elliptic Curve defined by y^2 = x^3 - 24300 over Rational Field sage: Jacobian(f.subs(c=1)) Elliptic Curve defined by y^2 = x^3 - 24300 over Rational Field - If we specify the domain curve the birational covering is returned:: + If we specify the domain curve, the birational covering is returned:: sage: h = Jacobian(f, curve=Curve(f)); h Scheme morphism: From: Projective Plane Curve over Rational Field defined by a^3 + b^3 + 60*c^3 To: Elliptic Curve defined by y^2 = x^3 - 24300 over Rational Field Defn: Defined on coordinates by sending (a : b : c) to - (-216000*a^4*b^4*c - 12960000*a^4*b*c^4 - 12960000*a*b^4*c^4 : - 108000*a^6*b^3 - 108000*a^3*b^6 - 6480000*a^6*c^3 + 6480000*b^6*c^3 + 388800000*a^3*c^6 - 388800000*b^3*c^6 : - 216000*a^3*b^3*c^3) + (-216000*a^4*b^4*c - 12960000*a^4*b*c^4 - 12960000*a*b^4*c^4 + : 108000*a^6*b^3 - 108000*a^3*b^6 - 6480000*a^6*c^3 + 6480000*b^6*c^3 + + 388800000*a^3*c^6 - 388800000*b^3*c^6 + : 216000*a^3*b^3*c^3) sage: h([1,-1,0]) (0 : 1 : 0) @@ -203,16 +202,16 @@ def Jacobian_of_equation(polynomial, variables=None, curve=None): sage: E = h.codomain() sage: E.defining_polynomial()(h.defining_polynomials()).factor() - (2519424000000000) * c^3 * b^3 * a^3 * (a^3 + b^3 + 60*c^3) * - (a^9*b^6 + a^6*b^9 - 120*a^9*b^3*c^3 + 900*a^6*b^6*c^3 - 120*a^3*b^9*c^3 + - 3600*a^9*c^6 + 54000*a^6*b^3*c^6 + 54000*a^3*b^6*c^6 + 3600*b^9*c^6 + - 216000*a^6*c^9 - 432000*a^3*b^3*c^9 + 216000*b^6*c^9) + (2519424000000000) * c^3 * b^3 * a^3 * (a^3 + b^3 + 60*c^3) + * (a^9*b^6 + a^6*b^9 - 120*a^9*b^3*c^3 + 900*a^6*b^6*c^3 - 120*a^3*b^9*c^3 + + 3600*a^9*c^6 + 54000*a^6*b^3*c^6 + 54000*a^3*b^6*c^6 + 3600*b^9*c^6 + + 216000*a^6*c^9 - 432000*a^3*b^3*c^9 + 216000*b^6*c^9) By specifying the variables, we can also construct an elliptic curve over a polynomial ring:: sage: R. = QQ[] - sage: Jacobian(u^3+v^3+t, variables=[u,v]) + sage: Jacobian(u^3 + v^3 + t, variables=[u,v]) Elliptic Curve defined by y^2 = x^3 + (-27/4*t^2) over Multivariate Polynomial Ring in u, v, t over Rational Field diff --git a/src/sage/schemes/elliptic_curves/lseries_ell.py b/src/sage/schemes/elliptic_curves/lseries_ell.py index e1506b17910..50db7ec188c 100644 --- a/src/sage/schemes/elliptic_curves/lseries_ell.py +++ b/src/sage/schemes/elliptic_curves/lseries_ell.py @@ -935,7 +935,8 @@ def zero_sums(self, N=None): sage: E = EllipticCurve("5077a") sage: E.lseries().zero_sums() - Zero sum estimator for L-function attached to Elliptic Curve defined by y^2 + y = x^3 - 7*x + 6 over Rational Field + Zero sum estimator for L-function attached to + Elliptic Curve defined by y^2 + y = x^3 - 7*x + 6 over Rational Field """ from sage.lfunctions.zero_sums import LFunctionZeroSum return LFunctionZeroSum(self.__E, N=N) diff --git a/src/sage/schemes/elliptic_curves/mod_sym_num.pyx b/src/sage/schemes/elliptic_curves/mod_sym_num.pyx index 369cd98a293..297801edca5 100644 --- a/src/sage/schemes/elliptic_curves/mod_sym_num.pyx +++ b/src/sage/schemes/elliptic_curves/mod_sym_num.pyx @@ -80,7 +80,8 @@ accessible, too):: 35261176 sage: M = E.modular_symbol(implementation="num", sign=-1) sage: M - Numerical modular symbol attached to Elliptic Curve defined by y^2 = x^3 + 101*x + 103 over Rational Field + Numerical modular symbol attached to + Elliptic Curve defined by y^2 = x^3 + 101*x + 103 over Rational Field We can then compute the value `[13/17]^{-}` and `[1/17]^{+}` by calling the function ``M``. The value of `[0]^{+}=0` tells us that the rank of diff --git a/src/sage/schemes/elliptic_curves/modular_parametrization.py b/src/sage/schemes/elliptic_curves/modular_parametrization.py index 57a90190fe5..d8ac9a3a807 100644 --- a/src/sage/schemes/elliptic_curves/modular_parametrization.py +++ b/src/sage/schemes/elliptic_curves/modular_parametrization.py @@ -16,11 +16,13 @@ sage: phi = EllipticCurve('11a1').modular_parametrization() sage: phi - Modular parameterization from the upper half plane to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Modular parameterization from the upper half plane + to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: phi(0.5+CDF(I)) (285684.320516... + 7.0...e-11*I : 1.526964169...e8 + 5.6...e-8*I : 1.00000000000000) sage: phi.power_series(prec = 7) - (q^-2 + 2*q^-1 + 4 + 5*q + 8*q^2 + q^3 + 7*q^4 + O(q^5), -q^-3 - 3*q^-2 - 7*q^-1 - 13 - 17*q - 26*q^2 - 19*q^3 + O(q^4)) + (q^-2 + 2*q^-1 + 4 + 5*q + 8*q^2 + q^3 + 7*q^4 + O(q^5), + -q^-3 - 3*q^-2 - 7*q^-1 - 13 - 17*q - 26*q^2 - 19*q^3 + O(q^4)) AUTHORS: @@ -64,7 +66,8 @@ class ModularParameterization: sage: phi = EllipticCurve('11a1').modular_parametrization() sage: phi - Modular parameterization from the upper half plane to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Modular parameterization from the upper half plane to Elliptic Curve + defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field """ def __init__(self, E): r""" @@ -264,7 +267,7 @@ def power_series(self, prec=20): sage: E = EllipticCurve('389a1') sage: phi = E.modular_parametrization() - sage: X,Y = phi.power_series(prec=10) + sage: X, Y = phi.power_series(prec=10) sage: X q^-2 + 2*q^-1 + 4 + 7*q + 13*q^2 + 18*q^3 + 31*q^4 + 49*q^5 + 74*q^6 + 111*q^7 + O(q^8) sage: Y diff --git a/src/sage/schemes/elliptic_curves/period_lattice.py b/src/sage/schemes/elliptic_curves/period_lattice.py index 7224988fc27..8c6ea6654e7 100644 --- a/src/sage/schemes/elliptic_curves/period_lattice.py +++ b/src/sage/schemes/elliptic_curves/period_lattice.py @@ -24,10 +24,12 @@ sage: emb = K.embeddings(RealField())[0] sage: L = E.period_lattice(emb); L - Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism: - From: Number Field in a with defining polynomial x^3 - 2 - To: Algebraic Real Field - Defn: a |--> 1.259921049894873? + Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a + over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding + Ring morphism: + From: Number Field in a with defining polynomial x^3 - 2 + To: Algebraic Real Field + Defn: a |--> 1.259921049894873? The first basis period is real:: @@ -47,10 +49,12 @@ sage: emb = K.embeddings(ComplexField())[0] sage: L = E.period_lattice(emb); L - Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism: - From: Number Field in a with defining polynomial x^3 - 2 - To: Algebraic Field - Defn: a |--> -0.6299605249474365? - 1.091123635971722?*I + Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a + over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding + Ring morphism: + From: Number Field in a with defining polynomial x^3 - 2 + To: Algebraic Field + Defn: a |--> -0.6299605249474365? - 1.091123635971722?*I In this case, the basis `\omega_1`, `\omega_2` is always normalised so that `\tau = \omega_1/\omega_2` is in the fundamental region in the @@ -71,7 +75,9 @@ sage: K. = QuadraticField(-7) sage: EK = E.change_ring(K) sage: EK.period_lattice(K.complex_embeddings()[0]) - Period lattice associated to Elliptic Curve defined by y^2 + y = x^3 + (-1)*x over Number Field in a with defining polynomial x^2 + 7 with a = 2.645751311064591?*I with respect to the embedding Ring morphism: + Period lattice associated to Elliptic Curve defined by y^2 + y = x^3 + (-1)*x + over Number Field in a with defining polynomial x^2 + 7 with a = 2.645751311064591?*I + with respect to the embedding Ring morphism: From: Number Field in a with defining polynomial x^2 + 7 with a = 2.645751311064591?*I To: Algebraic Field Defn: a |--> -2.645751311064591?*I @@ -167,7 +173,8 @@ def __init__(self, E, embedding=None): sage: from sage.schemes.elliptic_curves.period_lattice import PeriodLattice_ell sage: E = EllipticCurve('37a') sage: PeriodLattice_ell(E) - Period lattice associated to Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field + Period lattice associated to + Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field :: @@ -175,22 +182,26 @@ def __init__(self, E, embedding=None): sage: emb = K.embeddings(RealField())[0] sage: E = EllipticCurve([0,1,0,a,a]) sage: L = PeriodLattice_ell(E,emb); L - Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism: - From: Number Field in a with defining polynomial x^3 - 2 - To: Algebraic Real Field - Defn: a |--> 1.259921049894873? + Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a + over Number Field in a with defining polynomial x^3 - 2 with respect to + the embedding Ring morphism: + From: Number Field in a with defining polynomial x^3 - 2 + To: Algebraic Real Field + Defn: a |--> 1.259921049894873? sage: emb = K.embeddings(ComplexField())[0] sage: L = PeriodLattice_ell(E,emb); L - Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism: - From: Number Field in a with defining polynomial x^3 - 2 - To: Algebraic Field - Defn: a |--> -0.6299605249474365? - 1.091123635971722?*I + Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a + over Number Field in a with defining polynomial x^3 - 2 with respect to + the embedding Ring morphism: + From: Number Field in a with defining polynomial x^3 - 2 + To: Algebraic Field + Defn: a |--> -0.6299605249474365? - 1.091123635971722?*I TESTS:: sage: from sage.schemes.elliptic_curves.period_lattice import PeriodLattice_ell - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: emb = K.embeddings(RealField())[0] sage: E = EllipticCurve([0,1,0,a,a]) sage: L = PeriodLattice_ell(E,emb) @@ -422,7 +433,7 @@ def basis(self, prec=None, algorithm='sage'): :: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: emb = K.embeddings(RealField())[0] sage: E = EllipticCurve([0,1,0,a,a]) sage: L = E.period_lattice(emb) @@ -431,7 +442,7 @@ def basis(self, prec=None, algorithm='sage'): sage: emb = K.embeddings(ComplexField())[0] sage: L = E.period_lattice(emb) - sage: w1,w2 = L.basis(); w1,w2 + sage: w1, w2 = L.basis(); w1, w2 (-1.37588604166076 - 2.58560946624443*I, -2.10339907847356 + 0.428378776460622*I) sage: L.is_real() False @@ -486,7 +497,7 @@ def gens(self, prec=None, algorithm='sage'): sage: E.period_lattice().gens() (2.99345864623196, 2.45138938198679*I) - sage: E.period_lattice().gens(prec = 100) + sage: E.period_lattice().gens(prec=100) (2.9934586462319596298320099794, 2.4513893819867900608542248319*I) """ return tuple(self.basis(prec=prec, algorithm=algorithm)) @@ -523,17 +534,19 @@ def normalised_basis(self, prec=None, algorithm='sage'): :: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: emb = K.embeddings(RealField())[0] sage: E = EllipticCurve([0,1,0,a,a]) sage: L = E.period_lattice(emb) sage: L.normalised_basis(64) - (1.90726488608927255 - 1.34047785962440202*I, -1.90726488608927255 - 1.34047785962440202*I) + (1.90726488608927255 - 1.34047785962440202*I, + -1.90726488608927255 - 1.34047785962440202*I) sage: emb = K.embeddings(ComplexField())[0] sage: L = E.period_lattice(emb) - sage: w1,w2 = L.normalised_basis(); w1,w2 - (-1.37588604166076 - 2.58560946624443*I, -2.10339907847356 + 0.428378776460622*I) + sage: w1, w2 = L.normalised_basis(); w1, w2 + (-1.37588604166076 - 2.58560946624443*I, + -2.10339907847356 + 0.428378776460622*I) sage: L.is_real() False sage: tau = w1/w2; tau @@ -574,7 +587,7 @@ def tau(self, prec=None, algorithm='sage'): :: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: emb = K.embeddings(RealField())[0] sage: E = EllipticCurve([0,1,0,a,a]) sage: L = E.period_lattice(emb) @@ -620,7 +633,7 @@ def _compute_periods_real(self, prec=None, algorithm='sage'): EXAMPLES:: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: E = EllipticCurve([0,1,0,a,a]) sage: embs = K.embeddings(CC) sage: Ls = [E.period_lattice(e) for e in embs] @@ -752,7 +765,7 @@ def is_real(self): :: sage: K. = QuadraticField(-1) - sage: E = EllipticCurve(K,[0,0,0,i,2*i]) + sage: E = EllipticCurve(K, [0,0,0,i,2*i]) sage: emb = K.embeddings(ComplexField())[0] sage: L = E.period_lattice(emb) sage: L.is_real() @@ -760,7 +773,7 @@ def is_real(self): :: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: E = EllipticCurve([0,1,0,a,a]) sage: [E.period_lattice(emb).is_real() for emb in K.embeddings(CC)] [False, False, True] @@ -834,7 +847,7 @@ def real_period(self, prec=None, algorithm='sage'): :: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: emb = K.embeddings(RealField())[0] sage: E = EllipticCurve([0,1,0,a,a]) sage: L = E.period_lattice(emb) @@ -881,7 +894,7 @@ def omega(self, prec=None, bsd_normalise=False): This is not a minimal model:: - sage: E = EllipticCurve([0,-432*6^2]) + sage: E = EllipticCurve([0, -432*6^2]) sage: E.period_lattice().omega() 0.486109385710056 @@ -895,7 +908,7 @@ def omega(self, prec=None, bsd_normalise=False): :: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: emb = K.embeddings(RealField())[0] sage: E = EllipticCurve([0,1,0,a,a]) sage: L = E.period_lattice(emb) @@ -952,7 +965,7 @@ def basis_matrix(self, prec=None, normalised=False): :: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: emb = K.embeddings(RealField())[0] sage: E = EllipticCurve([0,1,0,a,a]) sage: L = E.period_lattice(emb) @@ -1009,7 +1022,7 @@ def complex_area(self, prec=None): :: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: embs = K.embeddings(ComplexField()) sage: E = EllipticCurve([0,1,0,a,a]) sage: [E.period_lattice(emb).is_real() for emb in K.embeddings(CC)] @@ -1033,11 +1046,11 @@ def sigma(self, z, prec=None, flag=0): - ``flag`` -- - 0: (default) ???; + 0: (default) ???; - 1: computes an arbitrary determination of log(sigma(z)) + 1: computes an arbitrary determination of log(sigma(z)) - 2, 3: same using the product expansion instead of theta series. ??? + 2, 3: same using the product expansion instead of theta series. ??? .. NOTE:: @@ -1075,7 +1088,7 @@ def curve(self): :: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: E = EllipticCurve([0,1,0,a,a]) sage: L = E.period_lattice(K.embeddings(RealField())[0]) sage: L.curve() is E @@ -1103,13 +1116,13 @@ def ei(self): :: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: E = EllipticCurve([0,1,0,a,a]) sage: L = E.period_lattice(K.embeddings(RealField())[0]) sage: x1,x2,x3 = L.ei() - sage: abs(x1.real())+abs(x2.real())<1e-14 + sage: abs(x1.real()) + abs(x2.real()) < 1e-14 True - sage: x1.imag(),x2.imag(),x3 + sage: x1.imag(), x2.imag(), x3 (-1.122462048309373?, 1.122462048309373?, -1.000000000000000?) :: @@ -1318,7 +1331,7 @@ def e_log_RC(self, xP, yP, prec=None, reduce=True): A number field example:: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: E = EllipticCurve([0,0,0,0,a]) sage: v = K.real_places()[0] sage: L = E.period_lattice(v) @@ -1579,21 +1592,21 @@ def elliptic_logarithm(self, P, prec=None, reduce=True): The elliptic logs of the 2-torsion points are half-periods:: - sage: L.elliptic_logarithm(E(e1,0),prec=100) + sage: L.elliptic_logarithm(E(e1,0), prec=100) 0.64607575874356525952487867052 + 0.22379609053909448304176885364*I - sage: L.elliptic_logarithm(E(e2,0),prec=100) + sage: L.elliptic_logarithm(E(e2,0), prec=100) 0.71330686725892253793705940192 - 0.40481924028150941053684639367*I - sage: L.elliptic_logarithm(E(e3,0),prec=100) + sage: L.elliptic_logarithm(E(e3,0), prec=100) 0.067231108515357278412180731396 - 0.62861533082060389357861524731*I We check this by doubling and seeing that the resulting coordinates are integers:: - sage: L.coordinates(2*L.elliptic_logarithm(E(e1,0),prec=100)) + sage: L.coordinates(2*L.elliptic_logarithm(E(e1,0), prec=100)) (1.0000000000000000000000000000, 0.00000000000000000000000000000) - sage: L.coordinates(2*L.elliptic_logarithm(E(e2,0),prec=100)) + sage: L.coordinates(2*L.elliptic_logarithm(E(e2,0), prec=100)) (1.0000000000000000000000000000, 1.0000000000000000000000000000) - sage: L.coordinates(2*L.elliptic_logarithm(E(e3,0),prec=100)) + sage: L.coordinates(2*L.elliptic_logarithm(E(e3,0), prec=100)) (0.00000000000000000000000000000, 1.0000000000000000000000000000) :: @@ -1603,12 +1616,12 @@ def elliptic_logarithm(self, P, prec=None, reduce=True): sage: E = EllipticCurve([0,0,0,a4,a6]) sage: emb = K.embeddings(CC)[1] sage: L = E.period_lattice(emb) - sage: P = E(3+2*i,14-7*i) + sage: P = E(3+2*i, 14-7*i) sage: L.elliptic_logarithm(P) 0.297147783912228 - 0.546125549639461*I sage: L.coordinates(L.elliptic_logarithm(P)) (0.628653378040238, 0.371417754610223) - sage: e1 = 1+3*i; e2 = -4-12*i; e3=-e1-e2 + sage: e1 = 1+3*i; e2 = -4-12*i; e3 = -e1-e2 sage: L.coordinates(L.elliptic_logarithm(E(e1,0))) (0.500000000000000, 0.500000000000000) sage: L.coordinates(L.elliptic_logarithm(E(e2,0))) @@ -1767,7 +1780,9 @@ def elliptic_exponential(self, z, to_curve=True): sage: P = L.elliptic_exponential(0); P (0.000000000000000 : 1.00000000000000 : 0.000000000000000) sage: P.parent() - Abelian group of points on Elliptic Curve defined by y^2 + 1.00000000000000*y = x^3 + (-1.00000000000000)*x over Complex Field with 53 bits of precision + Abelian group of points on Elliptic Curve defined by + y^2 + 1.00000000000000*y = x^3 + (-1.00000000000000)*x + over Complex Field with 53 bits of precision Very small `z` are handled properly (see :trac:`8820`):: @@ -1862,10 +1877,10 @@ def reduce_tau(tau): (tuple) `(\tau',[a,b,c,d])` where `a,b,c,d` are integers such that - - `ad-bc=1`; - - `\tau`=(a\tau+b)/(c\tau+d)`; - - `|\tau'|\ge1`; - - `|\Re(\tau')|\le\frac{1}{2}`. + - `ad-bc=1`; + - `\tau'=(a\tau+b)/(c\tau+d)`; + - `|\tau'|\ge1`; + - `|\Re(\tau')|\le\frac{1}{2}`. EXAMPLES:: @@ -1909,10 +1924,10 @@ def normalise_periods(w1, w2): (tuple) `((\omega_1',\omega_2'),[a,b,c,d])` where `a,b,c,d` are integers such that - - `ad-bc=\pm1`; - - `(\omega_1',\omega_2') = (a\omega_1+b\omega_2,c\omega_1+d\omega_2)`; - - `\tau=\omega_1'/\omega_2'` is in the upper half plane; - - `|\tau|\ge1` and `|\Re(\tau)|\le\frac{1}{2}`. + - `ad-bc=\pm1`; + - `(\omega_1',\omega_2') = (a\omega_1+b\omega_2,c\omega_1+d\omega_2)`; + - `\tau=\omega_1'/\omega_2'` is in the upper half plane; + - `|\tau|\ge1` and `|\Re(\tau)|\le\frac{1}{2}`. EXAMPLES:: @@ -1958,12 +1973,12 @@ def extended_agm_iteration(a, b, c): EXAMPLES:: sage: from sage.schemes.elliptic_curves.period_lattice import extended_agm_iteration - sage: extended_agm_iteration(RR(1),RR(2),RR(3)) + sage: extended_agm_iteration(RR(1), RR(2), RR(3)) (1.45679103104691, 1.45679103104691, 3.21245294970054) sage: extended_agm_iteration(CC(1,2),CC(2,3),CC(3,4)) (1.46242448156430 + 2.47791311676267*I, - 1.46242448156430 + 2.47791311676267*I, - 3.22202144343535 + 4.28383734262540*I) + 1.46242448156430 + 2.47791311676267*I, + 3.22202144343535 + 4.28383734262540*I) TESTS:: diff --git a/src/sage/schemes/elliptic_curves/saturation.py b/src/sage/schemes/elliptic_curves/saturation.py index 88775ee22a4..026d344e224 100644 --- a/src/sage/schemes/elliptic_curves/saturation.py +++ b/src/sage/schemes/elliptic_curves/saturation.py @@ -24,7 +24,7 @@ already `p`-saturated this sieving technique can prove their saturation quickly. -The method :meth:`saturation` of the class EllipticCurve_number_field +The method :meth:`saturation` of the class :class:`EllipticCurve_number_field` applies full `p`-saturation at any given set of primes, or can compute a bound on the primes `p` at which the given points may not be `p`-saturated. This involves computing a lower bound for the @@ -64,7 +64,7 @@ def reduce_mod_q(x, amodq): - ``amodq`` -- an element of `GF(q)` which is a root mod `q` of the defining polynomial of `K`. This defines a degree 1 prime - ideal `Q=(q,\alpha-a)` of `K=\QQ(\alpha)`, where `a \mod q = ` + ideal `Q=(q,\alpha-a)` of `K=\QQ(\alpha)`, where `a \bmod q` = ``amodq``. OUTPUT: @@ -144,7 +144,7 @@ def add_reductions(self, q): INPUT: - ``q`` -- a prime number not dividing the defining polynomial - of self.__field. + of ``self.__field``. OUTPUT: diff --git a/src/sage/schemes/elliptic_curves/sha_tate.py b/src/sage/schemes/elliptic_curves/sha_tate.py index 1e4fe251ff6..b905a6588fa 100644 --- a/src/sage/schemes/elliptic_curves/sha_tate.py +++ b/src/sage/schemes/elliptic_curves/sha_tate.py @@ -50,7 +50,8 @@ sage: E = EllipticCurve('389a') sage: S = E.sha(); S - Tate-Shafarevich group for the Elliptic Curve defined by y^2 + y = x^3 + x^2 - 2*x over Rational Field + Tate-Shafarevich group for the + Elliptic Curve defined by y^2 + y = x^3 + x^2 - 2*x over Rational Field sage: S.an_numerical() 1.00000000000000 sage: S.p_primary_bound(5) @@ -124,7 +125,8 @@ class Sha(SageObject): sage: E = EllipticCurve('389a') sage: S = E.sha(); S - Tate-Shafarevich group for the Elliptic Curve defined by y^2 + y = x^3 + x^2 - 2*x over Rational Field + Tate-Shafarevich group for the + Elliptic Curve defined by y^2 + y = x^3 + x^2 - 2*x over Rational Field sage: S.an_numerical() 1.00000000000000 sage: S.p_primary_bound(5) # long time @@ -147,7 +149,8 @@ def __init__(self, E): sage: E = EllipticCurve('11a1') sage: S = E.sha() sage: S - Tate-Shafarevich group for the Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Tate-Shafarevich group for the + Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: S == loads(dumps(S)) True @@ -260,11 +263,11 @@ def an_numerical(self, prec=None, sage: sha = EllipticCurve('37a1').sha() sage: [sha.an_numerical(prec) for prec in range(40,100,10)] # long time (3s on sage.math, 2013) [1.0000000000, - 1.0000000000000, - 1.0000000000000000, - 1.0000000000000000000, - 1.0000000000000000000000, - 1.0000000000000000000000000] + 1.0000000000000, + 1.0000000000000000, + 1.0000000000000000000, + 1.0000000000000000000000, + 1.0000000000000000000000000] """ if prec is None: prec = RealField().precision() @@ -324,8 +327,9 @@ def an(self, use_database=False, descent_second_limit=12): sage: E.sha().an() Traceback (most recent call last): ... - RuntimeError: Unable to compute the rank, hence generators, with certainty (lower bound=0, generators found=[]). This could be because Sha(E/Q)[2] is nontrivial. - Try increasing descent_second_limit then trying this command again. + RuntimeError: Unable to compute the rank, hence generators, with certainty + (lower bound=0, generators found=[]). This could be because Sha(E/Q)[2] is + nontrivial. Try increasing descent_second_limit then trying this command again. You can increase the ``descent_second_limit`` (in the above example, set to the default, 12) option to try again:: @@ -388,14 +392,14 @@ def an(self, use_database=False, descent_second_limit=12): In this case the input curve is not minimal, and if this function did not transform it to be minimal, it would give nonsense:: - sage: E = EllipticCurve([0,-432*6^2]) + sage: E = EllipticCurve([0, -432*6^2]) sage: E.sha().an() 1 See :trac:`10096`: this used to give the wrong result 6.0000 before since the minimal model was not used:: - sage: E = EllipticCurve([1215*1216,0]) # non-minimal model + sage: E = EllipticCurve([1215*1216, 0]) # non-minimal model sage: E.sha().an() # long time (2s on sage.math, 2011) 1.00000000000000 sage: E.minimal_model().sha().an() # long time (1s on sage.math, 2011) @@ -523,7 +527,7 @@ def an_padic(self, p, prec=0, use_twists=True): 1 + O(5) sage: EllipticCurve('240d3').sha().an_padic(5) # sha has 4 elements here 4 + O(5) - sage: EllipticCurve('448c5').sha().an_padic(7,prec=4, use_twists=False) # long time (2s on sage.math, 2011) + sage: EllipticCurve('448c5').sha().an_padic(7, prec=4, use_twists=False) # long time (2s on sage.math, 2011) 2 + 7 + O(7^6) sage: EllipticCurve([-19,34]).sha().an_padic(5) # see trac #6455, long time (4s on sage.math, 2011) 1 + O(5) @@ -841,7 +845,9 @@ def p_primary_bound(self, p): sage: E.sha().p_primary_bound(5) Traceback (most recent call last): ... - ValueError: The p-adic Galois representation is not surjective or reducible. Current knowledge about Euler systems does not provide an upper bound in this case. Try an_padic for a conjectural bound. + ValueError: The p-adic Galois representation is not surjective or reducible. + Current knowledge about Euler systems does not provide an upper bound + in this case. Try an_padic for a conjectural bound. sage: E.sha().an_padic(5) # long time 1 + O(5^22) @@ -1075,9 +1081,9 @@ def bound_kato(self): THEOREM: Suppose `L(E,1) \neq 0` and `p \neq 2` is a prime such that - - `E` does not have additive reduction at `p`, - - either the `p`-adic representation is surjective or has its - image contained in a Borel subgroup. + - `E` does not have additive reduction at `p`, + - either the `p`-adic representation is surjective or has its + image contained in a Borel subgroup. Then `{ord}_p(\#Sha(E))` is bounded from above by the `p`-adic valuation of `L(E,1)\cdot\#E(\QQ)_{tor}^2 / (\Omega_E \cdot \prod c_v)`. diff --git a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py index 6ca567ffe7b..ad8d47d7ec2 100644 --- a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py +++ b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py @@ -379,7 +379,7 @@ class WeierstrassIsomorphism(EllipticCurveHom, baseWI): - ``E`` -- an ``EllipticCurve``, or ``None`` (see below). - ``urst`` -- a 4-tuple `(u,r,s,t)`, a :class:`baseWI` object, - or ``None`` (see below). + or ``None`` (see below). - ``F`` -- an ``EllipticCurve``, or ``None`` (see below). diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index d62c207ea79..9229311bd78 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -4,14 +4,14 @@ An algebraic scheme is defined by a set of polynomials in some suitable affine or projective coordinates. Possible ambient spaces are - * Affine spaces (:class:`AffineSpace - `), +* Affine spaces (:class:`AffineSpace + `), - * Projective spaces (:class:`ProjectiveSpace - `), or +* Projective spaces (:class:`ProjectiveSpace + `), or - * Toric varieties (:class:`ToricVariety - `). +* Toric varieties (:class:`ToricVariety + `). Note that while projective spaces are of course toric varieties themselves, they are implemented differently in Sage due to efficiency considerations. @@ -58,10 +58,8 @@ Defining x0, x1, x2, x3 sage: Q = matrix([[x0, x1, x2], [x1, x2, x3]]).minors(2); Q [-x1^2 + x0*x2, -x1*x2 + x0*x3, -x2^2 + x1*x3] - sage: twisted_cubic = P3.subscheme(Q) - sage: twisted_cubic - Closed subscheme of Projective Space of dimension 3 - over Rational Field defined by: + sage: twisted_cubic = P3.subscheme(Q); twisted_cubic + Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: -x1^2 + x0*x2, -x1*x2 + x0*x3, -x2^2 + x1*x3 @@ -900,9 +898,9 @@ class AlgebraicScheme_subscheme(AlgebraicScheme): - ``A`` - ambient space (e.g. affine or projective `n`-space) - ``polynomials`` - single polynomial, ideal or iterable of defining - polynomials; in any case polynomials must belong to the coordinate - ring of the ambient space and define valid polynomial functions (e.g. - they should be homogeneous in the case of a projective space) + polynomials; in any case polynomials must belong to the coordinate + ring of the ambient space and define valid polynomial functions (e.g. + they should be homogeneous in the case of a projective space) OUTPUT: @@ -1360,8 +1358,8 @@ def Jacobian(self): sage: twisted_cubic = P3.subscheme(matrix([[w, x, y], [x, y, z]]).minors(2)) sage: twisted_cubic.Jacobian() Ideal (-x^2 + w*y, -x*y + w*z, -y^2 + x*z, x*z, -2*w*z, w*y, 3*w*y, -2*w*x, - w^2, y*z, -2*x*z, w*z, 3*w*z, -2*w*y, w*x, z^2, -2*y*z, x*z, 3*x*z, -2*w*z, - w*y) of Multivariate Polynomial Ring in w, x, y, z over Rational Field + w^2, y*z, -2*x*z, w*z, 3*w*z, -2*w*y, w*x, z^2, -2*y*z, x*z, 3*x*z, -2*w*z, w*y) + of Multivariate Polynomial Ring in w, x, y, z over Rational Field sage: twisted_cubic.defining_ideal() Ideal (-x^2 + w*y, -x*y + w*z, -y^2 + x*z) of Multivariate Polynomial Ring in w, x, y, z over Rational Field diff --git a/src/sage/schemes/generic/homset.py b/src/sage/schemes/generic/homset.py index 920bc758b0b..262e880f253 100644 --- a/src/sage/schemes/generic/homset.py +++ b/src/sage/schemes/generic/homset.py @@ -231,7 +231,7 @@ class SchemeHomset_generic(HomsetWithBase): - ``category`` -- a category (optional). The category of the Hom-set. - - ``check`` -- boolean (optional, default=``True``). Whether to + - ``check`` -- boolean (optional, default: ``True``). Whether to check the defining data for consistency. EXAMPLES:: diff --git a/src/sage/schemes/generic/hypersurface.py b/src/sage/schemes/generic/hypersurface.py index 1b100bb29eb..e5fbb2aac42 100644 --- a/src/sage/schemes/generic/hypersurface.py +++ b/src/sage/schemes/generic/hypersurface.py @@ -24,8 +24,8 @@ def is_Hypersurface(self): """ - Return True if self is a hypersurface, i.e. an object of the type - ProjectiveHypersurface or AffineHypersurface. + Return True if ``self`` is a hypersurface, i.e. an object of the type + :class:`ProjectiveHypersurface` or :class:`AffineHypersurface`. EXAMPLES:: diff --git a/src/sage/schemes/generic/morphism.py b/src/sage/schemes/generic/morphism.py index 66b15f9ca56..e3ef91c5e61 100644 --- a/src/sage/schemes/generic/morphism.py +++ b/src/sage/schemes/generic/morphism.py @@ -9,9 +9,9 @@ all schemes. If you want to extend the Sage library with some new kind of scheme, -your new class (say, ``myscheme``) should provide a method +your new class (say, ``MyScheme``) should provide a method -* ``myscheme._morphism(*args, **kwds)`` returning a morphism +* ``MyScheme._morphism(*args, **kwds)`` returning a morphism between two schemes in your category, usually defined via polynomials. Your morphism class should derive from :class:`SchemeMorphism_polynomial`. These morphisms will usually be @@ -22,17 +22,17 @@ subcategory of schemes. If you want to do this, you should also provide a method -* ``myscheme._homset(*args, **kwds)`` returning a +* ``MyScheme._homset(*args, **kwds)`` returning a Hom-set, which must be an element of a derived class of :class:`~sage.schemes.generic.homset.SchemeHomset_generic`. If your - new Hom-set class does not use ``myscheme._morphism`` then you + new Hom-set class does not use ``MyScheme._morphism`` then you do not have to provide it. Note that points on schemes are morphisms `Spec(K)\to X`, too. But we typically use a different notation, so they are implemented in a different derived class. For this, you should implement a method -* ``myscheme._point(*args, **kwds)`` returning a point, that is, +* ``MyScheme._point(*args, **kwds)`` returning a point, that is, a morphism `Spec(K)\to X`. Your point class should derive from :class:`SchemeMorphism_point`. @@ -40,10 +40,10 @@ example the point Hom-set can provide a method to enumerate all points. If you want to do this, you should also provide a method -* ``myscheme._point_homset(*args, **kwds)`` returning +* ``MyScheme._point_homset(*args, **kwds)`` returning the :mod:`~sage.schemes.generic.homset` of points. The Hom-sets of points are implemented in classes named ``SchemeHomset_points_...``. - If your new Hom-set class does not use ``myscheme._point`` then + If your new Hom-set class does not use ``MyScheme._point`` then you do not have to provide it. AUTHORS: @@ -1956,7 +1956,7 @@ def scheme(self): def change_ring(self, R, check=True): r""" - Returns a new :class:`SchemeMorphism_point` which is this point coerced to``R``. + Returns a new :class:`SchemeMorphism_point` which is this point coerced to ``R``. If ``check`` is true, then the initialization checks are performed. @@ -1964,8 +1964,6 @@ def change_ring(self, R, check=True): - ``R`` -- ring or morphism. - kwds: - - ``check`` -- Boolean OUTPUT: :class:`SchemeMorphism_point` diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py index 48d8dfedf81..d51f9eca1d8 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py @@ -337,7 +337,7 @@ def frobenius_polynomial_cardinalities(self, a=None): sage: H.frobenius_polynomial_cardinalities() x^4 + 8*x^3 + 70*x^2 + 392*x + 2401 - This method may actually be useful when `hypellfrob` does not work:: + This method may actually be useful when ``hypellfrob`` does not work:: sage: K = GF(7) sage: R. = PolynomialRing(K) @@ -1841,7 +1841,7 @@ def a_number(self): - ``a`` : a-number - EXAMPLES:: + EXAMPLES:: sage: K. = GF(49, 'x')[] sage: C = HyperellipticCurve(x^5 + 1, 0) diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py index 4aea89c393a..bb39a5badba 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py @@ -122,7 +122,7 @@ def __init__(self, PP, f, h=None, names=None, genus=None): def change_ring(self, R): """ - Returns this HyperellipticCurve over a new base ring R. + Returns this HyperellipticCurve over a new base ring ``R``. EXAMPLES:: @@ -458,7 +458,7 @@ def local_coordinates_at_nonweierstrass(self, P, prec=20, name='t'): AUTHOR: - - Jennifer Balakrishnan (2007-12) + - Jennifer Balakrishnan (2007-12) """ d = P[1] if d == 0: @@ -509,7 +509,7 @@ def local_coordinates_at_weierstrass(self, P, prec=20, name='t'): t + O(t^5) AUTHOR: - - Jennifer Balakrishnan (2007-12) + - Jennifer Balakrishnan (2007-12) - Francis Clarke (2012-08-26) """ @@ -610,7 +610,8 @@ def local_coord(self, P, prec=20, name='t'): t^-5 + 46*t^-1 - 36*t - 609*t^3 + 1656*t^5 + O(t^6)) AUTHOR: - - Jennifer Balakrishnan (2007-12) + + - Jennifer Balakrishnan (2007-12) """ if P[1] == 0: return self.local_coordinates_at_weierstrass(P, prec, name) @@ -628,7 +629,7 @@ def rational_points(self, **kwds): EXAMPLES: - For the LMFDB genus 2 curve `932.a.3728.1 `:: + For the LMFDB genus 2 curve `932.a.3728.1 `_:: sage: R. = PolynomialRing(QQ) sage: C = HyperellipticCurve(R([0, -1, 1, 0, 1, -2, 1]), R([1])) @@ -644,7 +645,7 @@ def rational_points(self, **kwds): (1 : 0 : 1)] Check that :trac:`29509` is fixed for the LMFDB genus 2 curve - `169.a.169.1 `:: + `169.a.169.1 `_:: sage: C = HyperellipticCurve(R([0, 0, 0, 0, 1, 1]), R([1, 1, 0, 1])) sage: C.rational_points(bound=10) diff --git a/src/sage/schemes/jacobians/abstract_jacobian.py b/src/sage/schemes/jacobians/abstract_jacobian.py index 6cb414667e2..8f57a14be36 100644 --- a/src/sage/schemes/jacobians/abstract_jacobian.py +++ b/src/sage/schemes/jacobians/abstract_jacobian.py @@ -132,8 +132,8 @@ def __init__(self, C): def __richcmp__(self, J, op): """ - Compare the Jacobian self to `J`. If `J` is a Jacobian, then - self and `J` are equal if and only if their curves are equal. + Compare the Jacobian ``self`` to `J`. If `J` is a Jacobian, then + ``self`` and `J` are equal if and only if their curves are equal. EXAMPLES:: @@ -194,7 +194,7 @@ def _point(self): def curve(self): """ - Return the curve of which self is the Jacobian. + Return the curve of which ``self`` is the Jacobian. EXAMPLES:: @@ -214,9 +214,7 @@ def change_ring(self, R): - ``R`` -- a field. The new base ring. - OUTPUT: - - The Jacobian over the ring `R`. + OUTPUT: The Jacobian over the ring `R`. EXAMPLES:: @@ -233,15 +231,13 @@ def change_ring(self, R): def base_extend(self, R): r""" - Return the natural extension of ``self`` over `R` + Return the natural extension of ``self`` over `R`. INPUT: - ``R`` -- a field. The new base field. - OUTPUT: - - The Jacobian over the ring `R`. + OUTPUT: The Jacobian over the ring `R`. EXAMPLES:: diff --git a/src/sage/schemes/plane_conics/con_field.py b/src/sage/schemes/plane_conics/con_field.py index 931b82649d5..7386b41bfc0 100644 --- a/src/sage/schemes/plane_conics/con_field.py +++ b/src/sage/schemes/plane_conics/con_field.py @@ -80,7 +80,7 @@ def __init__(self, A, f): def _repr_type(self): r""" - Returns ``'Projective Conic'``, which is the first part of the + Return ``'Projective Conic'``, which is the first part of the plain text representation of this object as output by the function ``_repr_`` of the class ``Curve_generic``. @@ -97,7 +97,7 @@ def _repr_type(self): def base_extend(self, S): r""" - Returns the conic over ``S`` given by the same equation as ``self``. + Return the conic over ``S`` given by the same equation as ``self``. EXAMPLES:: @@ -133,7 +133,7 @@ def base_extend(self, S): def cache_point(self, p): r""" Replace the point in the cache of ``self`` by ``p`` for use - by ``self.rational_point()`` and ``self.parametrization()``. + by :meth:`rational_point` and :meth:`parametrization`. EXAMPLES:: @@ -213,7 +213,7 @@ def derivative_matrix(self): def determinant(self): r""" - Returns the determinant of the symmetric matrix that defines + Return the determinant of the symmetric matrix that defines the conic ``self``. This is defined only if the base field has characteristic @@ -245,7 +245,7 @@ def determinant(self): def diagonal_matrix(self): r""" - Returns a diagonal matrix `D` and a matrix `T` such that `T^t A T = D` + Return a diagonal matrix `D` and a matrix `T` such that `T^t A T = D` holds, where `(x, y, z) A (x, y, z)^t` is the defining polynomial of the conic ``self``. @@ -307,7 +307,7 @@ def diagonal_matrix(self): def diagonalization(self, names=None): r""" - Returns a diagonal conic `C`, an isomorphism of schemes `M: C` -> ``self`` + Return a diagonal conic `C`, an isomorphism of schemes `M: C` -> ``self`` and the inverse `N` of `M`. EXAMPLES:: @@ -320,15 +320,13 @@ def diagonalization(self, names=None): defined by x^2 + y^2 + 2*z^2 To: Projective Conic Curve over Finite Field of size 5 defined by x^2 + y^2 + x*z + z^2 - Defn: Defined on coordinates by sending (x : y : z) to - (x + 2*z : y : z), + Defn: Defined on coordinates by sending (x : y : z) to (x + 2*z : y : z), Scheme morphism: From: Projective Conic Curve over Finite Field of size 5 defined by x^2 + y^2 + x*z + z^2 - To: Projective Conic Curve over Finite Field of size 5 d - efined by x^2 + y^2 + 2*z^2 - Defn: Defined on coordinates by sending (x : y : z) to - (x - 2*z : y : z)) + To: Projective Conic Curve over Finite Field of size 5 + defined by x^2 + y^2 + 2*z^2 + Defn: Defined on coordinates by sending (x : y : z) to (x - 2*z : y : z)) The diagonalization is only defined in characteristic different from 2: @@ -360,8 +358,7 @@ def diagonalization(self, names=None): To: Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 7 defined by (-3*t)*x^2 + 2*y^2 + x*z + 3*z^2 - Defn: Defined on coordinates by sending (x : y : z) to - (x - 1/t*z : y : z), + Defn: Defined on coordinates by sending (x : y : z) to (x - 1/t*z : y : z), Scheme morphism: From: Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 7 @@ -369,10 +366,7 @@ def diagonalization(self, names=None): To: Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 7 defined by (-3*t)*x^2 + 2*y^2 + (3*t + 3)/t*z^2 - Defn: Defined on coordinates by sending (x : y : z) to - (x + 1/t*z : y : z)) - - + Defn: Defined on coordinates by sending (x : y : z) to (x + 1/t*z : y : z)) """ if names is None: names = self.defining_polynomial().parent().variable_names() @@ -383,7 +377,7 @@ def diagonalization(self, names=None): def gens(self): r""" - Returns the generators of the coordinate ring of ``self``. + Return the generators of the coordinate ring of ``self``. EXAMPLES: @@ -410,7 +404,7 @@ def gens(self): def has_rational_point(self, point=False, algorithm='default', read_cache=True): r""" - Returns True if and only if the conic ``self`` + Return True if and only if the conic ``self`` has a point over its base field `B`. If ``point`` is True, then returns a second output, which is @@ -424,12 +418,12 @@ def has_rational_point(self, point=False, The parameter ``algorithm`` specifies the algorithm to be used: - - ``'default'`` -- If the base field is real or complex, - use an elementary native Sage implementation. + - ``'default'`` -- If the base field is real or complex, + use an elementary native Sage implementation. - - ``'magma'`` (requires Magma to be installed) -- - delegates the task to the Magma computer algebra - system. + - ``'magma'`` (requires Magma to be installed) -- + delegates the task to the Magma computer algebra + system. EXAMPLES:: @@ -648,7 +642,7 @@ def hom(self, x, Y=None): EXAMPLES: - Here are a few Morphisms given by matrices. In the first + Here are a few morphisms given by matrices. In the first example, ``Y`` is omitted, in the second example, ``Y`` is specified. :: @@ -734,13 +728,13 @@ def hom(self, x, Y=None): def is_diagonal(self): r""" Return True if and only if the conic has the form - `a*x^2 + b*y^2 + c*z^2`. + `a x^2 + b y^2 + c z^2`. EXAMPLES: :: - sage: c=Conic([1,1,0,1,0,1]); c + sage: c = Conic([1,1,0,1,0,1]); c Projective Conic Curve over Rational Field defined by x^2 + x*y + y^2 + z^2 sage: d,t = c.diagonal_matrix() sage: c.is_diagonal() @@ -752,7 +746,7 @@ def is_diagonal(self): def is_smooth(self): r""" - Returns True if and only if ``self`` is smooth. + Return True if and only if ``self`` is smooth. EXAMPLES: @@ -811,7 +805,7 @@ def _magma_init_(self, magma): def matrix(self): r""" - Returns a matrix `M` such that `(x, y, z) M (x, y, z)^t` + Return a matrix `M` such that `(x, y, z) M (x, y, z)^t` is the defining equation of ``self``. The matrix `M` is upper triangular if the base field has @@ -845,7 +839,7 @@ def parametrization(self, point=None, morphism=True): inverse of `f`. If ``point`` is specified, then that point is used - for the parametrization. Otherwise, use ``self.rational_point()`` + for the parametrization. Otherwise, use :meth:`rational_point()` to find a point. If ``morphism`` is True, then `f` is returned in the form @@ -974,7 +968,7 @@ def point(self, v, check=True): point on ``self``. If no rational point on ``self`` is known yet, then also caches the point - for use by ``self.rational_point()`` and ``self.parametrization()``. + for use by :meth:`rational_point` and :meth:`parametrization`. EXAMPLES:: @@ -1000,13 +994,11 @@ def random_rational_point(self, *args1, **args2): ALGORITHM: - 1. Compute a parametrization `f` of ``self`` using - ``self.parametrization()``. - 2. Computes a random point `(x:y)` on the projective - line. - 3. Output `f(x:y)`. + 1. Compute a parametrization `f` of ``self`` using :meth:`parametrization`. + 2. Computes a random point `(x:y)` on the projective line. + 3. Output `f(x:y)`. - The coordinates x and y are computed using + The coordinates `x` and `y` are computed using ``B.random_element``, where ``B`` is the base field of ``self`` and additional arguments to ``random_rational_point`` are passed to ``random_element``. @@ -1185,7 +1177,7 @@ def rational_point(self, algorithm='default', read_cache=True): def singular_point(self): r""" - Returns a singular rational point of ``self`` + Return a singular rational point of ``self``. EXAMPLES: @@ -1267,13 +1259,13 @@ def upper_triangular_matrix(self): def variable_names(self): r""" - Returns the variable names of the defining polynomial of ``self``. + Return the variable names of the defining polynomial of ``self``. EXAMPLES: :: - sage: c=Conic([1,1,0,1,0,1], 'x,y,z') + sage: c = Conic([1,1,0,1,0,1], 'x,y,z') sage: c.variable_names() ('x', 'y', 'z') sage: c.variable_name() diff --git a/src/sage/schemes/plane_conics/con_number_field.py b/src/sage/schemes/plane_conics/con_number_field.py index 4b0e7f1c5d4..fcd100d3707 100644 --- a/src/sage/schemes/plane_conics/con_number_field.py +++ b/src/sage/schemes/plane_conics/con_number_field.py @@ -66,7 +66,7 @@ def __init__(self, A, f): def has_rational_point(self, point=False, obstruction=False, algorithm='default', read_cache=True): r""" - Returns ``True`` if and only if ``self`` has a point + Return ``True`` if and only if ``self`` has a point defined over its base field `B`. If ``point`` and ``obstruction`` are both False (default), @@ -76,12 +76,12 @@ def has_rational_point(self, point=False, obstruction=False, If ``point`` or ``obstruction`` is True, then the output is a pair ``(out, S)``, where ``out`` is as above and: - - if ``point`` is True and ``self`` has a rational point, - then ``S`` is a rational point, + - if ``point`` is True and ``self`` has a rational point, + then ``S`` is a rational point, - - if ``obstruction`` is True, ``self`` has no rational point, - then ``S`` is a prime or infinite place of `B` such that no - rational point exists over the completion at ``S``. + - if ``obstruction`` is True, ``self`` has no rational point, + then ``S`` is a prime or infinite place of `B` such that no + rational point exists over the completion at ``S``. Points and obstructions are cached whenever they are found. Cached information is used for the output if available, but only @@ -92,20 +92,20 @@ def has_rational_point(self, point=False, obstruction=False, The parameter ``algorithm`` specifies the algorithm to be used: - - ``'rnfisnorm'`` -- Use PARI's rnfisnorm - (cannot be combined with ``obstruction = True``) + - ``'rnfisnorm'`` -- Use PARI's ``rnfisnorm`` + (cannot be combined with ``obstruction = True``) - - ``'local'`` -- Check if a local solution exists for all primes - and infinite places of `B` and apply the Hasse principle. - (Cannot be combined with ``point = True``.) + - ``'local'`` -- Check if a local solution exists for all primes + and infinite places of `B` and apply the Hasse principle. + (Cannot be combined with ``point = True``.) - - ``'default'`` -- Use algorithm ``'rnfisnorm'`` first. - Then, if no point exists and obstructions are requested, use - algorithm ``'local'`` to find an obstruction. + - ``'default'`` -- Use algorithm ``'rnfisnorm'`` first. + Then, if no point exists and obstructions are requested, use + algorithm ``'local'`` to find an obstruction. - - ``'magma'`` (requires Magma to be installed) -- - delegates the task to the Magma computer algebra - system. + - ``'magma'`` (requires Magma to be installed) -- + delegates the task to the Magma computer algebra + system. EXAMPLES: @@ -339,7 +339,7 @@ def has_rational_point(self, point=False, obstruction=False, def is_locally_solvable(self, p): r""" - Returns ``True`` if and only if ``self`` has a solution over the + Return ``True`` if and only if ``self`` has a solution over the completion of the base field `B` of ``self`` at ``p``. Here ``p`` is a finite prime or infinite place of `B`. @@ -388,7 +388,7 @@ def is_locally_solvable(self, p): def local_obstructions(self, finite=True, infinite=True, read_cache=True): r""" - Returns the sequence of finite primes and/or infinite places + Return the sequence of finite primes and/or infinite places such that ``self`` is locally solvable at those primes and places. If the base field is `\QQ`, then the infinite place is denoted `-1`. @@ -413,7 +413,8 @@ def local_obstructions(self, finite=True, infinite=True, read_cache=True): From: Number Field in a with defining polynomial x^2 - 5 with a = 2.236067977499790? To: Algebraic Real Field - Defn: a |--> -2.236067977499790?, Ring morphism: + Defn: a |--> -2.236067977499790?, + Ring morphism: From: Number Field in a with defining polynomial x^2 - 5 with a = 2.236067977499790? To: Algebraic Real Field diff --git a/src/sage/schemes/plane_conics/con_rational_field.py b/src/sage/schemes/plane_conics/con_rational_field.py index 68286fbed7b..46de65132b5 100644 --- a/src/sage/schemes/plane_conics/con_rational_field.py +++ b/src/sage/schemes/plane_conics/con_rational_field.py @@ -84,12 +84,12 @@ def has_rational_point(self, point=False, obstruction=False, a pair ``(out, S)``, where ``out`` is as above and the following holds: - - if ``point`` is ``True`` and ``self`` has a rational point, - then ``S`` is a rational point, + - if ``point`` is ``True`` and ``self`` has a rational point, + then ``S`` is a rational point, - - if ``obstruction`` is ``True`` and ``self`` has no rational point, - then ``S`` is a prime such that no rational point exists - over the completion at ``S`` or `-1` if no point exists over `\RR`. + - if ``obstruction`` is ``True`` and ``self`` has no rational point, + then ``S`` is a prime such that no rational point exists + over the completion at ``S`` or `-1` if no point exists over `\RR`. Points and obstructions are cached, whenever they are found. Cached information is used if and only if ``read_cache`` is ``True``. @@ -99,19 +99,19 @@ def has_rational_point(self, point=False, obstruction=False, The parameter ``algorithm`` specifies the algorithm to be used: - - ``'qfsolve'`` -- Use PARI/GP function :pari:`qfsolve` + - ``'qfsolve'`` -- Use PARI/GP function :pari:`qfsolve` - - ``'rnfisnorm'`` -- Use PARI's function :pari:`rnfisnorm` - (cannot be combined with ``obstruction = True``) + - ``'rnfisnorm'`` -- Use PARI's function :pari:`rnfisnorm` + (cannot be combined with ``obstruction = True``) - - ``'local'`` -- Check if a local solution exists for all primes - and infinite places of `\QQ` and apply the Hasse principle - (cannot be combined with ``point = True``) + - ``'local'`` -- Check if a local solution exists for all primes + and infinite places of `\QQ` and apply the Hasse principle + (cannot be combined with ``point = True``) - - ``'default'`` -- Use ``'qfsolve'`` + - ``'default'`` -- Use ``'qfsolve'`` - - ``'magma'`` (requires Magma to be installed) -- - delegates the task to the Magma computer algebra system. + - ``'magma'`` (requires Magma to be installed) -- + delegates the task to the Magma computer algebra system. EXAMPLES:: diff --git a/src/sage/schemes/plane_quartics/quartic_constructor.py b/src/sage/schemes/plane_quartics/quartic_constructor.py index 421c8d2bad8..37c06a1f5c9 100644 --- a/src/sage/schemes/plane_quartics/quartic_constructor.py +++ b/src/sage/schemes/plane_quartics/quartic_constructor.py @@ -15,15 +15,15 @@ def QuarticCurve(F, PP=None, check=False): """ - Returns the quartic curve defined by the polynomial F. + Return the quartic curve defined by the polynomial ``F``. INPUT: - - F -- a polynomial in three variables, homogeneous of degree 4 + - ``F`` -- a polynomial in three variables, homogeneous of degree 4 - - PP -- a projective plane (default:None) + - ``PP`` -- a projective plane (default: None) - - check -- whether to check for smoothness or not (default:False) + - ``check`` -- whether to check for smoothness or not (default: False) EXAMPLES:: diff --git a/src/sage/schemes/plane_quartics/quartic_generic.py b/src/sage/schemes/plane_quartics/quartic_generic.py index 8f2046f2b4a..537bf760c9a 100644 --- a/src/sage/schemes/plane_quartics/quartic_generic.py +++ b/src/sage/schemes/plane_quartics/quartic_generic.py @@ -23,7 +23,7 @@ def is_QuarticCurve(C): """ - Checks whether C is a Quartic Curve + Check whether ``C`` is a Quartic Curve. EXAMPLES:: @@ -41,7 +41,7 @@ class QuarticCurve_generic(projective_curve.ProjectivePlaneCurve): def _repr_type(self): """ - Return the representation of self + Return the representation of ``self``. EXAMPLES:: @@ -54,7 +54,7 @@ def _repr_type(self): def genus(self): """ - Returns the genus of self + Return the genus of ``self``. EXAMPLES:: diff --git a/src/sage/schemes/product_projective/homset.py b/src/sage/schemes/product_projective/homset.py index 4e84d38c954..91af8105def 100644 --- a/src/sage/schemes/product_projective/homset.py +++ b/src/sage/schemes/product_projective/homset.py @@ -31,9 +31,7 @@ class SchemeHomset_points_product_projective_spaces_ring(SchemeHomset_points): r""" Set of rational points of a product of projective spaces. - INPUT: - - See :class:`~sage.schemes.generic.homset.SchemeHomset_generic`. + INPUT: See :class:`~sage.schemes.generic.homset.SchemeHomset_generic`. EXAMPLES:: @@ -93,16 +91,14 @@ def points(self, **kwds): - ``bound`` - a real number - - ``tolerance`` - a rational number in (0,1] used in doyle-krumm algorithm-4 + - ``tolerance`` - a rational number in (0,1] used in Doyle-Krumm algorithm 4 - ``precision`` - the precision to use for computing the elements of bounded height of number fields. - - ``algorithm`` - either 'sieve' or 'enumerate' algorithms can be used over `QQ`. If - not specified, enumerate is used only for small height bounds. - - OUTPUT: + - ``algorithm`` - either ``'sieve'`` or ``'enumerate'`` algorithms can be used over `\QQ`. If + not specified, ``'enumerate'`` is used only for small height bounds. - - a list of rational points of a projective scheme + OUTPUT: A list of rational points of the projective scheme. EXAMPLES:: diff --git a/src/sage/schemes/product_projective/morphism.py b/src/sage/schemes/product_projective/morphism.py index 4f7aac00259..f203611cce6 100644 --- a/src/sage/schemes/product_projective/morphism.py +++ b/src/sage/schemes/product_projective/morphism.py @@ -346,7 +346,7 @@ def __ne__(self, right): def is_morphism(self): r""" - Returns ``True`` if this mapping is a morphism of products of projective spaces. + Return ``True`` if this mapping is a morphism of products of projective spaces. For each component space of the codomain of this mapping we consider the subscheme of the domain of this map generated by the corresponding coordinates of the map. @@ -421,7 +421,7 @@ def as_dynamical_system(self): def global_height(self, prec=None): r""" - Returns the maximum of the absolute logarithmic heights of the coefficients + Return the maximum of the absolute logarithmic heights of the coefficients in any of the coordinate functions of this map. INPUT: @@ -472,7 +472,7 @@ def global_height(self, prec=None): def local_height(self, v, prec=None): r""" - Returns the maximum of the local height of the coefficients in any + Return the maximum of the local height of the coefficients in any of the coordinate functions of this map. INPUT: @@ -482,9 +482,7 @@ def local_height(self, v, prec=None): - ``prec`` -- desired floating point precision (default: default RealField precision). - OUTPUT: - - - a real number. + OUTPUT: A real number. EXAMPLES:: diff --git a/src/sage/schemes/product_projective/point.py b/src/sage/schemes/product_projective/point.py index f0486ac801c..09cd0225209 100644 --- a/src/sage/schemes/product_projective/point.py +++ b/src/sage/schemes/product_projective/point.py @@ -404,9 +404,7 @@ def change_ring(self, R, **kwds): - ``embedding`` -- field embedding from the base ring of this point to ``R``. - OUTPUT: - - :class:`ProductProjectiveSpaces_point`. + OUTPUT: :class:`ProductProjectiveSpaces_point`. EXAMPLES:: @@ -433,9 +431,7 @@ def global_height(self, prec=None): - ``prec`` -- desired floating point precision (default: default RealField precision). - OUTPUT: - - - a real number. + OUTPUT: A real number. EXAMPLES:: @@ -489,9 +485,7 @@ def local_height(self, v, prec=None): - ``prec`` -- desired floating point precision (default: default RealField precision). - OUTPUT: - - - a real number. + OUTPUT: A real number. EXAMPLES:: diff --git a/src/sage/schemes/product_projective/subscheme.py b/src/sage/schemes/product_projective/subscheme.py index 059a82646ff..98d2633690b 100644 --- a/src/sage/schemes/product_projective/subscheme.py +++ b/src/sage/schemes/product_projective/subscheme.py @@ -186,9 +186,7 @@ def dimension(self): r""" Return the dimension of the algebraic subscheme. - OUTPUT: - - Integer. + OUTPUT: An integer. EXAMPLES:: @@ -266,7 +264,7 @@ def is_smooth(self, point=None): def affine_patch(self, I, return_embedding=False): r""" Return the `I^{th}` affine patch of this projective scheme - where 'I' is a multi-index. + where `I` is a multi-index. INPUT: @@ -419,7 +417,7 @@ def multiplicity(self, P): - ``P`` -- a point on this subscheme. - OUTPUT: an integer. + OUTPUT: An integer. EXAMPLES:: diff --git a/src/sage/schemes/projective/projective_homset.py b/src/sage/schemes/projective/projective_homset.py index 36b0f79956b..04a906eb43a 100644 --- a/src/sage/schemes/projective/projective_homset.py +++ b/src/sage/schemes/projective/projective_homset.py @@ -83,17 +83,17 @@ def points(self, **kwds): kwds: - - ``bound`` - real number (optional, default=0). The bound for the coordinates for + - ``bound`` - real number (optional, default: 0). The bound for the coordinates for subschemes with dimension at least 1. - - ``precision`` - integer (optional, default=53). The precision to use to + - ``precision`` - integer (optional, default: 53). The precision to use to compute the elements of bounded height for number fields. - - ``point_tolerance`` - positive real number (optional, default=10^(-10)). + - ``point_tolerance`` - positive real number (optional, default: `10^{-10}`). For numerically inexact fields, two points are considered the same if their coordinates are within tolerance. - - ``zero_tolerance`` - positive real number (optional, default=10^(-10)). + - ``zero_tolerance`` - positive real number (optional, default: `10^{-10}`). For numerically inexact fields, points are on the subscheme if they satisfy the equations to within tolerance. @@ -307,11 +307,11 @@ def numerical_points(self, F=None, **kwds): kwds: - - ``point_tolerance`` - positive real number (optional, default=10^(-10)). + - ``point_tolerance`` - positive real number (optional, default: `10^{-10}`). For numerically inexact fields, two points are considered the same if their coordinates are within tolerance. - - ``zero_tolerance`` - positive real number (optional, default=10^(-10)). + - ``zero_tolerance`` - positive real number (optional, default: `10^{-10}`). For numerically inexact fields, points are on the subscheme if they satisfy the equations to within tolerance. diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index ddb6b12d903..27bbfdc4c75 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -736,7 +736,7 @@ def scale_by(self, t): """ Scales each coordinate by a factor of ``t``. - A ``TypeError`` occurs if the point is not in the coordinate_ring + A ``TypeError`` occurs if the point is not in the coordinate ring of the parent after scaling. INPUT: @@ -1065,7 +1065,7 @@ def degree(self): def dehomogenize(self, n): r""" - Returns the standard dehomogenization at the ``n[0]`` coordinate for the domain + Return the standard dehomogenization at the ``n[0]`` coordinate for the domain and the ``n[1]`` coordinate for the codomain. Note that the new function is defined over the fraction field @@ -1209,7 +1209,7 @@ def dehomogenize(self, n): @cached_method def is_morphism(self): r""" - returns ``True`` if this map is a morphism. + Return ``True`` if this map is a morphism. The map is a morphism if and only if the ideal generated by the defining polynomials is the unit ideal @@ -1371,7 +1371,7 @@ def global_height(self, prec=None): def local_height(self, v, prec=None): r""" - Returns the maximum of the local height of the coefficients in any + Return the maximum of the local height of the coefficients in any of the coordinate functions of this map. INPUT: @@ -1429,7 +1429,7 @@ def local_height(self, v, prec=None): def local_height_arch(self, i, prec=None): r""" - Returns the maximum of the local height at the ``i``-th infinite place of the coefficients in any + Return the maximum of the local height at the ``i``-th infinite place of the coefficients in any of the coordinate functions of this map. INPUT: @@ -1479,7 +1479,7 @@ def local_height_arch(self, i, prec=None): def wronskian_ideal(self): r""" - Returns the ideal generated by the critical point locus. + Return the ideal generated by the critical point locus. This is the vanishing of the maximal minors of the Jacobian matrix. Not implemented for subvarieties. diff --git a/src/sage/schemes/projective/projective_point.py b/src/sage/schemes/projective/projective_point.py index 4bb8ab345b2..38da1544b2e 100644 --- a/src/sage/schemes/projective/projective_point.py +++ b/src/sage/schemes/projective/projective_point.py @@ -975,19 +975,20 @@ def is_preperiodic(self, f, err=0.1, return_period=False): sage: from sage.misc.verbose import set_verbose sage: set_verbose(-1) - sage: P. = ProjectiveSpace(QQbar, 2) # optional - sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2, QQbar(sqrt(-1))*y^2, z^2], domain=P) # optional - sage.rings.number_field sage.symbolic - sage: Q = P([1, 1, 1]) # optional - sage.rings.number_field sage.symbolic - sage: Q.is_preperiodic(f) # optional - sage.rings.number_field sage.symbolic + sage: P. = ProjectiveSpace(QQbar, 2) # optional - sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2, QQbar(sqrt(-1))*y^2, z^2], # optional - sage.rings.number_field sage.symbolic + ....: domain=P) + sage: Q = P([1, 1, 1]) # optional - sage.rings.number_field sage.symbolic + sage: Q.is_preperiodic(f) # optional - sage.rings.number_field sage.symbolic True :: sage: set_verbose(-1) - sage: P. = ProjectiveSpace(QQbar, 2) # optional - sage.rings.number_field - sage: f = DynamicalSystem_projective([x^2, y^2, z^2], domain=P) # optional - sage.rings.number_field - sage: Q = P([QQbar(sqrt(-1)), 1, 1]) # optional - sage.rings.number_field sage.symbolic - sage: Q.is_preperiodic(f) # optional - sage.rings.number_field sage.symbolic + sage: P. = ProjectiveSpace(QQbar, 2) # optional - sage.rings.number_field + sage: f = DynamicalSystem_projective([x^2, y^2, z^2], domain=P) # optional - sage.rings.number_field + sage: Q = P([QQbar(sqrt(-1)), 1, 1]) # optional - sage.rings.number_field sage.symbolic + sage: Q.is_preperiodic(f) # optional - sage.rings.number_field sage.symbolic True :: @@ -1000,10 +1001,10 @@ def is_preperiodic(self, f, err=0.1, return_period=False): :: - sage: P. = ProjectiveSpace(GF(3), 2) # optional - sage.rings.finite_rings - sage: F = DynamicalSystem([x^2 - 2*y^2, y^2, z^2]) # optional - sage.rings.finite_rings - sage: Q = P(1, 1, 1) # optional - sage.rings.finite_rings - sage: Q.is_preperiodic(F, return_period=True) # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(3), 2) # optional - sage.rings.finite_rings + sage: F = DynamicalSystem([x^2 - 2*y^2, y^2, z^2]) # optional - sage.rings.finite_rings + sage: Q = P(1, 1, 1) # optional - sage.rings.finite_rings + sage: Q.is_preperiodic(F, return_period=True) # optional - sage.rings.finite_rings (1, 1) TESTS:: @@ -1086,7 +1087,7 @@ def __init__(self, X, v, check=True): :: sage: P = ProjectiveSpace(1, GF(7)) # optional - sage.rings.finite_rings - sage: Q=P([2, 1]) # optional - sage.rings.finite_rings + sage: Q = P([2, 1]) # optional - sage.rings.finite_rings sage: Q[0].parent() # optional - sage.rings.finite_rings Finite Field of size 7 @@ -1179,10 +1180,10 @@ def normalize_coordinates(self): EXAMPLES:: - sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings - sage: Q = P.point([GF(5)(1), GF(5)(3), GF(5)(0)], False); Q # optional - sage.rings.finite_rings + sage: P. = ProjectiveSpace(GF(5), 2) # optional - sage.rings.finite_rings + sage: Q = P.point([GF(5)(1), GF(5)(3), GF(5)(0)], False); Q # optional - sage.rings.finite_rings (1 : 3 : 0) - sage: Q.normalize_coordinates(); Q # optional - sage.rings.finite_rings + sage: Q.normalize_coordinates(); Q # optional - sage.rings.finite_rings (2 : 1 : 0) :: @@ -1269,10 +1270,10 @@ def clear_denominators(self): :: sage: R. = PolynomialRing(QQ) - sage: K. = NumberField(x^2 - 3) # optional - sage.rings.number_field - sage: P. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field - sage: Q = P([1/w, 3, 0]) # optional - sage.rings.number_field - sage: Q.clear_denominators(); Q # optional - sage.rings.number_field + sage: K. = NumberField(x^2 - 3) # optional - sage.rings.number_field + sage: P. = ProjectiveSpace(K, 2) # optional - sage.rings.number_field + sage: Q = P([1/w, 3, 0]) # optional - sage.rings.number_field + sage: Q.clear_denominators(); Q # optional - sage.rings.number_field (w : 9 : 0) :: diff --git a/src/sage/schemes/projective/projective_rational_point.py b/src/sage/schemes/projective/projective_rational_point.py index ddef9a14d26..07de1170f66 100644 --- a/src/sage/schemes/projective/projective_rational_point.py +++ b/src/sage/schemes/projective/projective_rational_point.py @@ -313,10 +313,10 @@ def sieve(X, bound): Returns the list of all projective, rational points on scheme ``X`` of height up to ``bound``. - Height of a projective point X = (x_1, x_2,..., x_n) is given by - H_X = max(y_1, y_2,..., y_n), where H_X is height of point X and y_i's - are the normalized coordinates such that all y_i are integers and - gcd(y_1, y_2,..., y_n) = 1. + Height of a projective point `X = (x_1, x_2,\dots, x_n)` is given by + `H_X = \max(y_1, y_2,\dots, y_n)`, where the values `y_i` + are the normalized coordinates such that all `y_i` are integers and + `\gcd(y_1, y_2,\dots, y_n) = 1`. ALGORITHM: diff --git a/src/sage/schemes/projective/projective_space.py b/src/sage/schemes/projective/projective_space.py index 5c3adad9bea..1ff2372957c 100644 --- a/src/sage/schemes/projective/projective_space.py +++ b/src/sage/schemes/projective/projective_space.py @@ -345,7 +345,7 @@ def ngens(self): """ Return the number of generators of this projective space. - This is the number of variables in the coordinate ring of self. + This is the number of variables in the coordinate ring of ``self``. EXAMPLES:: @@ -604,7 +604,7 @@ def _linear_system_as_kernel(self, d, pt, m): - ``d`` -- a nonnegative integer. - - ``pt`` -- a point of self (possibly represented by a list with at \ + - ``pt`` -- a point of ``self`` (possibly represented by a list with at \ least one component equal to 1). - ``m`` -- a nonnegative integer. @@ -612,8 +612,8 @@ def _linear_system_as_kernel(self, d, pt, m): OUTPUT: A matrix of size `\binom{m-1+n}{n}` x `\binom{d+n}{n}` where n is the - relative dimension of self. The base ring of the matrix is a ring that - contains the base ring of self and the coefficients of the given point. + relative dimension of ``self``. The base ring of the matrix is a ring that + contains the base ring of ``self`` and the coefficients of the given point. EXAMPLES: @@ -998,15 +998,15 @@ def affine_patch(self, i, AA=None): Return the `i^{th}` affine patch of this projective space. This is an ambient affine space `\mathbb{A}^n_R,` where - `R` is the base ring of self, whose "projective embedding" + `R` is the base ring of ``self``, whose "projective embedding" map is `1` in the `i^{th}` factor. INPUT: - - ``i`` -- integer between 0 and dimension of self, inclusive. + - ``i`` -- integer between 0 and dimension of ``self``, inclusive. - ``AA`` -- (default: None) ambient affine space, this is constructed - if it is not given. + if it is not given. OUTPUT: @@ -2331,7 +2331,7 @@ def rational_points(self, bound=0): INPUT: - - ``bound`` - integer. + - ``bound`` - integer. EXAMPLES:: diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index 9934b49899b..34666453ec8 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -254,8 +254,7 @@ def affine_patch(self, i, AA=None): sage: S = P.subscheme([u^2 - v*w]) sage: A. = AffineSpace(2, ZZ) sage: S.affine_patch(1, A) - Closed subscheme of Affine Space of dimension 2 over Integer Ring - defined by: + Closed subscheme of Affine Space of dimension 2 over Integer Ring defined by: x^2 - y """ i = int(i) # implicit type checking diff --git a/src/sage/schemes/riemann_surfaces/riemann_surface.py b/src/sage/schemes/riemann_surfaces/riemann_surface.py index e7c401cd07b..917de00d7b0 100644 --- a/src/sage/schemes/riemann_surfaces/riemann_surface.py +++ b/src/sage/schemes/riemann_surfaces/riemann_surface.py @@ -258,15 +258,15 @@ def numerical_inverse(C): EXAMPLES:: - sage: C = matrix(CC,3,3,[-4.5606e-31 + 1.2326e-31*I, - ....: -0.21313 + 0.24166*I, - ....: -3.4513e-31 + 0.16111*I, - ....: -1.0175 + 9.8608e-32*I, - ....: 0.30912 + 0.19962*I, - ....: -4.9304e-32 + 0.39923*I, - ....: 0.96793 - 3.4513e-31*I, - ....: -0.091587 + 0.19276*I, - ....: 3.9443e-31 + 0.38552*I]) + sage: C = matrix(CC, 3, 3, [-4.5606e-31 + 1.2326e-31*I, + ....: -0.21313 + 0.24166*I, + ....: -3.4513e-31 + 0.16111*I, + ....: -1.0175 + 9.8608e-32*I, + ....: 0.30912 + 0.19962*I, + ....: -4.9304e-32 + 0.39923*I, + ....: 0.96793 - 3.4513e-31*I, + ....: -0.091587 + 0.19276*I, + ....: 3.9443e-31 + 0.38552*I]) sage: from sage.schemes.riemann_surfaces.riemann_surface import numerical_inverse sage: 3e-16 < (C^-1*C-C^0).norm() < 1e-15 True @@ -416,8 +416,8 @@ def reparameterize_differential_minpoly(minpoly, z0): INPUT: - - ``minpoly`` -- a polynomial in two variables, where the first variables - corresponds to the base coordinate on the Riemann surface + - ``minpoly`` -- a polynomial in two variables, where the first variable + corresponds to the base coordinate on the Riemann surface - ``z0`` -- complex number or infinity; the point about which to reparameterize @@ -434,7 +434,7 @@ def reparameterize_differential_minpoly(minpoly, z0): .. MATH:: - `\frac{-\bar{z}^{-2} d\bar{z}}{2\sqrt{\bar{z}^{-3}-1}} = \frac{-d\bar{z}}{2\sqrt{\bar{z}(1-\bar{z}^3)}}`. + \frac{-\bar{z}^{-2} d\bar{z}}{2\sqrt{\bar{z}^{-3}-1}} = \frac{-d\bar{z}}{2\sqrt{\bar{z}(1-\bar{z}^3)}}. Hence the transformed differential should have minimal polynomial `\bar{g}^2 \bar{z} (1 - \bar{z}^3) - 1/4 = 0`, and we can check this:: @@ -529,7 +529,7 @@ class RiemannSurface(): We can also work with Riemann surfaces that are defined over fields with a complex embedding, but since the current interface for computing genus and regular differentials in Singular presently does not support extensions of - QQ, we need to specify a description of the differentials ourselves. We give + `\QQ`, we need to specify a description of the differentials ourselves. We give an example of a CM elliptic curve:: sage: Qt. = QQ[] @@ -2294,7 +2294,7 @@ def matrix_of_integral_values(self, differentials, integration_method="heuristic .. NOTE:: If ``differentials is self.cohomology_basis()``, the calculations - of the integrals along the edges are written to `self._integral_dict``. + of the integrals along the edges are written to ``self._integral_dict``. This is as this data will be required when computing the Abel-Jacobi map, and so it is helpful to have is stored rather than recomputing. @@ -2562,12 +2562,12 @@ def homomorphism_basis(self, other, b=None, r=None): Given another complex torus (given as the analytic Jacobian of a Riemann surface), numerically compute a basis for the homomorphism module. The - answer is returned as a list of 2g x 2g integer matrices T=(D, B; C, A) - such that if the columns of (I|M1) generate the lattice defining the - Jacobian of the Riemann surface and the columns of (I|M2) do this for - the codomain, then approximately we have (I|M2)T=(D+M2C)(I|M1), i.e., up + answer is returned as a list of `2g \times 2g` integer matrices `T=(D, B; C, A)` + such that if the columns of `(I|M_1)` generate the lattice defining the + Jacobian of the Riemann surface and the columns of `(I|M_2)` do this for + the codomain, then approximately we have `(I|M_2)T=(D+M_2C)(I|M_1)`, i.e., up to a choice of basis for `\CC^g` as a complex vector space, we we - realize (I|M1) as a sublattice of (I|M2). + realize `(I|M_1)` as a sublattice of `(I|M_2)`. INPUT: @@ -3265,9 +3265,7 @@ def _aj_based(self, P): we are using the convention that the `w` value over `\infty` is given by the limit as ``z`` tends to `\infty` of ``self.w_values(z)[branch]``. - OUTPUT: - - A vector of length ``self.genus``. + OUTPUT: A vector of length ``self.genus``. EXAMPLES: @@ -3497,9 +3495,7 @@ def abel_jacobi(self, divisor, verbose=False): of the computation, in terms of how many elements of the list ``divisor`` have been completed. - OUTPUT: - - A vector of length ``self.genus``. + OUTPUT: A vector of length ``self.genus``. EXAMPLES: @@ -3666,9 +3662,7 @@ def curve(self): For others, the curve is constructed and cached, so that an identical curve is returned upon subsequent calls. - OUTPUT: - - Curve from which Riemann surface is obtained. + OUTPUT: Curve from which Riemann surface is obtained. EXAMPLES:: diff --git a/src/sage/schemes/toric/chow_group.py b/src/sage/schemes/toric/chow_group.py index 7e5bc8fa2bb..8c835df37d2 100644 --- a/src/sage/schemes/toric/chow_group.py +++ b/src/sage/schemes/toric/chow_group.py @@ -656,9 +656,7 @@ def scheme(self): r""" Return the underlying toric variety. - OUTPUT: - - A :class:`ToricVariety + OUTPUT: A :class:`ToricVariety `. EXAMPLES:: @@ -1101,9 +1099,7 @@ def _repr_(self) -> str: """ Return a string representation. - OUTPUT: - - String. + OUTPUT: A string. EXAMPLES:: @@ -1140,9 +1136,7 @@ def module(self): """ Return the submodule of the toric Chow group generated. - OUTPUT: - - A :class:`sage.modules.fg_pid.fgp_module.FGP_Module_class` + OUTPUT: A :class:`sage.modules.fg_pid.fgp_module.FGP_Module_class`. EXAMPLES:: @@ -1157,9 +1151,7 @@ def ngens(self) -> int: """ Return the number of generators. - OUTPUT: - - An integer. + OUTPUT: An integer. EXAMPLES:: @@ -1172,17 +1164,13 @@ def ngens(self) -> int: def gen(self, i): """ - Return the ``i``-th generator of the Chow group of fixed - degree. + Return the ``i``-th generator of the Chow group of fixed degree. INPUT: - ``i`` -- integer. The index of the generator to be returned. - OUTPUT: - - A tuple of Chow cycles of fixed degree generating - :meth:`module`. + OUTPUT: A Chow cycle. EXAMPLES:: @@ -1197,9 +1185,7 @@ def gens(self): """ Return the generators of the Chow group of fixed degree. - OUTPUT: - - A tuple of Chow cycles of fixed degree generating + OUTPUT: A tuple of Chow cycles of fixed degree generating :meth:`module`. EXAMPLES:: @@ -1214,15 +1200,13 @@ def gens(self): def is_ChowGroup(x) -> bool: r""" - Return whether ``x`` is a :class:`ChowGroup_class` + Return whether ``x`` is a :class:`ChowGroup_class`. INPUT: - ``x`` -- anything. - OUTPUT: - - ``True`` or ``False``. + OUTPUT: ``True`` or ``False``. EXAMPLES:: @@ -1239,15 +1223,13 @@ def is_ChowGroup(x) -> bool: def is_ChowCycle(x) -> bool: r""" - Return whether ``x`` is a :class:`ChowGroup_class` + Return whether ``x`` is a :class:`ChowCycle`. INPUT: - ``x`` -- anything. - OUTPUT: - - ``True`` or ``False``. + OUTPUT: ``True`` or ``False``. EXAMPLES:: diff --git a/src/sage/schemes/toric/divisor.py b/src/sage/schemes/toric/divisor.py index c0f7e58dbd2..c71ca05eede 100644 --- a/src/sage/schemes/toric/divisor.py +++ b/src/sage/schemes/toric/divisor.py @@ -257,9 +257,7 @@ def ToricDivisor(toric_variety, arg=None, ring=None, check=True, reduce=True): ``reduce=False`` it is your responsibility to pass valid input data ``arg``. - OUTPUT: - - - A :class:`sage.schemes.toric.divisor.ToricDivisor_generic` + OUTPUT: A :class:`sage.schemes.toric.divisor.ToricDivisor_generic`. EXAMPLES:: @@ -384,10 +382,10 @@ class ToricDivisor_generic(Divisor_generic): - ``parent`` -- :class:`ToricDivisorGroup`. The parent divisor group. - ``check`` -- boolean. Type-check the entries of ``v``, see - :meth:`sage.schemes.generic.divisor_group.DivisorGroup_generic.__init__`. + :class:`~sage.schemes.generic.divisor_group.DivisorGroup_generic`. - ``reduce`` -- boolean. Combine coefficients in ``v``, see - :meth:`sage.schemes.generic.divisor_group.DivisorGroup_generic.__init__`. + :class:`~sage.schemes.generic.divisor_group.DivisorGroup_generic`. .. WARNING:: @@ -518,9 +516,7 @@ def function_value(self, point): - ``point`` -- either an integer, interpreted as the index of a ray of `\Sigma`, or a point of the lattice `N`. - OUTPUT: - - - an integer or a rational number. + OUTPUT: An integer or a rational number. EXAMPLES:: @@ -812,7 +808,7 @@ def cohomology_class(self): OUTPUT: - Returns the corresponding cohomology class as an instance of + The corresponding cohomology class as an instance of :class:`~sage.schemes.toric.variety.CohomologyClass`. The cohomology class is the first Chern class of the associated line bundle `\mathcal{O}(D)`. @@ -859,7 +855,7 @@ def divisor_class(self): OUTPUT: - Returns the class of the divisor in `\mathop{Cl}(X) + The class of the divisor in `\mathop{Cl}(X) \otimes_\ZZ \QQ` as an instance of :class:`ToricRationalDivisorClassGroup`. @@ -915,7 +911,7 @@ def is_ample(self): .. NOTE:: - * For a QQ-Cartier divisor, some positive integral + * For a `\QQ`-Cartier divisor, some positive integral multiple is Cartier. We return whether this associated divisor is ample, i.e. corresponds to an ample line bundle. @@ -1138,9 +1134,7 @@ def sections(self): the line bundle (or reflexive sheaf) associated to the divisor. - OUTPUT: - - - :class:`tuple` of points of lattice `M`. + OUTPUT: A :class:`tuple` of points of lattice `M`. EXAMPLES:: @@ -1318,9 +1312,7 @@ def _sheaf_complex(self, m): - `m` -- a point in ``self.scheme().fan().dual_lattice()``. - OUTPUT: - - - :class:`simplicial complex `. + OUTPUT: A :class:`simplicial complex `. EXAMPLES:: @@ -1356,9 +1348,7 @@ def _sheaf_cohomology(self, cplx): - ``cplx`` -- simplicial complex. - OUTPUT: - - - integer vector. + OUTPUT: An integer vector. EXAMPLES:: @@ -1703,9 +1693,7 @@ def _latex_(self): r""" Return a LaTeX representation of ``self``. - OUTPUT: - - - string. + OUTPUT: A string. TESTS:: diff --git a/src/sage/schemes/toric/fano_variety.py b/src/sage/schemes/toric/fano_variety.py index ef58f689336..7e0fb7b8c49 100644 --- a/src/sage/schemes/toric/fano_variety.py +++ b/src/sage/schemes/toric/fano_variety.py @@ -264,9 +264,7 @@ def CPRFanoToricVariety(Delta=None, ``Delta``). If you know for sure that the input is valid, you may significantly decrease construction time using ``check=False`` option. - OUTPUT: - - - :class:`CPR-Fano toric variety `. + OUTPUT: :class:`CPR-Fano toric variety `. EXAMPLES: @@ -626,9 +624,7 @@ class CPRFanoToricVariety_field(ToricVariety_field): - ``base_field`` -- base field of the CPR-Fano toric variety. - OUTPUT: - - - :class:`CPR-Fano toric variety `. + OUTPUT: :class:`CPR-Fano toric variety `. TESTS:: @@ -838,10 +834,7 @@ def change_ring(self, F): - ``F`` -- field. - OUTPUT: - - - :class:`CPR-Fano toric variety ` over - ``F``. + OUTPUT: :class:`CPR-Fano toric variety ` over ``F``. .. NOTE:: @@ -913,9 +906,7 @@ def coordinate_points(self): r""" Return indices of points of :meth:`Delta_polar` used for coordinates. - OUTPUT: - - - :class:`tuple` of integers. + OUTPUT: :class:`tuple` of integers. EXAMPLES:: @@ -1511,10 +1502,7 @@ def cohomology_class(self): r""" Return the class of ``self`` in the ambient space cohomology ring. - OUTPUT: - - - a :class:`cohomology class - `. + OUTPUT: A :class:`cohomology class `. EXAMPLES:: @@ -1540,10 +1528,7 @@ def nef_partition(self): r""" Return the nef-partition associated to ``self``. - OUTPUT: - - - a :class:`nef-partition - `. + OUTPUT: A :class:`nef-partition `. EXAMPLES:: diff --git a/src/sage/schemes/toric/homset.py b/src/sage/schemes/toric/homset.py index d75b0ce27f7..4470303d8d4 100644 --- a/src/sage/schemes/toric/homset.py +++ b/src/sage/schemes/toric/homset.py @@ -291,16 +291,13 @@ def _an_element_(self): class SchemeHomset_points_toric_base(SchemeHomset_points): """ - Base class for homsets with toric ambient spaces + Base class for homsets with toric ambient spaces. INPUT: - same as for :class:`SchemeHomset_points`. - OUTPUT: - - A scheme morphism of type - :class:`SchemeHomset_points_toric_base`. + OUTPUT: A scheme morphism of type :class:`SchemeHomset_points_toric_base`. EXAMPLES:: @@ -320,9 +317,7 @@ def is_finite(self): """ Return whether there are finitely many points. - OUTPUT: - - Boolean. + OUTPUT: A boolean. EXAMPLES:: @@ -436,10 +431,7 @@ class SchemeHomset_points_toric_field(SchemeHomset_points_toric_base): - same as for :class:`~sage.schemes.generic.homset.SchemeHomset_points`. - OUTPUT: - - A scheme morphism of type - :class:`SchemeHomset_points_toric_field`. + OUTPUT: A scheme morphism of type :class:`SchemeHomset_points_toric_field`. EXAMPLES:: @@ -575,9 +567,7 @@ def __iter__(self): """ Iterate over the points of the variety. - OUTPUT: - - Iterator over points. + OUTPUT: Iterator over points. EXAMPLES:: diff --git a/src/sage/schemes/toric/ideal.py b/src/sage/schemes/toric/ideal.py index 2a2e02dfdbc..28613a5a7b0 100644 --- a/src/sage/schemes/toric/ideal.py +++ b/src/sage/schemes/toric/ideal.py @@ -249,9 +249,7 @@ def A(self): """ Return the defining matrix. - OUTPUT: - - An integer matrix. + OUTPUT: An integer matrix. EXAMPLES:: @@ -267,9 +265,7 @@ def ker(self): """ Return the kernel of the defining matrix. - OUTPUT: - - The kernel of ``self.A()``. + OUTPUT: The kernel of ``self.A()``. EXAMPLES:: @@ -290,9 +286,7 @@ def nvariables(self): r""" Return the number of variables of the ambient polynomial ring. - OUTPUT: - - Integer. The number of columns of the defining matrix + OUTPUT: An integer. The number of columns of the defining matrix :meth:`A`. EXAMPLES:: diff --git a/src/sage/schemes/toric/library.py b/src/sage/schemes/toric/library.py index 9d2587df187..c12c8e2c75e 100644 --- a/src/sage/schemes/toric/library.py +++ b/src/sage/schemes/toric/library.py @@ -203,9 +203,7 @@ def _make_ToricVariety(self, name, coordinate_names, base_ring): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`toric variety + OUTPUT: A :class:`toric variety `. EXAMPLES:: @@ -244,9 +242,7 @@ def _make_CPRFanoToricVariety(self, name, coordinate_names, base_ring): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`CPR-Fano toric variety + OUTPUT: A :class:`CPR-Fano toric variety `. EXAMPLES:: @@ -290,9 +286,7 @@ def dP6(self, names='x u y v z w', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`CPR-Fano toric variety + OUTPUT: A :class:`CPR-Fano toric variety `. EXAMPLES:: @@ -323,9 +317,7 @@ def dP7(self, names='x u y v z', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`CPR-Fano toric variety + OUTPUT: A :class:`CPR-Fano toric variety `. EXAMPLES:: @@ -356,9 +348,7 @@ def dP8(self, names='t x y z', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`CPR-Fano toric variety + OUTPUT: A :class:`CPR-Fano toric variety `. EXAMPLES:: @@ -389,9 +379,7 @@ def P1xP1(self, names='s t x y', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`CPR-Fano toric variety + OUTPUT: A :class:`CPR-Fano toric variety `. EXAMPLES:: @@ -422,9 +410,7 @@ def P1xP1_Z2(self, names='s t x y', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`CPR-Fano toric variety + OUTPUT: A :class:`CPR-Fano toric variety `. EXAMPLES:: @@ -457,9 +443,7 @@ def P1(self, names='s t', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`CPR-Fano toric variety + OUTPUT: A :class:`CPR-Fano toric variety `. EXAMPLES:: @@ -490,9 +474,7 @@ def P2(self, names='x y z', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`CPR-Fano toric variety + OUTPUT: A :class:`CPR-Fano toric variety `. EXAMPLES:: @@ -525,9 +507,7 @@ def P(self, n, names='z+', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`CPR-Fano toric variety + OUTPUT: A :class:`CPR-Fano toric variety `. EXAMPLES:: @@ -575,9 +555,7 @@ def A1(self, names='z', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`toric variety + OUTPUT: A :class:`toric variety `. EXAMPLES:: @@ -606,9 +584,7 @@ def A2(self, names='x y', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`toric variety + OUTPUT: A :class:`toric variety `. EXAMPLES:: @@ -640,9 +616,7 @@ def A(self, n, names='z+', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`toric variety + OUTPUT: A :class:`toric variety `. EXAMPLES:: @@ -687,9 +661,7 @@ def A2_Z2(self, names='x y', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`toric variety + OUTPUT: A :class:`toric variety `. EXAMPLES:: @@ -720,9 +692,7 @@ def P1xA1(self, names='s t z', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`toric variety + OUTPUT: A :class:`toric variety `. EXAMPLES:: @@ -753,9 +723,7 @@ def Conifold(self, names='u x y v', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`toric variety + OUTPUT: A :class:`toric variety `. EXAMPLES:: @@ -786,9 +754,7 @@ def dP6xdP6(self, names='x0 x1 x2 x3 x4 x5 y0 y1 y2 y3 y4 y5', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`CPR-Fano toric variety + OUTPUT: A :class:`CPR-Fano toric variety `. EXAMPLES:: @@ -824,9 +790,7 @@ def Cube_face_fan(self, names='z+', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`CPR-Fano toric variety + OUTPUT: A :class:`CPR-Fano toric variety `. EXAMPLES:: @@ -861,9 +825,7 @@ def Cube_sublattice(self, names='z+', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`CPR-Fano toric variety + OUTPUT: A :class:`CPR-Fano toric variety `. EXAMPLES:: @@ -898,9 +860,7 @@ def Cube_nonpolyhedral(self, names='z+', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`toric variety + OUTPUT: A :class:`toric variety `. .. NOTE:: @@ -994,9 +954,7 @@ def BCdlOG(self, names='v1 v2 c1 c2 v4 v5 b e1 e2 e3 f g v6', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`CPR-Fano toric variety + OUTPUT: A :class:`CPR-Fano toric variety `. EXAMPLES:: @@ -1032,9 +990,7 @@ def BCdlOG_base(self, names='d4 d3 r2 r1 d2 u d1', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`toric variety + OUTPUT: A :class:`toric variety `. EXAMPLES:: @@ -1065,9 +1021,7 @@ def P2_112(self, names='z+', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`CPR-Fano toric variety + OUTPUT: A :class:`CPR-Fano toric variety `. EXAMPLES:: @@ -1099,9 +1053,7 @@ def P2_123(self, names='z+', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`CPR-Fano toric variety + OUTPUT: A :class:`CPR-Fano toric variety `. EXAMPLES:: @@ -1133,9 +1085,7 @@ def P4_11169(self, names='z+', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`CPR-Fano toric variety + OUTPUT: A :class:`CPR-Fano toric variety `. EXAMPLES:: @@ -1167,9 +1117,7 @@ def P4_11169_resolved(self, names='z+', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`CPR-Fano toric variety + OUTPUT: A :class:`CPR-Fano toric variety `. EXAMPLES:: @@ -1201,9 +1149,7 @@ def P4_11133(self, names='z+', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`CPR-Fano toric variety + OUTPUT: A :class:`CPR-Fano toric variety `. EXAMPLES:: @@ -1234,9 +1180,7 @@ def P4_11133_resolved(self, names='z+', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`CPR-Fano toric variety + OUTPUT: A :class:`CPR-Fano toric variety `. EXAMPLES:: @@ -1361,9 +1305,7 @@ def torus(self, n, names='z+', base_ring=QQ): - ``base_ring`` -- a ring (default: `\QQ`). The base ring for the toric variety. - OUTPUT: - - A :class:`toric variety + OUTPUT: A :class:`toric variety `. EXAMPLES:: diff --git a/src/sage/schemes/toric/morphism.py b/src/sage/schemes/toric/morphism.py index 7b85c3f5d32..e8013196778 100644 --- a/src/sage/schemes/toric/morphism.py +++ b/src/sage/schemes/toric/morphism.py @@ -403,9 +403,7 @@ class SchemeMorphism_point_toric_field(SchemeMorphism_point, Morphism): - ``check`` -- if ``True`` (default), the input will be checked for correctness. - OUTPUT: - - A :class:`SchemeMorphism_point_toric_field`. + OUTPUT: A :class:`SchemeMorphism_point_toric_field`. TESTS:: @@ -466,9 +464,7 @@ class SchemeMorphism_polynomial_toric_variety(SchemeMorphism_polynomial, Morphis Same as for :class:`~sage.schemes.toric.morphism.SchemeMorphism_polynomial`. - OUTPUT: - - A :class:`~sage.schemes.toric.morphism.SchemeMorphism_polynomial_toric_variety`. + OUTPUT: A :class:`~sage.schemes.toric.morphism.SchemeMorphism_polynomial_toric_variety`. TESTS:: @@ -521,10 +517,9 @@ def as_fan_morphism(self): """ Express the morphism as a map defined by a fan morphism. - OUTPUT: + OUTPUT: A :class:`SchemeMorphism_polynomial_toric_variety`. - A :class:`SchemeMorphism_polynomial_toric_variety`. Raises a - ``TypeError`` if the morphism cannot be written in such a way. + Raises a ``TypeError`` if the morphism cannot be written in such a way. EXAMPLES:: @@ -607,9 +602,7 @@ def defining_cone(self): r""" Return the cone corresponding to the torus orbit. - OUTPUT: - - A cone of the fan of the ambient toric variety. + OUTPUT: A cone of the fan of the ambient toric variety. EXAMPLES:: @@ -630,8 +623,8 @@ def _reverse_ray_map(self): OUTPUT: - Return a dictionary `{orbit ray generator : preimage ray - index}`. Note that the orbit ray generator need not be + A dictionary ``{orbit ray generator: preimage ray + index}``. Note that the orbit ray generator need not be primitive. Also, the preimage ray is not necessarily unique. EXAMPLES:: @@ -739,7 +732,7 @@ def pullback_divisor(self, divisor): INPUT: - - ``divisor`` -- a torus-invariant QQ-Cartier divisor on the + - ``divisor`` -- a torus-invariant `\QQ`-Cartier divisor on the codomain of the embedding map. OUTPUT: @@ -806,9 +799,7 @@ class SchemeMorphism_fan_toric_variety(SchemeMorphism, Morphism): :class:`SchemeMorphism_fan_toric_variety_dominant` for additional functionality for fibrations. - OUTPUT: - - A :class:`~sage.schemes.toric.morphism.SchemeMorphism_fan_toric_variety`. + OUTPUT: A :class:`~sage.schemes.toric.morphism.SchemeMorphism_fan_toric_variety`. EXAMPLES:: @@ -877,9 +868,7 @@ def _richcmp_(self, right, op): - ``right`` -- another toric morphism - OUTPUT: - - - boolean + OUTPUT: A boolean. Comparison is done first by domain, then by codomain, then by fan morphism. @@ -920,9 +909,7 @@ def _composition_(self, right, homset): - ``right`` -- a toric morphism defined by a fan morphism. - OUTPUT: - - - a toric morphism. + OUTPUT: A toric morphism. EXAMPLES:: @@ -1059,9 +1046,7 @@ def fan_morphism(self): """ Return the defining fan morphism. - OUTPUT: - - A :class:`~sage.geometry.fan_morphism.FanMorphism`. + OUTPUT: A :class:`~sage.geometry.fan_morphism.FanMorphism`. EXAMPLES:: @@ -1081,10 +1066,9 @@ def as_polynomial_map(self): """ Express the morphism via homogeneous polynomials. - OUTPUT: + OUTPUT: A :class:`SchemeMorphism_polynomial_toric_variety`. - A :class:`SchemeMorphism_polynomial_toric_variety`. Raises a - ``TypeError`` if the morphism cannot be written in terms of + Raises a ``TypeError`` if the morphism cannot be written in terms of homogeneous polynomials. EXAMPLES:: @@ -1290,7 +1274,7 @@ def pullback_divisor(self, divisor): INPUT: - - ``divisor`` -- a torus-invariant QQ-Cartier divisor on the + - ``divisor`` -- a torus-invariant `\QQ`-Cartier divisor on the codomain of ``self``. OUTPUT: @@ -1347,9 +1331,7 @@ class SchemeMorphism_fan_toric_variety_dominant(SchemeMorphism_fan_toric_variety morphism :meth:`must be dominant `. - OUTPUT: - - A :class:`~sage.schemes.toric.morphism.SchemeMorphism_fan_toric_variety_dominant`. + OUTPUT: A :class:`~sage.schemes.toric.morphism.SchemeMorphism_fan_toric_variety_dominant`. EXAMPLES:: @@ -1968,7 +1950,7 @@ def pullback_divisor(self, divisor): INPUT: - - ``divisor`` -- a torus-invariant QQ-Cartier divisor on the + - ``divisor`` -- a torus-invariant `\QQ`-Cartier divisor on the codomain of the embedding map. OUTPUT: diff --git a/src/sage/schemes/toric/points.py b/src/sage/schemes/toric/points.py index a7224407150..55e36fa2238 100644 --- a/src/sage/schemes/toric/points.py +++ b/src/sage/schemes/toric/points.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +y# -*- coding: utf-8 -*- """ Enumerate points of a toric variety @@ -82,9 +82,7 @@ def __iter__(self): """ Iterate over the points. - OUTPUT: - - Iterator over points. + OUTPUT: Iterator over points. EXAMPLES:: @@ -138,9 +136,7 @@ def rays(self): """ Return all rays (real and virtual). - OUTPUT: - - Tuple of rays of the fan. + OUTPUT: Tuple of rays of the fan. EXAMPLES:: @@ -365,9 +361,7 @@ def coordinate_iter(self): This method does NOT identify homogeneous coordinates that are equivalent by a homogeneous rescaling. - OUTPUT: - - An iterator over the points. + OUTPUT: An iterator over the points. EXAMPLES:: @@ -409,9 +403,7 @@ def __iter__(self): rescalings, and returns precisely one representative per orbit. - OUTPUT: - - Iterator over points. + OUTPUT: An iterator over points. EXAMPLES:: @@ -444,9 +436,7 @@ def multiplicative_generator(self): """ Return the multiplicative generator of the finite field. - OUTPUT: - - A finite field element. + OUTPUT: A finite field element. EXAMPLES:: @@ -470,9 +460,7 @@ def root_generator(self, n): - ``n`` integer. - OUTPUT: - - A multiplicative generator for :meth:`roots`. + OUTPUT: A multiplicative generator for :meth:`roots`. EXAMPLES:: @@ -714,9 +702,7 @@ def __iter__(self): rescalings, and returns precisely one representative per orbit. - OUTPUT: - - Iterator over points. + OUTPUT: Iterator over points. EXAMPLES:: @@ -752,9 +738,7 @@ def cardinality(self): """ Return the cardinality of the point set. - OUTPUT: - - Integer. The number of points. + OUTPUT: An integer. The number of points. EXAMPLES:: @@ -1014,9 +998,7 @@ def cardinality(self): """ Return the cardinality of the point set. - OUTPUT: - - Integer. The number of points. + OUTPUT: An integer. The number of points. EXAMPLES:: diff --git a/src/sage/schemes/toric/sheaf/klyachko.py b/src/sage/schemes/toric/sheaf/klyachko.py index 9ccf070cf5e..5112420b54f 100644 --- a/src/sage/schemes/toric/sheaf/klyachko.py +++ b/src/sage/schemes/toric/sheaf/klyachko.py @@ -62,9 +62,7 @@ def is_KlyachkoBundle(X): - ``X`` -- anything. - OUTPUT: - - Boolean. + OUTPUT: A boolean. EXAMPLES:: @@ -183,9 +181,7 @@ def variety(self): r""" Return the base toric variety. - OUTPUT: - - A toric variety. + OUTPUT: A toric variety. EXAMPLES:: @@ -201,9 +197,7 @@ def base_ring(self): r""" Return the base field. - OUTPUT: - - A field. + OUTPUT: A field. EXAMPLES:: @@ -217,9 +211,7 @@ def fiber(self): r""" Return the generic fiber of the vector bundle. - OUTPUT: - - A vector space over :meth:`base_ring`. + OUTPUT: A vector space over :meth:`base_ring`. EXAMPLES:: @@ -234,9 +226,7 @@ def rank(self): r""" Return the rank of the vector bundle. - OUTPUT: - - Integer. + OUTPUT: An integer. EXAMPLES:: @@ -250,9 +240,7 @@ def _repr_(self): r""" Return a string representation. - OUTPUT: - - String. + OUTPUT: A string. EXAMPLES:: @@ -424,7 +412,7 @@ def E_degree(self, alpha, m): @cached_method def E_intersection(self, sigma, m): r""" - Return the vector subspace ``E^\sigma(m)``. + Return the vector subspace `E^\sigma(m)`. See [Kly1990]_, equation 4.1. @@ -435,9 +423,7 @@ def E_intersection(self, sigma, m): - ``m`` -- tuple of integers or `M`-lattice point. A point in the dual lattice of the fan. Must be immutable. - OUTPUT: - - The subspace `E^\sigma(m)` + OUTPUT: The subspace `E^\sigma(m)`. EXAMPLES:: @@ -476,9 +462,7 @@ def E_quotient(self, sigma, m): - ``m`` -- tuple of integers or `M`-lattice point. A point in the dual lattice of the fan. Must be immutable. - OUTPUT: - - The subspace `E_\sigma(m)` + OUTPUT: The subspace `E_\sigma(m)`. EXAMPLES:: @@ -724,9 +708,7 @@ def __richcmp__(self, other, op): - ``other`` -- anything. - OUTPUT: - - Boolean. + OUTPUT: A boolean. EXAMPLES:: @@ -761,9 +743,7 @@ def is_isomorphic(self, other): - ``other`` -- anything. - OUTPUT: - - Boolean. + OUTPUT: A boolean. EXAMPLES:: @@ -787,9 +767,7 @@ def direct_sum(self, other): - ``other`` -- a Klyachko bundle over the same base. - OUTPUT: - - The direct sum as a new Klyachko bundle. + OUTPUT: The direct sum as a new Klyachko bundle. EXAMPLES:: @@ -819,9 +797,7 @@ def tensor_product(self, other): - ``other`` -- a Klyachko bundle over the same base. - OUTPUT: - - The tensor product as a new Klyachko bundle. + OUTPUT: The tensor product as a new Klyachko bundle. EXAMPLES:: @@ -875,9 +851,7 @@ def symmetric_power(self, n): - ``n`` -- integer. - OUTPUT: - - The `n`-th symmetric power as a new Klyachko bundle. + OUTPUT: The `n`-th symmetric power as a new Klyachko bundle. EXAMPLES:: @@ -896,9 +870,7 @@ def dual(self): """ Return the dual bundle. - OUTPUT: - - The dual bundle as a new Klyachko bundle. + OUTPUT: The dual bundle as a new Klyachko bundle. EXAMPLES:: diff --git a/src/sage/schemes/toric/toric_subscheme.py b/src/sage/schemes/toric/toric_subscheme.py index 920bcaff30e..e0f31a4aa97 100644 --- a/src/sage/schemes/toric/toric_subscheme.py +++ b/src/sage/schemes/toric/toric_subscheme.py @@ -44,9 +44,7 @@ class AlgebraicScheme_subscheme_toric(AlgebraicScheme_subscheme): - ``polynomials`` -- single polynomial, list, or ideal of defining polynomials in the coordinate ring of ``toric_variety``. - OUTPUT: - - - :class:`algebraic subscheme of a toric variety + OUTPUT: An :class:`algebraic subscheme of a toric variety `. TESTS:: @@ -106,9 +104,7 @@ def _morphism(self, *args, **kwds): - same as for :class:`~sage.schemes.toric.morphism.SchemeMorphism_polynomial_toric_variety`. - OUTPUT: - - - :class:`~sage.schemes.toric.morphism.SchemeMorphism_polynomial_toric_variety`. + OUTPUT: A :class:`~sage.schemes.toric.morphism.SchemeMorphism_polynomial_toric_variety`. TESTS:: @@ -148,9 +144,7 @@ def _point_homset(self, *args, **kwds): - same as for :class:`~sage.schemes.toric.homset.SchemeHomset_points_toric_field`. - OUTPUT: - - :class:`~sage.schemes.toric.homset.SchemeHomset_points_subscheme_toric_field`. + OUTPUT: A :class:`~sage.schemes.toric.homset.SchemeHomset_points_subscheme_toric_field`. TESTS:: @@ -170,9 +164,7 @@ def fan(self): """ Return the fan of the ambient space. - OUTPUT: - - A fan. + OUTPUT: A fan. EXAMPLES:: @@ -499,9 +491,7 @@ def dimension(self): """ Return the dimension of ``self``. - OUTPUT: - - Integer. If ``self`` is empty, `-1` is returned. + OUTPUT: An integer. If ``self`` is empty, `-1` is returned. EXAMPLES:: @@ -796,9 +786,7 @@ def dimension(self): """ Return the dimension of ``self``. - OUTPUT: - - - integer. + OUTPUT: An integer. EXAMPLES:: diff --git a/src/sage/schemes/toric/variety.py b/src/sage/schemes/toric/variety.py index 523ccfcbbbb..48695e25403 100644 --- a/src/sage/schemes/toric/variety.py +++ b/src/sage/schemes/toric/variety.py @@ -271,13 +271,13 @@ The real advantage of the Chow group is that - * it works just as well over `\ZZ`, so torsion information is also - easily available, and +* it works just as well over `\ZZ`, so torsion information is also + easily available, and - * its combinatorial description also works over worse-than-orbifold - singularities. By contrast, the cohomology groups can become very - complicated to compute in this case, and one usually only has a - spectral sequence but no toric algorithm. +* its combinatorial description also works over worse-than-orbifold + singularities. By contrast, the cohomology groups can become very + complicated to compute in this case, and one usually only has a + spectral sequence but no toric algorithm. Below you will find detailed descriptions of available functions. If you are familiar with toric geometry, you will likely see that many important objects @@ -395,9 +395,7 @@ def ToricVariety(fan, - ``base_field`` -- alias for ``base_ring``. Takes precedence if both are specified. - OUTPUT: - - - :class:`toric variety `. + OUTPUT: A :class:`toric variety `. EXAMPLES: @@ -473,9 +471,7 @@ def AffineToricVariety(cone, *args, **kwds): `, which will be passed to :func:`ToricVariety` with the rest of positional and keyword arguments. - OUTPUT: - - - :class:`toric variety `. + OUTPUT: A :class:`toric variety `. .. NOTE:: @@ -532,9 +528,7 @@ class ToricVariety_field(AmbientSpace): - ``base_field`` -- base field of the toric variety. - OUTPUT: - - - :class:`toric variety `. + OUTPUT: A :class:`toric variety `. TESTS:: @@ -569,9 +563,7 @@ def __eq__(self, right): - ``right`` -- anything - OUTPUT: - - boolean + OUTPUT: A boolean. ``True`` if and only if ``right`` is of the same type as ``self``, their fans are the same, names of variables are the same and @@ -607,9 +599,7 @@ def __ne__(self, other): - ``other`` -- anything - OUTPUT: - - boolean + OUTPUT: A boolean. ``True`` if and only if ``other`` is of the same type as ``self``, their fans are the same, names of variables are the same and @@ -1033,9 +1023,7 @@ def change_ring(self, F): - ``F`` -- field. - OUTPUT: - - - :class:`toric variety ` over ``F``. + OUTPUT: :class:`toric variety ` over ``F``. .. NOTE:: @@ -1082,9 +1070,7 @@ def coordinate_ring(self): For toric varieties this is the homogeneous coordinate ring (a.k.a. Cox's ring and total ring). - OUTPUT: - - - polynomial ring. + OUTPUT: A polynomial ring. EXAMPLES:: @@ -1186,9 +1172,7 @@ def inject_coefficients(self, scope=None, verbose=True): - ``verbose`` -- if ``True`` (default), names of injected generators will be printed. - OUTPUT: - - - none. + OUTPUT: None. EXAMPLES:: @@ -1368,9 +1352,7 @@ def is_affine(self): face lattice of a single cone. See also :func:`AffineToricVariety`. - OUTPUT: - - Boolean. + OUTPUT: A boolean. EXAMPLES:: @@ -1452,9 +1434,7 @@ def Kaehler_cone(self): r""" Return the closure of the Kähler cone of ``self``. - OUTPUT: - - - :class:`cone `. + OUTPUT: :class:`cone `. .. NOTE:: @@ -1499,9 +1479,7 @@ def Mori_cone(self): r""" Returns the Mori cone of ``self``. - OUTPUT: - - - :class:`cone `. + OUTPUT: :class:`cone `. .. NOTE:: @@ -1548,9 +1526,7 @@ def plot(self, **options): - any options for toric plots (see :func:`toric_plotter.options `), none are mandatory. - OUTPUT: - - - a plot. + OUTPUT: A plot. .. NOTE:: @@ -1589,9 +1565,7 @@ def rational_class_group(self): we write as addition) is the tensor product of the line bundles. The Picard group of a toric variety is always torsion-free. - OUTPUT: - - - :class:`rational divisor class group + OUTPUT: :class:`rational divisor class group `. .. NOTE:: @@ -1620,9 +1594,7 @@ def Chow_group(self, base_ring=ZZ): - ``base_ring`` -- either ``ZZ`` (default) or ``QQ``. The coefficient ring of the Chow group. - OUTPUT: - - A :class:`sage.schemes.toric.chow_group.ChowGroup_class` + OUTPUT: A :class:`sage.schemes.toric.chow_group.ChowGroup_class`. EXAMPLES:: @@ -1651,9 +1623,7 @@ def cartesian_product(self, other, variables. If not given, the index of each variable will coincide with the index of the corresponding ray of the fan. - OUTPUT: - - -- a :class:`toric variety `. + OUTPUT: A :class:`toric variety `. EXAMPLES:: @@ -1696,9 +1666,7 @@ def resolve(self, **kwds): `, see its documentation for the available options. - OUTPUT: - - - :class:`toric variety `. + OUTPUT: A :class:`toric variety `. EXAMPLES: @@ -1800,9 +1768,7 @@ def resolve_to_orbifold(self, **kwds): - this function accepts only keyword arguments. See :meth:`resolve` for documentation. - OUTPUT: - - - :class:`toric variety `. + OUTPUT: A :class:`toric variety `. EXAMPLES:: @@ -1833,9 +1799,7 @@ def subscheme(self, polynomials): - ``polynomials`` -- list of polynomials in the coordinate ring of ``self``. - OUTPUT: - - - :class:`subscheme of a toric variety + OUTPUT: A :class:`subscheme of a toric variety `. EXAMPLES: diff --git a/src/sage/schemes/toric/weierstrass.py b/src/sage/schemes/toric/weierstrass.py index 7db602ef333..b0259f724b1 100644 --- a/src/sage/schemes/toric/weierstrass.py +++ b/src/sage/schemes/toric/weierstrass.py @@ -25,9 +25,9 @@ (that is, set one or more of the coefficients to zero) of the following three cases. In inhomogeneous coordinates, they are - * Cubic in `\mathbb{P}^2`: +* Cubic in `\mathbb{P}^2`: - .. MATH:: + .. MATH:: \begin{split} p(x,y) =&\; @@ -38,9 +38,9 @@ a_{02} y^{2} + a_{10} x + a_{01} y + a_{00} \end{split} - * Biquadric in `\mathbb{P}^1\times \mathbb{P}^1`: +* Biquadric in `\mathbb{P}^1\times \mathbb{P}^1`: - .. MATH:: + .. MATH:: \begin{split} p(x,y) =&\; @@ -51,10 +51,9 @@ y^2 a_{02} + y a_{01} + a_{00} \end{split} - * Anticanonical hypersurface in weighted projective space - `\mathbb{P}^2[1,1,2]`: +* Anticanonical hypersurface in weighted projective space `\mathbb{P}^2[1,1,2]`: - .. MATH:: + .. MATH:: \begin{split} p(x,y) =&\; @@ -160,9 +159,7 @@ def Discriminant(polynomial, variables=None): See :func:`WeierstrassForm` for how to specify the input polynomial(s) and variables. - OUTPUT: - - The discriminant of the elliptic curve. + OUTPUT: The discriminant of the elliptic curve. EXAMPLES:: @@ -196,12 +193,12 @@ def j_invariant(polynomial, variables=None): The j-invariant of the (irreducible) cubic. Notable special values: - * The Fermat cubic: `j(x^3+y^3+z^3) = 0` + * The Fermat cubic: `j(x^3+y^3+z^3) = 0` - * A nodal cubic: `j(-y^2 + x^2 + x^3) = \infty` + * A nodal cubic: `j(-y^2 + x^2 + x^3) = \infty` - * A cuspidal cubic `y^2=x^3` has undefined `j`-invariant. In this - case, a ``ValueError`` is returned. + * A cuspidal cubic `y^2=x^3` has undefined `j`-invariant. In this + case, a ``ValueError`` is raised. EXAMPLES:: diff --git a/src/sage/schemes/toric/weierstrass_covering.py b/src/sage/schemes/toric/weierstrass_covering.py index 9a01f1a2ed1..5c7b899d93a 100644 --- a/src/sage/schemes/toric/weierstrass_covering.py +++ b/src/sage/schemes/toric/weierstrass_covering.py @@ -280,7 +280,7 @@ def homogenize(inhomog, degree): def WeierstrassMap_P2(polynomial, variables=None): r""" - Map a cubic to its Weierstrass form + Map a cubic to its Weierstrass form. Input/output is the same as :func:`WeierstrassMap`, except that the input polynomial must be a cubic in `\mathbb{P}^2`, From 378132289dcdc3db4c534c9e9455063bc9503d0c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 25 Mar 2023 02:06:41 -0700 Subject: [PATCH 092/135] sage.schemes: Yet more cosmetic doctest changes (fixup) --- src/sage/schemes/toric/toric_subscheme.py | 2 +- src/sage/schemes/toric/variety.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/schemes/toric/toric_subscheme.py b/src/sage/schemes/toric/toric_subscheme.py index e0f31a4aa97..e425ee3d0a8 100644 --- a/src/sage/schemes/toric/toric_subscheme.py +++ b/src/sage/schemes/toric/toric_subscheme.py @@ -45,7 +45,7 @@ class AlgebraicScheme_subscheme_toric(AlgebraicScheme_subscheme): polynomials in the coordinate ring of ``toric_variety``. OUTPUT: An :class:`algebraic subscheme of a toric variety - `. + `. TESTS:: diff --git a/src/sage/schemes/toric/variety.py b/src/sage/schemes/toric/variety.py index 48695e25403..f794a3e7c16 100644 --- a/src/sage/schemes/toric/variety.py +++ b/src/sage/schemes/toric/variety.py @@ -1566,7 +1566,7 @@ def rational_class_group(self): Picard group of a toric variety is always torsion-free. OUTPUT: :class:`rational divisor class group - `. + `. .. NOTE:: @@ -1800,7 +1800,7 @@ def subscheme(self, polynomials): ``self``. OUTPUT: A :class:`subscheme of a toric variety - `. + `. EXAMPLES: From 61a7aeb6fcb8e71116ddee9a5c33a449f200be7a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 25 Mar 2023 12:02:47 -0700 Subject: [PATCH 093/135] src/sage/schemes/toric/points.py: Fix typo --- src/sage/schemes/toric/points.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sage/schemes/toric/points.py b/src/sage/schemes/toric/points.py index 55e36fa2238..f72bd2eb3ba 100644 --- a/src/sage/schemes/toric/points.py +++ b/src/sage/schemes/toric/points.py @@ -1,4 +1,3 @@ -y# -*- coding: utf-8 -*- """ Enumerate points of a toric variety From 7bc90fcb0a367578d4456674423c66494538abc1 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 25 Mar 2023 13:29:44 -0700 Subject: [PATCH 094/135] sage.schemes: Some more cosmetic doctest changes --- src/sage/schemes/affine/affine_space.py | 12 +++++------- src/sage/schemes/generic/algebraic_scheme.py | 19 ++++++++++--------- src/sage/schemes/generic/morphism.py | 11 ++++------- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/src/sage/schemes/affine/affine_space.py b/src/sage/schemes/affine/affine_space.py index dc58eba4e96..cdacc283b1c 100644 --- a/src/sage/schemes/affine/affine_space.py +++ b/src/sage/schemes/affine/affine_space.py @@ -619,13 +619,11 @@ def change_ring(self, R): - ``R`` -- commutative ring or morphism. - OUTPUT: - - - affine space over ``R``. + OUTPUT: An affine space over ``R``. .. NOTE:: - There is no need to have any relation between `R` and the base ring + There is no need to have any relation between ``R`` and the base ring of this space, if you want to have such a relation, use ``self.base_extend(R)`` instead. @@ -840,7 +838,7 @@ def subscheme(self, X, **kwds): def _an_element_(self): r""" - Return an element of this affine space,used both for illustration and + Return an element of this affine space, used both for illustration and testing purposes. OUTPUT: a point in the affine space @@ -859,7 +857,7 @@ def _an_element_(self): def chebyshev_polynomial(self, n, kind='first', monic=False): """ - Generates an endomorphism of this affine line by a Chebyshev polynomial. + Generate an endomorphism of this affine line by a Chebyshev polynomial. Chebyshev polynomials are a sequence of recursively defined orthogonal polynomials. Chebyshev of the first kind are defined as `T_0(x) = 1`, @@ -1101,7 +1099,7 @@ def weil_restriction(self): the Weil restriction to the prime subfield. OUTPUT: Affine space of dimension ``d * self.dimension_relative()`` - over the base field of ``self.base_ring()``. + over the base field of ``self.base_ring()``. EXAMPLES:: diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index 9229311bd78..419b6a43724 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -1207,17 +1207,17 @@ def irreducible_components(self): `\P^4_{\QQ}` then find the irreducible components:: sage: PP. = ProjectiveSpace(4, QQ) - sage: V = PP.subscheme( (x^2 - y^2 - z^2)*(w^5 - 2*v^2*z^3)* w * (v^3 - x^2*z) ) + sage: V = PP.subscheme((x^2 - y^2 - z^2) * (w^5 - 2*v^2*z^3) * w * (v^3 - x^2*z)) sage: V.irreducible_components() [ Closed subscheme of Projective Space of dimension 4 over Rational Field defined by: - w, + w, Closed subscheme of Projective Space of dimension 4 over Rational Field defined by: - x^2 - y^2 - z^2, + x^2 - y^2 - z^2, Closed subscheme of Projective Space of dimension 4 over Rational Field defined by: - x^2*z - v^3, + x^2*z - v^3, Closed subscheme of Projective Space of dimension 4 over Rational Field defined by: - w^5 - 2*z^3*v^2 + w^5 - 2*z^3*v^2 ] We verify that the irrelevant ideal is not accidentally returned @@ -1454,7 +1454,7 @@ def union(self, other): sage: A.subscheme([x]) + A.subscheme([y^2 - (x^3+1)]) Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - x^4 - x*y^2 + x + x^4 - x*y^2 + x Saving and loading:: @@ -2037,7 +2037,7 @@ def specialization(self, D=None, phi=None): - ``D`` -- dictionary (optional) - - ``phi`` -- SpecializationMorphism (optional) + - ``phi`` -- :class:`SpecializationMorphism` (optional) OUTPUT: :class:`SchemeMorphism_polynomial` @@ -2057,9 +2057,10 @@ def specialization(self, D=None, phi=None): sage: P. = AffineSpace(S, 3) sage: X = P.subscheme([x^2 + a*c*y^2 - b*z^2]) sage: from sage.rings.polynomial.flatten import SpecializationMorphism - sage: phi = SpecializationMorphism(P.coordinate_ring(),dict({c:2,a:1})) + sage: phi = SpecializationMorphism(P.coordinate_ring(), dict({c: 2, a: 1})) sage: X.specialization(phi=phi) - Closed subscheme of Affine Space of dimension 3 over Univariate Polynomial Ring in b over Rational Field defined by: + Closed subscheme of Affine Space of dimension 3 + over Univariate Polynomial Ring in b over Rational Field defined by: x^2 + 2*y^2 + (-b)*z^2 """ if D is None: diff --git a/src/sage/schemes/generic/morphism.py b/src/sage/schemes/generic/morphism.py index e3ef91c5e61..1f3b9dcf50e 100644 --- a/src/sage/schemes/generic/morphism.py +++ b/src/sage/schemes/generic/morphism.py @@ -1300,12 +1300,9 @@ def __copy__(self): def coordinate_ring(self): r""" - Returns the coordinate ring of the ambient projective space - the multivariable polynomial ring over the base ring + Return the coordinate ring of the ambient projective space. - OUTPUT: - - - ring + OUTPUT: A multivariable polynomial ring over the base ring. EXAMPLES:: @@ -2079,7 +2076,7 @@ def specialization(self, D=None, phi=None, ambient=None): sage: Q.specialization({c: 1}) (1 : 1) - :: + :: sage: R. = PolynomialRing(QQ) sage: P. = ProjectiveSpace(R, 1) @@ -2106,7 +2103,7 @@ def specialization(self, D=None, phi=None, ambient=None): (2 : 1) sage: Q2.codomain() Closed subscheme of Projective Space of dimension 1 over Rational Field defined by: - x - 2*y + x - 2*y :: From fbfbd28af44f3bfa1bc1db36bf71898b4a405e1a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 28 Mar 2023 21:42:07 -0700 Subject: [PATCH 095/135] src/sage/schemes/affine/affine_homset.py: Add missing space --- src/sage/schemes/affine/affine_homset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/schemes/affine/affine_homset.py b/src/sage/schemes/affine/affine_homset.py index d0a87fae087..5a75d699c52 100644 --- a/src/sage/schemes/affine/affine_homset.py +++ b/src/sage/schemes/affine/affine_homset.py @@ -217,7 +217,7 @@ def points(self, **kwds): :: sage: A. = ZZ[] - sage: I = A.ideal(x^2 - y^2-1) + sage: I = A.ideal(x^2 - y^2 - 1) sage: V = AffineSpace(ZZ, 2) sage: X = V.subscheme(I) sage: M = X(ZZ) From 0f935d06730216dc479abc0b247c83a262637af4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 29 Mar 2023 00:10:42 -0700 Subject: [PATCH 096/135] src/sage/schemes/elliptic_curves: Revise indentation of multiline doctest output --- src/sage/schemes/elliptic_curves/BSD.py | 7 +- .../schemes/elliptic_curves/cardinality.py | 2 +- .../schemes/elliptic_curves/constructor.py | 4 +- .../elliptic_curves/ell_curve_isogeny.py | 194 +++++++++--------- src/sage/schemes/elliptic_curves/ell_field.py | 100 ++++----- .../elliptic_curves/ell_finite_field.py | 118 +++++------ .../schemes/elliptic_curves/ell_local_data.py | 16 +- .../elliptic_curves/ell_modular_symbols.py | 19 +- .../elliptic_curves/ell_number_field.py | 152 +++++++------- src/sage/schemes/elliptic_curves/ell_point.py | 39 ++-- 10 files changed, 328 insertions(+), 323 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/BSD.py b/src/sage/schemes/elliptic_curves/BSD.py index a9f8e537797..f5522de2e00 100644 --- a/src/sage/schemes/elliptic_curves/BSD.py +++ b/src/sage/schemes/elliptic_curves/BSD.py @@ -22,7 +22,7 @@ class BSD_data: sage: D.update() sage: D.Sha Tate-Shafarevich group for the Elliptic Curve - defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field """ def __init__(self): self.curve = None @@ -54,7 +54,7 @@ def update(self): sage: D.update() sage: D.Sha Tate-Shafarevich group for the Elliptic Curve - defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field """ self.two_tor_rk = self.curve.two_torsion_rank() self.Sha = self.curve.sha() @@ -361,7 +361,8 @@ def prove_BSD(E, verbosity=0, two_desc='mwrank', proof=None, secs_hi=5, sage: E = EllipticCurve('37a') sage: S = E.sha(); S - Tate-Shafarevich group for the Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field + Tate-Shafarevich group for the Elliptic Curve defined by y^2 + y = x^3 - x + over Rational Field sage: def foo(use_database): ....: return 4 sage: S.an = foo diff --git a/src/sage/schemes/elliptic_curves/cardinality.py b/src/sage/schemes/elliptic_curves/cardinality.py index d2f7f1daef8..2a73de71a50 100644 --- a/src/sage/schemes/elliptic_curves/cardinality.py +++ b/src/sage/schemes/elliptic_curves/cardinality.py @@ -550,7 +550,7 @@ def _cardinality_subfield(self, jpol): sage: k. = GF(7^5) sage: E = EllipticCurve(k, [1,2,3,4,5]); E Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 - over Finite Field in a of size 7^5 + over Finite Field in a of size 7^5 sage: _cardinality_subfield(E, E.j_invariant().minimal_polynomial()) 17019 diff --git a/src/sage/schemes/elliptic_curves/constructor.py b/src/sage/schemes/elliptic_curves/constructor.py index d36020d6650..75d1167064f 100644 --- a/src/sage/schemes/elliptic_curves/constructor.py +++ b/src/sage/schemes/elliptic_curves/constructor.py @@ -147,7 +147,7 @@ class EllipticCurveFactory(UniqueFactory): sage: E = EllipticCurve(CC, [0,0,1,-1,0]) sage: E Elliptic Curve defined by y^2 + 1.00000000000000*y = x^3 + (-1.00000000000000)*x - over Complex Field with 53 bits of precision + over Complex Field with 53 bits of precision sage: E.j_invariant() 2988.97297297297 @@ -656,7 +656,7 @@ def EllipticCurve_from_j(j, minimal_twist=True): `j-1728` the following example would take a long time without setting ``minimal_twist`` to False:: - sage: E = EllipticCurve_from_j(2^256+1,minimal_twist=False) + sage: E = EllipticCurve_from_j(2^256+1, minimal_twist=False) sage: E.j_invariant() == 2^256+1 True """ diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index 768cbeaa965..91a32f85bf6 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -28,8 +28,8 @@ Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 11 sage: phi.rational_maps() # optional - sage.rings.finite_rings ((x^7 + 4*x^6 - 3*x^5 - 2*x^4 - 3*x^3 + 3*x^2 + x - 2)/(x^6 + 4*x^5 - 4*x^4 - - 5*x^3 + 5*x^2), (x^9*y - 5*x^8*y - x^7*y + x^5*y - x^4*y - 5*x^3*y - - 5*x^2*y - 2*x*y - 5*y)/(x^9 - 5*x^8 + 4*x^6 - 3*x^4 + 2*x^3)) + - 5*x^3 + 5*x^2), (x^9*y - 5*x^8*y - x^7*y + x^5*y - x^4*y - 5*x^3*y - + 5*x^2*y - 2*x*y - 5*y)/(x^9 - 5*x^8 + 4*x^6 - 3*x^4 + 2*x^3)) The methods directly accessible from an elliptic curve ``E`` over a field are @@ -196,22 +196,22 @@ def isogeny_codomain_from_kernel(E, kernel, degree=None): sage: R. = GF(7)[] # optional - sage.rings.finite_rings sage: isogeny_codomain_from_kernel(E, [4,1]) # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + 6 - over Finite Field of size 7 + over Finite Field of size 7 sage: (EllipticCurveIsogeny(E, [4,1]).codomain() # optional - sage.rings.finite_rings ....: == isogeny_codomain_from_kernel(E, [4,1])) True sage: isogeny_codomain_from_kernel(E, x^3 + x^2 + 4*x + 3) # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + 6 - over Finite Field of size 7 + over Finite Field of size 7 sage: isogeny_codomain_from_kernel(E, x^3 + 2*x^2 + 4*x + 3) # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 + x*y + y = x^3 + 5*x + 2 - over Finite Field of size 7 + over Finite Field of size 7 sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) # optional - sage.rings.finite_rings sage: kernel_list = [E((15,10)), E((10,3)), E((6,5))] # optional - sage.rings.finite_rings sage: isogeny_codomain_from_kernel(E, kernel_list) # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 3*x + 15 - over Finite Field of size 19 + over Finite Field of size 19 TESTS: @@ -223,7 +223,7 @@ def isogeny_codomain_from_kernel(E, kernel, degree=None): DeprecationWarning: The "degree" argument to isogeny_codomain_from_kernel() does nothing and will be removed. ... Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 3*x + 15 - over Finite Field of size 19 + over Finite Field of size 19 """ if degree is not None: from sage.misc.superseded import deprecation @@ -267,7 +267,7 @@ def compute_codomain_formula(E, v, w): sage: phi = EllipticCurveIsogeny(E, E((1,2)) ) # optional - sage.rings.finite_rings sage: phi.codomain() # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 9*x + 13 - over Finite Field of size 19 + over Finite Field of size 19 sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import compute_codomain_formula sage: v = phi._EllipticCurveIsogeny__v # optional - sage.rings.finite_rings sage: w = phi._EllipticCurveIsogeny__w # optional - sage.rings.finite_rings @@ -304,9 +304,9 @@ def compute_vw_kohel_even_deg1(x0, y0, a1, a2, a4): sage: phi = EllipticCurveIsogeny(E, [9,1]); phi # optional - sage.rings.finite_rings Isogeny of degree 2 from Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 - over Finite Field of size 19 - to Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 9*x + 8 - over Finite Field of size 19 + over Finite Field of size 19 + to Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 9*x + 8 + over Finite Field of size 19 sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import compute_vw_kohel_even_deg1 sage: a1,a2,a3,a4,a6 = E.a_invariants() # optional - sage.rings.finite_rings sage: x0 = -9 # optional - sage.rings.finite_rings @@ -343,9 +343,9 @@ def compute_vw_kohel_even_deg3(b2, b4, s1, s2, s3): sage: phi = EllipticCurveIsogeny(E, x^3 + 7*x^2 + 15*x + 12); phi # optional - sage.rings.finite_rings Isogeny of degree 4 from Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 - over Finite Field of size 19 - to Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 3*x + 15 - over Finite Field of size 19 + over Finite Field of size 19 + to Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 3*x + 15 + over Finite Field of size 19 sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import compute_vw_kohel_even_deg3 sage: b2,b4 = E.b2(), E.b4() # optional - sage.rings.finite_rings sage: s1, s2, s3 = -7, 15, -12 # optional - sage.rings.finite_rings @@ -384,9 +384,9 @@ def compute_vw_kohel_odd(b2, b4, b6, s1, s2, s3, n): sage: phi = EllipticCurveIsogeny(E, x^3 + 14*x^2 + 3*x + 11); phi # optional - sage.rings.finite_rings Isogeny of degree 7 from Elliptic Curve defined by y^2 + 18*x*y + 16*y = x^3 + 17*x^2 + 15*x + 14 - over Finite Field of size 19 - to Elliptic Curve defined by y^2 + 18*x*y + 16*y = x^3 + 17*x^2 + 18*x + 18 - over Finite Field of size 19 + over Finite Field of size 19 + to Elliptic Curve defined by y^2 + 18*x*y + 16*y = x^3 + 17*x^2 + 18*x + 18 + over Finite Field of size 19 sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import compute_vw_kohel_odd sage: b2,b4,b6 = E.b2(), E.b4(), E.b6() # optional - sage.rings.finite_rings sage: s1,s2,s3 = -14,3,-11 # optional - sage.rings.finite_rings @@ -423,7 +423,7 @@ def compute_codomain_kohel(E, kernel): True sage: compute_codomain_kohel(E, [9,1]) # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 9*x + 8 - over Finite Field of size 19 + over Finite Field of size 19 sage: R. = GF(19)[] # optional - sage.rings.finite_rings sage: E = EllipticCurve(GF(19), [18,17,16,15,14]) # optional - sage.rings.finite_rings sage: phi = EllipticCurveIsogeny(E, x^3 + 14*x^2 + 3*x + 11) # optional - sage.rings.finite_rings @@ -431,14 +431,14 @@ def compute_codomain_kohel(E, kernel): True sage: compute_codomain_kohel(E, x^3 + 14*x^2 + 3*x + 11) # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 + 18*x*y + 16*y = x^3 + 17*x^2 + 18*x + 18 - over Finite Field of size 19 + over Finite Field of size 19 sage: E = EllipticCurve(GF(19), [1,2,3,4,5]) # optional - sage.rings.finite_rings sage: phi = EllipticCurveIsogeny(E, x^3 + 7*x^2 + 15*x + 12) # optional - sage.rings.finite_rings sage: isogeny_codomain_from_kernel(E, x^3 + 7*x^2 + 15*x + 12) == phi.codomain() # optional - sage.rings.finite_rings True sage: compute_codomain_kohel(E, x^3 + 7*x^2 + 15*x + 12) # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 3*x + 15 - over Finite Field of size 19 + over Finite Field of size 19 ALGORITHM: @@ -614,7 +614,7 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: phi = EllipticCurveIsogeny(E, E((0,0)) ); phi # optional - sage.rings.finite_rings Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 7 - to Elliptic Curve defined by y^2 = x^3 + 3*x over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 3*x over Finite Field of size 7 sage: phi.degree() == 2 # optional - sage.rings.finite_rings True sage: phi.kernel_polynomial() # optional - sage.rings.finite_rings @@ -631,9 +631,9 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: phi_v = EllipticCurveIsogeny(E, P); phi_v # optional - sage.rings.finite_rings Isogeny of degree 3 from Elliptic Curve defined by y^2 + y = x^3 + 1 - over Finite Field in alpha of size 2^4 - to Elliptic Curve defined by y^2 + y = x^3 - over Finite Field in alpha of size 2^4 + over Finite Field in alpha of size 2^4 + to Elliptic Curve defined by y^2 + y = x^3 + over Finite Field in alpha of size 2^4 sage: phi_ker_poly = phi_v.kernel_polynomial() # optional - sage.rings.finite_rings sage: phi_ker_poly # optional - sage.rings.finite_rings x + 1 @@ -666,9 +666,9 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: phi = EllipticCurveIsogeny(E, ker_poly); phi # optional - sage.rings.finite_rings Isogeny of degree 4 from Elliptic Curve defined by y^2 = x^3 + x + 1 - over Finite Field in z2 of size 3^2 - to Elliptic Curve defined by y^2 = x^3 + x + 1 - over Finite Field in z2 of size 3^2 + over Finite Field in z2 of size 3^2 + to Elliptic Curve defined by y^2 = x^3 + x + 1 + over Finite Field in z2 of size 3^2 sage: P1,P2,P3 = filter(bool, E(0).division_points(2)) # optional - sage.rings.finite_rings sage: phi(P1) # optional - sage.rings.finite_rings (0 : 1 : 0) @@ -697,9 +697,9 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: phi_k = EllipticCurveIsogeny(E, [1]); phi_k # optional - sage.rings.finite_rings Isogeny of degree 1 from Elliptic Curve defined by y^2 + 23*x*y + 22*y = x^3 + x^2 + 7*x + 18 - over Finite Field of size 31 - to Elliptic Curve defined by y^2 + 23*x*y + 22*y = x^3 + x^2 + 7*x + 18 - over Finite Field of size 31 + over Finite Field of size 31 + to Elliptic Curve defined by y^2 + 23*x*y + 22*y = x^3 + x^2 + 7*x + 18 + over Finite Field of size 31 sage: phi_k.degree() # optional - sage.rings.finite_rings 1 sage: phi_k.rational_maps() # optional - sage.rings.finite_rings @@ -718,7 +718,7 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: phi = EllipticCurveIsogeny(E, P_list); phi Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 3*x + 4 over Rational Field - to Elliptic Curve defined by y^2 = x^3 - 27*x + 46 over Rational Field + to Elliptic Curve defined by y^2 = x^3 - 27*x + 46 over Rational Field sage: P = E((0,2)) sage: phi(P) (6 : -10 : 1) @@ -728,7 +728,7 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: phi_k = EllipticCurveIsogeny(E, phi_ker_poly); phi_k Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 3*x + 4 over Rational Field - to Elliptic Curve defined by y^2 = x^3 - 27*x + 46 over Rational Field + to Elliptic Curve defined by y^2 = x^3 - 27*x + 46 over Rational Field sage: phi_k(P) == phi(P) True sage: phi_k == phi @@ -745,7 +745,7 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: phi_v = EllipticCurveIsogeny(E, P_list); phi_v Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field - to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field sage: P = E((16,-61)) sage: phi_v(P) (0 : 1 : 0) @@ -754,7 +754,7 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: phi_k = EllipticCurveIsogeny(E, ker_poly); phi_k Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field - to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field sage: phi_k == phi_v True sage: phi_v(P) == phi_k(P) @@ -773,9 +773,9 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: phi_v = EllipticCurveIsogeny(EK, P_list); phi_v # optional - sage.rings.number_field Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) - over Number Field in alpha with defining polynomial x^3 - 2*x^2 - 40*x - 158 - to Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-7820)*x + (-263580) - over Number Field in alpha with defining polynomial x^3 - 2*x^2 - 40*x - 158 + over Number Field in alpha with defining polynomial x^3 - 2*x^2 - 40*x - 158 + to Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-7820)*x + (-263580) + over Number Field in alpha with defining polynomial x^3 - 2*x^2 - 40*x - 158 sage: P = EK((alpha/2,-1/2)) # optional - sage.rings.number_field sage: phi_v(P) # optional - sage.rings.number_field (122/121*alpha^2 + 1633/242*alpha - 3920/121 : -1/2 : 1) @@ -785,9 +785,9 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: phi_k = EllipticCurveIsogeny(EK, ker_poly); phi_k # optional - sage.rings.number_field Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) - over Number Field in alpha with defining polynomial x^3 - 2*x^2 - 40*x - 158 - to Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-7820)*x + (-263580) - over Number Field in alpha with defining polynomial x^3 - 2*x^2 - 40*x - 158 + over Number Field in alpha with defining polynomial x^3 - 2*x^2 - 40*x - 158 + to Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-7820)*x + (-263580) + over Number Field in alpha with defining polynomial x^3 - 2*x^2 - 40*x - 158 sage: phi_v == phi_k # optional - sage.rings.number_field True sage: phi_k(P) == phi_v(P) # optional - sage.rings.number_field @@ -810,7 +810,7 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: phi_s = EllipticCurveIsogeny(E, None, E2, 5); phi_s Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field - to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field sage: phi_s == phi True sage: phi_s.rational_maps() == phi.rational_maps() @@ -833,8 +833,8 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: phihat = phi.dual(); phihat Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 - over Rational Field - to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: phihat.is_normalized() False @@ -878,7 +878,7 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: phi = E.isogeny([E(0), E((0,1)), E((0,-1))]); phi # optional - sage.rings.finite_rings Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 7 - to Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 7 sage: phi2 = phi * phi; phi2 # optional - sage.rings.finite_rings Composite morphism of degree 9 = 3^2: From: Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 7 @@ -906,26 +906,26 @@ class EllipticCurveIsogeny(EllipticCurveHom): sage: isogs[0] Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + (-t^2)*x - over Rational function field in t over Rational Field - to Elliptic Curve defined by y^2 = x^3 + 4*t^2*x - over Rational function field in t over Rational Field + over Rational function field in t over Rational Field + to Elliptic Curve defined by y^2 = x^3 + 4*t^2*x + over Rational function field in t over Rational Field sage: isogs[0].rational_maps() ((x^2 - t^2)/x, (x^2*y + t^2*y)/x^2) sage: duals = [phi.dual() for phi in isogs] sage: duals[0] Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 4*t^2*x - over Rational function field in t over Rational Field - to Elliptic Curve defined by y^2 = x^3 + (-t^2)*x - over Rational function field in t over Rational Field + over Rational function field in t over Rational Field + to Elliptic Curve defined by y^2 = x^3 + (-t^2)*x + over Rational function field in t over Rational Field sage: duals[0].rational_maps() ((1/4*x^2 + t^2)/x, (1/8*x^2*y + (-1/2*t^2)*y)/x^2) sage: duals[0] Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 4*t^2*x - over Rational function field in t over Rational Field - to Elliptic Curve defined by y^2 = x^3 + (-t^2)*x - over Rational function field in t over Rational Field + over Rational function field in t over Rational Field + to Elliptic Curve defined by y^2 = x^3 + (-t^2)*x + over Rational function field in t over Rational Field """ #################### @@ -1018,28 +1018,28 @@ def __init__(self, E, kernel, codomain=None, degree=None, model=None, check=True sage: phi = EllipticCurveIsogeny(E, [1,1]); phi # optional - sage.rings.finite_rings Isogeny of degree 3 from Elliptic Curve defined by y^2 + y = x^3 + 1 over Finite Field of size 2 - to Elliptic Curve defined by y^2 + y = x^3 over Finite Field of size 2 + to Elliptic Curve defined by y^2 + y = x^3 over Finite Field of size 2 sage: E = EllipticCurve(GF(31), [0,0,0,1,0]) # optional - sage.rings.finite_rings sage: P = E((2,17)) # optional - sage.rings.finite_rings sage: phi = EllipticCurveIsogeny(E, P); phi # optional - sage.rings.finite_rings Isogeny of degree 8 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 31 - to Elliptic Curve defined by y^2 = x^3 + 10*x + 28 over Finite Field of size 31 + to Elliptic Curve defined by y^2 = x^3 + 10*x + 28 over Finite Field of size 31 sage: E = EllipticCurve('17a1') sage: phi = EllipticCurveIsogeny(E, [41/3, -55, -1, -1, 1]); phi Isogeny of degree 9 from Elliptic Curve defined by y^2 + x*y + y = x^3 - x^2 - x - 14 - over Rational Field - to Elliptic Curve defined by y^2 + x*y + y = x^3 - x^2 - 56*x - 10124 - over Rational Field + over Rational Field + to Elliptic Curve defined by y^2 + x*y + y = x^3 - x^2 - 56*x - 10124 + over Rational Field sage: E = EllipticCurve('37a1') sage: triv = EllipticCurveIsogeny(E, E(0)); triv Isogeny of degree 1 from Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field - to Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field sage: triv.rational_maps() (x, y) @@ -1048,9 +1048,9 @@ def __init__(self, E, kernel, codomain=None, degree=None, model=None, check=True sage: EllipticCurveIsogeny(E, X^3 - 13*X^2 - 58*X + 503, check=False) Isogeny of degree 7 from Elliptic Curve defined by y^2 + x*y = x^3 - x^2 - 107*x + 552 - over Rational Field - to Elliptic Curve defined by y^2 + x*y = x^3 - x^2 - 5252*x - 178837 - over Rational Field + over Rational Field + to Elliptic Curve defined by y^2 + x*y = x^3 - x^2 - 5252*x - 178837 + over Rational Field """ if not is_EllipticCurve(E): raise ValueError("given E is not an elliptic curve") @@ -1392,14 +1392,14 @@ def __neg__(self): sage: phi # optional - sage.rings.finite_rings Isogeny of degree 2 from Elliptic Curve defined by y^2 + 15*x*y + 12*y = x^3 + 3*x^2 + 7*x + 6 over Finite Field of size 17 - to Elliptic Curve defined by y^2 + 15*x*y + 12*y = x^3 + 3*x^2 + 4*x + 8 over Finite Field of size 17 + to Elliptic Curve defined by y^2 + 15*x*y + 12*y = x^3 + 3*x^2 + 4*x + 8 over Finite Field of size 17 sage: phi.rational_maps() # optional - sage.rings.finite_rings ((x^2 + 6*x + 4)/(x + 6), (x^2*y - 5*x*y + 8*x - 2*y)/(x^2 - 5*x + 2)) sage: negphi = -phi # optional - sage.rings.finite_rings sage: negphi # optional - sage.rings.finite_rings Isogeny of degree 2 from Elliptic Curve defined by y^2 + 15*x*y + 12*y = x^3 + 3*x^2 + 7*x + 6 over Finite Field of size 17 - to Elliptic Curve defined by y^2 + 15*x*y + 12*y = x^3 + 3*x^2 + 4*x + 8 over Finite Field of size 17 + to Elliptic Curve defined by y^2 + 15*x*y + 12*y = x^3 + 3*x^2 + 4*x + 8 over Finite Field of size 17 sage: negphi.rational_maps() # optional - sage.rings.finite_rings ((x^2 + 6*x + 4)/(x + 6), (2*x^3 - x^2*y - 5*x^2 + 5*x*y - 4*x + 2*y + 7)/(x^2 - 5*x + 2)) @@ -1804,18 +1804,18 @@ def __setup_post_isomorphism(self, codomain, model): sage: phi = EllipticCurveIsogeny(E, E((0,0)), E2); phi # optional - sage.rings.finite_rings Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 7 - to Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 7 sage: E3 = EllipticCurve(GF(7), [0,0,0,6,0]) # optional - sage.rings.finite_rings sage: phi._EllipticCurveIsogeny__setup_post_isomorphism(E3, None) # optional - sage.rings.finite_rings sage: phi # optional - sage.rings.finite_rings Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 7 - to Elliptic Curve defined by y^2 = x^3 + 6*x over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 6*x over Finite Field of size 7 sage: EllipticCurveIsogeny(E, E(0,0), model='montgomery') # optional - sage.rings.finite_rings Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 7 - to Elliptic Curve defined by y^2 = x^3 + x^2 + x over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + x^2 + x over Finite Field of size 7 sage: R. = QQ[] sage: E = EllipticCurve(j=1728) @@ -1823,14 +1823,14 @@ def __setup_post_isomorphism(self, codomain, model): sage: phi = EllipticCurveIsogeny(E, f, model='minimal'); phi Isogeny of degree 4 from Elliptic Curve defined by y^2 = x^3 - x over Rational Field - to Elliptic Curve defined by y^2 = x^3 - x over Rational Field + to Elliptic Curve defined by y^2 = x^3 - x over Rational Field sage: phi = EllipticCurveIsogeny(E, f, model=None) sage: phi._EllipticCurveIsogeny__setup_post_isomorphism(None, 'minimal') sage: phi Isogeny of degree 4 from Elliptic Curve defined by y^2 = x^3 - x over Rational Field - to Elliptic Curve defined by y^2 = x^3 - x over Rational Field + to Elliptic Curve defined by y^2 = x^3 - x over Rational Field """ if model is codomain is None: return @@ -1875,7 +1875,7 @@ def __init_from_kernel_list(self, kernel_gens): sage: phi = EllipticCurveIsogeny(E, E((0,0))); phi # optional - sage.rings.finite_rings Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 6*x over Finite Field of size 7 - to Elliptic Curve defined by y^2 = x^3 + 4*x over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 4*x over Finite Field of size 7 sage: phi._EllipticCurveIsogeny__init_from_kernel_list([E(0), E((0,0))]) # optional - sage.rings.finite_rings The following example demonstrates the necessity of avoiding any calls @@ -1889,9 +1889,9 @@ def __init_from_kernel_list(self, kernel_gens): sage: EllipticCurveIsogeny(E, P) # optional - sage.rings.finite_rings Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + x - over Finite Field of size 461742260113997803268895001173557974278278194575766957660028841364655249961609425998827452443620996655395008156411 - to Elliptic Curve defined by y^2 = x^3 + 80816485163488178037199320944019099858815874115367810482828676054000067654558381377552245721755005198633191074893*x + 301497584865165444049833326660609767433467459033532853758006118022998267706948164646650354324860226263546558337993 - over Finite Field of size 461742260113997803268895001173557974278278194575766957660028841364655249961609425998827452443620996655395008156411 + over Finite Field of size 461742260113997803268895001173557974278278194575766957660028841364655249961609425998827452443620996655395008156411 + to Elliptic Curve defined by y^2 = x^3 + 80816485163488178037199320944019099858815874115367810482828676054000067654558381377552245721755005198633191074893*x + 301497584865165444049833326660609767433467459033532853758006118022998267706948164646650354324860226263546558337993 + over Finite Field of size 461742260113997803268895001173557974278278194575766957660028841364655249961609425998827452443620996655395008156411 """ if self.__check : for P in kernel_gens: @@ -1938,7 +1938,7 @@ def __sort_kernel_list(self): sage: phi = EllipticCurveIsogeny(E, P); phi # optional - sage.rings.finite_rings Isogeny of degree 4 from Elliptic Curve defined by y^2 = x^3 + 6*x over Finite Field of size 7 - to Elliptic Curve defined by y^2 = x^3 + 2*x over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 2*x over Finite Field of size 7 sage: phi._EllipticCurveIsogeny__sort_kernel_list() # optional - sage.rings.finite_rings """ a1, a2, a3, a4, _ = self._domain.a_invariants() @@ -2205,7 +2205,7 @@ def __init_from_kernel_polynomial(self, kernel_polynomial): sage: phi = EllipticCurveIsogeny(E, x);phi # optional - sage.rings.finite_rings Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 6*x over Finite Field of size 7 - to Elliptic Curve defined by y^2 = x^3 + 4*x over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 4*x over Finite Field of size 7 sage: phi._EllipticCurveIsogeny__init_from_kernel_polynomial(x) # optional - sage.rings.finite_rings @@ -2213,7 +2213,7 @@ def __init_from_kernel_polynomial(self, kernel_polynomial): sage: phi = EllipticCurveIsogeny(E, x+6, degree=3); phi # optional - sage.rings.finite_rings Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 1 over Finite Field of size 7 - to Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 4*x + 2 over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 4*x + 2 over Finite Field of size 7 sage: phi._EllipticCurveIsogeny__init_from_kernel_polynomial(x+6) # optional - sage.rings.finite_rings """ @@ -2307,7 +2307,7 @@ def __init_even_kernel_polynomial(self, E, psi_G): sage: phi = EllipticCurveIsogeny(E, x); phi # optional - sage.rings.finite_rings Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 6*x over Finite Field of size 7 - to Elliptic Curve defined by y^2 = x^3 + 4*x over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 4*x over Finite Field of size 7 sage: from sage.schemes.elliptic_curves.ell_curve_isogeny import two_torsion_part sage: psig = two_torsion_part(E,x) # optional - sage.rings.finite_rings @@ -2319,7 +2319,7 @@ def __init_even_kernel_polynomial(self, E, psi_G): sage: phi = EllipticCurveIsogeny(E, x); phi # optional - sage.rings.finite_rings Isogeny of degree 2 from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 + x over Finite Field in alpha of size 2^4 - to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 + 1 over Finite Field in alpha of size 2^4 + to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 + 1 over Finite Field in alpha of size 2^4 sage: psig = two_torsion_part(E,x) # optional - sage.rings.finite_rings sage: phi._EllipticCurveIsogeny__init_even_kernel_polynomial(E,psig) # optional - sage.rings.finite_rings @@ -2331,7 +2331,7 @@ def __init_even_kernel_polynomial(self, E, psi_G): sage: phi = EllipticCurveIsogeny(E, f); phi # optional - sage.rings.finite_rings Isogeny of degree 4 from Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 1 over Finite Field of size 7 - to Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 2*x + 5 over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 2*x + 5 over Finite Field of size 7 sage: psig = two_torsion_part(E,f) # optional - sage.rings.finite_rings sage: psig = two_torsion_part(E,f) # optional - sage.rings.finite_rings sage: phi._EllipticCurveIsogeny__init_even_kernel_polynomial(E,psig) # optional - sage.rings.finite_rings @@ -2424,7 +2424,7 @@ def __init_odd_kernel_polynomial(self, E, psi): sage: phi = EllipticCurveIsogeny(E, x+6, degree=3); phi # optional - sage.rings.finite_rings Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 1 over Finite Field of size 7 - to Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 4*x + 2 over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 4*x + 2 over Finite Field of size 7 sage: R. = GF(7)[] # optional - sage.rings.finite_rings sage: phi._EllipticCurveIsogeny__init_odd_kernel_polynomial(E, x+6) # optional - sage.rings.finite_rings @@ -2437,7 +2437,7 @@ def __init_odd_kernel_polynomial(self, E, psi): sage: phi = EllipticCurveIsogeny(E, f); phi # optional - sage.rings.finite_rings Isogeny of degree 3 from Elliptic Curve defined by y^2 + x*y + alpha*y = x^3 + x^2 + (alpha^2+1)*x + 1 over Finite Field in alpha of size 2^4 - to Elliptic Curve defined by y^2 + x*y + alpha*y = x^3 + x^2 + alpha*x + alpha^3 over Finite Field in alpha of size 2^4 + to Elliptic Curve defined by y^2 + x*y + alpha*y = x^3 + x^2 + alpha*x + alpha^3 over Finite Field in alpha of size 2^4 sage: R. = F[] # optional - sage.rings.finite_rings sage: f = x + alpha^2 + 1 # optional - sage.rings.finite_rings @@ -2451,7 +2451,7 @@ def __init_odd_kernel_polynomial(self, E, psi): sage: E.isogeny(kernel=f, check=False) # optional - sage.rings.finite_rings Isogeny of degree 163 from Elliptic Curve defined by y^2 + y = x^3 - 2174420*x + 1234136692 over Rational Field - to Elliptic Curve defined by y^2 + y = x^3 - 57772164980*x - 5344733777551611 over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - 57772164980*x - 5344733777551611 over Rational Field """ n = psi.degree() d = 2*n + 1 @@ -2526,7 +2526,7 @@ def __compute_omega_fast(self, E, psi, psi_pr, phi, phi_pr): sage: phi = EllipticCurveIsogeny(E, x+6, degree=3); phi # optional - sage.rings.finite_rings Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 1 over Finite Field of size 7 - to Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 4*x + 2 over Finite Field of size 7 + to Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 4*x + 2 over Finite Field of size 7 sage: R. = GF(7)[] # optional - sage.rings.finite_rings sage: psi = phi._EllipticCurveIsogeny__psi # optional - sage.rings.finite_rings @@ -2577,7 +2577,7 @@ def __compute_omega_general(self, E, psi, psi_pr, phi, phi_pr): sage: phi = EllipticCurveIsogeny(E, f); phi # optional - sage.rings.finite_rings Isogeny of degree 3 from Elliptic Curve defined by y^2 + x*y + alpha*y = x^3 + x^2 + (alpha^2+1)*x + 1 over Finite Field in alpha of size 2^4 - to Elliptic Curve defined by y^2 + x*y + alpha*y = x^3 + x^2 + alpha*x + alpha^3 over Finite Field in alpha of size 2^4 + to Elliptic Curve defined by y^2 + x*y + alpha*y = x^3 + x^2 + alpha*x + alpha^3 over Finite Field in alpha of size 2^4 sage: R. = F[] # optional - sage.rings.finite_rings sage: psi = phi._EllipticCurveIsogeny__psi # optional - sage.rings.finite_rings @@ -2598,7 +2598,7 @@ def __compute_omega_general(self, E, psi, psi_pr, phi, phi_pr): sage: E.isogeny(ker) # optional - sage.rings.finite_rings Isogeny of degree 13 from Elliptic Curve defined by y^2 + x*y = x^3 + (a^6+a^4+a^2+a) over Finite Field in a of size 2^7 - to Elliptic Curve defined by y^2 + x*y = x^3 + (a^6+a^5+a^4+a^3+a^2+a)*x + (a^5+a^3) over Finite Field in a of size 2^7 + to Elliptic Curve defined by y^2 + x*y = x^3 + (a^6+a^5+a^4+a^3+a^2+a)*x + (a^5+a^3) over Finite Field in a of size 2^7 """ a1, a2, a3, a4, a6 = E.a_invariants() b2, b4, _, _ = E.b_invariants() @@ -2915,7 +2915,7 @@ def _set_pre_isomorphism(self, preWI): sage: phi # optional - sage.rings.finite_rings Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 29 - to Elliptic Curve defined by y^2 = x^3 + 20*x over Finite Field of size 29 + to Elliptic Curve defined by y^2 = x^3 + 20*x over Finite Field of size 29 sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism sage: inv_isom = WeierstrassIsomorphism(E, (1,-2,5,10)) # optional - sage.rings.finite_rings sage: Epr = inv_isom.codomain() # optional - sage.rings.finite_rings @@ -2924,7 +2924,7 @@ def _set_pre_isomorphism(self, preWI): sage: phi # optional - sage.rings.finite_rings Isogeny of degree 5 from Elliptic Curve defined by y^2 + 10*x*y + 20*y = x^3 + 27*x^2 + 6 over Finite Field of size 29 - to Elliptic Curve defined by y^2 = x^3 + 20*x over Finite Field of size 29 + to Elliptic Curve defined by y^2 = x^3 + 20*x over Finite Field of size 29 sage: phi(Epr((12,1))) # optional - sage.rings.finite_rings (26 : 0 : 1) sage: phi(Epr((2,9))) # optional - sage.rings.finite_rings @@ -2940,7 +2940,7 @@ def _set_pre_isomorphism(self, preWI): sage: phi = EllipticCurveIsogeny(E, f); phi Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field - to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism sage: Epr = E.short_weierstrass_model() sage: isom = Epr.isomorphism_to(E) @@ -2948,7 +2948,7 @@ def _set_pre_isomorphism(self, preWI): sage: phi Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 - 13392*x - 1080432 over Rational Field - to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field sage: phi(Epr((168,1188))) (0 : 1 : 0) """ @@ -2990,7 +2990,7 @@ def _set_post_isomorphism(self, postWI): sage: phi # optional - sage.rings.finite_rings Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 31 - to Elliptic Curve defined by y^2 + 24*x*y + 7*y = x^3 + 22*x^2 + 16*x + 20 over Finite Field of size 31 + to Elliptic Curve defined by y^2 + 24*x*y + 7*y = x^3 + 22*x^2 + 16*x + 20 over Finite Field of size 31 sage: E = EllipticCurve(j=GF(47)(0)) # optional - sage.rings.finite_rings sage: f = E.torsion_polynomial(3)/3 # optional - sage.rings.finite_rings @@ -3014,7 +3014,7 @@ def _set_post_isomorphism(self, postWI): sage: phi Isogeny of degree 4 from Elliptic Curve defined by y^2 = x^3 + x over Number Field in a with defining polynomial x^2 + 2 - to Elliptic Curve defined by y^2 = x^3 + (-44)*x + 112 over Number Field in a with defining polynomial x^2 + 2 + to Elliptic Curve defined by y^2 = x^3 + (-44)*x + 112 over Number Field in a with defining polynomial x^2 + 2 """ WIdom = postWI.domain() WIcod = postWI.codomain() @@ -3143,7 +3143,7 @@ def dual(self): sage: phi.dual() # optional - sage.rings.finite_rings Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 427*x over Finite Field in z2 of size 431^2 - to Elliptic Curve defined by y^2 = x^3 + x over Finite Field in z2 of size 431^2 + to Elliptic Curve defined by y^2 = x^3 + x over Finite Field in z2 of size 431^2 Test (for :trac:`7096`):: @@ -3158,7 +3158,7 @@ def dual(self): sage: phi # optional - sage.rings.finite_rings Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 11*x + 11 over Finite Field of size 103 - to Elliptic Curve defined by y^2 = x^3 + 25*x + 80 over Finite Field of size 103 + to Elliptic Curve defined by y^2 = x^3 + 25*x + 80 over Finite Field of size 103 sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism sage: phi = WeierstrassIsomorphism(phi.codomain(),(5,0,1,2)) * phi # optional - sage.rings.finite_rings sage: phi.dual().dual() == phi # optional - sage.rings.finite_rings @@ -3169,7 +3169,7 @@ def dual(self): sage: phi.dual() # optional - sage.rings.finite_rings Isogeny of degree 7 from Elliptic Curve defined by y^2 + x*y = x^3 + 84*x + 34 over Finite Field of size 103 - to Elliptic Curve defined by y^2 + x*y = x^3 + x + 102 over Finite Field of size 103 + to Elliptic Curve defined by y^2 + x*y = x^3 + x + 102 over Finite Field of size 103 Check that :trac:`17293` is fixed:: @@ -3279,15 +3279,15 @@ def _composition_impl(left, right): sage: phi * iso1 # indirect doctest # optional - sage.rings.finite_rings Isogeny of degree 11 from Elliptic Curve defined by y^2 + 2*x*y + 2*y = x^3 + 2*x^2 + 6*x + 7 over Finite Field of size 127 - to Elliptic Curve defined by y^2 = x^3 + 37*x + 85 over Finite Field of size 127 + to Elliptic Curve defined by y^2 = x^3 + 37*x + 85 over Finite Field of size 127 sage: iso2 * phi # indirect doctest # optional - sage.rings.finite_rings Isogeny of degree 11 from Elliptic Curve defined by y^2 = x^3 + 5*x + 2 over Finite Field of size 127 - to Elliptic Curve defined by y^2 = x^3 + 117*x + 58 over Finite Field of size 127 + to Elliptic Curve defined by y^2 = x^3 + 117*x + 58 over Finite Field of size 127 sage: iso2 * phi * iso1 # indirect doctest # optional - sage.rings.finite_rings Isogeny of degree 11 from Elliptic Curve defined by y^2 + 2*x*y + 2*y = x^3 + 2*x^2 + 6*x + 7 over Finite Field of size 127 - to Elliptic Curve defined by y^2 = x^3 + 117*x + 58 over Finite Field of size 127 + to Elliptic Curve defined by y^2 = x^3 + 117*x + 58 over Finite Field of size 127 TESTS: diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py index 3fca7a4acb6..7a98d1d1bfe 100644 --- a/src/sage/schemes/elliptic_curves/ell_field.py +++ b/src/sage/schemes/elliptic_curves/ell_field.py @@ -123,8 +123,8 @@ def quadratic_twist(self, D=None): sage: Et = E.quadratic_twist() # optional - sage.rings.finite_rings sage: Et # random (only determined up to isomorphism) # optional - sage.rings.finite_rings Elliptic Curve defined - by y^2 + x*y = x^3 + (a^7+a^4+a^3+a^2+a+1)*x^2 + (a^8+a^6+a^4+1) - over Finite Field in a of size 2^10 + by y^2 + x*y = x^3 + (a^7+a^4+a^3+a^2+a+1)*x^2 + (a^8+a^6+a^4+1) + over Finite Field in a of size 2^10 sage: E.is_isomorphic(Et) # optional - sage.rings.finite_rings False sage: E.j_invariant() == Et.j_invariant() # optional - sage.rings.finite_rings @@ -136,8 +136,8 @@ def quadratic_twist(self, D=None): sage: Et = E.quadratic_twist() # optional - sage.rings.finite_rings sage: Et # random (only determined up to isomorphism) # optional - sage.rings.finite_rings Elliptic Curve defined - by y^2 = x^3 + 7860088097*x^2 + 9495240877*x + 3048660957 - over Finite Field of size 10000000019 + by y^2 = x^3 + 7860088097*x^2 + 9495240877*x + 3048660957 + over Finite Field of size 10000000019 sage: E.is_isomorphic(Et) # optional - sage.rings.finite_rings False sage: k2 = GF(p^2,'a') # optional - sage.rings.finite_rings @@ -694,7 +694,7 @@ def descend_to(self, K, f=None): sage: E = EllipticCurve(k,[0,0,0,1,0]) # optional - sage.rings.number_field sage: E.descend_to(QQ) # optional - sage.rings.number_field [Elliptic Curve defined by y^2 = x^3 + x over Rational Field, - Elliptic Curve defined by y^2 = x^3 - 4*x over Rational Field] + Elliptic Curve defined by y^2 = x^3 - 4*x over Rational Field] """ if not K.is_field(): raise TypeError("Input must be a field.") @@ -1174,9 +1174,9 @@ def isogeny(self, kernel, codomain=None, degree=None, model=None, check=True, al sage: E.isogeny(P) Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 - over Rational Field - to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 - over Rational Field + over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 + over Rational Field :: @@ -1187,7 +1187,7 @@ def isogeny(self, kernel, codomain=None, degree=None, model=None, check=True, al sage: phi = E.isogeny([P,Q]); phi # optional - sage.rings.finite_rings Isogeny of degree 21 from Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 19 - to Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 19 + to Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 19 sage: phi(E.random_point()) # all points defined over GF(19) are in the kernel # optional - sage.rings.finite_rings (0 : 1 : 0) @@ -1231,7 +1231,9 @@ def isogeny(self, kernel, codomain=None, degree=None, model=None, check=True, al sage: phi = E.isogeny( (x-564)*(x - 396/5*a + 348/5) ) # optional - sage.rings.number_field Traceback (most recent call last): ... - ValueError: the polynomial x^2 + (-396/5*a - 2472/5)*x + 223344/5*a - 196272/5 does not define a finite subgroup of Elliptic Curve defined by y^2 = x^3 + (-13392)*x + (-1080432) over Number Field in a with defining polynomial x^2 - x - 1 + ValueError: the polynomial x^2 + (-396/5*a - 2472/5)*x + 223344/5*a - 196272/5 does not + define a finite subgroup of Elliptic Curve defined by y^2 = x^3 + (-13392)*x + (-1080432) + over Number Field in a with defining polynomial x^2 - x - 1 We check that the cached order is correctly copied over:: @@ -1294,7 +1296,7 @@ def isogeny_codomain(self, kernel, degree=None): DeprecationWarning: The "degree" argument to .isogeny_codomain() does nothing and will be removed. ... Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 20731788786372791581385345584850817122*x + 125200507378516567345719286707201096361 - over Finite Field of size 170141183460469231731687303715884105727 + over Finite Field of size 170141183460469231731687303715884105727 """ if degree is not None: from sage.misc.superseded import deprecation @@ -1337,13 +1339,13 @@ def isogenies_prime_degree(self, l=None, max_l=31): sage: E.isogenies_prime_degree(2) # optional - sage.rings.finite_rings [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 - to Elliptic Curve defined by y^2 = x^3 + 970389*x + 794257 over Finite Field of size 1000003, + to Elliptic Curve defined by y^2 = x^3 + 970389*x + 794257 over Finite Field of size 1000003, Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 - to Elliptic Curve defined by y^2 = x^3 + 29783*x + 206196 over Finite Field of size 1000003, + to Elliptic Curve defined by y^2 = x^3 + 29783*x + 206196 over Finite Field of size 1000003, Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 - to Elliptic Curve defined by y^2 = x^3 + 999960*x + 78 over Finite Field of size 1000003] + to Elliptic Curve defined by y^2 = x^3 + 999960*x + 78 over Finite Field of size 1000003] sage: E.isogenies_prime_degree(3) # optional - sage.rings.finite_rings [] sage: E.isogenies_prime_degree(5) # optional - sage.rings.finite_rings @@ -1355,51 +1357,51 @@ def isogenies_prime_degree(self, l=None, max_l=31): sage: E.isogenies_prime_degree(13) # optional - sage.rings.finite_rings [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 - to Elliptic Curve defined by y^2 = x^3 + 878063*x + 845666 over Finite Field of size 1000003, + to Elliptic Curve defined by y^2 = x^3 + 878063*x + 845666 over Finite Field of size 1000003, Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 - to Elliptic Curve defined by y^2 = x^3 + 375648*x + 342776 over Finite Field of size 1000003] + to Elliptic Curve defined by y^2 = x^3 + 375648*x + 342776 over Finite Field of size 1000003] sage: E.isogenies_prime_degree(max_l=13) # optional - sage.rings.finite_rings [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 - to Elliptic Curve defined by y^2 = x^3 + 970389*x + 794257 over Finite Field of size 1000003, + to Elliptic Curve defined by y^2 = x^3 + 970389*x + 794257 over Finite Field of size 1000003, Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 - to Elliptic Curve defined by y^2 = x^3 + 29783*x + 206196 over Finite Field of size 1000003, + to Elliptic Curve defined by y^2 = x^3 + 29783*x + 206196 over Finite Field of size 1000003, Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 - to Elliptic Curve defined by y^2 = x^3 + 999960*x + 78 over Finite Field of size 1000003, + to Elliptic Curve defined by y^2 = x^3 + 999960*x + 78 over Finite Field of size 1000003, Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 - to Elliptic Curve defined by y^2 = x^3 + 878063*x + 845666 over Finite Field of size 1000003, + to Elliptic Curve defined by y^2 = x^3 + 878063*x + 845666 over Finite Field of size 1000003, Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 - to Elliptic Curve defined by y^2 = x^3 + 375648*x + 342776 over Finite Field of size 1000003] + to Elliptic Curve defined by y^2 = x^3 + 375648*x + 342776 over Finite Field of size 1000003] sage: E.isogenies_prime_degree() # Default limit of 31 # optional - sage.rings.finite_rings [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 - to Elliptic Curve defined by y^2 = x^3 + 970389*x + 794257 over Finite Field of size 1000003, + to Elliptic Curve defined by y^2 = x^3 + 970389*x + 794257 over Finite Field of size 1000003, Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 - to Elliptic Curve defined by y^2 = x^3 + 29783*x + 206196 over Finite Field of size 1000003, + to Elliptic Curve defined by y^2 = x^3 + 29783*x + 206196 over Finite Field of size 1000003, Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 - to Elliptic Curve defined by y^2 = x^3 + 999960*x + 78 over Finite Field of size 1000003, + to Elliptic Curve defined by y^2 = x^3 + 999960*x + 78 over Finite Field of size 1000003, Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 - to Elliptic Curve defined by y^2 = x^3 + 878063*x + 845666 over Finite Field of size 1000003, + to Elliptic Curve defined by y^2 = x^3 + 878063*x + 845666 over Finite Field of size 1000003, Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 - to Elliptic Curve defined by y^2 = x^3 + 375648*x + 342776 over Finite Field of size 1000003, + to Elliptic Curve defined by y^2 = x^3 + 375648*x + 342776 over Finite Field of size 1000003, Isogeny of degree 17 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 - to Elliptic Curve defined by y^2 = x^3 + 347438*x + 594729 over Finite Field of size 1000003, + to Elliptic Curve defined by y^2 = x^3 + 347438*x + 594729 over Finite Field of size 1000003, Isogeny of degree 17 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 - to Elliptic Curve defined by y^2 = x^3 + 674846*x + 7392 over Finite Field of size 1000003, + to Elliptic Curve defined by y^2 = x^3 + 674846*x + 7392 over Finite Field of size 1000003, Isogeny of degree 23 from Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 1000003 - to Elliptic Curve defined by y^2 = x^3 + 390065*x + 605596 over Finite Field of size 1000003] + to Elliptic Curve defined by y^2 = x^3 + 390065*x + 605596 over Finite Field of size 1000003] sage: E = EllipticCurve(GF(17), [2,0]) # optional - sage.rings.finite_rings sage: E.isogenies_prime_degree(3) # optional - sage.rings.finite_rings @@ -1422,33 +1424,33 @@ def isogenies_prime_degree(self, l=None, max_l=31): sage: E.isogenies_prime_degree(max_l=3) # optional - sage.rings.finite_rings [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field of size 13 - to Elliptic Curve defined by y^2 = x^3 + 7*x + 4 over Finite Field of size 13, + to Elliptic Curve defined by y^2 = x^3 + 7*x + 4 over Finite Field of size 13, Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field of size 13 - to Elliptic Curve defined by y^2 = x^3 + 9*x + 11 over Finite Field of size 13] + to Elliptic Curve defined by y^2 = x^3 + 9*x + 11 over Finite Field of size 13] sage: E = EllipticCurve(GF(13^6), [2,8]) # optional - sage.rings.finite_rings sage: E.isogenies_prime_degree(max_l=3) # optional - sage.rings.finite_rings [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 - to Elliptic Curve defined by y^2 = x^3 + 7*x + 4 over Finite Field in z6 of size 13^6, + to Elliptic Curve defined by y^2 = x^3 + 7*x + 4 over Finite Field in z6 of size 13^6, Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 - to Elliptic Curve defined by y^2 = x^3 + (2*z6^5+6*z6^4+9*z6^3+8*z6+7)*x + (3*z6^5+9*z6^4+7*z6^3+12*z6+7) over Finite Field in z6 of size 13^6, + to Elliptic Curve defined by y^2 = x^3 + (2*z6^5+6*z6^4+9*z6^3+8*z6+7)*x + (3*z6^5+9*z6^4+7*z6^3+12*z6+7) over Finite Field in z6 of size 13^6, Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 - to Elliptic Curve defined by y^2 = x^3 + (11*z6^5+7*z6^4+4*z6^3+5*z6+9)*x + (10*z6^5+4*z6^4+6*z6^3+z6+10) over Finite Field in z6 of size 13^6, + to Elliptic Curve defined by y^2 = x^3 + (11*z6^5+7*z6^4+4*z6^3+5*z6+9)*x + (10*z6^5+4*z6^4+6*z6^3+z6+10) over Finite Field in z6 of size 13^6, Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 - to Elliptic Curve defined by y^2 = x^3 + 9*x + 11 over Finite Field in z6 of size 13^6, + to Elliptic Curve defined by y^2 = x^3 + 9*x + 11 over Finite Field in z6 of size 13^6, Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 - to Elliptic Curve defined by y^2 = x^3 + (3*z6^5+5*z6^4+8*z6^3+11*z6^2+5*z6+12)*x + (12*z6^5+6*z6^4+8*z6^3+4*z6^2+7*z6+6) over Finite Field in z6 of size 13^6, + to Elliptic Curve defined by y^2 = x^3 + (3*z6^5+5*z6^4+8*z6^3+11*z6^2+5*z6+12)*x + (12*z6^5+6*z6^4+8*z6^3+4*z6^2+7*z6+6) over Finite Field in z6 of size 13^6, Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 - to Elliptic Curve defined by y^2 = x^3 + (7*z6^4+12*z6^3+7*z6^2+4)*x + (6*z6^5+10*z6^3+12*z6^2+10*z6+8) over Finite Field in z6 of size 13^6, + to Elliptic Curve defined by y^2 = x^3 + (7*z6^4+12*z6^3+7*z6^2+4)*x + (6*z6^5+10*z6^3+12*z6^2+10*z6+8) over Finite Field in z6 of size 13^6, Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field in z6 of size 13^6 - to Elliptic Curve defined by y^2 = x^3 + (10*z6^5+z6^4+6*z6^3+8*z6^2+8*z6)*x + (8*z6^5+7*z6^4+8*z6^3+10*z6^2+9*z6+7) over Finite Field in z6 of size 13^6] + to Elliptic Curve defined by y^2 = x^3 + (10*z6^5+z6^4+6*z6^3+8*z6^2+8*z6)*x + (8*z6^5+7*z6^4+8*z6^3+10*z6^2+9*z6+7) over Finite Field in z6 of size 13^6] If the degree equals the characteristic, we find only separable isogenies:: @@ -1457,19 +1459,19 @@ def isogenies_prime_degree(self, l=None, max_l=31): sage: E.isogenies_prime_degree(13) # optional - sage.rings.finite_rings [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 2*x + 8 over Finite Field of size 13 - to Elliptic Curve defined by y^2 = x^3 + 6*x + 5 over Finite Field of size 13] + to Elliptic Curve defined by y^2 = x^3 + 6*x + 5 over Finite Field of size 13] sage: E = EllipticCurve(GF(5), [1,1]) # optional - sage.rings.finite_rings sage: E.isogenies_prime_degree(5) # optional - sage.rings.finite_rings [Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 5 - to Elliptic Curve defined by y^2 = x^3 + x + 4 over Finite Field of size 5] + to Elliptic Curve defined by y^2 = x^3 + x + 4 over Finite Field of size 5] sage: k. = GF(3^4) # optional - sage.rings.finite_rings sage: E = EllipticCurve(k, [0,1,0,0,a]) # optional - sage.rings.finite_rings sage: E.isogenies_prime_degree(3) # optional - sage.rings.finite_rings [Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + x^2 + a over Finite Field in a of size 3^4 - to Elliptic Curve defined by y^2 = x^3 + x^2 + (2*a^3+a^2+2)*x + (a^2+2) + to Elliptic Curve defined by y^2 = x^3 + x^2 + (2*a^3+a^2+2)*x + (a^2+2) over Finite Field in a of size 3^4] In the supersingular case, there are no separable isogenies of @@ -1488,7 +1490,7 @@ def isogenies_prime_degree(self, l=None, max_l=31): [Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + x + t^5 over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5 - to Elliptic Curve defined by y^2 = x^3 + x + 4*t over Fraction Field + to Elliptic Curve defined by y^2 = x^3 + x + 4*t over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5] Examples over number fields (other than QQ):: @@ -1499,38 +1501,38 @@ def isogenies_prime_degree(self, l=None, max_l=31): [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + (-150528000)*x + (-629407744000) over Number Field in e with defining polynomial x^2 - 2 - to Elliptic Curve defined by y^2 = x^3 + (-36750)*x + 2401000 + to Elliptic Curve defined by y^2 = x^3 + (-36750)*x + 2401000 over Number Field in e with defining polynomial x^2 - 2, Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + (-150528000)*x + (-629407744000) over Number Field in e with defining polynomial x^2 - 2 - to Elliptic Curve defined by y^2 = x^3 + (220500*e-257250)*x + (54022500*e-88837000) + to Elliptic Curve defined by y^2 = x^3 + (220500*e-257250)*x + (54022500*e-88837000) over Number Field in e with defining polynomial x^2 - 2, Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + (-150528000)*x + (-629407744000) over Number Field in e with defining polynomial x^2 - 2 - to Elliptic Curve defined by y^2 = x^3 + (-220500*e-257250)*x + (-54022500*e-88837000) + to Elliptic Curve defined by y^2 = x^3 + (-220500*e-257250)*x + (-54022500*e-88837000) over Number Field in e with defining polynomial x^2 - 2] sage: E = EllipticCurve(QQroot2, [1,0,1,4, -6]); E # optional - sage.rings.number_field Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + (-6) - over Number Field in e with defining polynomial x^2 - 2 + over Number Field in e with defining polynomial x^2 - 2 sage: E.isogenies_prime_degree(2) # optional - sage.rings.number_field [Isogeny of degree 2 from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + (-6) over Number Field in e with defining polynomial x^2 - 2 - to Elliptic Curve defined by y^2 + x*y + y = x^3 + (-36)*x + (-70) + to Elliptic Curve defined by y^2 + x*y + y = x^3 + (-36)*x + (-70) over Number Field in e with defining polynomial x^2 - 2] sage: E.isogenies_prime_degree(3) # optional - sage.rings.number_field [Isogeny of degree 3 from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + (-6) over Number Field in e with defining polynomial x^2 - 2 - to Elliptic Curve defined by y^2 + x*y + y = x^3 + (-1)*x + to Elliptic Curve defined by y^2 + x*y + y = x^3 + (-1)*x over Number Field in e with defining polynomial x^2 - 2, Isogeny of degree 3 from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x + (-6) over Number Field in e with defining polynomial x^2 - 2 - to Elliptic Curve defined by y^2 + x*y + y = x^3 + (-171)*x + (-874) + to Elliptic Curve defined by y^2 + x*y + y = x^3 + (-171)*x + (-874) over Number Field in e with defining polynomial x^2 - 2] These are not implemented yet:: diff --git a/src/sage/schemes/elliptic_curves/ell_finite_field.py b/src/sage/schemes/elliptic_curves/ell_finite_field.py index 09d6fcab7f3..67311df1789 100644 --- a/src/sage/schemes/elliptic_curves/ell_finite_field.py +++ b/src/sage/schemes/elliptic_curves/ell_finite_field.py @@ -941,8 +941,8 @@ def abelian_group(self): sage: E = EllipticCurve(GF(11),[2,5]) sage: E.abelian_group() Additive abelian group isomorphic to Z/10 embedded in - Abelian group of points on Elliptic Curve defined by y^2 = x^3 + 2*x + 5 - over Finite Field of size 11 + Abelian group of points on Elliptic Curve defined by y^2 = x^3 + 2*x + 5 + over Finite Field of size 11 :: @@ -966,10 +966,10 @@ def abelian_group(self): The group can be trivial:: - sage: E = EllipticCurve(GF(2),[0,0,1,1,1]) + sage: E = EllipticCurve(GF(2), [0,0,1,1,1]) sage: E.abelian_group() Trivial group embedded in Abelian group of points on - Elliptic Curve defined by y^2 + y = x^3 + x + 1 over Finite Field of size 2 + Elliptic Curve defined by y^2 + y = x^3 + x + 1 over Finite Field of size 2 Of course, there are plenty of points if we extend the field:: @@ -990,15 +990,15 @@ def abelian_group(self): sage: K. = QuadraticField(-1) sage: OK = K.ring_of_integers() - sage: P=K.factor(10007)[0][0] + sage: P = K.factor(10007)[0][0] sage: OKmodP = OK.residue_field(P) - sage: E = EllipticCurve([0,0,0,i,i+3]) + sage: E = EllipticCurve([0, 0, 0, i, i + 3]) sage: Emod = E.change_ring(OKmodP); Emod - Elliptic Curve defined by y^2 = x^3 + ibar*x + (ibar+3) - over Residue field in ibar of Fractional ideal (10007) + Elliptic Curve defined by y^2 = x^3 + ibar*x + (ibar+3) + over Residue field in ibar of Fractional ideal (10007) sage: Emod.abelian_group() #random generators (Multiplicative Abelian group isomorphic to C50067594 x C2, - ((3152*ibar + 7679 : 7330*ibar + 7913 : 1), (8466*ibar + 1770 : 0 : 1))) + ((3152*ibar + 7679 : 7330*ibar + 7913 : 1), (8466*ibar + 1770 : 0 : 1))) """ gens = self.gens() @@ -1042,8 +1042,8 @@ def torsion_basis(self, n): sage: E = EllipticCurve(GF(62207^2), [1,0]) sage: E.abelian_group() Additive abelian group isomorphic to Z/62208 + Z/62208 embedded in - Abelian group of points on Elliptic Curve defined by y^2 = x^3 + x - over Finite Field in z2 of size 62207^2 + Abelian group of points on Elliptic Curve defined by y^2 = x^3 + x + over Finite Field in z2 of size 62207^2 sage: PA,QA = E.torsion_basis(2^8) sage: PA.weil_pairing(QA, 2^8).multiplicative_order() 256 @@ -1672,9 +1672,9 @@ def twists(self): sage: K = GF(3**5) sage: [E.ainvs() for E in EllipticCurve(j=K(0)).twists()] # random [(0, 0, 0, 1, 0), - (0, 0, 0, 2, 0), - (0, 0, 0, 2, z5^4 + z5^3 + z5^2), - (0, 0, 0, 2, 2*z5^4 + 2*z5^3 + 2*z5^2)] + (0, 0, 0, 2, 0), + (0, 0, 0, 2, z5^4 + z5^3 + z5^2), + (0, 0, 0, 2, 2*z5^4 + 2*z5^3 + 2*z5^2)] sage: K = GF(3**4) sage: [E.ainvs() for E in EllipticCurve(j=K(1)).twists()] @@ -1683,11 +1683,11 @@ def twists(self): sage: K = GF(3**4) sage: [E.ainvs() for E in EllipticCurve(j=K(0)).twists()] # random [(0, 0, 0, 1, 0), - (0, 0, 0, 2, 2*z4^3 + 2*z4^2 + 2*z4 + 2), - (0, 0, 0, 1, 0), - (0, 0, 0, 1, 2*z4^3 + 2*z4^2 + 2*z4 + 2), - (0, 0, 0, z4, 0), - (0, 0, 0, z4^3, 0)] + (0, 0, 0, 2, 2*z4^3 + 2*z4^2 + 2*z4 + 2), + (0, 0, 0, 1, 0), + (0, 0, 0, 1, 2*z4^3 + 2*z4^2 + 2*z4 + 2), + (0, 0, 0, z4, 0), + (0, 0, 0, z4^3, 0)] In characteristic 2, the number of twists is 2 except for `j=0=1728`, when there are either 3 or 7 depending on whether the @@ -1708,12 +1708,12 @@ def twists(self): sage: K = GF(2**8) sage: [E.ainvs() for E in EllipticCurve(j=K(0)).twists()] # random [(0, 0, 1, 0, 0), - (0, 0, 1, 0, z8^5 + z8^4 + z8^3), - (0, 0, 1, z8^6 + z8^5 + z8^2 + 1, 0), - (0, 0, z8^4 + z8^3 + z8^2 + 1, 0, 0), - (0, 0, z8^4 + z8^3 + z8^2 + 1, 0, z8^3 + z8^2 + 1), - (0, 0, z8^6 + z8^3 + z8^2, 0, 0), - (0, 0, z8^6 + z8^3 + z8^2, 0, z8^3 + z8^2)] + (0, 0, 1, 0, z8^5 + z8^4 + z8^3), + (0, 0, 1, z8^6 + z8^5 + z8^2 + 1, 0), + (0, 0, z8^4 + z8^3 + z8^2 + 1, 0, 0), + (0, 0, z8^4 + z8^3 + z8^2 + 1, 0, z8^3 + z8^2 + 1), + (0, 0, z8^6 + z8^3 + z8^2, 0, 0), + (0, 0, z8^6 + z8^3 + z8^2, 0, z8^3 + z8^2)] TESTS: @@ -1795,18 +1795,18 @@ def curves_with_j_0(K): sage: from sage.schemes.elliptic_curves.ell_finite_field import curves_with_j_0 sage: sorted(curves_with_j_0(GF(7)), key = lambda E: E.a_invariants()) [Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 7, - Elliptic Curve defined by y^2 = x^3 + 2 over Finite Field of size 7, - Elliptic Curve defined by y^2 = x^3 + 3 over Finite Field of size 7, - Elliptic Curve defined by y^2 = x^3 + 4 over Finite Field of size 7, - Elliptic Curve defined by y^2 = x^3 + 5 over Finite Field of size 7, - Elliptic Curve defined by y^2 = x^3 + 6 over Finite Field of size 7] + Elliptic Curve defined by y^2 = x^3 + 2 over Finite Field of size 7, + Elliptic Curve defined by y^2 = x^3 + 3 over Finite Field of size 7, + Elliptic Curve defined by y^2 = x^3 + 4 over Finite Field of size 7, + Elliptic Curve defined by y^2 = x^3 + 5 over Finite Field of size 7, + Elliptic Curve defined by y^2 = x^3 + 6 over Finite Field of size 7] sage: curves_with_j_0(GF(25)) [Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in z2 of size 5^2, - Elliptic Curve defined by y^2 = x^3 + z2 over Finite Field in z2 of size 5^2, - Elliptic Curve defined by y^2 = x^3 + (z2+3) over Finite Field in z2 of size 5^2, - Elliptic Curve defined by y^2 = x^3 + (4*z2+3) over Finite Field in z2 of size 5^2, - Elliptic Curve defined by y^2 = x^3 + (2*z2+2) over Finite Field in z2 of size 5^2, - Elliptic Curve defined by y^2 = x^3 + (4*z2+1) over Finite Field in z2 of size 5^2] + Elliptic Curve defined by y^2 = x^3 + z2 over Finite Field in z2 of size 5^2, + Elliptic Curve defined by y^2 = x^3 + (z2+3) over Finite Field in z2 of size 5^2, + Elliptic Curve defined by y^2 = x^3 + (4*z2+3) over Finite Field in z2 of size 5^2, + Elliptic Curve defined by y^2 = x^3 + (2*z2+2) over Finite Field in z2 of size 5^2, + Elliptic Curve defined by y^2 = x^3 + (4*z2+1) over Finite Field in z2 of size 5^2] For `K=\GF{q}` where `q\equiv5\mod{6}` there are two curves, quadratic twists of each other by `-3`: `y^2=x^3+1` and @@ -1815,10 +1815,10 @@ def curves_with_j_0(K): sage: from sage.schemes.elliptic_curves.ell_finite_field import curves_with_j_0 sage: curves_with_j_0(GF(5)) [Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 5, - Elliptic Curve defined by y^2 = x^3 + 3 over Finite Field of size 5] + Elliptic Curve defined by y^2 = x^3 + 3 over Finite Field of size 5] sage: curves_with_j_0(GF(11)) [Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 11, - Elliptic Curve defined by y^2 = x^3 + 6 over Finite Field of size 11] + Elliptic Curve defined by y^2 = x^3 + 6 over Finite Field of size 11] """ if not K.is_finite(): raise ValueError("field must be finite") @@ -1856,14 +1856,14 @@ def curves_with_j_1728(K): sage: from sage.schemes.elliptic_curves.ell_finite_field import curves_with_j_1728 sage: sorted(curves_with_j_1728(GF(5)), key = lambda E: E.a_invariants()) [Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 5, - Elliptic Curve defined by y^2 = x^3 + 2*x over Finite Field of size 5, - Elliptic Curve defined by y^2 = x^3 + 3*x over Finite Field of size 5, - Elliptic Curve defined by y^2 = x^3 + 4*x over Finite Field of size 5] + Elliptic Curve defined by y^2 = x^3 + 2*x over Finite Field of size 5, + Elliptic Curve defined by y^2 = x^3 + 3*x over Finite Field of size 5, + Elliptic Curve defined by y^2 = x^3 + 4*x over Finite Field of size 5] sage: curves_with_j_1728(GF(49)) [Elliptic Curve defined by y^2 = x^3 + x over Finite Field in z2 of size 7^2, - Elliptic Curve defined by y^2 = x^3 + z2*x over Finite Field in z2 of size 7^2, - Elliptic Curve defined by y^2 = x^3 + (z2+4)*x over Finite Field in z2 of size 7^2, - Elliptic Curve defined by y^2 = x^3 + (5*z2+4)*x over Finite Field in z2 of size 7^2] + Elliptic Curve defined by y^2 = x^3 + z2*x over Finite Field in z2 of size 7^2, + Elliptic Curve defined by y^2 = x^3 + (z2+4)*x over Finite Field in z2 of size 7^2, + Elliptic Curve defined by y^2 = x^3 + (5*z2+4)*x over Finite Field in z2 of size 7^2] For `K=\GF{q}` where `q\equiv3\mod{4}`, there are two curves, quadratic twists of each other by `-1`: `y^2=x^3+x` and @@ -1872,10 +1872,10 @@ def curves_with_j_1728(K): sage: from sage.schemes.elliptic_curves.ell_finite_field import curves_with_j_1728 sage: curves_with_j_1728(GF(7)) [Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 7, - Elliptic Curve defined by y^2 = x^3 + 6*x over Finite Field of size 7] + Elliptic Curve defined by y^2 = x^3 + 6*x over Finite Field of size 7] sage: curves_with_j_1728(GF(11)) [Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 11, - Elliptic Curve defined by y^2 = x^3 + 10*x over Finite Field of size 11] + Elliptic Curve defined by y^2 = x^3 + 10*x over Finite Field of size 11] """ if not K.is_finite(): raise ValueError("field must be finite") @@ -1935,12 +1935,12 @@ def curves_with_j_0_char2(K): 7 sage: [E.ainvs() for E in curves] # random [(0, 0, 1, 0, 0), - (0, 0, 1, 0, z8^5 + z8^4 + z8^3), - (0, 0, 1, z8^6 + z8^5 + z8^2 + 1, 0), - (0, 0, z8^4 + z8^3 + z8^2 + 1, 0, 0), - (0, 0, z8^4 + z8^3 + z8^2 + 1, 0, z8^3 + z8^2 + 1), - (0, 0, z8^6 + z8^3 + z8^2, 0, 0), - (0, 0, z8^6 + z8^3 + z8^2, 0, z8^3 + z8^2)] + (0, 0, 1, 0, z8^5 + z8^4 + z8^3), + (0, 0, 1, z8^6 + z8^5 + z8^2 + 1, 0), + (0, 0, z8^4 + z8^3 + z8^2 + 1, 0, 0), + (0, 0, z8^4 + z8^3 + z8^2 + 1, 0, z8^3 + z8^2 + 1), + (0, 0, z8^6 + z8^3 + z8^2, 0, 0), + (0, 0, z8^6 + z8^3 + z8^2, 0, z8^3 + z8^2)] Check that the twists are mutually non-isomorphic:: @@ -2002,9 +2002,9 @@ def curves_with_j_0_char3(K): 4 sage: [E.ainvs() for E in curves] # random [(0, 0, 0, 1, 0), - (0, 0, 0, 2, 0), - (0, 0, 0, 2, z5^4 + z5^3 + z5^2), - (0, 0, 0, 2, 2*z5^4 + 2*z5^3 + 2*z5^2)] + (0, 0, 0, 2, 0), + (0, 0, 0, 2, z5^4 + z5^3 + z5^2), + (0, 0, 0, 2, 2*z5^4 + 2*z5^3 + 2*z5^2)] Check that the twists are mutually non-isomorphic:: @@ -2025,11 +2025,11 @@ def curves_with_j_0_char3(K): 6 sage: [E.ainvs() for E in curves] # random [(0, 0, 0, 1, 0), - (0, 0, 0, 2, 2*z4^3 + 2*z4^2 + 2*z4 + 2), - (0, 0, 0, 1, 0), - (0, 0, 0, 1, 2*z4^3 + 2*z4^2 + 2*z4 + 2), - (0, 0, 0, z4, 0), - (0, 0, 0, z4^3, 0)] + (0, 0, 0, 2, 2*z4^3 + 2*z4^2 + 2*z4 + 2), + (0, 0, 0, 1, 0), + (0, 0, 0, 1, 2*z4^3 + 2*z4^2 + 2*z4 + 2), + (0, 0, 0, z4, 0), + (0, 0, 0, z4^3, 0)] Check that the twists are mutually non-isomorphic:: diff --git a/src/sage/schemes/elliptic_curves/ell_local_data.py b/src/sage/schemes/elliptic_curves/ell_local_data.py index 2031ee08fde..2845a623d0f 100644 --- a/src/sage/schemes/elliptic_curves/ell_local_data.py +++ b/src/sage/schemes/elliptic_curves/ell_local_data.py @@ -30,7 +30,7 @@ 4 sage: da.minimal_model() Elliptic Curve defined by y^2 = x^3 + (4*i+3)*x + (-29*i-278) - over Number Field in i with defining polynomial x^2 + 1 + over Number Field in i with defining polynomial x^2 + 1 An example to show how the Neron model can change as one extends the field:: @@ -64,7 +64,7 @@ sage: da = EK.local_data(1+i) sage: da.minimal_model() Elliptic Curve defined by y^2 = x^3 + (-i) - over Number Field in i with defining polynomial x^2 + 1 + over Number Field in i with defining polynomial x^2 + 1 AUTHORS: @@ -335,10 +335,10 @@ def minimal_model(self, reduce=True): sage: E = EllipticCurve(K, [0, 0, a, 0, 1]) sage: E.local_data(K.ideal(a-1)).minimal_model() Elliptic Curve defined by y^2 + a*y = x^3 + 1 - over Number Field in a with defining polynomial x^3 + x + 1 + over Number Field in a with defining polynomial x^3 + x + 1 sage: E.local_data(K.ideal(a-1)).minimal_model(reduce=False) Elliptic Curve defined by y^2 + (a+2)*y = x^3 + 3*x^2 + 3*x + (-a+1) - over Number Field in a with defining polynomial x^3 + x + 1 + over Number Field in a with defining polynomial x^3 + x + 1 sage: E = EllipticCurve([2, 1, 0, -2, -1]) sage: E.local_data(ZZ.ideal(2), algorithm="generic").minimal_model(reduce=False) @@ -362,9 +362,9 @@ def minimal_model(self, reduce=True): sage: vv = K.fractional_ideal(g^2 - g - 2) sage: E.local_data(vv).minimal_model() Elliptic Curve defined by - y^2 + (-2*g^3+10/3*g^2+3*g-2/3)*x*y + (-11/9*g^3+34/9*g^2-7/3*g+4/9)*y - = x^3 + (-11/9*g^3+34/9*g^2-7/3*g+4/9)*x^2 - over Number Field in g with defining polynomial t^4 - t^3 - 3*t^2 - t + 1 + y^2 + (-2*g^3+10/3*g^2+3*g-2/3)*x*y + (-11/9*g^3+34/9*g^2-7/3*g+4/9)*y + = x^3 + (-11/9*g^3+34/9*g^2-7/3*g+4/9)*x^2 + over Number Field in g with defining polynomial t^4 - t^3 - 3*t^2 - t + 1 """ if reduce: try: @@ -640,7 +640,7 @@ def has_additive_reduction(self): EXAMPLES:: sage: E = EllipticCurve('27a1') - sage: [(p,E.local_data(p).has_additive_reduction()) for p in prime_range(15)] + sage: [(p, E.local_data(p).has_additive_reduction()) for p in prime_range(15)] [(2, False), (3, True), (5, False), (7, False), (11, False), (13, False)] :: diff --git a/src/sage/schemes/elliptic_curves/ell_modular_symbols.py b/src/sage/schemes/elliptic_curves/ell_modular_symbols.py index ac321635328..e624113bc92 100644 --- a/src/sage/schemes/elliptic_curves/ell_modular_symbols.py +++ b/src/sage/schemes/elliptic_curves/ell_modular_symbols.py @@ -49,9 +49,10 @@ sage: V = E.modular_symbol_space() sage: V Modular Symbols subspace of dimension 1 of Modular Symbols space of dimension 2 - for Gamma_0(19) of weight 2 with sign 1 over Rational Field + for Gamma_0(19) of weight 2 with sign 1 over Rational Field sage: V.q_eigenform(30) - q - 2*q^3 - 2*q^4 + 3*q^5 - q^7 + q^9 + 3*q^11 + 4*q^12 - 4*q^13 - 6*q^15 + 4*q^16 - 3*q^17 + q^19 - 6*q^20 + 2*q^21 + 4*q^25 + 4*q^27 + 2*q^28 + 6*q^29 + O(q^30) + q - 2*q^3 - 2*q^4 + 3*q^5 - q^7 + q^9 + 3*q^11 + 4*q^12 - 4*q^13 - 6*q^15 + 4*q^16 + - 3*q^17 + q^19 - 6*q^20 + 2*q^21 + 4*q^25 + 4*q^27 + 2*q^28 + 6*q^29 + O(q^30) For more details on modular symbols consult the following @@ -131,7 +132,7 @@ def modular_symbol_space(E, sign, base_ring, bound=None): sage: M = modular_symbol_space(E, -1, GF(37)) # optional - sage.rings.finite_rings sage: M # optional - sage.rings.finite_rings Modular Symbols space of dimension 1 for Gamma_0(11) of weight 2 with sign -1 - over Finite Field of size 37 + over Finite Field of size 37 """ if sign not in [-1, 0, 1]: raise TypeError('sign must -1, 0 or 1') @@ -212,11 +213,11 @@ def _repr_(self): sage: m = EllipticCurve('11a1').modular_symbol() sage: m Modular symbol with sign 1 over Rational Field attached to - Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: m = EllipticCurve('43a1').modular_symbol(sign=-1, implementation="sage") sage: m Modular symbol with sign -1 over Rational Field attached to - Elliptic Curve defined by y^2 + y = x^3 + x^2 over Rational Field + Elliptic Curve defined by y^2 + y = x^3 + x^2 over Rational Field """ return "Modular symbol with sign %s over %s attached to %s"%( self._sign, self._base_ring, self._E) @@ -249,7 +250,7 @@ def __init__(self, E, sign, nap=1000): sage: M = ModularSymbolECLIB(E,+1) sage: M Modular symbol with sign 1 over Rational Field attached to - Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: M(0) 1/5 sage: E = EllipticCurve('11a2') @@ -279,12 +280,12 @@ def __init__(self, E, sign, nap=1000): sage: E = EllipticCurve('11a1') sage: Mplus = E.modular_symbol(+1); Mplus Modular symbol with sign 1 over Rational Field attached to - Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: [Mplus(1/i) for i in [1..11]] [1/5, -4/5, -3/10, 7/10, 6/5, 6/5, 7/10, -3/10, -4/5, 1/5, 0] sage: Mminus = E.modular_symbol(-1); Mminus Modular symbol with sign -1 over Rational Field attached to - Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: [Mminus(1/i) for i in [1..11]] [0, 0, 1/2, 1/2, 0, 0, -1/2, -1/2, 0, 0, 0] @@ -404,7 +405,7 @@ def __init__(self, E, sign, normalize="L_ratio"): sage: M = ModularSymbolSage(E, +1) sage: M Modular symbol with sign 1 over Rational Field attached to - Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: M(0) 1/5 sage: E = EllipticCurve('11a2') diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py index 0509c20bf52..91745aa6e22 100644 --- a/src/sage/schemes/elliptic_curves/ell_number_field.py +++ b/src/sage/schemes/elliptic_curves/ell_number_field.py @@ -33,13 +33,13 @@ True sage: E.local_data(4+i) Local data at Fractional ideal (i + 4): - Reduction type: bad additive - Local minimal model: Elliptic Curve defined by y^2 = x^3 + (i+4) - over Number Field in i with defining polynomial x^2 + 1 - Minimal discriminant valuation: 2 - Conductor exponent: 2 - Kodaira Symbol: II - Tamagawa Number: 1 + Reduction type: bad additive + Local minimal model: Elliptic Curve defined by y^2 = x^3 + (i+4) + over Number Field in i with defining polynomial x^2 + 1 + Minimal discriminant valuation: 2 + Conductor exponent: 2 + Kodaira Symbol: II + Tamagawa Number: 1 sage: E.tamagawa_product_bsd() 1 @@ -58,9 +58,9 @@ sage: E.isogenies_prime_degree(3) [Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + (i+4) - over Number Field in i with defining polynomial x^2 + 1 - to Elliptic Curve defined by y^2 = x^3 + (-27*i-108) - over Number Field in i with defining polynomial x^2 + 1] + over Number Field in i with defining polynomial x^2 + 1 + to Elliptic Curve defined by y^2 = x^3 + (-27*i-108) + over Number Field in i with defining polynomial x^2 + 1] AUTHORS: @@ -112,8 +112,8 @@ class EllipticCurve_number_field(EllipticCurve_field): sage: K. = NumberField(x^2+1) sage: EllipticCurve([i, i - 1, i + 1, 24*i + 15, 14*i + 35]) Elliptic Curve defined by - y^2 + i*x*y + (i+1)*y = x^3 + (i-1)*x^2 + (24*i+15)*x + (14*i+35) - over Number Field in i with defining polynomial x^2 + 1 + y^2 + i*x*y + (i+1)*y = x^3 + (i-1)*x^2 + (24*i+15)*x + (14*i+35) + over Number Field in i with defining polynomial x^2 + 1 """ def __init__(self, K, ainvs): r""" @@ -124,13 +124,13 @@ def __init__(self, K, ainvs): sage: K. = NumberField(x^2+1) sage: EllipticCurve(K,'389a1') Elliptic Curve defined by y^2 + y = x^3 + x^2 + (-2)*x - over Number Field in i with defining polynomial x^2 + 1 + over Number Field in i with defining polynomial x^2 + 1 Making the field of definition explicitly larger:: sage: EllipticCurve(K,[0,-1,1,0,0]) Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 - over Number Field in i with defining polynomial x^2 + 1 + over Number Field in i with defining polynomial x^2 + 1 """ self._known_points = [] EllipticCurve_field.__init__(self, K, ainvs) @@ -147,7 +147,7 @@ def base_extend(self, R): sage: K = QuadraticField(-5, 'a') sage: E.base_extend(K) Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 over Number Field in a - with defining polynomial x^2 + 5 with a = 2.236067977499790?*I + with defining polynomial x^2 + 5 with a = 2.236067977499790?*I Check that non-torsion points are remembered when extending the base field (see :trac:`16034`):: @@ -237,7 +237,7 @@ def simon_two_descent(self, verbose=0, lim1=2, lim3=4, limtriv=2, sage: K. = NumberField(x^2 + 7, 'a') sage: E = EllipticCurve(K, [0,0,0,1,a]); E Elliptic Curve defined by y^2 = x^3 + x + a - over Number Field in a with defining polynomial x^2 + 7 + over Number Field in a with defining polynomial x^2 + 7 sage: v = E.simon_two_descent(verbose=1); v elliptic curve: Y^2 = x^3 + Mod(1, y^2 + 7)*x + Mod(y, y^2 + 7) @@ -569,8 +569,8 @@ def local_integral_model(self,*P): sage: E = EllipticCurve([i/5,i/5,i/5,i/5,i/5]) sage: E.local_integral_model((P1,P2)) Elliptic Curve defined by - y^2 + (-i)*x*y + (-25*i)*y = x^3 + 5*i*x^2 + 125*i*x + 3125*i - over Number Field in i with defining polynomial x^2 + 1 + y^2 + (-i)*x*y + (-25*i)*y = x^3 + 5*i*x^2 + 125*i*x + 3125*i + over Number Field in i with defining polynomial x^2 + 1 """ if len(P) == 1: P = P[0] @@ -611,8 +611,8 @@ def global_integral_model(self): sage: P1, P2 = K.primes_above(5) sage: E.global_integral_model() Elliptic Curve defined by - y^2 + (-i)*x*y + (-25*i)*y = x^3 + 5*i*x^2 + 125*i*x + 3125*i - over Number Field in i with defining polynomial x^2 + 1 + y^2 + (-i)*x*y + (-25*i)*y = x^3 + 5*i*x^2 + 125*i*x + 3125*i + over Number Field in i with defining polynomial x^2 + 1 :trac:`7935`:: @@ -620,7 +620,7 @@ def global_integral_model(self): sage: E = EllipticCurve([a,1/2]) sage: E.global_integral_model() Elliptic Curve defined by y^2 = x^3 + 1444*a*x + 27436 - over Number Field in a with defining polynomial x^2 - 38 + over Number Field in a with defining polynomial x^2 - 38 :trac:`9266`:: @@ -629,7 +629,7 @@ def global_integral_model(self): sage: E = EllipticCurve(K, [2,w]) sage: E.global_integral_model() Elliptic Curve defined by y^2 = x^3 + 2*x + (1/2*s+1/2) - over Number Field in s with defining polynomial x^2 - 5 + over Number Field in s with defining polynomial x^2 - 5 :trac:`12151`:: @@ -638,7 +638,7 @@ def global_integral_model(self): sage: M = E.global_integral_model(); M # choice varies, not tested Elliptic Curve defined by y^2 + (2094779518028859*v-1940492905300351)*x*y + (477997268472544193101178234454165304071127500*v-442791377441346852919930773849502871958097500)*y = x^3 + (26519784690047674853185542622500*v-24566525306469707225840460652500)*x^2 - over Number Field in v with defining polynomial x^2 + 161*x - 150 + over Number Field in v with defining polynomial x^2 + 161*x - 150 :trac:`14476`:: @@ -647,8 +647,8 @@ def global_integral_model(self): sage: E = EllipticCurve([ -43/625*g^3 + 14/625*g^2 - 4/625*g + 706/625, -4862/78125*g^3 - 4074/78125*g^2 - 711/78125*g + 10304/78125, -4862/78125*g^3 - 4074/78125*g^2 - 711/78125*g + 10304/78125, 0,0]) sage: E.global_integral_model() Elliptic Curve defined by - y^2 + (15*g^3-48*g-42)*x*y + (-111510*g^3-162162*g^2-44145*g+37638)*y = x^3 + (-954*g^3-1134*g^2+81*g+576)*x^2 - over Number Field in g with defining polynomial t^4 - t^3 - 3*t^2 - t + 1 + y^2 + (15*g^3-48*g-42)*x*y + (-111510*g^3-162162*g^2-44145*g+37638)*y = x^3 + (-954*g^3-1134*g^2+81*g+576)*x^2 + over Number Field in g with defining polynomial t^4 - t^3 - 3*t^2 - t + 1 TESTS: @@ -1074,7 +1074,7 @@ def has_good_reduction(self, P): EXAMPLES:: sage: E = EllipticCurve('14a1') - sage: [(p,E.has_good_reduction(p)) for p in prime_range(15)] + sage: [(p, E.has_good_reduction(p)) for p in prime_range(15)] [(2, False), (3, True), (5, True), (7, False), (11, True), (13, True)] sage: K. = NumberField(x^3 - 2) @@ -1108,7 +1108,7 @@ def has_bad_reduction(self, P): EXAMPLES:: sage: E = EllipticCurve('14a1') - sage: [(p,E.has_bad_reduction(p)) for p in prime_range(15)] + sage: [(p, E.has_bad_reduction(p)) for p in prime_range(15)] [(2, True), (3, False), (5, False), (7, True), (11, False), (13, False)] sage: K. = NumberField(x^3 - 2) @@ -1148,7 +1148,7 @@ def has_multiplicative_reduction(self, P): sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] sage: E = EllipticCurve([0,0,0,0,2*a+1]) - sage: [(p,E.has_multiplicative_reduction(p)) for p in [P17a,P17b]] + sage: [(p, E.has_multiplicative_reduction(p)) for p in [P17a,P17b]] [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)] """ @@ -1171,13 +1171,13 @@ def has_split_multiplicative_reduction(self, P): EXAMPLES:: sage: E = EllipticCurve('14a1') - sage: [(p,E.has_split_multiplicative_reduction(p)) for p in prime_range(15)] + sage: [(p, E.has_split_multiplicative_reduction(p)) for p in prime_range(15)] [(2, False), (3, False), (5, False), (7, True), (11, False), (13, False)] sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] sage: E = EllipticCurve([0,0,0,0,2*a+1]) - sage: [(p,E.has_split_multiplicative_reduction(p)) for p in [P17a,P17b]] + sage: [(p, E.has_split_multiplicative_reduction(p)) for p in [P17a,P17b]] [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)] """ @@ -1200,7 +1200,7 @@ def has_nonsplit_multiplicative_reduction(self, P): EXAMPLES:: sage: E = EllipticCurve('14a1') - sage: [(p,E.has_nonsplit_multiplicative_reduction(p)) for p in prime_range(15)] + sage: [(p, E.has_nonsplit_multiplicative_reduction(p)) for p in prime_range(15)] [(2, True), (3, False), (5, False), (7, False), (11, False), (13, False)] sage: K. = NumberField(x^3 - 2) @@ -1228,13 +1228,13 @@ def has_additive_reduction(self, P): EXAMPLES:: sage: E = EllipticCurve('27a1') - sage: [(p,E.has_additive_reduction(p)) for p in prime_range(15)] + sage: [(p, E.has_additive_reduction(p)) for p in prime_range(15)] [(2, False), (3, True), (5, False), (7, False), (11, False), (13, False)] sage: K. = NumberField(x^3 - 2) sage: P17a, P17b = [P for P,e in K.factor(17)] sage: E = EllipticCurve([0,0,0,0,2*a+1]) - sage: [(p,E.has_additive_reduction(p)) for p in [P17a,P17b]] + sage: [(p, E.has_additive_reduction(p)) for p in [P17a,P17b]] [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), True)] """ @@ -1804,8 +1804,8 @@ def global_minimal_model(self, proof=None, semi_global=False): sage: E2 = E.global_minimal_model() sage: E2 Elliptic Curve defined by - y^2 + a*x*y + (a+1)*y = x^3 + (a+1)*x^2 + (4*a+15)*x + (4*a+21) - over Number Field in a with defining polynomial x^2 - 38 + y^2 + a*x*y + (a+1)*y = x^3 + (a+1)*x^2 + (4*a+15)*x + (4*a+21) + over Number Field in a with defining polynomial x^2 - 38 sage: E2.local_data() [] @@ -1815,7 +1815,7 @@ def global_minimal_model(self, proof=None, semi_global=False): sage: E = EllipticCurve(K, [0, 0, 0, -1/48, 161/864]) sage: E2 = E.integral_model().global_minimal_model(); E2 Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - over Number Field in g with defining polynomial x^2 - x - 1 + over Number Field in g with defining polynomial x^2 - x - 1 sage: [(p.norm(), e) for p, e in E2.conductor().factor()] [(9, 1), (5, 1)] sage: [(p.norm(), e) for p, e in E2.discriminant().factor()] @@ -1829,7 +1829,7 @@ def global_minimal_model(self, proof=None, semi_global=False): sage: E = EllipticCurve([0*v, -432]) sage: E.global_minimal_model() Elliptic Curve defined by y^2 + y = x^3 - over Number Field in v with defining polynomial x^2 - w + 1 over its base field + over Number Field in v with defining polynomial x^2 - w + 1 over its base field See :trac:`18662`: for fields of class number greater than 1, even when global minimal models did exist, their computation @@ -1847,8 +1847,8 @@ def global_minimal_model(self, proof=None, semi_global=False): True sage: Emin = E.global_minimal_model(); Emin Elliptic Curve defined by - y^2 + (a+1)*x*y + (a+1)*y = x^3 + (-a)*x^2 + (a-12)*x + (-2*a+2) - over Number Field in a with defining polynomial x^2 - 10 + y^2 + (a+1)*x*y + (a+1)*y = x^3 + (-a)*x^2 + (a-12)*x + (-2*a+2) + over Number Field in a with defining polynomial x^2 - 10 sage: Emin.discriminant().norm() 3456 sage: Emin.discriminant().norm().factor() @@ -1872,8 +1872,8 @@ def global_minimal_model(self, proof=None, semi_global=False): For a semi-global minimal model use semi_global=True sage: E.global_minimal_model(semi_global=True) Elliptic Curve defined by - y^2 + a*x*y = x^3 + a*x^2 + (3*a+8)*x + (4*a+3) over Number Field in a - with defining polynomial x^2 - 10 + y^2 + a*x*y = x^3 + a*x^2 + (3*a+8)*x + (4*a+3) over Number Field in a + with defining polynomial x^2 - 10 An example of a curve with everywhere good reduction but which has no model with unit discriminant:: @@ -1930,7 +1930,7 @@ def reduction(self,place): sage: v = K.fractional_ideal(2*i+3) sage: EK.reduction(v) Elliptic Curve defined by y^2 = x^3 + 5*x + 8 - over Residue field of Fractional ideal (2*i + 3) + over Residue field of Fractional ideal (2*i + 3) sage: EK.reduction(K.ideal(1+i)) Traceback (most recent call last): ... @@ -1943,7 +1943,7 @@ def reduction(self,place): sage: E = EllipticCurve([1024*K.0, 1024*K.0]) sage: E.reduction(2*K) Elliptic Curve defined by y^2 + (abar+1)*y = x^3 - over Residue field in abar of Fractional ideal (2) + over Residue field in abar of Fractional ideal (2) """ K = self.base_field() OK = K.ring_of_integers() @@ -1979,8 +1979,8 @@ def torsion_subgroup(self): sage: tor = EK.torsion_subgroup() # long time (2s on sage.math, 2014) sage: tor # long time Torsion Subgroup isomorphic to Z/5 + Z/5 associated to the Elliptic Curve - defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field - in t with defining polynomial x^4 + x^3 + 11*x^2 + 41*x + 101 + defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field + in t with defining polynomial x^4 + x^3 + 11*x^2 + 41*x + 101 sage: tor.gens() # long time ((16 : 60 : 1), (t : 1/11*t^3 + 6/11*t^2 + 19/11*t + 48/11 : 1)) @@ -1991,8 +1991,8 @@ def torsion_subgroup(self): sage: EK = E.base_extend(K) sage: EK.torsion_subgroup() Torsion Subgroup isomorphic to Z/4 + Z/4 associated to the - Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 + (-10)*x + (-10) - over Number Field in t with defining polynomial x^2 + 2*x + 10 + Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 + (-10)*x + (-10) + over Number Field in t with defining polynomial x^2 + 2*x + 10 :: @@ -2001,8 +2001,8 @@ def torsion_subgroup(self): sage: EK = E.base_extend(K) sage: EK.torsion_subgroup() Torsion Subgroup isomorphic to Z/9 associated to the Elliptic Curve defined - by y^2 + y = x^3 + x^2 + (-9)*x + (-15) over Number Field in t with defining - polynomial x^9 - 3*x^8 - 4*x^7 + 16*x^6 - 3*x^5 - 21*x^4 + 5*x^3 + 7*x^2 - 7*x + 1 + by y^2 + y = x^3 + x^2 + (-9)*x + (-15) over Number Field in t with defining + polynomial x^9 - 3*x^8 - 4*x^7 + 16*x^6 - 3*x^5 - 21*x^4 + 5*x^3 + 7*x^2 - 7*x + 1 :: @@ -2010,8 +2010,8 @@ def torsion_subgroup(self): sage: EK = EllipticCurve([0, 0, 0, i, i+3]) sage: EK.torsion_subgroup () Torsion Subgroup isomorphic to Trivial group associated to the - Elliptic Curve defined by y^2 = x^3 + i*x + (i+3) - over Number Field in i with defining polynomial x^2 + 1 with i = 1*I + Elliptic Curve defined by y^2 = x^3 + i*x + (i+3) + over Number Field in i with defining polynomial x^2 + 1 with i = 1*I .. SEEALSO:: @@ -2049,7 +2049,7 @@ def torsion_order(self): :: sage: E = EllipticCurve('19a1') - sage: K. = NumberField(x^9-3*x^8-4*x^7+16*x^6-3*x^5-21*x^4+5*x^3+7*x^2-7*x+1) + sage: K. = NumberField(x^9 - 3*x^8 - 4*x^7 + 16*x^6 - 3*x^5 - 21*x^4 + 5*x^3 + 7*x^2 - 7*x + 1) sage: EK = E.base_extend(K) sage: EK.torsion_order() 9 @@ -2057,7 +2057,7 @@ def torsion_order(self): :: sage: K. = QuadraticField(-1) - sage: EK = EllipticCurve([0,0,0,i,i+3]) + sage: EK = EllipticCurve([0, 0, 0, i, i + 3]) sage: EK.torsion_order() 1 """ @@ -2424,24 +2424,24 @@ def period_lattice(self, embedding): sage: E.period_lattice(embs[0]) Period lattice associated to Elliptic Curve defined by y^2 = x^3 + a*x + 2 - over Number Field in a with defining polynomial x^3 - 2 - with respect to the embedding Ring morphism: + over Number Field in a with defining polynomial x^3 - 2 + with respect to the embedding Ring morphism: From: Number Field in a with defining polynomial x^3 - 2 To: Algebraic Field Defn: a |--> -0.6299605249474365? - 1.091123635971722?*I sage: E.period_lattice(embs[1]) Period lattice associated to Elliptic Curve defined by y^2 = x^3 + a*x + 2 - over Number Field in a with defining polynomial x^3 - 2 - with respect to the embedding Ring morphism: + over Number Field in a with defining polynomial x^3 - 2 + with respect to the embedding Ring morphism: From: Number Field in a with defining polynomial x^3 - 2 To: Algebraic Field Defn: a |--> -0.6299605249474365? + 1.091123635971722?*I sage: E.period_lattice(embs[2]) Period lattice associated to Elliptic Curve defined by y^2 = x^3 + a*x + 2 - over Number Field in a with defining polynomial x^3 - 2 - with respect to the embedding Ring morphism: + over Number Field in a with defining polynomial x^3 - 2 + with respect to the embedding Ring morphism: From: Number Field in a with defining polynomial x^3 - 2 To: Algebraic Field Defn: a |--> 1.259921049894873? @@ -2524,8 +2524,8 @@ def height_function(self): sage: E = EllipticCurve(K, '11a3') sage: E.height_function() EllipticCurveCanonicalHeight object associated to - Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 - over Number Field in a with defining polynomial x^2 - 5 + Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + over Number Field in a with defining polynomial x^2 - 5 """ if not hasattr(self, '_height_function'): from sage.schemes.elliptic_curves.height import EllipticCurveCanonicalHeight @@ -2589,7 +2589,7 @@ def isogeny_class(self, reducible_primes=None, algorithm='Billerey', minimal_mod sage: E = EllipticCurve(K, [0,0,0,0,1]) sage: C = E.isogeny_class(); C Isogeny class of Elliptic Curve defined by y^2 = x^3 + 1 - over Number Field in i with defining polynomial x^2 + 1 with i = 1*I + over Number Field in i with defining polynomial x^2 + 1 with i = 1*I The curves in the class (sorted):: @@ -2646,8 +2646,8 @@ class :class:`EllipticCurveIsogeny` allowed composition. In sage: E = EllipticCurve([1+i, -i, i, 1, 0]) sage: C = E.isogeny_class(); C # long time Isogeny class of - Elliptic Curve defined by y^2 + (i+1)*x*y + i*y = x^3 + (-i)*x^2 + x - over Number Field in i with defining polynomial x^2 + 1 with i = 1*I + Elliptic Curve defined by y^2 + (i+1)*x*y + i*y = x^3 + (-i)*x^2 + x + over Number Field in i with defining polynomial x^2 + 1 with i = 1*I sage: len(C) # long time 6 sage: C.matrix() # long time @@ -2691,7 +2691,7 @@ class :class:`EllipticCurveIsogeny` allowed composition. In from Elliptic Curve defined by y^2 = x^3 + (83490*c^2-147015)*x + (-64739840*c^2-84465260) over Number Field in c with defining polynomial x^4 + 3*x^2 + 1 - to Elliptic Curve defined by + to Elliptic Curve defined by y^2 = x^3 + (-161535*c^2+70785)*x + (-62264180*c^3+6229080*c) over Number Field in c with defining polynomial x^4 + 3*x^2 + 1 @@ -2786,7 +2786,7 @@ class number is only `3` is that the class also contains three different endomorphism rings, then use a 3-dimensional plot which can be rotated:: - sage: for i,j,l in G.edge_iterator(): # long time + sage: for i, j, l in G.edge_iterator(): # long time ....: G.set_edge_label(i, j, l.count(',')) sage: G.show3d(color_by_label=True) # long time @@ -2894,7 +2894,7 @@ class number is only `3` is that the class also contains three sage: E = EllipticCurve(K,[0,6,0,2,0]) sage: C = E.isogeny_class(algorithm='heuristic', minimal_models=False); C # long time (10s) Isogeny class of Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 2*x - over Cyclotomic Field of order 53 and degree 52 + over Cyclotomic Field of order 53 and degree 52 sage: C.curves # long time [Elliptic Curve defined by y^2 = x^3 + 6*x^2 + (-8)*x + (-48) over Cyclotomic Field of order 53 and degree 52, @@ -2984,13 +2984,13 @@ def isogenies_prime_degree(self, l=None, algorithm='Billerey', minimal_models=Tr [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 2*x over Cyclotomic Field of order 53 and degree 52 - to Elliptic Curve defined by y^2 = x^3 + 6*x^2 + (-8)*x + (-48) + to Elliptic Curve defined by y^2 = x^3 + 6*x^2 + (-8)*x + (-48) over Cyclotomic Field of order 53 and degree 52] sage: E.isogenies_prime_degree(2, minimal_models=True) # not tested (10s) [Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 6*x^2 + 2*x over Cyclotomic Field of order 53 and degree 52 - to Elliptic Curve defined by y^2 = x^3 + (-20)*x + (-16) + to Elliptic Curve defined by y^2 = x^3 + (-20)*x + (-16) over Cyclotomic Field of order 53 and degree 52] TESTS:: @@ -3482,8 +3482,8 @@ def galois_representation(self): sage: rho = E.galois_representation() sage: rho Compatible family of Galois representations associated to the - Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) - over Number Field in a with defining polynomial x^2 + 1 + Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) + over Number Field in a with defining polynomial x^2 + 1 sage: rho.is_surjective(3) True sage: rho.is_surjective(5) # long time (4s on sage.math, 2014) @@ -3809,11 +3809,11 @@ def is_Q_curve(self, maxp=100, certificate=False, verbose=False): True sage: cert # long time {'CM': 0, - 'N': 2, - 'core_degs': [1, 2], - 'core_poly': x^2 - 840064*x + 1593413632, - 'r': 1, - 'rho': 1} + 'N': 2, + 'core_degs': [1, 2], + 'core_poly': x^2 - 840064*x + 1593413632, + 'r': 1, + 'rho': 1} """ from sage.schemes.elliptic_curves.Qcurves import is_Q_curve as isQ return isQ(self, maxp, certificate, verbose) diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py index 83204482368..2402ae8036b 100644 --- a/src/sage/schemes/elliptic_curves/ell_point.py +++ b/src/sage/schemes/elliptic_curves/ell_point.py @@ -180,7 +180,7 @@ class EllipticCurvePoint_field(SchemeMorphism_point_abelian_variety_field): sage: E = EllipticCurve([0,0,1,-1,0]) sage: S = E(QQ); S Abelian group of points on - Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field + Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field sage: E = EllipticCurve(K, [0,1,0,-160,308]) # optional - sage.rings.number_field @@ -229,7 +229,8 @@ class EllipticCurvePoint_field(SchemeMorphism_point_abelian_variety_field): sage: P.domain() # optional - sage.rings.number_field Spectrum of Number Field in a with defining polynomial x^2 - 3 sage: P.codomain() # optional - sage.rings.number_field - Elliptic Curve defined by y^2 = x^3 + x + 1 over Number Field in a with defining polynomial x^2 - 3 + Elliptic Curve defined by y^2 = x^3 + x + 1 + over Number Field in a with defining polynomial x^2 - 3 sage: P.codomain() == P.curve() # optional - sage.rings.number_field True """ @@ -736,8 +737,8 @@ def __neg__(self): sage: [type(c) for c in -EllipticCurve('37a1').gen(0)] [<... 'sage.rings.rational.Rational'>, - <... 'sage.rings.rational.Rational'>, - <... 'sage.rings.rational.Rational'>] + <... 'sage.rings.rational.Rational'>, + <... 'sage.rings.rational.Rational'>] """ if self.is_zero(): return self @@ -1011,17 +1012,17 @@ def division_points(self, m, poly_only=False): sage: E = EllipticCurve([1, 0, 1, -19, 26]) sage: [(Q,Q._order) for Q in E(0).division_points(12)] [((-5 : 2 : 1), 2), - ((-2 : -7 : 1), 6), - ((-2 : 8 : 1), 6), - ((0 : 1 : 0), 1), - ((1 : -4 : 1), 6), - ((1 : 2 : 1), 6), - ((7/4 : -11/8 : 1), 2), - ((3 : -2 : 1), 2), - ((4 : -7 : 1), 3), - ((4 : 2 : 1), 3), - ((13 : -52 : 1), 6), - ((13 : 38 : 1), 6)] + ((-2 : -7 : 1), 6), + ((-2 : 8 : 1), 6), + ((0 : 1 : 0), 1), + ((1 : -4 : 1), 6), + ((1 : 2 : 1), 6), + ((7/4 : -11/8 : 1), 2), + ((3 : -2 : 1), 2), + ((4 : -7 : 1), 3), + ((4 : 2 : 1), 3), + ((13 : -52 : 1), 6), + ((13 : 38 : 1), 6)] sage: P = E(4,-7) sage: P.order() 3 @@ -2588,7 +2589,7 @@ def height(self, precision=None, normalised=True, algorithm='pari'): sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field sage: E = EllipticCurve([a, 4]); E # optional - sage.rings.number_field Elliptic Curve defined by y^2 = x^3 + a*x + 4 - over Number Field in a with defining polynomial x^3 - 2 + over Number Field in a with defining polynomial x^3 - 2 sage: P = E((0,2)) # optional - sage.rings.number_field sage: P.height() # optional - sage.rings.number_field 0.810463096585925 @@ -2782,7 +2783,7 @@ def archimedean_local_height(self, v=None, prec=None, weighted=False): sage: K. = QuadraticField(-2) # optional - sage.rings.number_field sage: E = EllipticCurve(K, [0,-1,1,0,0]); E # optional - sage.rings.number_field Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 over Number Field - in a with defining polynomial x^2 + 2 with a = 1.414213562373095?*I + in a with defining polynomial x^2 + 2 with a = 1.414213562373095?*I sage: P = E.lift_x(2 + a); P # optional - sage.rings.number_field (a + 2 : 2*a + 1 : 1) sage: P.archimedean_local_height(K.places(prec=170)[0]) / 2 # optional - sage.rings.number_field @@ -2791,7 +2792,7 @@ def archimedean_local_height(self, v=None, prec=None, weighted=False): sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field sage: E = EllipticCurve(K, [0,0,4,6*i,0]); E # optional - sage.rings.number_field Elliptic Curve defined by y^2 + 4*y = x^3 + 6*i*x - over Number Field in i with defining polynomial x^2 + 1 + over Number Field in i with defining polynomial x^2 + 1 sage: P = E((0,0)) # optional - sage.rings.number_field sage: P.archimedean_local_height(K.places()[0]) / 2 # optional - sage.rings.number_field 0.510184995162373 @@ -3010,7 +3011,7 @@ def non_archimedean_local_height(self, v=None, prec=None, sage: K. = NumberField(x^2 + 1) # optional - sage.rings.number_field sage: E = EllipticCurve(K, [0,0,4,6*i,0]); E # optional - sage.rings.number_field Elliptic Curve defined by y^2 + 4*y = x^3 + 6*i*x - over Number Field in i with defining polynomial x^2 + 1 + over Number Field in i with defining polynomial x^2 + 1 sage: P = E((0,0)) # optional - sage.rings.number_field sage: P.non_archimedean_local_height(K.ideal(i+1)) # optional - sage.rings.number_field -1/2*log(2) From 20bb0f61283ab4f5f1cd602fa297d4b77d56a6b8 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 29 Mar 2023 00:11:00 -0700 Subject: [PATCH 097/135] src/sage/schemes/curves: Revise indentation of multiline doctest output --- src/sage/schemes/curves/constructor.py | 4 ++-- src/sage/schemes/curves/curve.py | 10 ++++----- src/sage/schemes/curves/point.py | 4 ++-- src/sage/schemes/curves/projective_curve.py | 25 +++++++++++---------- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/sage/schemes/curves/constructor.py b/src/sage/schemes/curves/constructor.py index 34bea0c9cd7..690a3962896 100644 --- a/src/sage/schemes/curves/constructor.py +++ b/src/sage/schemes/curves/constructor.py @@ -170,8 +170,8 @@ def Curve(F, A=None): sage: X = C.intersection(D); X Closed subscheme of Projective Space of dimension 2 over Rational Field - defined by: x^3 + y^3 + z^3, - x^4 + y^4 + z^4 + defined by: x^3 + y^3 + z^3, + x^4 + y^4 + z^4 Note that the intersection has dimension 0. :: diff --git a/src/sage/schemes/curves/curve.py b/src/sage/schemes/curves/curve.py index 3954aea62ce..49f8fbeb611 100644 --- a/src/sage/schemes/curves/curve.py +++ b/src/sage/schemes/curves/curve.py @@ -278,7 +278,7 @@ def singular_subscheme(self): sage: C = Curve([y^4 - 2*x^5 - x^2*y], A) sage: C.singular_subscheme() Closed subscheme of Affine Space of dimension 2 over Complex Field - with 53 bits of precision defined by: + with 53 bits of precision defined by: (-2.00000000000000)*x^5 + y^4 - x^2*y, (-10.0000000000000)*x^4 + (-2.00000000000000)*x*y, 4.00000000000000*y^3 - x^2 @@ -289,7 +289,7 @@ def singular_subscheme(self): sage: C = Curve([y^8 - x^2*z*w^5, w^2 - 2*y^2 - x*z], P) sage: C.singular_subscheme() Closed subscheme of Projective Space of dimension 3 - over Rational Field defined by: + over Rational Field defined by: y^8 - x^2*z*w^5, -2*y^2 - x*z + w^2, -x^3*y*z^4 + 3*x^2*y*z^3*w^2 - 3*x*y*z^2*w^4 + 8*x*y*z*w^5 + y*z*w^6, @@ -507,7 +507,7 @@ def change_ring(self, R): sage: C = Curve([x^2 - y^2, z*y - 4/5*w^2], P) sage: C.change_ring(QuadraticField(-1)) # optional - sage.rings.number_field Projective Curve over Number Field in a with defining polynomial x^2 + 1 - with a = 1*I defined by x^2 - y^2, y*z - 4/5*w^2 + with a = 1*I defined by x^2 - y^2, y*z - 4/5*w^2 :: @@ -518,8 +518,8 @@ def change_ring(self, R): sage: L = K.embeddings(QQbar) # optional - sage.rings.number_field sage: set_verbose(-1) # suppress warnings for slow computation sage: C.change_ring(L[0]) # optional - sage.rings.number_field - Affine Plane Curve over Algebraic Field - defined by y^3 + (-0.8774388331233464? - 0.744861766619745?*I)*x^2 - x - 11 + Affine Plane Curve over Algebraic Field defined + by y^3 + (-0.8774388331233464? - 0.744861766619745?*I)*x^2 - x - 11 :: diff --git a/src/sage/schemes/curves/point.py b/src/sage/schemes/curves/point.py index 5fbe6303b2e..aa41d55627a 100644 --- a/src/sage/schemes/curves/point.py +++ b/src/sage/schemes/curves/point.py @@ -8,7 +8,7 @@ sage: Q = C([1,1,0,0]) sage: Q.parent() Set of rational points of Projective Curve over Rational Field - defined by x^3 - y^3 - 2*x*z^2, -x*y*z + z^3 - w^3 + defined by x^3 - y^3 - 2*x*z^2, -x*y*z + z^3 - w^3 or on affine curves:: @@ -17,7 +17,7 @@ sage: Q = C([22,21]) # optional - sage.rings.finite_rings sage: Q.parent() # optional - sage.rings.finite_rings Set of rational points of Affine Plane Curve over Finite Field of size 23 - defined by -y^4 - 6*x^2 - 2*x + y - 1 + defined by -y^4 - 6*x^2 - 2*x + y - 1 AUTHORS: diff --git a/src/sage/schemes/curves/projective_curve.py b/src/sage/schemes/curves/projective_curve.py index 971fa4cb553..4fe4463f764 100644 --- a/src/sage/schemes/curves/projective_curve.py +++ b/src/sage/schemes/curves/projective_curve.py @@ -190,7 +190,7 @@ class ProjectiveCurve(Curve_generic, AlgebraicScheme_subscheme_projective): sage: P. = ProjectiveSpace(GF(7), 4) # optional - sage.rings.finite_rings sage: C = Curve([y*u^2 - x^3, z*u^2 - x^3, w*u^2 - x^3, y^3 - x^3], P); C # optional - sage.rings.finite_rings Projective Curve over Finite Field of size 7 defined - by -x^3 + y*u^2, -x^3 + z*u^2, -x^3 + w*u^2, -x^3 + y^3 + by -x^3 + y*u^2, -x^3 + z*u^2, -x^3 + w*u^2, -x^3 + y^3 :: @@ -198,7 +198,7 @@ class ProjectiveCurve(Curve_generic, AlgebraicScheme_subscheme_projective): sage: P. = ProjectiveSpace(K, 3) # optional - sage.rings.number_field sage: C = Curve([y*w - u*z^2 - x^2, x*w - 3*u^2*z*w], P); C # optional - sage.rings.number_field Projective Curve over Cyclotomic Field of order 11 and degree 10 defined - by -x^2 + (-u)*z^2 + y*w, x*w + (-3*u^2)*z*w + by -x^2 + (-u)*z^2 + y*w, x*w + (-3*u^2)*z*w """ def __init__(self, A, X): """ @@ -248,8 +248,8 @@ def affine_patch(self, i, AA=None): sage: P. = ProjectiveSpace(CC, 3) sage: C = Curve([y*z - x^2, w^2 - x*y], P) sage: C.affine_patch(0) - Affine Curve over Complex Field with 53 bits of precision defined by - y*z - 1.00000000000000, w^2 - y + Affine Curve over Complex Field with 53 bits of precision defined + by y*z - 1.00000000000000, w^2 - y :: @@ -363,8 +363,8 @@ def projection(self, P=None, PS=None): sage: C.projection(PS=Q) # optional - sage.rings.finite_rings Traceback (most recent call last): ... - TypeError: (=Projective Space of dimension 2 over Finite Field of size - 7) must have dimension (=3) + TypeError: (=Projective Space of dimension 2 over Finite Field of + size 7) must have dimension (=3) :: @@ -942,9 +942,10 @@ def tangents(self, P, factor=True): :: sage: P. = ProjectiveSpace(QQ, 2) - sage: C = P.curve([x^2*y^3*z^4 - y^6*z^3 - 4*x^2*y^4*z^3 - 4*x^4*y^2*z^3 + 3*y^7*z^2 +\ - 10*x^2*y^5*z^2 + 9*x^4*y^3*z^2 + 5*x^6*y*z^2 - 3*y^8*z - 9*x^2*y^6*z - 11*x^4*y^4*z -\ - 7*x^6*y^2*z - 2*x^8*z + y^9 + 2*x^2*y^7 + 3*x^4*y^5 + 4*x^6*y^3 + 2*x^8*y]) + sage: C = P.curve([x^2*y^3*z^4 - y^6*z^3 - 4*x^2*y^4*z^3 - 4*x^4*y^2*z^3 + ....: + 3*y^7*z^2 + 10*x^2*y^5*z^2 + 9*x^4*y^3*z^2 + 5*x^6*y*z^2 + ....: - 3*y^8*z - 9*x^2*y^6*z - 11*x^4*y^4*z - 7*x^6*y^2*z + ....: - 2*x^8*z + y^9 + 2*x^2*y^7 + 3*x^4*y^5 + 4*x^6*y^3 + 2*x^8*y]) sage: Q = P([0,1,1]) sage: C.tangents(Q) [-y + z, 3*x^2 - y^2 + 2*y*z - z^2] @@ -2133,7 +2134,7 @@ def rational_points(self, algorithm="enum", sort=True): sage: f = y^2*z^7 - x^9 - x*z^8 # optional - sage.rings.finite_rings sage: C = Curve(f); C # optional - sage.rings.finite_rings Projective Plane Curve over Finite Field of size 5 - defined by -x^9 + y^2*z^7 - x*z^8 + defined by -x^9 + y^2*z^7 - x*z^8 sage: C.rational_points() # optional - sage.rings.finite_rings [(0 : 0 : 1), (0 : 1 : 0), (2 : 2 : 1), (2 : 3 : 1), (3 : 1 : 1), (3 : 4 : 1)] @@ -2283,8 +2284,8 @@ def __call__(self, *args): (y/(y^5 + 1))*z^4 + (y^2/(y^5 + 1))*z^2 sage: C(GF(4^2)) # optional - sage.rings.finite_rings Set of rational points of Closed subscheme of Projective Space of - dimension 2 over Finite Field in z4 of size 2^4 defined by: x^5 + - y^5 + x*y*z^3 + z^5 + dimension 2 over Finite Field in z4 of size 2^4 defined by: + x^5 + y^5 + x*y*z^3 + z^5 """ try: return super().__call__(*args) From 50cc089dbc0ffa2cd347a9d46f163e30ccd03835 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 29 Mar 2023 01:27:00 -0700 Subject: [PATCH 098/135] src/sage/schemes/elliptic_curves: Revise indentation of multiline doctest output (ctd.) --- .../elliptic_curves/ell_rational_field.py | 115 +++---- .../schemes/elliptic_curves/ell_tate_curve.py | 12 +- .../schemes/elliptic_curves/ell_torsion.py | 26 +- src/sage/schemes/elliptic_curves/ell_wp.py | 6 +- .../schemes/elliptic_curves/formal_group.py | 2 +- src/sage/schemes/elliptic_curves/heegner.py | 153 +++++---- src/sage/schemes/elliptic_curves/height.py | 42 +-- .../schemes/elliptic_curves/hom_composite.py | 86 +++-- .../schemes/elliptic_curves/hom_frobenius.py | 27 +- .../schemes/elliptic_curves/isogeny_class.py | 4 +- .../elliptic_curves/isogeny_small_degree.py | 293 ++++++++++++------ src/sage/schemes/elliptic_curves/jacobian.py | 16 +- .../schemes/elliptic_curves/lseries_ell.py | 5 +- .../schemes/elliptic_curves/mod_sym_num.pyx | 4 +- .../modular_parametrization.py | 11 +- .../schemes/elliptic_curves/period_lattice.py | 68 ++-- .../schemes/elliptic_curves/saturation.py | 4 +- src/sage/schemes/elliptic_curves/sha_tate.py | 12 +- .../elliptic_curves/weierstrass_morphism.py | 24 +- 19 files changed, 543 insertions(+), 367 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py index b3e3e5a010e..65499d81718 100644 --- a/src/sage/schemes/elliptic_curves/ell_rational_field.py +++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py @@ -1033,13 +1033,13 @@ def modular_symbol_space(self, sign=1, base_ring=Q, bound=None): sage: f = EllipticCurve('37b') sage: f.modular_symbol_space() Modular Symbols subspace of dimension 1 of Modular Symbols space - of dimension 3 for Gamma_0(37) of weight 2 with sign 1 over Rational Field + of dimension 3 for Gamma_0(37) of weight 2 with sign 1 over Rational Field sage: f.modular_symbol_space(-1) Modular Symbols subspace of dimension 1 of Modular Symbols space - of dimension 2 for Gamma_0(37) of weight 2 with sign -1 over Rational Field + of dimension 2 for Gamma_0(37) of weight 2 with sign -1 over Rational Field sage: f.modular_symbol_space(0, bound=3) Modular Symbols subspace of dimension 2 of Modular Symbols space - of dimension 5 for Gamma_0(37) of weight 2 with sign 0 over Rational Field + of dimension 5 for Gamma_0(37) of weight 2 with sign 0 over Rational Field .. NOTE:: @@ -1184,7 +1184,7 @@ def modular_symbol(self, sign=+1, normalize=None, implementation='eclib', nap=0) sage: E = EllipticCurve('37a1') sage: M = E.modular_symbol(); M Modular symbol with sign 1 over Rational Field attached to - Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field + Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field sage: M(1/2) 0 sage: M(1/5) @@ -1262,12 +1262,12 @@ def modular_symbol(self, sign=+1, normalize=None, implementation='eclib', nap=0) sage: E = EllipticCurve('11a1') sage: Mplus = E.modular_symbol(+1); Mplus Modular symbol with sign 1 over Rational Field attached to - Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: [Mplus(1/i) for i in [1..11]] [1/5, -4/5, -3/10, 7/10, 6/5, 6/5, 7/10, -3/10, -4/5, 1/5, 0] sage: Mminus = E.modular_symbol(-1); Mminus Modular symbol with sign -1 over Rational Field attached to - Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: [Mminus(1/i) for i in [1..11]] [0, 0, 1/2, 1/2, 0, 0, -1/2, -1/2, 0, 0, 0] @@ -1674,12 +1674,12 @@ def analytic_rank_upper_bound(self, sage: E = EllipticCurve("11a") sage: E.rank() 0 - sage: E.analytic_rank_upper_bound(max_Delta=1,adaptive=False) + sage: E.analytic_rank_upper_bound(max_Delta=1, adaptive=False) 0 sage: E = EllipticCurve([-39,123]) sage: E.rank() 1 - sage: E.analytic_rank_upper_bound(max_Delta=1,adaptive=True) + sage: E.analytic_rank_upper_bound(max_Delta=1, adaptive=True) 1 This is especially true for elliptic curves with large rank. @@ -1689,7 +1689,8 @@ def analytic_rank_upper_bound(self, sage: for r in range(9): ....: E = elliptic_curves.rank(r)[0] ....: print((r, E.analytic_rank_upper_bound(max_Delta=1, - ....: adaptive=False,root_number="ignore"))) + ....: adaptive=False, + ....: root_number="ignore"))) (0, 0) (1, 1) (2, 2) @@ -1708,9 +1709,9 @@ def analytic_rank_upper_bound(self, sage: E = EllipticCurve("974b1") sage: r = E.rank(); r 0 - sage: E.analytic_rank_upper_bound(max_Delta=1,root_number="ignore") + sage: E.analytic_rank_upper_bound(max_Delta=1, root_number="ignore") 1 - sage: E.analytic_rank_upper_bound(max_Delta=1.3,root_number="ignore") + sage: E.analytic_rank_upper_bound(max_Delta=1.3, root_number="ignore") 0 Knowing the root number of `E` allows us to use smaller Delta values @@ -1718,7 +1719,7 @@ def analytic_rank_upper_bound(self, :: - sage: E.analytic_rank_upper_bound(max_Delta=0.6,root_number="compute") + sage: E.analytic_rank_upper_bound(max_Delta=0.6, root_number="compute") 0 There are a small number of curves which have pathologically low-lying @@ -1731,11 +1732,11 @@ def analytic_rank_upper_bound(self, :: sage: E = EllipticCurve([0, -1, 0, -7460362000712, -7842981500851012704]) - sage: N,r = E.conductor(),E.analytic_rank(); N, r + sage: N, r = E.conductor(), E.analytic_rank(); N, r (256944, 0) - sage: E.analytic_rank_upper_bound(max_Delta=1,adaptive=False) + sage: E.analytic_rank_upper_bound(max_Delta=1, adaptive=False) 2 - sage: E.analytic_rank_upper_bound(max_Delta=2,adaptive=False) + sage: E.analytic_rank_upper_bound(max_Delta=2, adaptive=False) 2 This method is can be called on curves with large conductor. @@ -1756,11 +1757,12 @@ def analytic_rank_upper_bound(self, sage: a4 = -20067762415575526585033208209338542750930230312178956502 sage: a6 = 34481611795030556467032985690390720374855944359319180361266008296291939448732243429 - sage: E = EllipticCurve([1,-1,1,a4,a6]) - sage: bad_primes = [2,3,5,7,11,13,17,19,48463] + sage: E = EllipticCurve([1, -1, 1, a4, a6]) + sage: bad_primes = [2, 3, 5, 7, 11, 13, 17, 19, 48463] sage: N = 3455601108357547341532253864901605231198511505793733138900595189472144724781456635380154149870961231592352897621963802238155192936274322687070 - sage: E.analytic_rank_upper_bound(max_Delta=2.37,adaptive=False, # long time - ....: N=N,root_number=1,bad_primes=bad_primes,ncpus=2) + sage: E.analytic_rank_upper_bound(max_Delta=2.37, adaptive=False, # long time + ....: N=N, root_number=1, + ....: bad_primes=bad_primes, ncpus=2) 32 """ Z = LFunctionZeroSum_EllipticCurve(self, N) @@ -2237,7 +2239,7 @@ def gens(self, proof=None, **kwds): sage: E = EllipticCurve('389a1') sage: E1 = E.change_weierstrass_model([1/20,0,0,0]); E1 Elliptic Curve defined by y^2 + 8000*y = x^3 + 400*x^2 - 320000*x - over Rational Field + over Rational Field sage: E1.gens() # random (if database not used) [(-400 : 8000 : 1), (0 : -8000 : 1)] """ @@ -3274,7 +3276,7 @@ def period_lattice(self, embedding=None): sage: E = EllipticCurve('37a') sage: E.period_lattice() Period lattice associated to - Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field + Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field """ try: return self._period_lattice @@ -3338,13 +3340,13 @@ def elliptic_exponential(self, z, embedding=None): sage: E.division_polynomial(3).roots(CC,multiplicities=False) [-2.88288879135..., - 1.39292799513..., - 0.078313731444316... - 0.492840991709...*I, - 0.078313731444316... + 0.492840991709...*I] + 1.39292799513..., + 0.078313731444316... - 0.492840991709...*I, + 0.078313731444316... + 0.492840991709...*I] sage: [E.elliptic_exponential((a*w1+b*w2)/3)[0] for a,b in [(0,1),(1,0),(1,1),(2,1)]] [-2.8828887913533..., 1.39292799513138, - 0.0783137314443... - 0.492840991709...*I, - 0.0783137314443... + 0.492840991709...*I] + 0.0783137314443... - 0.492840991709...*I, + 0.0783137314443... + 0.492840991709...*I] Observe that this is a group homomorphism (modulo rounding error):: @@ -3406,7 +3408,9 @@ def lseries_gross_zagier(self, A): sage: A = K.class_group().gen(0); A Fractional ideal class (2, 1/2*a) sage: L = E.lseries_gross_zagier(A) ; L - Gross Zagier L-series attached to Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field with ideal class Fractional ideal class (2, 1/2*a) + Gross Zagier L-series attached to + Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field + with ideal class Fractional ideal class (2, 1/2*a) sage: L(1) 0.000000000000000 sage: L.taylor_series(1, 5) @@ -3444,7 +3448,7 @@ def Lambda(self, s, prec): EXAMPLES:: sage: E = EllipticCurve('389a') - sage: E.Lambda(1.4+0.5*I, 50) + sage: E.Lambda(1.4 + 0.5*I, 50) -0.354172680517... + 0.874518681720...*I """ from sage.symbolic.constants import pi @@ -3467,7 +3471,7 @@ def is_local_integral_model(self, *p): EXAMPLES:: - sage: E = EllipticCurve([1/2,1/5,1/5,1/5,1/5]) + sage: E = EllipticCurve([1/2, 1/5, 1/5, 1/5, 1/5]) sage: [E.is_local_integral_model(p) for p in (2,3,5)] [False, True, False] sage: E.is_local_integral_model(2,3,5) @@ -3508,7 +3512,7 @@ def is_global_integral_model(self): EXAMPLES:: - sage: E = EllipticCurve([1/2,1/5,1/5,1/5,1/5]) + sage: E = EllipticCurve([1/2, 1/5, 1/5, 1/5, 1/5]) sage: E.is_global_integral_model() False sage: Emin=E.global_integral_model() @@ -3597,8 +3601,8 @@ def _generalized_congmod_numbers(self, M, invariant="both"): EXAMPLES:: sage: E = EllipticCurve('37a') - sage: for M in range(2,8): # long time (22s on 2009 MBP) - ....: print((M, E.modular_degree(M=M),E.congruence_number(M=M))) + sage: for M in range(2, 8): # long time (22s on 2009 MBP) + ....: print((M, E.modular_degree(M=M), E.congruence_number(M=M))) (2, 5, 20) (3, 7, 28) (4, 50, 400) @@ -3785,7 +3789,10 @@ def modular_parametrization(self): sage: E = EllipticCurve('15a') sage: phi = E.modular_parametrization(); phi - Modular parameterization from the upper half plane to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 10*x - 10 over Rational Field + Modular parameterization + from the upper half plane + to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 10*x - 10 + over Rational Field sage: z = 0.1 + 0.2j sage: phi(z) (8.20822465478531 - 13.1562816054682*I : -8.79855099049364 + 69.4006129342200*I : 1.00000000000000) @@ -3938,7 +3945,8 @@ def cremona_label(self, space=False): sage: E.cremona_label() Traceback (most recent call last): ... - LookupError: Cremona database does not contain entry for Elliptic Curve defined by y^2 + y = x^3 - 79*x + 342 over Rational Field + LookupError: Cremona database does not contain entry for + Elliptic Curve defined by y^2 + y = x^3 - 79*x + 342 over Rational Field """ try: label = self.__cremona_label @@ -4072,10 +4080,10 @@ def torsion_subgroup(self): sage: EllipticCurve('11a').torsion_subgroup() Torsion Subgroup isomorphic to Z/5 associated to the - Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: EllipticCurve('37b').torsion_subgroup() Torsion Subgroup isomorphic to Z/3 associated to the - Elliptic Curve defined by y^2 + y = x^3 + x^2 - 23*x - 50 over Rational Field + Elliptic Curve defined by y^2 + y = x^3 + x^2 - 23*x - 50 over Rational Field :: @@ -4686,25 +4694,25 @@ def isogenies_prime_degree(self, l=None): sage: E.isogenies_prime_degree() [Isogeny of degree 163 from Elliptic Curve defined by y^2 + y = x^3 - 2174420*x + 1234136692 over Rational Field - to Elliptic Curve defined by y^2 + y = x^3 - 57772164980*x - 5344733777551611 over Rational Field] + to Elliptic Curve defined by y^2 + y = x^3 - 57772164980*x - 5344733777551611 over Rational Field] sage: E1 = E.quadratic_twist(6584935282) sage: E1.isogenies_prime_degree() [Isogeny of degree 163 from Elliptic Curve defined by y^2 = x^3 - 94285835957031797981376080*x + 352385311612420041387338054224547830898 over Rational Field - to Elliptic Curve defined by y^2 = x^3 - 2505080375542377840567181069520*x - 1526091631109553256978090116318797845018020806 over Rational Field] + to Elliptic Curve defined by y^2 = x^3 - 2505080375542377840567181069520*x - 1526091631109553256978090116318797845018020806 over Rational Field] sage: E = EllipticCurve('14a1') sage: E.isogenies_prime_degree(2) [Isogeny of degree 2 from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field - to Elliptic Curve defined by y^2 + x*y + y = x^3 - 36*x - 70 over Rational Field] + to Elliptic Curve defined by y^2 + x*y + y = x^3 - 36*x - 70 over Rational Field] sage: E.isogenies_prime_degree(3) [Isogeny of degree 3 from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field - to Elliptic Curve defined by y^2 + x*y + y = x^3 - x over Rational Field, + to Elliptic Curve defined by y^2 + x*y + y = x^3 - x over Rational Field, Isogeny of degree 3 from Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field - to Elliptic Curve defined by y^2 + x*y + y = x^3 - 171*x - 874 over Rational Field] + to Elliptic Curve defined by y^2 + x*y + y = x^3 - 171*x - 874 over Rational Field] sage: E.isogenies_prime_degree(5) [] sage: E.isogenies_prime_degree(11) @@ -5220,8 +5228,8 @@ def galois_representation(self): sage: rho = EllipticCurve('11a1').galois_representation() sage: rho - Compatible family of Galois representations associated to - the Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Compatible family of Galois representations associated to the + Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: rho.is_irreducible(7) True sage: rho.is_irreducible(5) @@ -5477,7 +5485,7 @@ def sha(self): sage: S = E.sha() sage: S Tate-Shafarevich group for the Elliptic Curve - defined by y^2 + y = x^3 - x over Rational Field + defined by y^2 + y = x^3 - x over Rational Field sage: S.bound_kolyvagin() ([2], 1) """ @@ -5536,7 +5544,8 @@ def mod5family(self): sage: E = EllipticCurve('32a1') sage: E.mod5family() - Elliptic Curve defined by y^2 = x^3 + 4*x over Fraction Field of Univariate Polynomial Ring in t over Rational Field + Elliptic Curve defined by y^2 = x^3 + 4*x + over Fraction Field of Univariate Polynomial Ring in t over Rational Field """ E = self.short_weierstrass_model() a = E.a4() @@ -5565,7 +5574,7 @@ def tate_curve(self, p): sage: e = EllipticCurve('130a1') sage: e.tate_curve(2) 2-adic Tate curve associated to the Elliptic Curve - defined by y^2 + x*y + y = x^3 - 33*x + 68 over Rational Field + defined by y^2 + x*y + y = x^3 - 33*x + 68 over Rational Field The input curve must have multiplicative reduction at the prime. @@ -5580,7 +5589,7 @@ def tate_curve(self, p): sage: T = e.tate_curve(5); T 5-adic Tate curve associated to the Elliptic Curve - defined by y^2 + x*y + y = x^3 - 33*x + 68 over Rational Field + defined by y^2 + x*y + y = x^3 - 33*x + 68 over Rational Field We find the Tate parameter `q`:: @@ -5938,7 +5947,7 @@ def integral_points(self, mw_base='auto', both_signs=False, verbose=False): See :trac:`22063`:: sage: for n in [67,71,74,91]: - ....: assert 4*n^6+4*n^2 in [P[0] for P in EllipticCurve([0,0,0,2,n^2]).integral_points()] + ....: assert 4*n^6 + 4*n^2 in [P[0] for P in EllipticCurve([0,0,0,2,n^2]).integral_points()] ALGORITHM: @@ -6970,11 +6979,11 @@ def integral_points_with_bounded_mw_coeffs(E, mw_base, N, x_bound): We check that some large integral points in a paper of Zagier are found:: - sage: def t(a,b,x): # indirect doctest - ....: E = EllipticCurve([0,0,0,a,b]) - ....: xs = [P[0] for P in E.integral_points()] - ....: return x in xs - sage: all(t(a,b,x) for a,b,x in [ (-2,5, 1318), (4,-1, 4321), + sage: def t(a, b, x): # indirect doctest + ....: E = EllipticCurve([0,0,0,a,b]) + ....: xs = [P[0] for P in E.integral_points()] + ....: return x in xs + sage: all(t(a,b,x) for a,b,x in [(-2,5, 1318), (4,-1, 4321), ....: (0,17, 5234), (11,4, 16833), (-13,37, 60721), (-12,-10, 80327), ....: (-7,22, 484961), (-9,28, 764396), (-13,4, 1056517), (-19,-51, ....: 2955980), (-24,124, 4435710), (-30,133, 5143326), (-37,60, diff --git a/src/sage/schemes/elliptic_curves/ell_tate_curve.py b/src/sage/schemes/elliptic_curves/ell_tate_curve.py index de5e43c01a1..0b7cd52a146 100644 --- a/src/sage/schemes/elliptic_curves/ell_tate_curve.py +++ b/src/sage/schemes/elliptic_curves/ell_tate_curve.py @@ -69,7 +69,7 @@ class TateCurve(SageObject): sage: e = EllipticCurve('130a1') sage: eq = e.tate_curve(5); eq 5-adic Tate curve associated to the Elliptic Curve - defined by y^2 + x*y + y = x^3 - 33*x + 68 over Rational Field + defined by y^2 + x*y + y = x^3 - 33*x + 68 over Rational Field sage: eq == loads(dumps(eq)) True @@ -89,7 +89,7 @@ def __init__(self, E, p): sage: e = EllipticCurve('130a1') sage: eq = e.tate_curve(2); eq 2-adic Tate curve associated to the Elliptic Curve - defined by y^2 + x*y + y = x^3 - 33*x + 68 over Rational Field + defined by y^2 + x*y + y = x^3 - 33*x + 68 over Rational Field """ if not p.is_prime(): raise ValueError("p (=%s) must be a prime" % p) @@ -140,7 +140,7 @@ def original_curve(self): sage: eq = EllipticCurve('130a1').tate_curve(5) sage: eq.original_curve() Elliptic Curve defined by y^2 + x*y + y = x^3 - 33*x + 68 - over Rational Field + over Rational Field """ return self._E @@ -153,7 +153,7 @@ def prime(self): sage: eq = EllipticCurve('130a1').tate_curve(5) sage: eq.original_curve() Elliptic Curve defined by y^2 + x*y + y = x^3 - 33*x + 68 - over Rational Field + over Rational Field sage: eq.prime() 5 """ @@ -216,8 +216,8 @@ def curve(self, prec=20): sage: eq = EllipticCurve('130a1').tate_curve(5) sage: eq.curve(prec=5) Elliptic Curve defined by y^2 + (1+O(5^5))*x*y = - x^3 + (2*5^4+5^5+2*5^6+5^7+3*5^8+O(5^9))*x + (2*5^3+5^4+2*5^5+5^7+O(5^8)) - over 5-adic Field with capped relative precision 5 + x^3 + (2*5^4+5^5+2*5^6+5^7+3*5^8+O(5^9))*x + (2*5^3+5^4+2*5^5+5^7+O(5^8)) + over 5-adic Field with capped relative precision 5 """ Eq = getattr(self, "__curve", None) if Eq and Eq.a6().precision_relative() >= prec: diff --git a/src/sage/schemes/elliptic_curves/ell_torsion.py b/src/sage/schemes/elliptic_curves/ell_torsion.py index aa16e32a660..6a84cb8a5e6 100644 --- a/src/sage/schemes/elliptic_curves/ell_torsion.py +++ b/src/sage/schemes/elliptic_curves/ell_torsion.py @@ -41,10 +41,10 @@ class EllipticCurveTorsionSubgroup(groups.AdditiveAbelianGroupWrapper): Examples over `\QQ`:: sage: E = EllipticCurve([-4, 0]); E - Elliptic Curve defined by y^2 = x^3 - 4*x over Rational Field + Elliptic Curve defined by y^2 = x^3 - 4*x over Rational Field sage: G = E.torsion_subgroup(); G Torsion Subgroup isomorphic to Z/2 + Z/2 associated to the - Elliptic Curve defined by y^2 = x^3 - 4*x over Rational Field + Elliptic Curve defined by y^2 = x^3 - 4*x over Rational Field sage: G.order() 4 sage: G.gen(0) @@ -60,7 +60,7 @@ class EllipticCurveTorsionSubgroup(groups.AdditiveAbelianGroupWrapper): Elliptic Curve defined by y^2 + 17*x*y - 60*y = x^3 - 120*x^2 over Rational Field sage: G = E.torsion_subgroup(); G Torsion Subgroup isomorphic to Trivial group associated to the - Elliptic Curve defined by y^2 + 17*x*y - 60*y = x^3 - 120*x^2 over Rational Field + Elliptic Curve defined by y^2 + 17*x*y - 60*y = x^3 - 120*x^2 over Rational Field sage: G.gens() () sage: e = EllipticCurve([0, 33076156654533652066609946884, 0, @@ -94,7 +94,7 @@ class EllipticCurveTorsionSubgroup(groups.AdditiveAbelianGroupWrapper): sage: T = E.torsion_subgroup() sage: T Torsion Subgroup isomorphic to Trivial group associated to the - Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field + Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field sage: [E(t) for t in T] [(0 : 1 : 0)] @@ -106,8 +106,8 @@ class EllipticCurveTorsionSubgroup(groups.AdditiveAbelianGroupWrapper): sage: from sage.schemes.elliptic_curves.ell_torsion import EllipticCurveTorsionSubgroup sage: EllipticCurveTorsionSubgroup(EK) Torsion Subgroup isomorphic to Z/5 associated to the - Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) - over Number Field in i with defining polynomial x^2 + 1 + Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) + over Number Field in i with defining polynomial x^2 + 1 sage: E = EllipticCurve('11a1') sage: K. = NumberField(x^2 + 1) @@ -122,8 +122,8 @@ class EllipticCurveTorsionSubgroup(groups.AdditiveAbelianGroupWrapper): sage: T = EK.torsion_subgroup(); T Torsion Subgroup isomorphic to Z/5 associated to the - Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) - over Number Field in i with defining polynomial x^2 + 1 + Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) + over Number Field in i with defining polynomial x^2 + 1 sage: type(T) @@ -149,15 +149,15 @@ def __init__(self, E): sage: EK = E.change_ring(K) sage: EllipticCurveTorsionSubgroup(EK) Torsion Subgroup isomorphic to Z/5 associated to the - Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) - over Number Field in i with defining polynomial x^2 + 1 + Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) + over Number Field in i with defining polynomial x^2 + 1 Note: this class is normally constructed indirectly as follows:: sage: T = EK.torsion_subgroup(); T Torsion Subgroup isomorphic to Z/5 associated to the - Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) - over Number Field in i with defining polynomial x^2 + 1 + Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) + over Number Field in i with defining polynomial x^2 + 1 sage: type(T) @@ -216,7 +216,7 @@ def _repr_(self): EXAMPLES:: sage: E = EllipticCurve('11a1') - sage: K. = NumberField(x^2+1) + sage: K. = NumberField(x^2 + 1) sage: EK = E.change_ring(K) sage: T = EK.torsion_subgroup(); T._repr_() 'Torsion Subgroup isomorphic to Z/5 associated to the Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in i with defining polynomial x^2 + 1' diff --git a/src/sage/schemes/elliptic_curves/ell_wp.py b/src/sage/schemes/elliptic_curves/ell_wp.py index b9c0d624537..820b9050a22 100644 --- a/src/sage/schemes/elliptic_curves/ell_wp.py +++ b/src/sage/schemes/elliptic_curves/ell_wp.py @@ -227,7 +227,7 @@ def compute_wp_quadratic(k, A, B, prec): sage: E = EllipticCurve(GF(103), [1,2]) # optional - sage.rings.finite_rings sage: E.weierstrass_p(algorithm='quadratic') # optional - sage.rings.finite_rings z^-2 + 41*z^2 + 88*z^4 + 11*z^6 + 57*z^8 + 55*z^10 + 73*z^12 - + 11*z^14 + 17*z^16 + 50*z^18 + O(z^20) + + 11*z^14 + 17*z^16 + 50*z^18 + O(z^20) sage: from sage.schemes.elliptic_curves.ell_wp import compute_wp_quadratic sage: compute_wp_quadratic(E.base_ring(), E.a4(), E.a6(), prec=10) # optional - sage.rings.finite_rings @@ -255,7 +255,9 @@ def compute_wp_quadratic(k, A, B, prec): def compute_wp_fast(k, A, B, m): r""" - Computes the Weierstrass function of an elliptic curve defined by short Weierstrass model: `y^2 = x^3 + Ax + B`. It does this with as fast as polynomial of degree `m` can be multiplied together in the base ring, i.e. `O(M(n))` in the notation of [BMSS2006]_. + Computes the Weierstrass function of an elliptic curve defined by short Weierstrass model: + `y^2 = x^3 + Ax + B`. It does this with as fast as polynomial of degree `m` can be multiplied + together in the base ring, i.e. `O(M(n))` in the notation of [BMSS2006]_. Let `p` be the characteristic of the underlying field: Then we must have either `p=0`, or `p > m + 3`. diff --git a/src/sage/schemes/elliptic_curves/formal_group.py b/src/sage/schemes/elliptic_curves/formal_group.py index a47ab2d58cf..18fb8b6c9d1 100644 --- a/src/sage/schemes/elliptic_curves/formal_group.py +++ b/src/sage/schemes/elliptic_curves/formal_group.py @@ -30,7 +30,7 @@ def __init__(self, E): sage: E = EllipticCurve('11a') sage: F = E.formal_group(); F Formal Group associated to the Elliptic Curve - defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: F == loads(dumps(F)) True """ diff --git a/src/sage/schemes/elliptic_curves/heegner.py b/src/sage/schemes/elliptic_curves/heegner.py index 3b000ac86dc..f5cc605a09c 100644 --- a/src/sage/schemes/elliptic_curves/heegner.py +++ b/src/sage/schemes/elliptic_curves/heegner.py @@ -16,7 +16,7 @@ (-4/3 : 1/9*a : 1) sage: parent(z) Abelian group of points on Elliptic Curve defined by y^2 + x*y = x^3 + 1 - over Number Field in a with defining polynomial x^2 - 12*x + 111 + over Number Field in a with defining polynomial x^2 - 12*x + 111 sage: parent(z[0]).discriminant() -3 sage: E.quadratic_twist(-3).rank() @@ -35,8 +35,8 @@ (x^6 + x^5 - 1/4*x^4 + 19/10*x^3 + 31/20*x^2 - 7/10*x + 49/100)^2 sage: z[1].charpoly().factor() x^12 - x^11 + 6/5*x^10 - 33/40*x^9 - 89/320*x^8 + 3287/800*x^7 - - 5273/1600*x^6 + 993/4000*x^5 + 823/320*x^4 - 2424/625*x^3 - + 12059/12500*x^2 + 3329/25000*x + 123251/250000 + - 5273/1600*x^6 + 993/4000*x^5 + 823/320*x^4 - 2424/625*x^3 + + 12059/12500*x^2 + 3329/25000*x + 123251/250000 sage: f = P.x_poly_exact(300); f x^6 + x^5 - 1/4*x^4 + 19/10*x^3 + 31/20*x^2 - 7/10*x + 49/100 sage: f.discriminant().factor() @@ -518,7 +518,7 @@ def quadratic_field(self): sage: E = EllipticCurve('389a'); K = E.heegner_point(-7,5).ring_class_field() sage: K.quadratic_field() Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 - with sqrt_minus_7 = 2.645751311064591?*I + with sqrt_minus_7 = 2.645751311064591?*I """ D = self.__D var = 'sqrt_minus_%s'%(-D) @@ -545,14 +545,14 @@ def galois_group(self, base=QQ): Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 5 sage: A.galois_group(B) Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 5 - over Hilbert class field of QQ[sqrt(-7)] + over Hilbert class field of QQ[sqrt(-7)] sage: A.galois_group().cardinality() 12 sage: A.galois_group(B).cardinality() 6 sage: C.galois_group(A) Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 15 - over Ring class field extension of QQ[sqrt(-7)] of conductor 5 + over Ring class field extension of QQ[sqrt(-7)] of conductor 5 sage: C.galois_group(A).cardinality() 4 """ @@ -609,7 +609,7 @@ class GaloisGroup(SageObject): 12 sage: G.complex_conjugation() Complex conjugation automorphism of Ring class field extension of QQ[sqrt(-7)] - of conductor 5 + of conductor 5 TESTS:: @@ -633,10 +633,10 @@ def __init__(self, field, base=QQ): sage: K1 = heegner_points(389,-7,1).ring_class_field() sage: sage.schemes.elliptic_curves.heegner.GaloisGroup(K5,K1) Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 5 - over Hilbert class field of QQ[sqrt(-7)] + over Hilbert class field of QQ[sqrt(-7)] sage: K5.galois_group(K1) Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 5 - over Hilbert class field of QQ[sqrt(-7)] + over Hilbert class field of QQ[sqrt(-7)] """ if not isinstance(field, RingClassField): raise TypeError("field must be of type RingClassField") @@ -781,8 +781,8 @@ def base_field(self): 12 sage: G = Kc.galois_group(K); G Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 5 - over Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 - with sqrt_minus_7 = 2.645751311064591?*I + over Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 + with sqrt_minus_7 = 2.645751311064591?*I sage: G.cardinality() 6 sage: G.base_field() @@ -790,7 +790,7 @@ def base_field(self): with sqrt_minus_7 = 2.645751311064591?*I sage: G = Kc.galois_group(Kc); G Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 5 - over Ring class field extension of QQ[sqrt(-7)] of conductor 5 + over Ring class field extension of QQ[sqrt(-7)] of conductor 5 sage: G.cardinality() 1 sage: G.base_field() @@ -920,7 +920,8 @@ def _list(self): sage: K1 = heegner_points(389,-52,1).ring_class_field() sage: G = K3.galois_group(K1) sage: G._list() - (Class field automorphism defined by x^2 + 117*y^2, Class field automorphism defined by 9*x^2 - 6*x*y + 14*y^2, Class field automorphism defined by 9*x^2 + 13*y^2, Class field automorphism defined by 9*x^2 + 6*x*y + 14*y^2) + (Class field automorphism defined by x^2 + 117*y^2, Class field automorphism defined by 9*x^2 - 6*x*y + 14*y^2, + Class field automorphism defined by 9*x^2 + 13*y^2, Class field automorphism defined by 9*x^2 + 6*x*y + 14*y^2) """ if self._base_is_QQ(): raise NotImplementedError("Galois group over QQ not yet implemented") @@ -1238,7 +1239,7 @@ def complex_conjugation(self): sage: G = E.heegner_point(-7,5).ring_class_field().galois_group() sage: G.complex_conjugation() Complex conjugation automorphism of Ring class field extension - of QQ[sqrt(-7)] of conductor 5 + of QQ[sqrt(-7)] of conductor 5 """ if self.base_field() != QQ: raise ValueError("the base field must be fixed by complex conjugation") @@ -1316,7 +1317,7 @@ class GaloisAutomorphismComplexConjugation(GaloisAutomorphism): sage: conj = G.complex_conjugation() sage: conj Complex conjugation automorphism of Ring class field extension - of QQ[sqrt(-7)] of conductor 5 + of QQ[sqrt(-7)] of conductor 5 sage: conj.domain() Ring class field extension of QQ[sqrt(-7)] of conductor 5 @@ -1631,7 +1632,8 @@ def __mul__(self, right): sage: s * s Class field automorphism defined by x^2 + 45*y^2 sage: G = s.parent(); list(G) - [Class field automorphism defined by x^2 + 45*y^2, Class field automorphism defined by 2*x^2 + 2*x*y + 23*y^2, Class field automorphism defined by 5*x^2 + 9*y^2, Class field automorphism defined by 7*x^2 + 4*x*y + 7*y^2] + [Class field automorphism defined by x^2 + 45*y^2, Class field automorphism defined by 2*x^2 + 2*x*y + 23*y^2, + Class field automorphism defined by 5*x^2 + 9*y^2, Class field automorphism defined by 7*x^2 + 4*x*y + 7*y^2] sage: G[0]*G[0] Class field automorphism defined by x^2 + 45*y^2 sage: G[1]*G[2] == G[3] @@ -1884,12 +1886,12 @@ def quadratic_field(self): sage: x = heegner_point(37,-7,5) sage: x.quadratic_field() Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 - with sqrt_minus_7 = 2.645751311064591?*I + with sqrt_minus_7 = 2.645751311064591?*I sage: E = EllipticCurve('37a'); P = E.heegner_point(-40) sage: P.quadratic_field() Number Field in sqrt_minus_40 with defining polynomial x^2 + 40 - with sqrt_minus_40 = 6.324555320336759?*I + with sqrt_minus_40 = 6.324555320336759?*I sage: P.quadratic_field() is P.quadratic_field() True sage: type(P.quadratic_field()) @@ -1907,7 +1909,7 @@ def quadratic_order(self): sage: heegner_point(389,-7,5).quadratic_order() Order in Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 - with sqrt_minus_7 = 2.645751311064591?*I + with sqrt_minus_7 = 2.645751311064591?*I sage: heegner_point(389,-7,5).quadratic_order().basis() [1, 5*sqrt_minus_7] @@ -2224,7 +2226,7 @@ def quadratic_field(self): sage: E = EllipticCurve('389a'); K = E.heegner_point(-7,5).ring_class_field() sage: K.quadratic_field() Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 - with sqrt_minus_7 = 2.645751311064591?*I + with sqrt_minus_7 = 2.645751311064591?*I """ D = self.__D var = 'sqrt_minus_%s'%(-D) @@ -2376,7 +2378,7 @@ class HeegnerPoints_level_disc_cond(HeegnerPoints_level, HeegnerPoints_level_dis sage: H.quadratic_field() Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 - with sqrt_minus_7 = 2.645751311064591?*I + with sqrt_minus_7 = 2.645751311064591?*I sage: H.ring_class_field() Ring class field extension of QQ[sqrt(-7)] of conductor 5 @@ -2583,14 +2585,18 @@ def points(self, beta=None): sage: H = heegner_points(389,-7,5); H All Heegner points of conductor 5 on X_0(389) associated to QQ[sqrt(-7)] sage: H.points() - (Heegner point 5/778*sqrt(-7) - 147/778 of discriminant -7 and conductor 5 on X_0(389), ..., Heegner point 5/5446*sqrt(-7) - 757/778 of discriminant -7 and conductor 5 on X_0(389)) + (Heegner point 5/778*sqrt(-7) - 147/778 of discriminant -7 and conductor 5 on X_0(389), + ..., + Heegner point 5/5446*sqrt(-7) - 757/778 of discriminant -7 and conductor 5 on X_0(389)) sage: H.betas() (147, 631) sage: [x.tau() for x in H.points(147)] - [5/778*sqrt_minus_7 - 147/778, 5/1556*sqrt_minus_7 - 147/1556, 5/1556*sqrt_minus_7 - 925/1556, 5/3112*sqrt_minus_7 - 1703/3112, 5/3112*sqrt_minus_7 - 2481/3112, 5/5446*sqrt_minus_7 - 21/778] + [5/778*sqrt_minus_7 - 147/778, 5/1556*sqrt_minus_7 - 147/1556, 5/1556*sqrt_minus_7 - 925/1556, + 5/3112*sqrt_minus_7 - 1703/3112, 5/3112*sqrt_minus_7 - 2481/3112, 5/5446*sqrt_minus_7 - 21/778] sage: [x.tau() for x in H.points(631)] - [5/778*sqrt_minus_7 - 631/778, 5/1556*sqrt_minus_7 - 631/1556, 5/1556*sqrt_minus_7 - 1409/1556, 5/3112*sqrt_minus_7 - 631/3112, 5/3112*sqrt_minus_7 - 1409/3112, 5/5446*sqrt_minus_7 - 757/778] + [5/778*sqrt_minus_7 - 631/778, 5/1556*sqrt_minus_7 - 631/1556, 5/1556*sqrt_minus_7 - 1409/1556, + 5/3112*sqrt_minus_7 - 631/3112, 5/3112*sqrt_minus_7 - 1409/3112, 5/5446*sqrt_minus_7 - 757/778] The result is cached and is a tuple (since it is immutable):: @@ -2670,12 +2676,12 @@ class HeegnerPointOnX0N(HeegnerPoint): -7 sage: x.quadratic_field() Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 - with sqrt_minus_7 = 2.645751311064591?*I + with sqrt_minus_7 = 2.645751311064591?*I sage: x.quadratic_form() 37*x^2 + 11*x*y + 2*y^2 sage: x.quadratic_order() Order in Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 - with sqrt_minus_7 = 2.645751311064591?*I + with sqrt_minus_7 = 2.645751311064591?*I sage: x.tau() 5/74*sqrt_minus_7 - 11/74 sage: loads(dumps(x)) == x @@ -2703,12 +2709,12 @@ def __init__(self, N, D, c=ZZ(1), f=None, check=True): sage: from sage.schemes.elliptic_curves.heegner import HeegnerPointOnX0N sage: x = heegner_point(389, -7, 5); x Heegner point 5/778*sqrt(-7) - 147/778 of discriminant -7 and conductor 5 - on X_0(389) + on X_0(389) sage: type(x) sage: HeegnerPointOnX0N(389, -7, 5, None, check=False) Heegner point 5/778*sqrt(-7) - 147/778 of discriminant -7 and conductor 5 - on X_0(389) + on X_0(389) """ if check: N = ZZ(N) @@ -2769,7 +2775,7 @@ def __richcmp__(self, x, op): EXAMPLES:: sage: x1 = EllipticCurve('389a').heegner_point(-7).heegner_point_on_X0N() - sage: x5 = EllipticCurve('389a').heegner_point(-7,5).heegner_point_on_X0N() + sage: x5 = EllipticCurve('389a').heegner_point(-7, 5).heegner_point_on_X0N() sage: x1 == x1 True sage: x1 < x5 @@ -2811,12 +2817,12 @@ def atkin_lehner_act(self, Q=None): EXAMPLES:: - sage: x = heegner_point(389,-7,5) + sage: x = heegner_point(389, -7, 5) sage: x.atkin_lehner_act() Heegner point 5/199168*sqrt(-7) - 631/199168 of discriminant -7 - and conductor 5 on X_0(389) + and conductor 5 on X_0(389) - sage: x = heegner_point(45,D=-11,c=1); x + sage: x = heegner_point(45, D=-11, c=1); x Heegner point 1/90*sqrt(-11) - 13/90 of discriminant -11 on X_0(45) sage: x.atkin_lehner_act(5) Heegner point 1/90*sqrt(-11) + 23/90 of discriminant -11 on X_0(45) @@ -2848,7 +2854,7 @@ def quadratic_form(self): EXAMPLES:: - sage: heegner_point(389,-7,5).quadratic_form() + sage: heegner_point(389, -7, 5).quadratic_form() 389*x^2 + 147*x*y + 14*y^2 """ # It is good/important that this return a copy, since @@ -2863,7 +2869,7 @@ def reduced_quadratic_form(self): EXAMPLES:: - sage: x = heegner_point(389,-7,5) + sage: x = heegner_point(389, -7, 5) sage: x.quadratic_form() 389*x^2 + 147*x*y + 14*y^2 sage: x.reduced_quadratic_form() @@ -2882,7 +2888,7 @@ def tau(self): EXAMPLES:: - sage: x = heegner_point(37,-7,5); tau = x.tau(); tau + sage: x = heegner_point(37, -7, 5); tau = x.tau(); tau 5/74*sqrt_minus_7 - 11/74 sage: 37 * tau.minpoly() 37*x^2 + 11*x + 2 @@ -2904,15 +2910,15 @@ def map_to_curve(self, E): sage: x = heegner_point(389, -7, 5); x Heegner point 5/778*sqrt(-7) - 147/778 of discriminant -7 - and conductor 5 on X_0(389) + and conductor 5 on X_0(389) sage: y = x.map_to_curve(EllipticCurve('389a')); y Heegner point of discriminant -7 and conductor 5 - on elliptic curve of conductor 389 + on elliptic curve of conductor 389 sage: y.curve().cremona_label() '389a1' sage: y.heegner_point_on_X0N() Heegner point 5/778*sqrt(-7) - 147/778 of discriminant -7 - and conductor 5 on X_0(389) + and conductor 5 on X_0(389) You can also directly apply the modular parametrization of the elliptic curve:: @@ -2931,7 +2937,7 @@ def galois_orbit_over_K(self): EXAMPLES:: - sage: x = heegner_point(389,-7,3); x + sage: x = heegner_point(389, -7, 3); x Heegner point 3/778*sqrt(-7) - 223/778 of discriminant -7 and conductor 3 on X_0(389) sage: x.galois_orbit_over_K() @@ -3015,7 +3021,7 @@ def __init__(self, E, x, check=True): sage: E = EllipticCurve('389a') sage: sage.schemes.elliptic_curves.heegner.HeegnerPointOnEllipticCurve(E, x) Heegner point of discriminant -7 and conductor 5 on elliptic curve - of conductor 389 + of conductor 389 """ if check: if E.conductor() != x.level(): @@ -3123,10 +3129,10 @@ def heegner_point_on_X0N(self): sage: E = EllipticCurve('37a'); P = E.heegner_point(-7,5); P Heegner point of discriminant -7 and conductor 5 on elliptic curve - of conductor 37 + of conductor 37 sage: P.heegner_point_on_X0N() Heegner point 5/74*sqrt(-7) - 11/74 of discriminant -7 and conductor 5 - on X_0(37) + on X_0(37) """ return self.__x @@ -3283,7 +3289,7 @@ def quadratic_form(self): sage: P = EllipticCurve('389a').heegner_point(-7, 5, (778,925,275)); P Heegner point of discriminant -7 and conductor 5 on elliptic curve - of conductor 389 + of conductor 389 sage: P.quadratic_form() 778*x^2 + 925*x*y + 275*y^2 """ @@ -3335,7 +3341,7 @@ def numerical_approx(self, prec=53, algorithm=None): sage: E = EllipticCurve('389a'); P = E.heegner_point(-7, 5); P Heegner point of discriminant -7 and conductor 5 on elliptic curve - of conductor 389 + of conductor 389 sage: numerical_approx(P) (0.675507556926807 + 0.344749649302635*I : -0.377142931401887 + 0.843366227137146*I : 1.00000000000000) @@ -3410,7 +3416,11 @@ def x_poly_exact(self, prec=53, algorithm='lll'): sage: E = EllipticCurve('37a') sage: v = E.heegner_discriminants_list(10) sage: [E.heegner_point(D).x_poly_exact() for D in v] - [x, x, x^2 + 2, x^5 - x^4 + x^3 + x^2 - 2*x + 1, x - 6, x^7 - 2*x^6 + 9*x^5 - 10*x^4 - x^3 + 8*x^2 - 5*x + 1, x^3 + 5*x^2 + 10*x + 4, x^4 - 10*x^3 + 10*x^2 + 12*x - 12, x^8 - 5*x^7 + 7*x^6 + 13*x^5 - 10*x^4 - 4*x^3 + x^2 - 5*x + 7, x^6 - 2*x^5 + 11*x^4 - 24*x^3 + 30*x^2 - 16*x + 4] + [x, x, x^2 + 2, x^5 - x^4 + x^3 + x^2 - 2*x + 1, x - 6, + x^7 - 2*x^6 + 9*x^5 - 10*x^4 - x^3 + 8*x^2 - 5*x + 1, + x^3 + 5*x^2 + 10*x + 4, x^4 - 10*x^3 + 10*x^2 + 12*x - 12, + x^8 - 5*x^7 + 7*x^6 + 13*x^5 - 10*x^4 - 4*x^3 + x^2 - 5*x + 7, + x^6 - 2*x^5 + 11*x^4 - 24*x^3 + 30*x^2 - 16*x + 4] We compute `x`-coordinate polynomials for some Heegner points of conductor bigger than 1 on a rank 2 curve:: @@ -3609,7 +3619,11 @@ def conjugates_over_K(self): sage: y = E.heegner_point(-52,5); y Heegner point of discriminant -52 and conductor 5 on elliptic curve of conductor 77 sage: print([z.quadratic_form() for z in y.conjugates_over_K()]) - [77*x^2 + 52*x*y + 13*y^2, 154*x^2 + 206*x*y + 71*y^2, 539*x^2 + 822*x*y + 314*y^2, 847*x^2 + 1284*x*y + 487*y^2, 1001*x^2 + 52*x*y + y^2, 1078*x^2 + 822*x*y + 157*y^2, 1309*x^2 + 360*x*y + 25*y^2, 1309*x^2 + 2054*x*y + 806*y^2, 1463*x^2 + 976*x*y + 163*y^2, 2233*x^2 + 2824*x*y + 893*y^2, 2387*x^2 + 2054*x*y + 442*y^2, 3619*x^2 + 3286*x*y + 746*y^2] + [77*x^2 + 52*x*y + 13*y^2, 154*x^2 + 206*x*y + 71*y^2, 539*x^2 + 822*x*y + 314*y^2, + 847*x^2 + 1284*x*y + 487*y^2, 1001*x^2 + 52*x*y + y^2, 1078*x^2 + 822*x*y + 157*y^2, + 1309*x^2 + 360*x*y + 25*y^2, 1309*x^2 + 2054*x*y + 806*y^2, + 1463*x^2 + 976*x*y + 163*y^2, 2233*x^2 + 2824*x*y + 893*y^2, + 2387*x^2 + 2054*x*y + 442*y^2, 3619*x^2 + 3286*x*y + 746*y^2] sage: y.quadratic_form() 77*x^2 + 52*x*y + 13*y^2 """ @@ -5095,8 +5109,8 @@ def modp_splitting_map(self, p): sage: f = H.modp_splitting_map(13) sage: B = H.quaternion_algebra(); B Quaternion Algebra (-1, -7) with base ring Rational Field - sage: i,j,k = H.quaternion_algebra().gens() - sage: a = 2+i-j+3*k; b = 7+2*i-4*j+k + sage: i, j, k = H.quaternion_algebra().gens() + sage: a = 2 + i - j + 3*k; b = 7 + 2*i - 4*j + k sage: f(a*b) [12 3] [10 5] @@ -5133,7 +5147,7 @@ def cyclic_subideal_p1(self, I, c): sage: H = heegner_points(11).reduce_mod(7) sage: I = H.brandt_module().right_ideals()[0] - sage: sorted(H.cyclic_subideal_p1(I,3).items()) + sage: sorted(H.cyclic_subideal_p1(I, 3).items()) [((0, 1), Fractional ideal (2 + 2*j + 32*k, 2*i + 8*j + 82*k, 12*j + 60*k, 132*k)), ((1, 0), @@ -5142,7 +5156,7 @@ def cyclic_subideal_p1(self, I, c): Fractional ideal (2 + 2*j + 76*k, 2*i + 4*j + 106*k, 12*j + 60*k, 132*k)), ((1, 2), Fractional ideal (2 + 10*j + 116*k, 2*i + 8*j + 38*k, 12*j + 60*k, 132*k))] - sage: len(H.cyclic_subideal_p1(I,17)) + sage: len(H.cyclic_subideal_p1(I, 17)) 18 """ c = ZZ(c) @@ -5186,7 +5200,7 @@ def galois_group_over_hilbert_class_field(self, D, c): sage: H = heegner_points(N).reduce_mod(ell) sage: H.galois_group_over_hilbert_class_field(D, c) Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 41 - over Hilbert class field of QQ[sqrt(-7)] + over Hilbert class field of QQ[sqrt(-7)] """ Kc = heegner_points(self.level(), D, c).ring_class_field() K1 = heegner_points(self.level(), D, 1).ring_class_field() @@ -5210,8 +5224,8 @@ def galois_group_over_quadratic_field(self, D, c): sage: H = heegner_points(N).reduce_mod(ell) sage: H.galois_group_over_quadratic_field(D, c) Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 41 - over Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 - with sqrt_minus_7 = 2.645751311064591?*I + over Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 + with sqrt_minus_7 = 2.645751311064591?*I """ Kc = heegner_points(self.level(), D, c).ring_class_field() return Kc.galois_group(Kc.quadratic_field()) @@ -5232,7 +5246,8 @@ def quadratic_field(self, D): sage: H = heegner_points(389).reduce_mod(5) sage: H.quadratic_field(-7) - Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 with sqrt_minus_7 = 2.645751311064591?*I + Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 + with sqrt_minus_7 = 2.645751311064591?*I """ Kc = heegner_points(self.level(), D, 1).ring_class_field() return Kc.quadratic_field() @@ -5257,7 +5272,7 @@ def kolyvagin_cyclic_subideals(self, I, p, alpha_quaternion): EXAMPLES:: - sage: N = 37; D = -7; ell = 17; c=5 + sage: N = 37; D = -7; ell = 17; c = 5 sage: H = heegner_points(N).reduce_mod(ell) sage: I = H.brandt_module().right_ideals()[49] sage: f = H.optimal_embeddings(D, 1, I.left_order())[1] @@ -5293,7 +5308,7 @@ def kolyvagin_generator(self, K, p): EXAMPLES:: - sage: N = 37; D = -7; ell = 17; p=5 + sage: N = 37; D = -7; ell = 17; p = 5 sage: H = heegner_points(N).reduce_mod(ell) sage: I = H.brandt_module().right_ideals()[49] sage: f = H.optimal_embeddings(D, 1, I.left_order())[0] @@ -5344,7 +5359,7 @@ def kolyvagin_generators(self, K, c): EXAMPLES:: - sage: N = 37; D = -7; ell = 17; p=5 + sage: N = 37; D = -7; ell = 17; p = 5 sage: H = heegner_points(N).reduce_mod(ell) sage: I = H.brandt_module().right_ideals()[49] sage: f = H.optimal_embeddings(D, 1, I.left_order())[0] @@ -5513,8 +5528,7 @@ def modp_dual_elliptic_curve_factor(self, E, p, bound=10): sage: H = heegner_points(N).reduce_mod(ell) sage: V = H.modp_dual_elliptic_curve_factor(EllipticCurve('37a'), q, 5); V Vector space of degree 52 and dimension 2 over Ring of integers modulo 3 - Basis matrix: - 2 x 52 dense matrix over Ring of integers modulo 3 + Basis matrix: 2 x 52 dense matrix over Ring of integers modulo 3 """ if E.conductor() != self.level(): raise ValueError("conductor of E must equal level of self") @@ -6022,7 +6036,8 @@ def codomain(self): sage: H = heegner_points(11).reduce_mod(3); R = H.left_orders()[0] sage: H.optimal_embeddings(-7, 2, R)[0].codomain() - Order of Quaternion Algebra (-1, -3) with base ring Rational Field with basis (1/2 + 1/2*j + 7*k, 1/2*i + 13/2*k, j + 3*k, 11*k) + Order of Quaternion Algebra (-1, -3) with base ring Rational Field + with basis (1/2 + 1/2*j + 7*k, 1/2*i + 13/2*k, j + 3*k, 11*k) """ return self.__R @@ -6087,10 +6102,12 @@ def quadratic_order(D, c, names='a'): EXAMPLES:: sage: sage.schemes.elliptic_curves.heegner.quadratic_order(-7,3) - (Order in Number Field in a with defining polynomial x^2 + 7 with a = 2.645751311064591?*I, + (Order in Number Field in a with defining polynomial x^2 + 7 + with a = 2.645751311064591?*I, 3*a) sage: sage.schemes.elliptic_curves.heegner.quadratic_order(-7,3,'alpha') - (Order in Number Field in alpha with defining polynomial x^2 + 7 with alpha = 2.645751311064591?*I, + (Order in Number Field in alpha with defining polynomial x^2 + 7 + with alpha = 2.645751311064591?*I, 3*alpha) """ K = QuadraticField(D, names) @@ -6209,10 +6226,11 @@ def nearby_rational_poly(f, **kwds): EXAMPLES:: + sage: from sage.schemes.elliptic_curves.heegner import nearby_rational_poly sage: R. = RR[] - sage: sage.schemes.elliptic_curves.heegner.nearby_rational_poly(2.1*x^2 + 3.5*x - 1.2, max_error=10e-16) + sage: nearby_rational_poly(2.1*x^2 + 3.5*x - 1.2, max_error=10e-16) 21/10*X^2 + 7/2*X - 6/5 - sage: sage.schemes.elliptic_curves.heegner.nearby_rational_poly(2.1*x^2 + 3.5*x - 1.2, max_error=10e-17) + sage: nearby_rational_poly(2.1*x^2 + 3.5*x - 1.2, max_error=10e-17) 4728779608739021/2251799813685248*X^2 + 7/2*X - 5404319552844595/4503599627370496 sage: RR(4728779608739021/2251799813685248 - 21/10) 8.88178419700125e-17 @@ -6233,8 +6251,9 @@ def simplest_rational_poly(f, prec): EXAMPLES:: + sage: from sage.schemes.elliptic_curves.heegner import simplest_rational_poly sage: R. = RR[] - sage: sage.schemes.elliptic_curves.heegner.simplest_rational_poly(2.1*x^2 + 3.5*x - 1.2, 53) + sage: simplest_rational_poly(2.1*x^2 + 3.5*x - 1.2, 53) 21/10*X^2 + 7/2*X - 6/5 """ R = QQ['X'] @@ -6532,7 +6551,7 @@ def heegner_point_height(self, D, prec=2, check_rank=True): sage: E = EllipticCurve('5077a') sage: E.heegner_point_height(-7) 0 - sage: E.heegner_point_height(-7,check_rank=False) + sage: E.heegner_point_height(-7, check_rank=False) 0.0000? """ @@ -6784,7 +6803,7 @@ def _adjust_heegner_index(self, a): EXAMPLES:: sage: E = EllipticCurve('11a1') - sage: a = RIF(sqrt(2))-RIF(1.4142135623730951) + sage: a = RIF(sqrt(2)) - RIF(1.4142135623730951) sage: E._adjust_heegner_index(a) 1.?e-8 """ diff --git a/src/sage/schemes/elliptic_curves/height.py b/src/sage/schemes/elliptic_curves/height.py index 105262b6d57..5a73acec090 100644 --- a/src/sage/schemes/elliptic_curves/height.py +++ b/src/sage/schemes/elliptic_curves/height.py @@ -758,13 +758,13 @@ class EllipticCurveCanonicalHeight: sage: E = EllipticCurve([0,0,0,0,1]) sage: EllipticCurveCanonicalHeight(E) EllipticCurveCanonicalHeight object associated to - Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field + Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field Normally this object would be created like this:: sage: E.height_function() EllipticCurveCanonicalHeight object associated to - Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field + Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field """ def __init__(self, E): @@ -781,7 +781,7 @@ def __init__(self, E): sage: E = EllipticCurve([0,0,0,0,1]) sage: EllipticCurveCanonicalHeight(E) EllipticCurveCanonicalHeight object associated to - Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field + Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field An example over a number field:: @@ -789,15 +789,15 @@ def __init__(self, E): sage: E = EllipticCurve([0,i,0,i,i]) sage: EllipticCurveCanonicalHeight(E) EllipticCurveCanonicalHeight object associated to - Elliptic Curve defined by y^2 = x^3 + i*x^2 + i*x + i - over Number Field in i with defining polynomial x^2 + 1 with i = 1*I + Elliptic Curve defined by y^2 = x^3 + i*x^2 + i*x + i + over Number Field in i with defining polynomial x^2 + 1 with i = 1*I TESTS: The base field must be a number field (or `\QQ`):: sage: from sage.schemes.elliptic_curves.height import EllipticCurveCanonicalHeight - sage: E = EllipticCurve(GF(7),[0,0,0,0,1]) + sage: E = EllipticCurve(GF(7), [0,0,0,0,1]) sage: EllipticCurveCanonicalHeight(E) Traceback (most recent call last): ... @@ -825,7 +825,7 @@ def __repr__(self): sage: E = EllipticCurve([0,0,0,0,1]) sage: E.height_function() EllipticCurveCanonicalHeight object associated to - Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field + Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field """ return "EllipticCurveCanonicalHeight object associated to %s" % self.E @@ -913,7 +913,7 @@ def alpha(self, v, tol=0.01): Example 1 from [CPS2006]_:: sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0,0,0,1+5*i,3+i]) + sage: E = EllipticCurve([0, 0, 0, 1 + 5*i, 3 + i]) sage: H = E.height_function() sage: alpha = H.alpha(K.places()[0]) sage: alpha @@ -984,7 +984,7 @@ def e_p(self, p): EXAMPLES:: sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0,0,0,1+5*i,3+i]) + sage: E = EllipticCurve([0, 0, 0, 1 + 5*i, 3 + i]) sage: H = E.height_function() sage: H.e_p(K.prime_above(2)) 2 @@ -1156,7 +1156,7 @@ def psi(self, xi, v): sage: L(P) / L.real_period() 0.615014189772115 sage: H = E.height_function() - sage: H.psi(10/9,v) + sage: H.psi(10/9, v) 0.615014189772115 An example over a number field:: @@ -1172,9 +1172,9 @@ def psi(self, xi, v): 0.867385122699931 sage: xP = v(P.xy()[0]) sage: H = E.height_function() - sage: H.psi(xP,v) + sage: H.psi(xP, v) 0.867385122699931 - sage: H.psi(1.23,v) + sage: H.psi(1.23, v) 0.785854718241495 """ if xi > 1e9: @@ -1211,16 +1211,16 @@ def S(self, xi1, xi2, v): sage: E = EllipticCurve('389a') sage: v = QQ.places()[0] sage: H = E.height_function() - sage: H.S(2,3,v) + sage: H.S(2, 3, v) ([0.224512677391895, 0.274544821597130] U [0.725455178402870, 0.775487322608105]) An example over a number field:: - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: E = EllipticCurve([0,0,0,0,a]) sage: v = K.real_places()[0] sage: H = E.height_function() - sage: H.S(9,10,v) + sage: H.S(9, 10, v) ([0.0781194447253472, 0.0823423732016403] U [0.917657626798360, 0.921880555274653]) """ L = self.E.period_lattice(v) @@ -1259,10 +1259,10 @@ def Sn(self, xi1, xi2, n, v): sage: E = EllipticCurve('389a') sage: v = QQ.places()[0] sage: H = E.height_function() - sage: H.S(2,3,v) , H.Sn(2,3,1,v) + sage: H.S(2, 3, v), H.Sn(2, 3, 1, v) (([0.224512677391895, 0.274544821597130] U [0.725455178402870, 0.775487322608105]), ([0.224512677391895, 0.274544821597130] U [0.725455178402870, 0.775487322608105])) - sage: H.Sn(2,3,6,v) + sage: H.Sn(2, 3, 6, v) ([0.0374187795653158, 0.0457574702661884] U [0.120909196400478, 0.129247887101351] U [0.204085446231982, 0.212424136932855] U [0.287575863067145, 0.295914553768017] U [0.370752112898649, 0.379090803599522] U [0.454242529733812, 0.462581220434684] U [0.537418779565316, 0.545757470266188] U [0.620909196400478, 0.629247887101351] U [0.704085446231982, 0.712424136932855] U [0.787575863067145, 0.795914553768017] U [0.870752112898649, 0.879090803599522] U [0.954242529733812, 0.962581220434684]) An example over a number field:: @@ -1271,10 +1271,10 @@ def Sn(self, xi1, xi2, n, v): sage: E = EllipticCurve([0,0,0,0,a]) sage: v = K.real_places()[0] sage: H = E.height_function() - sage: H.S(2,3,v), H.Sn(2,3,1,v) + sage: H.S(2, 3, v), H.Sn(2, 3, 1, v) (([0.142172065860075, 0.172845716928584] U [0.827154283071416, 0.857827934139925]), ([0.142172065860075, 0.172845716928584] U [0.827154283071416, 0.857827934139925])) - sage: H.Sn(2,3,6,v) + sage: H.Sn(2, 3, 6, v) ([0.0236953443100124, 0.0288076194880974] U [0.137859047178569, 0.142971322356654] U [0.190362010976679, 0.195474286154764] U [0.304525713845236, 0.309637989023321] U [0.357028677643346, 0.362140952821431] U [0.471192380511903, 0.476304655689988] U [0.523695344310012, 0.528807619488097] U [0.637859047178569, 0.642971322356654] U [0.690362010976679, 0.695474286154764] U [0.804525713845236, 0.809637989023321] U [0.857028677643346, 0.862140952821431] U [0.971192380511903, 0.976304655689988]) """ SS = 1/ZZ(n) * self.S(xi1, xi2, v) @@ -1391,8 +1391,8 @@ def wp_c(self, v): sage: H.wp_c(QQ.places()[0]) 2.68744508779950 - sage: K.=QuadraticField(-1) - sage: E = EllipticCurve([0,0,0,1+5*i,3+i]) + sage: K. = QuadraticField(-1) + sage: E = EllipticCurve([0, 0, 0, 1 + 5*i, 3 + i]) sage: H = E.height_function() sage: H.wp_c(K.places()[0]) 2.66213425640096 diff --git a/src/sage/schemes/elliptic_curves/hom_composite.py b/src/sage/schemes/elliptic_curves/hom_composite.py index 0ed4b22739d..19bad468141 100644 --- a/src/sage/schemes/elliptic_curves/hom_composite.py +++ b/src/sage/schemes/elliptic_curves/hom_composite.py @@ -43,15 +43,13 @@ sage: psi(E.lift_x(11)) (352 : 73 : 1) sage: psi.rational_maps() - ((x^35 + 162*x^34 + 186*x^33 + 92*x^32 - ... + 44*x^3 + 190*x^2 + 80*x - - 72)/(x^34 + 162*x^33 - 129*x^32 + 41*x^31 + ... + 66*x^3 - 191*x^2 + 119*x - + 21), (x^51*y - 176*x^50*y + 115*x^49*y - 120*x^48*y + ... + 72*x^3*y + - 129*x^2*y + 163*x*y + 178*y)/(x^51 - 176*x^50 + 11*x^49 + 26*x^48 - ... - - 77*x^3 + 185*x^2 + 169*x - 128)) + ((x^35 + 162*x^34 + 186*x^33 + 92*x^32 - ... + 44*x^3 + 190*x^2 + 80*x + - 72)/(x^34 + 162*x^33 - 129*x^32 + 41*x^31 + ... + 66*x^3 - 191*x^2 + 119*x + 21), + (x^51*y - 176*x^50*y + 115*x^49*y - 120*x^48*y + ... + 72*x^3*y + 129*x^2*y + 163*x*y + + 178*y)/(x^51 - 176*x^50 + 11*x^49 + 26*x^48 - ... - 77*x^3 + 185*x^2 + 169*x - 128)) sage: psi.kernel_polynomial() x^17 + 81*x^16 + 7*x^15 + 82*x^14 + 49*x^13 + 68*x^12 + 109*x^11 + 326*x^10 - + 117*x^9 + 136*x^8 + 111*x^7 + 292*x^6 + 55*x^5 + 389*x^4 + 175*x^3 + - 43*x^2 + 149*x + 373 + + 117*x^9 + 136*x^8 + 111*x^7 + 292*x^6 + 55*x^5 + 389*x^4 + 175*x^3 + 43*x^2 + 149*x + 373 sage: psi.dual() Composite morphism of degree 35 = 7*5: From: Elliptic Curve defined by y^2 = x^3 + 101*x + 285 over Finite Field of size 419 @@ -71,10 +69,10 @@ sage: psi.factors() (Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 419 - to Elliptic Curve defined by y^2 = x^3 + 140*x + 214 over Finite Field of size 419, + to Elliptic Curve defined by y^2 = x^3 + 140*x + 214 over Finite Field of size 419, Isogeny of degree 7 from Elliptic Curve defined by y^2 = x^3 + 140*x + 214 over Finite Field of size 419 - to Elliptic Curve defined by y^2 = x^3 + 101*x + 285 over Finite Field of size 419) + to Elliptic Curve defined by y^2 = x^3 + 101*x + 285 over Finite Field of size 419) AUTHORS: @@ -234,8 +232,8 @@ def __init__(self, E, kernel, codomain=None, model=None): sage: E = EllipticCurve('210.b6').change_ring(K) sage: E.torsion_subgroup() Torsion Subgroup isomorphic to Z/12 + Z/2 associated to the Elliptic Curve - defined by y^2 + x*y + y = x^3 + (-578)*x + 2756 over Number Field in a - with defining polynomial x^2 - x - 5 + defined by y^2 + x*y + y = x^3 + (-578)*x + 2756 + over Number Field in a with defining polynomial x^2 - x - 5 sage: EllipticCurveHom_composite(E, E.torsion_points()) Composite morphism of degree 24 = 2^3*3: From: Elliptic Curve defined by y^2 + x*y + y = x^3 + (-578)*x + 2756 over Number Field in a with defining polynomial x^2 - x - 5 @@ -493,13 +491,13 @@ def factors(self): sage: phi.factors() (Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 43 - to Elliptic Curve defined by y^2 = x^3 + 39*x over Finite Field of size 43, + to Elliptic Curve defined by y^2 = x^3 + 39*x over Finite Field of size 43, Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + 39*x over Finite Field of size 43 - to Elliptic Curve defined by y^2 = x^3 + 42*x + 26 over Finite Field of size 43, + to Elliptic Curve defined by y^2 = x^3 + 42*x + 26 over Finite Field of size 43, Isogeny of degree 11 from Elliptic Curve defined by y^2 = x^3 + 42*x + 26 over Finite Field of size 43 - to Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 43) + to Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 43) """ return self._phis @@ -610,8 +608,15 @@ def rational_maps(self): sage: P = E.lift_x(7321) sage: phi = EllipticCurveHom_composite(E, P) sage: phi.rational_maps() - ((x^9 + 27463*x^8 + 21204*x^7 - 5750*x^6 + 1610*x^5 + 14440*x^4 + 26605*x^3 - 15569*x^2 - 3341*x + 1267)/(x^8 + 27463*x^7 + 26871*x^6 + 5999*x^5 - 20194*x^4 - 6310*x^3 + 24366*x^2 - 20905*x - 13867), - (x^12*y + 8426*x^11*y + 5667*x^11 + 27612*x^10*y + 26124*x^10 + 9688*x^9*y - 22715*x^9 + 19864*x^8*y + 498*x^8 + 22466*x^7*y - 14036*x^7 + 8070*x^6*y + 19955*x^6 - 20765*x^5*y - 12481*x^5 + 12672*x^4*y + 24142*x^4 - 23695*x^3*y + 26667*x^3 + 23780*x^2*y + 17864*x^2 + 15053*x*y - 30118*x + 17539*y - 23609)/(x^12 + 8426*x^11 + 21945*x^10 - 22587*x^9 + 22094*x^8 + 14603*x^7 - 26255*x^6 + 11171*x^5 - 16508*x^4 - 14435*x^3 - 2170*x^2 + 29081*x - 19009)) + ((x^9 + 27463*x^8 + 21204*x^7 - 5750*x^6 + 1610*x^5 + 14440*x^4 + 26605*x^3 + - 15569*x^2 - 3341*x + 1267)/(x^8 + 27463*x^7 + 26871*x^6 + 5999*x^5 + - 20194*x^4 - 6310*x^3 + 24366*x^2 - 20905*x - 13867), + (x^12*y + 8426*x^11*y + 5667*x^11 + 27612*x^10*y + 26124*x^10 + 9688*x^9*y + - 22715*x^9 + 19864*x^8*y + 498*x^8 + 22466*x^7*y - 14036*x^7 + 8070*x^6*y + + 19955*x^6 - 20765*x^5*y - 12481*x^5 + 12672*x^4*y + 24142*x^4 - 23695*x^3*y + + 26667*x^3 + 23780*x^2*y + 17864*x^2 + 15053*x*y - 30118*x + 17539*y + - 23609)/(x^12 + 8426*x^11 + 21945*x^10 - 22587*x^9 + 22094*x^8 + 14603*x^7 + - 26255*x^6 + 11171*x^5 - 16508*x^4 - 14435*x^3 - 2170*x^2 + 29081*x - 19009)) TESTS:: @@ -623,9 +628,11 @@ def rational_maps(self): :: sage: phi.rational_maps()[0].parent() - Fraction Field of Multivariate Polynomial Ring in x, y over Finite Field of size 65537 + Fraction Field of + Multivariate Polynomial Ring in x, y over Finite Field of size 65537 sage: phi.rational_maps()[1].parent() - Fraction Field of Multivariate Polynomial Ring in x, y over Finite Field of size 65537 + Fraction Field of + Multivariate Polynomial Ring in x, y over Finite Field of size 65537 """ fx, fy = self._phis[-1].rational_maps() for phi in self._phis[:-1][::-1]: @@ -667,8 +674,10 @@ def kernel_polynomial(self): sage: P = E.lift_x(7321) sage: phi = EllipticCurveHom_composite(E, P); phi Composite morphism of degree 9 = 3^2: - From: Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Finite Field of size 65537 - To: Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 28339*x + 59518 over Finite Field of size 65537 + From: Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 + over Finite Field of size 65537 + To: Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 28339*x + 59518 + over Finite Field of size 65537 sage: phi.kernel_polynomial() x^4 + 46500*x^3 + 19556*x^2 + 7643*x + 15952 """ @@ -687,12 +696,16 @@ def dual(self): sage: P = E.lift_x(7321) sage: phi = EllipticCurveHom_composite(E, P); phi Composite morphism of degree 9 = 3^2: - From: Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Finite Field of size 65537 - To: Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 28339*x + 59518 over Finite Field of size 65537 + From: Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 + over Finite Field of size 65537 + To: Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 28339*x + 59518 + over Finite Field of size 65537 sage: psi = phi.dual(); psi Composite morphism of degree 9 = 3^2: - From: Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 28339*x + 59518 over Finite Field of size 65537 - To: Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Finite Field of size 65537 + From: Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 28339*x + 59518 + over Finite Field of size 65537 + To: Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 + over Finite Field of size 65537 sage: psi * phi == phi.domain().scalar_multiplication(phi.degree()) True sage: phi * psi == psi.domain().scalar_multiplication(psi.degree()) @@ -715,8 +728,10 @@ def is_separable(self): sage: P = E.lift_x(1) sage: phi = EllipticCurveHom_composite(E, P); phi Composite morphism of degree 7 = 7: - From: Elliptic Curve defined by y^2 = x^3 + 3*x + 2 over Finite Field in z2 of size 7^2 - To: Elliptic Curve defined by y^2 = x^3 + 3*x + 2 over Finite Field in z2 of size 7^2 + From: Elliptic Curve defined by y^2 = x^3 + 3*x + 2 + over Finite Field in z2 of size 7^2 + To: Elliptic Curve defined by y^2 = x^3 + 3*x + 2 + over Finite Field in z2 of size 7^2 sage: phi.is_separable() True """ @@ -735,9 +750,13 @@ def formal(self, prec=20): sage: P = E.lift_x(7321) sage: phi = EllipticCurveHom_composite(E, P) sage: phi.formal() - t + 54203*t^5 + 48536*t^6 + 40698*t^7 + 37808*t^8 + 21111*t^9 + 42381*t^10 + 46688*t^11 + 657*t^12 + 38916*t^13 + 62261*t^14 + 59707*t^15 + 30767*t^16 + 7248*t^17 + 60287*t^18 + 50451*t^19 + 38305*t^20 + 12312*t^21 + 31329*t^22 + O(t^23) + t + 54203*t^5 + 48536*t^6 + 40698*t^7 + 37808*t^8 + 21111*t^9 + 42381*t^10 + + 46688*t^11 + 657*t^12 + 38916*t^13 + 62261*t^14 + 59707*t^15 + + 30767*t^16 + 7248*t^17 + 60287*t^18 + 50451*t^19 + 38305*t^20 + + 12312*t^21 + 31329*t^22 + O(t^23) sage: (phi.dual() * phi).formal(prec=5) - 9*t + 65501*t^2 + 65141*t^3 + 59183*t^4 + 21491*t^5 + 8957*t^6 + 999*t^7 + O(t^8) + 9*t + 65501*t^2 + 65141*t^3 + 59183*t^4 + 21491*t^5 + 8957*t^6 + + 999*t^7 + O(t^8) """ res = self._phis[-1].formal(prec=prec) for phi in self._phis[:-1][::-1]: @@ -764,7 +783,10 @@ def scaling_factor(self): sage: phi = EllipticCurveHom_composite(E, P) sage: phi = WeierstrassIsomorphism(phi.codomain(), [7,8,9,10]) * phi sage: phi.formal() - 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) + 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) sage: phi.scaling_factor() 7 @@ -792,8 +814,10 @@ def is_injective(self): sage: nu = EllipticCurveHom_composite.from_factors(E.automorphisms()) sage: nu Composite morphism of degree 1 = 1^12: - From: Elliptic Curve defined by y^2 = x^3 + x over Algebraic closure of Finite Field of size 3 - To: Elliptic Curve defined by y^2 = x^3 + x over Algebraic closure of Finite Field of size 3 + From: Elliptic Curve defined by y^2 = x^3 + x + over Algebraic closure of Finite Field of size 3 + To: Elliptic Curve defined by y^2 = x^3 + x + over Algebraic closure of Finite Field of size 3 sage: nu.is_injective() True """ diff --git a/src/sage/schemes/elliptic_curves/hom_frobenius.py b/src/sage/schemes/elliptic_curves/hom_frobenius.py index 3499e3a8194..66120753cdf 100644 --- a/src/sage/schemes/elliptic_curves/hom_frobenius.py +++ b/src/sage/schemes/elliptic_curves/hom_frobenius.py @@ -56,8 +56,10 @@ sage: pi = EllipticCurveHom_frobenius(E) sage: pihat = pi.dual(); pihat Isogeny of degree 17 - from Elliptic Curve defined by y^2 = x^3 + (15*z6^5+5*z6^4+8*z6^3+12*z6^2+11*z6+7)*x over Finite Field in z6 of size 17^6 - to Elliptic Curve defined by y^2 = x^3 + z6*x over Finite Field in z6 of size 17^6 + from Elliptic Curve defined by y^2 = x^3 + (15*z6^5+5*z6^4+8*z6^3+12*z6^2+11*z6+7)*x + over Finite Field in z6 of size 17^6 + to Elliptic Curve defined by y^2 = x^3 + z6*x + over Finite Field in z6 of size 17^6 sage: pihat.is_separable() True sage: pihat * pi == EllipticCurveHom_scalar(E,17) # known bug -- #6413 @@ -71,18 +73,25 @@ sage: pi1 = EllipticCurveHom_frobenius(E) sage: pi1hat = pi1.dual(); pi1hat Composite morphism of degree 17 = 17*1: - From: Elliptic Curve defined by y^2 = x^3 + (15*z6^5+5*z6^4+8*z6^3+12*z6^2+11*z6+7) over Finite Field in z6 of size 17^6 - To: Elliptic Curve defined by y^2 = x^3 + z6 over Finite Field in z6 of size 17^6 + From: Elliptic Curve defined by y^2 = x^3 + (15*z6^5+5*z6^4+8*z6^3+12*z6^2+11*z6+7) + over Finite Field in z6 of size 17^6 + To: Elliptic Curve defined by y^2 = x^3 + z6 + over Finite Field in z6 of size 17^6 sage: pi6 = EllipticCurveHom_frobenius(E,6) sage: pi6hat = pi6.dual(); pi6hat Composite morphism of degree 24137569 = 24137569*1: - From: Elliptic Curve defined by y^2 = x^3 + z6 over Finite Field in z6 of size 17^6 - To: Elliptic Curve defined by y^2 = x^3 + z6 over Finite Field in z6 of size 17^6 + From: Elliptic Curve defined by y^2 = x^3 + z6 + over Finite Field in z6 of size 17^6 + To: Elliptic Curve defined by y^2 = x^3 + z6 + over Finite Field in z6 of size 17^6 sage: pi6hat.factors() (Frobenius endomorphism of degree 24137569 = 17^6: - From: Elliptic Curve defined by y^2 = x^3 + z6 over Finite Field in z6 of size 17^6 - To: Elliptic Curve defined by y^2 = x^3 + z6 over Finite Field in z6 of size 17^6, - Elliptic-curve endomorphism of Elliptic Curve defined by y^2 = x^3 + z6 over Finite Field in z6 of size 17^6 + From: Elliptic Curve defined by y^2 = x^3 + z6 + over Finite Field in z6 of size 17^6 + To: Elliptic Curve defined by y^2 = x^3 + z6 + over Finite Field in z6 of size 17^6, + Elliptic-curve endomorphism of + Elliptic Curve defined by y^2 = x^3 + z6 over Finite Field in z6 of size 17^6 Via: (u,r,s,t) = (2*z6^5 + 10*z6^3 + z6^2 + 8, 0, 0, 0)) diff --git a/src/sage/schemes/elliptic_curves/isogeny_class.py b/src/sage/schemes/elliptic_curves/isogeny_class.py index bf514741929..4e2c6ac2dc9 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_class.py +++ b/src/sage/schemes/elliptic_curves/isogeny_class.py @@ -660,8 +660,8 @@ class :class:`EllipticCurveIsogeny` allowed composition. In sage: E = EllipticCurve([1+i, -i, i, 1, 0]) sage: C = E.isogeny_class(); C Isogeny class of Elliptic Curve defined - by y^2 + (i+1)*x*y + i*y = x^3 + (-i)*x^2 + x - over Number Field in i with defining polynomial x^2 + 1 with i = 1*I + by y^2 + (i+1)*x*y + i*y = x^3 + (-i)*x^2 + x + over Number Field in i with defining polynomial x^2 + 1 with i = 1*I sage: len(C) 6 sage: C.matrix() diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py index 4ce59658677..1588770b73b 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py +++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py @@ -270,16 +270,16 @@ def isogenies_prime_degree_genus_0(E, l=None, minimal_models=True): sage: isogenies_prime_degree_genus_0(E) [Isogeny of degree 3 from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 + 300*x - 1000 over Rational Field - to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 5950*x - 182250 over Rational Field] + to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 5950*x - 182250 over Rational Field] sage: E = EllipticCurve('50a1') sage: isogenies_prime_degree_genus_0(E) [Isogeny of degree 3 from Elliptic Curve defined by y^2 + x*y + y = x^3 - x - 2 over Rational Field - to Elliptic Curve defined by y^2 + x*y + y = x^3 - 126*x - 552 over Rational Field, + to Elliptic Curve defined by y^2 + x*y + y = x^3 - 126*x - 552 over Rational Field, Isogeny of degree 5 from Elliptic Curve defined by y^2 + x*y + y = x^3 - x - 2 over Rational Field - to Elliptic Curve defined by y^2 + x*y + y = x^3 - 76*x + 298 over Rational Field] + to Elliptic Curve defined by y^2 + x*y + y = x^3 - 76*x + 298 over Rational Field] """ if l not in [2, 3, 5, 7, 13, None]: raise ValueError("%s is not a genus 0 prime."%l) @@ -596,7 +596,7 @@ def isogenies_sporadic_Q(E, l=None, minimal_models=True): sage: isogenies_sporadic_Q(E, 11) [Isogeny of degree 11 from Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 30*x - 76 over Rational Field - to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 305*x + 7888 over Rational Field] + to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 305*x + 7888 over Rational Field] sage: isogenies_sporadic_Q(E, 13) [] sage: isogenies_sporadic_Q(E, 17) @@ -604,17 +604,17 @@ def isogenies_sporadic_Q(E, l=None, minimal_models=True): sage: isogenies_sporadic_Q(E) [Isogeny of degree 11 from Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 30*x - 76 over Rational Field - to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 305*x + 7888 over Rational Field] + to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 305*x + 7888 over Rational Field] sage: E = EllipticCurve([1, 1, 0, -660, -7600]) sage: isogenies_sporadic_Q(E, 17) [Isogeny of degree 17 from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 660*x - 7600 over Rational Field - to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 878710*x + 316677750 over Rational Field] + to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 878710*x + 316677750 over Rational Field] sage: isogenies_sporadic_Q(E) [Isogeny of degree 17 from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 660*x - 7600 over Rational Field - to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 878710*x + 316677750 over Rational Field] + to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 878710*x + 316677750 over Rational Field] sage: isogenies_sporadic_Q(E, 11) [] @@ -624,11 +624,11 @@ def isogenies_sporadic_Q(E, l=None, minimal_models=True): sage: isogenies_sporadic_Q(E, 19) [Isogeny of degree 19 from Elliptic Curve defined by y^2 + y = x^3 - 1862*x - 30956 over Rational Field - to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 over Rational Field] + to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 over Rational Field] sage: isogenies_sporadic_Q(E) [Isogeny of degree 19 from Elliptic Curve defined by y^2 + y = x^3 - 1862*x - 30956 over Rational Field - to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 over Rational Field] + to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 over Rational Field] sage: E = EllipticCurve([0, -1, 0, -6288, 211072]) sage: E.conductor() @@ -636,7 +636,7 @@ def isogenies_sporadic_Q(E, l=None, minimal_models=True): sage: isogenies_sporadic_Q(E,37) [Isogeny of degree 37 from Elliptic Curve defined by y^2 = x^3 - x^2 - 6288*x + 211072 over Rational Field - to Elliptic Curve defined by y^2 = x^3 - x^2 - 163137088*x - 801950801728 over Rational Field] + to Elliptic Curve defined by y^2 = x^3 - x^2 - 163137088*x - 801950801728 over Rational Field] sage: E = EllipticCurve([1, 1, 0, -25178045, 48616918750]) sage: E.conductor() @@ -644,7 +644,7 @@ def isogenies_sporadic_Q(E, l=None, minimal_models=True): sage: isogenies_sporadic_Q(E,37) [Isogeny of degree 37 from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 25178045*x + 48616918750 over Rational Field - to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 970*x - 13075 over Rational Field] + to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 970*x - 13075 over Rational Field] sage: E = EllipticCurve([-3440, 77658]) sage: E.conductor() @@ -652,7 +652,7 @@ def isogenies_sporadic_Q(E, l=None, minimal_models=True): sage: isogenies_sporadic_Q(E,43) [Isogeny of degree 43 from Elliptic Curve defined by y^2 = x^3 - 3440*x + 77658 over Rational Field - to Elliptic Curve defined by y^2 = x^3 - 6360560*x - 6174354606 over Rational Field] + to Elliptic Curve defined by y^2 = x^3 - 6360560*x - 6174354606 over Rational Field] sage: E = EllipticCurve([-29480, -1948226]) sage: E.conductor() @@ -660,7 +660,7 @@ def isogenies_sporadic_Q(E, l=None, minimal_models=True): sage: isogenies_sporadic_Q(E,67) [Isogeny of degree 67 from Elliptic Curve defined by y^2 = x^3 - 29480*x - 1948226 over Rational Field - to Elliptic Curve defined by y^2 = x^3 - 132335720*x + 585954296438 over Rational Field] + to Elliptic Curve defined by y^2 = x^3 - 132335720*x + 585954296438 over Rational Field] sage: E = EllipticCurve([-34790720, -78984748304]) sage: E.conductor() @@ -668,7 +668,7 @@ def isogenies_sporadic_Q(E, l=None, minimal_models=True): sage: isogenies_sporadic_Q(E,163) [Isogeny of degree 163 from Elliptic Curve defined by y^2 = x^3 - 34790720*x - 78984748304 over Rational Field - to Elliptic Curve defined by y^2 = x^3 - 924354639680*x + 342062961763303088 over Rational Field] + to Elliptic Curve defined by y^2 = x^3 - 924354639680*x + 342062961763303088 over Rational Field] """ j = E.j_invariant() j = QQ(j) @@ -824,18 +824,34 @@ def isogenies_5_0(E, minimal_models=True): sage: E = EllipticCurve(GF(13^2,'a'),[0,-3]) sage: isogenies_5_0(E) - [Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + (4*a+6)*x + (2*a+10) over Finite Field in a of size 13^2, - Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + (12*a+5)*x + (2*a+10) over Finite Field in a of size 13^2, - Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + (10*a+2)*x + (2*a+10) over Finite Field in a of size 13^2, - Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + (3*a+12)*x + (11*a+12) over Finite Field in a of size 13^2, - Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + (a+4)*x + (11*a+12) over Finite Field in a of size 13^2, - Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + (9*a+10)*x + (11*a+12) over Finite Field in a of size 13^2] - - sage: K. = NumberField(x**6-320*x**3-320) + [Isogeny of degree 5 + from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 + to Elliptic Curve defined by y^2 = x^3 + (4*a+6)*x + (2*a+10) over Finite Field in a of size 13^2, + Isogeny of degree 5 + from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 + to Elliptic Curve defined by y^2 = x^3 + (12*a+5)*x + (2*a+10) over Finite Field in a of size 13^2, + Isogeny of degree 5 + from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 + to Elliptic Curve defined by y^2 = x^3 + (10*a+2)*x + (2*a+10) over Finite Field in a of size 13^2, + Isogeny of degree 5 + from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 + to Elliptic Curve defined by y^2 = x^3 + (3*a+12)*x + (11*a+12) over Finite Field in a of size 13^2, + Isogeny of degree 5 + from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 + to Elliptic Curve defined by y^2 = x^3 + (a+4)*x + (11*a+12) over Finite Field in a of size 13^2, + Isogeny of degree 5 + from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 + to Elliptic Curve defined by y^2 = x^3 + (9*a+10)*x + (11*a+12) over Finite Field in a of size 13^2] + + sage: K. = NumberField(x**6 - 320*x**3 - 320) sage: E = EllipticCurve(K,[0,0,1,0,0]) sage: isogenies_5_0(E) - [Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 over Number Field in a with defining polynomial x^6 - 320*x^3 - 320 to Elliptic Curve defined by y^2 + y = x^3 + (241565/32*a^5-362149/48*a^4+180281/24*a^3-9693307/4*a^2+14524871/6*a-7254985/3)*x + (1660391123/192*a^5-829315373/96*a^4+77680504/9*a^3-66622345345/24*a^2+33276655441/12*a-24931615912/9) over Number Field in a with defining polynomial x^6 - 320*x^3 - 320, - Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 over Number Field in a with defining polynomial x^6 - 320*x^3 - 320 to Elliptic Curve defined by y^2 + y = x^3 + (47519/32*a^5-72103/48*a^4+32939/24*a^3-1909753/4*a^2+2861549/6*a-1429675/3)*x + (-131678717/192*a^5+65520419/96*a^4-12594215/18*a^3+5280985135/24*a^2-2637787519/12*a+1976130088/9) over Number Field in a with defining polynomial x^6 - 320*x^3 - 320] + [Isogeny of degree 5 + from Elliptic Curve defined by y^2 + y = x^3 over Number Field in a with defining polynomial x^6 - 320*x^3 - 320 + to Elliptic Curve defined by y^2 + y = x^3 + (241565/32*a^5-362149/48*a^4+180281/24*a^3-9693307/4*a^2+14524871/6*a-7254985/3)*x + (1660391123/192*a^5-829315373/96*a^4+77680504/9*a^3-66622345345/24*a^2+33276655441/12*a-24931615912/9) over Number Field in a with defining polynomial x^6 - 320*x^3 - 320, + Isogeny of degree 5 + from Elliptic Curve defined by y^2 + y = x^3 over Number Field in a with defining polynomial x^6 - 320*x^3 - 320 + to Elliptic Curve defined by y^2 + y = x^3 + (47519/32*a^5-72103/48*a^4+32939/24*a^3-1909753/4*a^2+2861549/6*a-1429675/3)*x + (-131678717/192*a^5+65520419/96*a^4-12594215/18*a^3+5280985135/24*a^2-2637787519/12*a+1976130088/9) over Number Field in a with defining polynomial x^6 - 320*x^3 - 320] """ F = E.base_field() if E.j_invariant() != 0: @@ -898,29 +914,41 @@ def isogenies_5_1728(E, minimal_models=True): sage: E = EllipticCurve(GF(13),[11,0]) sage: isogenies_5_1728(E) - [Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 11*x over Finite Field of size 13 to Elliptic Curve defined by y^2 = x^3 + 11*x over Finite Field of size 13, - Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 11*x over Finite Field of size 13 to Elliptic Curve defined by y^2 = x^3 + 11*x over Finite Field of size 13] + [Isogeny of degree 5 + from Elliptic Curve defined by y^2 = x^3 + 11*x over Finite Field of size 13 + to Elliptic Curve defined by y^2 = x^3 + 11*x over Finite Field of size 13, + Isogeny of degree 5 + from Elliptic Curve defined by y^2 = x^3 + 11*x over Finite Field of size 13 + to Elliptic Curve defined by y^2 = x^3 + 11*x over Finite Field of size 13] An example of endomorphisms of degree 5:: sage: K. = QuadraticField(-1) sage: E = EllipticCurve(K,[0,0,0,1,0]) sage: isogenies_5_1728(E) - [Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I to Elliptic Curve defined by y^2 = x^3 + x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I, - Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I to Elliptic Curve defined by y^2 = x^3 + x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I] + [Isogeny of degree 5 + from Elliptic Curve defined by y^2 = x^3 + x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I + to Elliptic Curve defined by y^2 = x^3 + x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I, + Isogeny of degree 5 + from Elliptic Curve defined by y^2 = x^3 + x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I + to Elliptic Curve defined by y^2 = x^3 + x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I] sage: _[0].rational_maps() (((4/25*i + 3/25)*x^5 + (4/5*i - 2/5)*x^3 - x)/(x^4 + (-4/5*i + 2/5)*x^2 + (-4/25*i - 3/25)), ((11/125*i + 2/125)*x^6*y + (-23/125*i + 64/125)*x^4*y + (141/125*i + 162/125)*x^2*y + (3/25*i - 4/25)*y)/(x^6 + (-6/5*i + 3/5)*x^4 + (-12/25*i - 9/25)*x^2 + (2/125*i - 11/125))) An example of 5-isogenies over a number field:: - sage: K. = NumberField(x**4+20*x**2-80) - sage: K(5).is_square() #necessary but not sufficient! + sage: K. = NumberField(x**4 + 20*x**2 - 80) + sage: K(5).is_square() # necessary but not sufficient! True sage: E = EllipticCurve(K,[0,0,0,1,0]) sage: isogenies_5_1728(E) - [Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + x over Number Field in a with defining polynomial x^4 + 20*x^2 - 80 to Elliptic Curve defined by y^2 = x^3 + (-753/4*a^2-4399)*x + (2779*a^3+65072*a) over Number Field in a with defining polynomial x^4 + 20*x^2 - 80, - Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + x over Number Field in a with defining polynomial x^4 + 20*x^2 - 80 to Elliptic Curve defined by y^2 = x^3 + (-753/4*a^2-4399)*x + (-2779*a^3-65072*a) over Number Field in a with defining polynomial x^4 + 20*x^2 - 80] + [Isogeny of degree 5 + from Elliptic Curve defined by y^2 = x^3 + x over Number Field in a with defining polynomial x^4 + 20*x^2 - 80 + to Elliptic Curve defined by y^2 = x^3 + (-753/4*a^2-4399)*x + (2779*a^3+65072*a) over Number Field in a with defining polynomial x^4 + 20*x^2 - 80, + Isogeny of degree 5 + from Elliptic Curve defined by y^2 = x^3 + x over Number Field in a with defining polynomial x^4 + 20*x^2 - 80 + to Elliptic Curve defined by y^2 = x^3 + (-753/4*a^2-4399)*x + (-2779*a^3-65072*a) over Number Field in a with defining polynomial x^4 + 20*x^2 - 80] See :trac:`19840`:: @@ -1001,27 +1029,45 @@ def isogenies_7_0(E, minimal_models=True): sage: K. = QuadraticField(-3) sage: E = EllipticCurve(K, [0,1]) sage: isogenies_7_0(E) - [Isogeny of degree 7 from Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I to Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I, - Isogeny of degree 7 from Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I to Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I] + [Isogeny of degree 7 + from Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I + to Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I, + Isogeny of degree 7 + from Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I + to Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I] sage: E = EllipticCurve(GF(13^2,'a'),[0,-3]) sage: isogenies_7_0(E) - [Isogeny of degree 7 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2, Isogeny of degree 7 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2] + [Isogeny of degree 7 + from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 + to Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2, + Isogeny of degree 7 + from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 + to Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2] Now some examples of 7-isogenies which are not endomorphisms:: sage: K = GF(101) sage: E = EllipticCurve(K, [0,1]) sage: isogenies_7_0(E) - [Isogeny of degree 7 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 101 to Elliptic Curve defined by y^2 = x^3 + 55*x + 100 over Finite Field of size 101, Isogeny of degree 7 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 101 to Elliptic Curve defined by y^2 = x^3 + 83*x + 26 over Finite Field of size 101] + [Isogeny of degree 7 + from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 101 + to Elliptic Curve defined by y^2 = x^3 + 55*x + 100 over Finite Field of size 101, + Isogeny of degree 7 + from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 101 + to Elliptic Curve defined by y^2 = x^3 + 83*x + 26 over Finite Field of size 101] Examples over a number field:: sage: from sage.schemes.elliptic_curves.isogeny_small_degree import isogenies_7_0 sage: E = EllipticCurve('27a1').change_ring(QuadraticField(-3,'r')) sage: isogenies_7_0(E) - [Isogeny of degree 7 from Elliptic Curve defined by y^2 + y = x^3 + (-7) over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I to Elliptic Curve defined by y^2 + y = x^3 + (-7) over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I, - Isogeny of degree 7 from Elliptic Curve defined by y^2 + y = x^3 + (-7) over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I to Elliptic Curve defined by y^2 + y = x^3 + (-7) over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I] + [Isogeny of degree 7 + from Elliptic Curve defined by y^2 + y = x^3 + (-7) over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I + to Elliptic Curve defined by y^2 + y = x^3 + (-7) over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I, + Isogeny of degree 7 + from Elliptic Curve defined by y^2 + y = x^3 + (-7) over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I + to Elliptic Curve defined by y^2 + y = x^3 + (-7) over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I] sage: K. = NumberField(x^6 + 1512*x^3 - 21168) sage: E = EllipticCurve(K, [0,1]) @@ -1106,8 +1152,12 @@ def isogenies_7_1728(E, minimal_models=True): sage: from sage.schemes.elliptic_curves.isogeny_small_degree import isogenies_7_1728 sage: E = EllipticCurve(GF(47), [1, 0]) sage: isogenies_7_1728(E) - [Isogeny of degree 7 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 47 to Elliptic Curve defined by y^2 = x^3 + 26 over Finite Field of size 47, - Isogeny of degree 7 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 47 to Elliptic Curve defined by y^2 = x^3 + 21 over Finite Field of size 47] + [Isogeny of degree 7 + from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 47 + to Elliptic Curve defined by y^2 = x^3 + 26 over Finite Field of size 47, + Isogeny of degree 7 + from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 47 + to Elliptic Curve defined by y^2 = x^3 + 21 over Finite Field of size 47] An example in characteristic 53 (for which an earlier implementation did not work):: @@ -1117,7 +1167,9 @@ def isogenies_7_1728(E, minimal_models=True): [] sage: E = EllipticCurve(GF(53^2,'a'), [1, 0]) sage: [iso.codomain().ainvs() for iso in isogenies_7_1728(E)] - [(0, 0, 0, 36, 19*a + 15), (0, 0, 0, 36, 34*a + 38), (0, 0, 0, 33, 39*a + 28), (0, 0, 0, 33, 14*a + 25), (0, 0, 0, 19, 45*a + 16), (0, 0, 0, 19, 8*a + 37), (0, 0, 0, 3, 45*a + 16), (0, 0, 0, 3, 8*a + 37)] + [(0, 0, 0, 36, 19*a + 15), (0, 0, 0, 36, 34*a + 38), (0, 0, 0, 33, 39*a + 28), + (0, 0, 0, 33, 14*a + 25), (0, 0, 0, 19, 45*a + 16), (0, 0, 0, 19, 8*a + 37), + (0, 0, 0, 3, 45*a + 16), (0, 0, 0, 3, 8*a + 37)] :: @@ -1198,12 +1250,18 @@ def isogenies_13_0(E, minimal_models=True): sage: K. = QuadraticField(-3) sage: E = EllipticCurve(K, [0, r]); E - Elliptic Curve defined by y^2 = x^3 + r over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I + Elliptic Curve defined by y^2 = x^3 + r over Number Field in r + with defining polynomial x^2 + 3 with r = 1.732050807568878?*I sage: isogenies_13_0(E) - [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + r over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I to Elliptic Curve defined by y^2 = x^3 + r over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I, - Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + r over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I to Elliptic Curve defined by y^2 = x^3 + r over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I] + [Isogeny of degree 13 + from Elliptic Curve defined by y^2 = x^3 + r over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I + to Elliptic Curve defined by y^2 = x^3 + r over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I, + Isogeny of degree 13 + from Elliptic Curve defined by y^2 = x^3 + r over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I + to Elliptic Curve defined by y^2 = x^3 + r over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I] sage: isogenies_13_0(E)[0].rational_maps() - (((7/338*r + 23/338)*x^13 + (-164/13*r - 420/13)*x^10 + (720/13*r + 3168/13)*x^7 + (3840/13*r - 576/13)*x^4 + (4608/13*r + 2304/13)*x)/(x^12 + (4*r + 36)*x^9 + (1080/13*r + 3816/13)*x^6 + (2112/13*r - 5184/13)*x^3 + (-17280/169*r - 1152/169)), ((18/2197*r + 35/2197)*x^18*y + (23142/2197*r + 35478/2197)*x^15*y + (-1127520/2197*r - 1559664/2197)*x^12*y + (-87744/2197*r + 5992704/2197)*x^9*y + (-6625152/2197*r - 9085824/2197)*x^6*y + (-28919808/2197*r - 2239488/2197)*x^3*y + (-1990656/2197*r - 3870720/2197)*y)/(x^18 + (6*r + 54)*x^15 + (3024/13*r + 11808/13)*x^12 + (31296/13*r + 51840/13)*x^9 + (487296/169*r - 2070144/169)*x^6 + (-940032/169*r + 248832/169)*x^3 + (1990656/2197*r + 3870720/2197))) + (((7/338*r + 23/338)*x^13 + (-164/13*r - 420/13)*x^10 + (720/13*r + 3168/13)*x^7 + (3840/13*r - 576/13)*x^4 + (4608/13*r + 2304/13)*x)/(x^12 + (4*r + 36)*x^9 + (1080/13*r + 3816/13)*x^6 + (2112/13*r - 5184/13)*x^3 + (-17280/169*r - 1152/169)), + ((18/2197*r + 35/2197)*x^18*y + (23142/2197*r + 35478/2197)*x^15*y + (-1127520/2197*r - 1559664/2197)*x^12*y + (-87744/2197*r + 5992704/2197)*x^9*y + (-6625152/2197*r - 9085824/2197)*x^6*y + (-28919808/2197*r - 2239488/2197)*x^3*y + (-1990656/2197*r - 3870720/2197)*y)/(x^18 + (6*r + 54)*x^15 + (3024/13*r + 11808/13)*x^12 + (31296/13*r + 51840/13)*x^9 + (487296/169*r - 2070144/169)*x^6 + (-940032/169*r + 248832/169)*x^3 + (1990656/2197*r + 3870720/2197))) An example of endomorphisms over a finite field:: @@ -1211,18 +1269,27 @@ def isogenies_13_0(E, minimal_models=True): sage: E = EllipticCurve(j=K(0)); E Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2 sage: isogenies_13_0(E) - [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2 to Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2, - Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2 to Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2] + [Isogeny of degree 13 + from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2 + to Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2, + Isogeny of degree 13 + from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2 + to Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2] sage: isogenies_13_0(E)[0].rational_maps() - ((6*x^13 - 6*x^10 - 3*x^7 + 6*x^4 + x)/(x^12 - 5*x^9 - 9*x^6 - 7*x^3 + 5), (-8*x^18*y - 9*x^15*y + 9*x^12*y - 5*x^9*y + 5*x^6*y - 7*x^3*y + 7*y)/(x^18 + 2*x^15 + 3*x^12 - x^9 + 8*x^6 - 9*x^3 + 7)) + ((6*x^13 - 6*x^10 - 3*x^7 + 6*x^4 + x)/(x^12 - 5*x^9 - 9*x^6 - 7*x^3 + 5), + (-8*x^18*y - 9*x^15*y + 9*x^12*y - 5*x^9*y + 5*x^6*y - 7*x^3*y + 7*y)/(x^18 + 2*x^15 + 3*x^12 - x^9 + 8*x^6 - 9*x^3 + 7)) A previous implementation did not work in some characteristics:: sage: K = GF(29) sage: E = EllipticCurve(j=K(0)) sage: isogenies_13_0(E) - [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 29 to Elliptic Curve defined by y^2 = x^3 + 26*x + 12 over Finite Field of size 29, - Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 29 to Elliptic Curve defined by y^2 = x^3 + 16*x + 28 over Finite Field of size 29] + [Isogeny of degree 13 + from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 29 + to Elliptic Curve defined by y^2 = x^3 + 26*x + 12 over Finite Field of size 29, + Isogeny of degree 13 + from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 29 + to Elliptic Curve defined by y^2 = x^3 + 16*x + 28 over Finite Field of size 29] :: @@ -1318,8 +1385,12 @@ def isogenies_13_1728(E, minimal_models=True): sage: E = EllipticCurve([0,0,0,i,0]); E.ainvs() (0, 0, 0, i, 0) sage: isogenies_13_1728(E) - [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + i*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I to Elliptic Curve defined by y^2 = x^3 + i*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I, - Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + i*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I to Elliptic Curve defined by y^2 = x^3 + i*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I] + [Isogeny of degree 13 + from Elliptic Curve defined by y^2 = x^3 + i*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I + to Elliptic Curve defined by y^2 = x^3 + i*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I, + Isogeny of degree 13 + from Elliptic Curve defined by y^2 = x^3 + i*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I + to Elliptic Curve defined by y^2 = x^3 + i*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I] :: @@ -1332,16 +1403,24 @@ def isogenies_13_1728(E, minimal_models=True): sage: E = EllipticCurve(K, [0,0,0,5,0]); E.ainvs() (0, 0, 0, 5, 0) sage: isogenies_13_1728(E) - [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 89 to Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 89, - Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 89 to Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 89] + [Isogeny of degree 13 + from Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 89 + to Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 89, + Isogeny of degree 13 + from Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 89 + to Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 89] :: sage: K = GF(23) sage: E = EllipticCurve(K, [1,0]) sage: isogenies_13_1728(E) - [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 23 to Elliptic Curve defined by y^2 = x^3 + 16 over Finite Field of size 23, - Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 23 to Elliptic Curve defined by y^2 = x^3 + 7 over Finite Field of size 23] + [Isogeny of degree 13 + from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 23 + to Elliptic Curve defined by y^2 = x^3 + 16 over Finite Field of size 23, + Isogeny of degree 13 + from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 23 + to Elliptic Curve defined by y^2 = x^3 + 7 over Finite Field of size 23] :: @@ -1351,15 +1430,15 @@ def isogenies_13_1728(E, minimal_models=True): sage: E = EllipticCurve(K, [1,0]) sage: [phi.codomain().ainvs() for phi in isogenies_13_1728(E)] # long time (3s) [(0, - 0, - 0, - -4225010072113/3063768069807341568*a^10 - 24841071989413/15957125363579904*a^8 + 11179537789374271/21276167151439872*a^6 - 407474562289492049/47871376090739712*a^4 + 1608052769560747/4522994717568*a^2 + 7786720245212809/36937790193472, - -363594277511/574456513088876544*a^11 - 7213386922793/2991961005671232*a^9 - 2810970361185589/1329760446964992*a^7 + 281503836888046601/8975883017013696*a^5 - 1287313166530075/848061509544*a^3 + 9768837984886039/6925835661276*a), - (0, - 0, - 0, - -4225010072113/3063768069807341568*a^10 - 24841071989413/15957125363579904*a^8 + 11179537789374271/21276167151439872*a^6 - 407474562289492049/47871376090739712*a^4 + 1608052769560747/4522994717568*a^2 + 7786720245212809/36937790193472, - 363594277511/574456513088876544*a^11 + 7213386922793/2991961005671232*a^9 + 2810970361185589/1329760446964992*a^7 - 281503836888046601/8975883017013696*a^5 + 1287313166530075/848061509544*a^3 - 9768837984886039/6925835661276*a)] + 0, + 0, + -4225010072113/3063768069807341568*a^10 - 24841071989413/15957125363579904*a^8 + 11179537789374271/21276167151439872*a^6 - 407474562289492049/47871376090739712*a^4 + 1608052769560747/4522994717568*a^2 + 7786720245212809/36937790193472, + -363594277511/574456513088876544*a^11 - 7213386922793/2991961005671232*a^9 - 2810970361185589/1329760446964992*a^7 + 281503836888046601/8975883017013696*a^5 - 1287313166530075/848061509544*a^3 + 9768837984886039/6925835661276*a), + (0, + 0, + 0, + -4225010072113/3063768069807341568*a^10 - 24841071989413/15957125363579904*a^8 + 11179537789374271/21276167151439872*a^6 - 407474562289492049/47871376090739712*a^4 + 1608052769560747/4522994717568*a^2 + 7786720245212809/36937790193472, + 363594277511/574456513088876544*a^11 + 7213386922793/2991961005671232*a^9 + 2810970361185589/1329760446964992*a^7 - 281503836888046601/8975883017013696*a^5 + 1287313166530075/848061509544*a^3 - 9768837984886039/6925835661276*a)] """ if E.j_invariant()!=1728: raise ValueError("j-invariant must be 1728.") @@ -1657,21 +1736,29 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True): sage: E = EllipticCurve('121a1') sage: isogenies_prime_degree_genus_plus_0(E, 11) - [Isogeny of degree 11 from Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 30*x - 76 over Rational Field to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 305*x + 7888 over Rational Field] + [Isogeny of degree 11 + from Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 30*x - 76 over Rational Field + to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 305*x + 7888 over Rational Field] sage: E = EllipticCurve([1, 1, 0, -660, -7600]) sage: isogenies_prime_degree_genus_plus_0(E, 17) - [Isogeny of degree 17 from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 660*x - 7600 over Rational Field to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 878710*x + 316677750 over Rational Field] + [Isogeny of degree 17 + from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 660*x - 7600 over Rational Field + to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 878710*x + 316677750 over Rational Field] sage: E = EllipticCurve([0, 0, 1, -1862, -30956]) sage: isogenies_prime_degree_genus_plus_0(E, 19) - [Isogeny of degree 19 from Elliptic Curve defined by y^2 + y = x^3 - 1862*x - 30956 over Rational Field to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 over Rational Field] + [Isogeny of degree 19 + from Elliptic Curve defined by y^2 + y = x^3 - 1862*x - 30956 over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 over Rational Field] sage: K = QuadraticField(-295,'a') sage: a = K.gen() sage: E = EllipticCurve_from_j(-484650135/16777216*a + 4549855725/16777216) sage: isogenies_prime_degree_genus_plus_0(E, 23) - [Isogeny of degree 23 from Elliptic Curve defined by y^2 = x^3 + (-14460494784192904095/140737488355328*a+270742665778826768325/140737488355328)*x + (37035998788154488846811217135/590295810358705651712*a-1447451882571839266752561148725/590295810358705651712) over Number Field in a with defining polynomial x^2 + 295 with a = 17.17556403731767?*I to Elliptic Curve defined by y^2 = x^3 + (-5130542435555445498495/140737488355328*a+173233955029127361005925/140737488355328)*x + (-1104699335561165691575396879260545/590295810358705651712*a+3169785826904210171629535101419675/590295810358705651712) over Number Field in a with defining polynomial x^2 + 295 with a = 17.17556403731767?*I] + [Isogeny of degree 23 + from Elliptic Curve defined by y^2 = x^3 + (-14460494784192904095/140737488355328*a+270742665778826768325/140737488355328)*x + (37035998788154488846811217135/590295810358705651712*a-1447451882571839266752561148725/590295810358705651712) over Number Field in a with defining polynomial x^2 + 295 with a = 17.17556403731767?*I + to Elliptic Curve defined by y^2 = x^3 + (-5130542435555445498495/140737488355328*a+173233955029127361005925/140737488355328)*x + (-1104699335561165691575396879260545/590295810358705651712*a+3169785826904210171629535101419675/590295810358705651712) over Number Field in a with defining polynomial x^2 + 295 with a = 17.17556403731767?*I] sage: K = QuadraticField(-199,'a') sage: a = K.gen() @@ -1683,24 +1770,34 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True): sage: a = K.gen() sage: E = EllipticCurve_from_j(208438034112000*a - 3315409892960000) sage: isogenies_prime_degree_genus_plus_0(E, 31) - [Isogeny of degree 31 from Elliptic Curve defined by y^2 = x^3 + (4146345122185433034677956608000*a-65951656549965037259634800640000)*x + (-18329111516954473474583425393698245080252416000*a+291542366110383928366510368064204147260129280000) over Number Field in a with defining polynomial x^2 - 253 with a = 15.905973720586867? to Elliptic Curve defined by y^2 = x^3 + (200339763852548615776123686912000*a-3186599019027216904280948275200000)*x + (7443671791411479629112717260182286294850207744000*a-118398847898864757209685951728838895495168655360000) over Number Field in a with defining polynomial x^2 - 253 with a = 15.905973720586867?] + [Isogeny of degree 31 + from Elliptic Curve defined by y^2 = x^3 + (4146345122185433034677956608000*a-65951656549965037259634800640000)*x + (-18329111516954473474583425393698245080252416000*a+291542366110383928366510368064204147260129280000) over Number Field in a with defining polynomial x^2 - 253 with a = 15.905973720586867? + to Elliptic Curve defined by y^2 = x^3 + (200339763852548615776123686912000*a-3186599019027216904280948275200000)*x + (7443671791411479629112717260182286294850207744000*a-118398847898864757209685951728838895495168655360000) over Number Field in a with defining polynomial x^2 - 253 with a = 15.905973720586867?] sage: E = EllipticCurve_from_j(GF(5)(1)) sage: isogenies_prime_degree_genus_plus_0(E, 41) - [Isogeny of degree 41 from Elliptic Curve defined by y^2 = x^3 + x + 2 over Finite Field of size 5 to Elliptic Curve defined by y^2 = x^3 + x + 3 over Finite Field of size 5, - Isogeny of degree 41 from Elliptic Curve defined by y^2 = x^3 + x + 2 over Finite Field of size 5 to Elliptic Curve defined by y^2 = x^3 + x + 3 over Finite Field of size 5] + [Isogeny of degree 41 + from Elliptic Curve defined by y^2 = x^3 + x + 2 over Finite Field of size 5 + to Elliptic Curve defined by y^2 = x^3 + x + 3 over Finite Field of size 5, + Isogeny of degree 41 + from Elliptic Curve defined by y^2 = x^3 + x + 2 over Finite Field of size 5 + to Elliptic Curve defined by y^2 = x^3 + x + 3 over Finite Field of size 5] sage: K = QuadraticField(5,'a') sage: a = K.gen() sage: E = EllipticCurve_from_j(184068066743177379840*a - 411588709724712960000) sage: isogenies_prime_degree_genus_plus_0(E, 47) # long time (2s) - [Isogeny of degree 47 from Elliptic Curve defined by y^2 = x^3 + (454562028554080355857852049849975895490560*a-1016431595837124114668689286176511361024000)*x + (-249456798429896080881440540950393713303830363999480904280965120*a+557802358738710443451273320227578156598454035482869042774016000) over Number Field in a with defining polynomial x^2 - 5 with a = 2.236067977499790? to Elliptic Curve defined by y^2 = x^3 + (39533118442361013730577638493616965245992960*a-88398740199669828340617478832005245173760000)*x + (214030321479466610282320528611562368963830105830555363061803253760*a-478586348074220699687616322532666163722004497458452316582576128000) over Number Field in a with defining polynomial x^2 - 5 with a = 2.236067977499790?] + [Isogeny of degree 47 + from Elliptic Curve defined by y^2 = x^3 + (454562028554080355857852049849975895490560*a-1016431595837124114668689286176511361024000)*x + (-249456798429896080881440540950393713303830363999480904280965120*a+557802358738710443451273320227578156598454035482869042774016000) over Number Field in a with defining polynomial x^2 - 5 with a = 2.236067977499790? + to Elliptic Curve defined by y^2 = x^3 + (39533118442361013730577638493616965245992960*a-88398740199669828340617478832005245173760000)*x + (214030321479466610282320528611562368963830105830555363061803253760*a-478586348074220699687616322532666163722004497458452316582576128000) over Number Field in a with defining polynomial x^2 - 5 with a = 2.236067977499790?] sage: K = QuadraticField(-66827,'a') sage: a = K.gen() sage: E = EllipticCurve_from_j(-98669236224000*a + 4401720074240000) sage: isogenies_prime_degree_genus_plus_0(E, 59) # long time (5s) - [Isogeny of degree 59 from Elliptic Curve defined by y^2 = x^3 + (2605886146782144762297974784000*a+1893681048912773634944634716160000)*x + (-116918454256410782232296183198067568744071168000*a+17012043538294664027185882358514011304812871680000) over Number Field in a with defining polynomial x^2 + 66827 with a = 258.5091874576221?*I to Elliptic Curve defined by y^2 = x^3 + (-19387084027159786821400775098368000*a-4882059104868154225052787156713472000)*x + (-25659862010101415428713331477227179429538847260672000*a-2596038148441293485938798119003462972840818381946880000) over Number Field in a with defining polynomial x^2 + 66827 with a = 258.5091874576221?*I] + [Isogeny of degree 59 + from Elliptic Curve defined by y^2 = x^3 + (2605886146782144762297974784000*a+1893681048912773634944634716160000)*x + (-116918454256410782232296183198067568744071168000*a+17012043538294664027185882358514011304812871680000) over Number Field in a with defining polynomial x^2 + 66827 with a = 258.5091874576221?*I + to Elliptic Curve defined by y^2 = x^3 + (-19387084027159786821400775098368000*a-4882059104868154225052787156713472000)*x + (-25659862010101415428713331477227179429538847260672000*a-2596038148441293485938798119003462972840818381946880000) over Number Field in a with defining polynomial x^2 + 66827 with a = 258.5091874576221?*I] sage: E = EllipticCurve_from_j(GF(13)(5)) sage: isogenies_prime_degree_genus_plus_0(E, 71) @@ -1710,11 +1807,11 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True): sage: E = EllipticCurve(GF(13),[0,1,1,1,0]) sage: isogenies_prime_degree_genus_plus_0(E) [Isogeny of degree 17 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 10*x + 1 over Finite Field of size 13, - Isogeny of degree 17 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 12*x + 4 over Finite Field of size 13, - Isogeny of degree 29 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 12*x + 6 over Finite Field of size 13, - Isogeny of degree 29 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 5*x + 6 over Finite Field of size 13, - Isogeny of degree 41 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 12*x + 4 over Finite Field of size 13, - Isogeny of degree 41 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 5*x + 6 over Finite Field of size 13] + Isogeny of degree 17 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 12*x + 4 over Finite Field of size 13, + Isogeny of degree 29 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 12*x + 6 over Finite Field of size 13, + Isogeny of degree 29 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 5*x + 6 over Finite Field of size 13, + Isogeny of degree 41 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 12*x + 4 over Finite Field of size 13, + Isogeny of degree 41 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 5*x + 6 over Finite Field of size 13] """ if l is None: return sum([isogenies_prime_degree_genus_plus_0(E, ell, minimal_models=minimal_models) @@ -1801,8 +1898,8 @@ def isogenies_prime_degree_genus_plus_0_j0(E, l, minimal_models=True): sage: from sage.schemes.elliptic_curves.isogeny_small_degree import isogenies_prime_degree_genus_plus_0_j0 sage: u = polygen(QQ) - sage: K. = NumberField(u^4+228*u^3+486*u^2-540*u+225) - sage: E = EllipticCurve(K,[0,-121/5*a^3-20691/5*a^2-29403/5*a+3267]) + sage: K. = NumberField(u^4 + 228*u^3 + 486*u^2 - 540*u + 225) + sage: E = EllipticCurve(K, [0,-121/5*a^3-20691/5*a^2-29403/5*a+3267]) sage: isogenies_prime_degree_genus_plus_0_j0(E,11) [Isogeny of degree 11 from Elliptic Curve defined by y^2 = x^3 + (-121/5*a^3-20691/5*a^2-29403/5*a+3267) over Number Field in a with defining polynomial x^4 + 228*x^3 + 486*x^2 - 540*x + 225 to Elliptic Curve defined by y^2 = x^3 + (-44286*a^2+178596*a-32670)*x + (-17863351/5*a^3+125072739/5*a^2-74353653/5*a-682803) over Number Field in a with defining polynomial x^4 + 228*x^3 + 486*x^2 - 540*x + 225, Isogeny of degree 11 from Elliptic Curve defined by y^2 = x^3 + (-121/5*a^3-20691/5*a^2-29403/5*a+3267) over Number Field in a with defining polynomial x^4 + 228*x^3 + 486*x^2 - 540*x + 225 to Elliptic Curve defined by y^2 = x^3 + (-3267*a^3-740157*a^2+600039*a-277695)*x + (-17863351/5*a^3-4171554981/5*a^2+3769467867/5*a-272366523) over Number Field in a with defining polynomial x^4 + 228*x^3 + 486*x^2 - 540*x + 225] @@ -1890,15 +1987,23 @@ def isogenies_prime_degree_genus_plus_0_j1728(E, l, minimal_models=True): sage: u = polygen(QQ) sage: K. = NumberField(u^6 - 522*u^5 - 10017*u^4 + 2484*u^3 - 5265*u^2 + 12150*u - 5103) - sage: E = EllipticCurve(K,[-75295/1335852*a^5+13066735/445284*a^4+44903485/74214*a^3+17086861/24738*a^2+11373021/16492*a-1246245/2356,0]) + sage: E = EllipticCurve(K, [-75295/1335852*a^5+13066735/445284*a^4+44903485/74214*a^3+17086861/24738*a^2+11373021/16492*a-1246245/2356,0]) sage: isogenies_prime_degree_genus_plus_0_j1728(E,11) - [Isogeny of degree 11 from Elliptic Curve defined by y^2 = x^3 + (-75295/1335852*a^5+13066735/445284*a^4+44903485/74214*a^3+17086861/24738*a^2+11373021/16492*a-1246245/2356)*x over Number Field in a with defining polynomial x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103 to Elliptic Curve defined by y^2 = x^3 + (9110695/1335852*a^5-1581074935/445284*a^4-5433321685/74214*a^3-3163057249/24738*a^2+1569269691/16492*a+73825125/2356)*x + (-3540460*a^3+30522492*a^2-7043652*a-5031180) over Number Field in a with defining polynomial x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103, - Isogeny of degree 11 from Elliptic Curve defined by y^2 = x^3 + (-75295/1335852*a^5+13066735/445284*a^4+44903485/74214*a^3+17086861/24738*a^2+11373021/16492*a-1246245/2356)*x over Number Field in a with defining polynomial x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103 to Elliptic Curve defined by y^2 = x^3 + (9110695/1335852*a^5-1581074935/445284*a^4-5433321685/74214*a^3-3163057249/24738*a^2+1569269691/16492*a+73825125/2356)*x + (3540460*a^3-30522492*a^2+7043652*a+5031180) over Number Field in a with defining polynomial x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103] + [Isogeny of degree 11 + from Elliptic Curve defined by y^2 = x^3 + (-75295/1335852*a^5+13066735/445284*a^4+44903485/74214*a^3+17086861/24738*a^2+11373021/16492*a-1246245/2356)*x over Number Field in a with defining polynomial x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103 + to Elliptic Curve defined by y^2 = x^3 + (9110695/1335852*a^5-1581074935/445284*a^4-5433321685/74214*a^3-3163057249/24738*a^2+1569269691/16492*a+73825125/2356)*x + (-3540460*a^3+30522492*a^2-7043652*a-5031180) over Number Field in a with defining polynomial x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103, + Isogeny of degree 11 + from Elliptic Curve defined by y^2 = x^3 + (-75295/1335852*a^5+13066735/445284*a^4+44903485/74214*a^3+17086861/24738*a^2+11373021/16492*a-1246245/2356)*x over Number Field in a with defining polynomial x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103 + to Elliptic Curve defined by y^2 = x^3 + (9110695/1335852*a^5-1581074935/445284*a^4-5433321685/74214*a^3-3163057249/24738*a^2+1569269691/16492*a+73825125/2356)*x + (3540460*a^3-30522492*a^2+7043652*a+5031180) over Number Field in a with defining polynomial x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103] sage: i = QuadraticField(-1,'i').gen() - sage: E = EllipticCurve([-1-2*i,0]) - sage: isogenies_prime_degree_genus_plus_0_j1728(E,17) - [Isogeny of degree 17 from Elliptic Curve defined by y^2 = x^3 + (-2*i-1)*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I to Elliptic Curve defined by y^2 = x^3 + (-82*i-641)*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I, - Isogeny of degree 17 from Elliptic Curve defined by y^2 = x^3 + (-2*i-1)*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I to Elliptic Curve defined by y^2 = x^3 + (-562*i+319)*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I] + sage: E = EllipticCurve([-1-2*i, 0]) + sage: isogenies_prime_degree_genus_plus_0_j1728(E, 17) + [Isogeny of degree 17 + from Elliptic Curve defined by y^2 = x^3 + (-2*i-1)*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I + to Elliptic Curve defined by y^2 = x^3 + (-82*i-641)*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I, + Isogeny of degree 17 + from Elliptic Curve defined by y^2 = x^3 + (-2*i-1)*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I + to Elliptic Curve defined by y^2 = x^3 + (-562*i+319)*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I] sage: Emin = E.global_minimal_model() sage: [(p,len(isogenies_prime_degree_genus_plus_0_j1728(Emin,p))) for p in [17, 29, 41]] [(17, 2), (29, 2), (41, 2)] @@ -2024,9 +2129,9 @@ def is_kernel_polynomial(E, m, f): sage: from sage.schemes.elliptic_curves.isogeny_small_degree import is_kernel_polynomial sage: E = EllipticCurve([0, -1, 1, -10, -20]) sage: x = polygen(QQ) - sage: is_kernel_polynomial(E,5,x^2 + x - 29/5) + sage: is_kernel_polynomial(E, 5, x^2 + x - 29/5) True - sage: is_kernel_polynomial(E,5,(x - 16) * (x - 5)) + sage: is_kernel_polynomial(E, 5, (x - 16) * (x - 5)) True An example from [KT2013]_, where the 13-division polynomial splits @@ -2034,12 +2139,12 @@ def is_kernel_polynomial(E, m, f): kernel polynomial for a 13-isogeny:: sage: F = GF(3) - sage: E = EllipticCurve(F,[0,0,0,-1,0]) + sage: E = EllipticCurve(F, [0,0,0,-1,0]) sage: f13 = E.division_polynomial(13) - sage: factors = [f for f,e in f13.factor()] + sage: factors = [f for f, e in f13.factor()] sage: all(f.degree() == 6 for f in factors) True - sage: [is_kernel_polynomial(E,13,f) for f in factors] + sage: [is_kernel_polynomial(E, 13, f) for f in factors] [True, True, False, @@ -2065,7 +2170,7 @@ def is_kernel_polynomial(E, m, f): x^3 + (7*z2 + 11)*x^2 + (25*z2 + 33)*x + 25*z2 sage: f.divides(psi7) True - sage: is_kernel_polynomial(E,7, f) + sage: is_kernel_polynomial(E, 7, f) False """ m2 = m // 2 diff --git a/src/sage/schemes/elliptic_curves/jacobian.py b/src/sage/schemes/elliptic_curves/jacobian.py index 750e0b7b5a7..1a33c7e4726 100644 --- a/src/sage/schemes/elliptic_curves/jacobian.py +++ b/src/sage/schemes/elliptic_curves/jacobian.py @@ -13,17 +13,17 @@ EXAMPLES:: sage: R. = QQ[] - sage: Jacobian(u^3+v^3+w^3) + sage: Jacobian(u^3 + v^3 + w^3) Elliptic Curve defined by y^2 = x^3 - 27/4 over Rational Field - sage: Jacobian(u^4+v^4+w^2) + sage: Jacobian(u^4 + v^4 + w^2) Elliptic Curve defined by y^2 = x^3 - 4*x over Rational Field - sage: C = Curve(u^3+v^3+w^3) + sage: C = Curve(u^3 + v^3 + w^3) sage: Jacobian(C) Elliptic Curve defined by y^2 = x^3 - 27/4 over Rational Field sage: P2. = ProjectiveSpace(2, QQ) - sage: C = P2.subscheme(u^3+v^3+w^3) + sage: C = P2.subscheme(u^3 + v^3 + w^3) sage: Jacobian(C) Elliptic Curve defined by y^2 = x^3 - 27/4 over Rational Field @@ -36,7 +36,7 @@ sage: C = HyperellipticCurve(f) sage: Jacobian(C) Jacobian of Hyperelliptic Curve over Rational Field defined - by y^2 = x^5 + 1184*x^3 + 1846*x^2 + 956*x + 560 + by y^2 = x^5 + 1184*x^3 + 1846*x^2 + 956*x + 560 REFERENCES: @@ -95,8 +95,8 @@ def Jacobian(X, **kwds): To: Elliptic Curve defined by y^2 = x^3 - 27/4 over Rational Field Defn: Defined on coordinates by sending (u : v : w) to (-u^4*v^4*w - u^4*v*w^4 - u*v^4*w^4 : - 1/2*u^6*v^3 - 1/2*u^3*v^6 - 1/2*u^6*w^3 + 1/2*v^6*w^3 + 1/2*u^3*w^6 - 1/2*v^3*w^6 : - u^3*v^3*w^3) + 1/2*u^6*v^3 - 1/2*u^3*v^6 - 1/2*u^6*w^3 + 1/2*v^6*w^3 + 1/2*u^3*w^6 - 1/2*v^3*w^6 : + u^3*v^3*w^3) """ try: return X.jacobian(**kwds) @@ -213,7 +213,7 @@ def Jacobian_of_equation(polynomial, variables=None, curve=None): sage: R. = QQ[] sage: Jacobian(u^3 + v^3 + t, variables=[u,v]) Elliptic Curve defined by y^2 = x^3 + (-27/4*t^2) over - Multivariate Polynomial Ring in u, v, t over Rational Field + Multivariate Polynomial Ring in u, v, t over Rational Field TESTS:: diff --git a/src/sage/schemes/elliptic_curves/lseries_ell.py b/src/sage/schemes/elliptic_curves/lseries_ell.py index 50db7ec188c..7f0e4d3e5e5 100644 --- a/src/sage/schemes/elliptic_curves/lseries_ell.py +++ b/src/sage/schemes/elliptic_curves/lseries_ell.py @@ -42,7 +42,8 @@ def __init__(self, E): EXAMPLES:: sage: EllipticCurve([1..5]).lseries() - Complex L-series of the Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Rational Field + Complex L-series of the Elliptic Curve + defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Rational Field """ self.__E = E @@ -936,7 +937,7 @@ def zero_sums(self, N=None): sage: E = EllipticCurve("5077a") sage: E.lseries().zero_sums() Zero sum estimator for L-function attached to - Elliptic Curve defined by y^2 + y = x^3 - 7*x + 6 over Rational Field + Elliptic Curve defined by y^2 + y = x^3 - 7*x + 6 over Rational Field """ from sage.lfunctions.zero_sums import LFunctionZeroSum return LFunctionZeroSum(self.__E, N=N) diff --git a/src/sage/schemes/elliptic_curves/mod_sym_num.pyx b/src/sage/schemes/elliptic_curves/mod_sym_num.pyx index 297801edca5..6e1b888d9cf 100644 --- a/src/sage/schemes/elliptic_curves/mod_sym_num.pyx +++ b/src/sage/schemes/elliptic_curves/mod_sym_num.pyx @@ -62,7 +62,7 @@ The most likely usage for the code is through the functions ``modular_symbol_numerical``:: sage: E = EllipticCurve("5077a1") - sage: M = E.modular_symbol(implementation = "num") + sage: M = E.modular_symbol(implementation="num") sage: M(0) 0 sage: M(1/123) @@ -81,7 +81,7 @@ accessible, too):: sage: M = E.modular_symbol(implementation="num", sign=-1) sage: M Numerical modular symbol attached to - Elliptic Curve defined by y^2 = x^3 + 101*x + 103 over Rational Field + Elliptic Curve defined by y^2 = x^3 + 101*x + 103 over Rational Field We can then compute the value `[13/17]^{-}` and `[1/17]^{+}` by calling the function ``M``. The value of `[0]^{+}=0` tells us that the rank of diff --git a/src/sage/schemes/elliptic_curves/modular_parametrization.py b/src/sage/schemes/elliptic_curves/modular_parametrization.py index d8ac9a3a807..ee38d1ffe53 100644 --- a/src/sage/schemes/elliptic_curves/modular_parametrization.py +++ b/src/sage/schemes/elliptic_curves/modular_parametrization.py @@ -16,8 +16,9 @@ sage: phi = EllipticCurve('11a1').modular_parametrization() sage: phi - Modular parameterization from the upper half plane - to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Modular parameterization + from the upper half plane + to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: phi(0.5+CDF(I)) (285684.320516... + 7.0...e-11*I : 1.526964169...e8 + 5.6...e-8*I : 1.00000000000000) sage: phi.power_series(prec = 7) @@ -66,8 +67,10 @@ class ModularParameterization: sage: phi = EllipticCurve('11a1').modular_parametrization() sage: phi - Modular parameterization from the upper half plane to Elliptic Curve - defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Modular parameterization + from the upper half plane + to Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 + over Rational Field """ def __init__(self, E): r""" diff --git a/src/sage/schemes/elliptic_curves/period_lattice.py b/src/sage/schemes/elliptic_curves/period_lattice.py index 8c6ea6654e7..61b99b411b3 100644 --- a/src/sage/schemes/elliptic_curves/period_lattice.py +++ b/src/sage/schemes/elliptic_curves/period_lattice.py @@ -25,11 +25,11 @@ sage: emb = K.embeddings(RealField())[0] sage: L = E.period_lattice(emb); L Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a - over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding - Ring morphism: - From: Number Field in a with defining polynomial x^3 - 2 - To: Algebraic Real Field - Defn: a |--> 1.259921049894873? + over Number Field in a with defining polynomial x^3 - 2 + with respect to the embedding Ring morphism: + From: Number Field in a with defining polynomial x^3 - 2 + To: Algebraic Real Field + Defn: a |--> 1.259921049894873? The first basis period is real:: @@ -50,11 +50,11 @@ sage: emb = K.embeddings(ComplexField())[0] sage: L = E.period_lattice(emb); L Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a - over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding - Ring morphism: - From: Number Field in a with defining polynomial x^3 - 2 - To: Algebraic Field - Defn: a |--> -0.6299605249474365? - 1.091123635971722?*I + over Number Field in a with defining polynomial x^3 - 2 + with respect to the embedding Ring morphism: + From: Number Field in a with defining polynomial x^3 - 2 + To: Algebraic Field + Defn: a |--> -0.6299605249474365? - 1.091123635971722?*I In this case, the basis `\omega_1`, `\omega_2` is always normalised so that `\tau = \omega_1/\omega_2` is in the fundamental region in the @@ -76,11 +76,13 @@ sage: EK = E.change_ring(K) sage: EK.period_lattice(K.complex_embeddings()[0]) Period lattice associated to Elliptic Curve defined by y^2 + y = x^3 + (-1)*x - over Number Field in a with defining polynomial x^2 + 7 with a = 2.645751311064591?*I - with respect to the embedding Ring morphism: - From: Number Field in a with defining polynomial x^2 + 7 with a = 2.645751311064591?*I - To: Algebraic Field - Defn: a |--> -2.645751311064591?*I + over Number Field in a with defining polynomial x^2 + 7 + with a = 2.645751311064591?*I + with respect to the embedding Ring morphism: + From: Number Field in a with defining polynomial x^2 + 7 + with a = 2.645751311064591?*I + To: Algebraic Field + Defn: a |--> -2.645751311064591?*I REFERENCES: @@ -183,20 +185,20 @@ def __init__(self, E, embedding=None): sage: E = EllipticCurve([0,1,0,a,a]) sage: L = PeriodLattice_ell(E,emb); L Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a - over Number Field in a with defining polynomial x^3 - 2 with respect to - the embedding Ring morphism: - From: Number Field in a with defining polynomial x^3 - 2 - To: Algebraic Real Field - Defn: a |--> 1.259921049894873? + over Number Field in a with defining polynomial x^3 - 2 + with respect to the embedding Ring morphism: + From: Number Field in a with defining polynomial x^3 - 2 + To: Algebraic Real Field + Defn: a |--> 1.259921049894873? sage: emb = K.embeddings(ComplexField())[0] sage: L = PeriodLattice_ell(E,emb); L Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a - over Number Field in a with defining polynomial x^3 - 2 with respect to - the embedding Ring morphism: - From: Number Field in a with defining polynomial x^3 - 2 - To: Algebraic Field - Defn: a |--> -0.6299605249474365? - 1.091123635971722?*I + over Number Field in a with defining polynomial x^3 - 2 + with respect to the embedding Ring morphism: + From: Number Field in a with defining polynomial x^3 - 2 + To: Algebraic Field + Defn: a |--> -0.6299605249474365? - 1.091123635971722?*I TESTS:: @@ -278,7 +280,7 @@ def __richcmp__(self, other, op): TESTS:: sage: from sage.schemes.elliptic_curves.period_lattice import PeriodLattice_ell - sage: K. = NumberField(x^3-2) + sage: K. = NumberField(x^3 - 2) sage: E = EllipticCurve([0,1,0,a,a]) sage: embs = K.embeddings(ComplexField()) sage: L1,L2,L3 = [PeriodLattice_ell(E,e) for e in embs] @@ -312,10 +314,11 @@ def __repr__(self): sage: emb = K.embeddings(RealField())[0] sage: E = EllipticCurve([0,1,0,a,a]) sage: L = E.period_lattice(emb); L - Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism: - From: Number Field in a with defining polynomial x^3 - 2 - To: Algebraic Real Field - Defn: a |--> 1.259921049894873? + Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a over Number Field in a + with defining polynomial x^3 - 2 with respect to the embedding Ring morphism: + From: Number Field in a with defining polynomial x^3 - 2 + To: Algebraic Real Field + Defn: a |--> 1.259921049894873? """ if self.E.base_field() is QQ: return "Period lattice associated to %s"%(self.E) @@ -355,7 +358,7 @@ def __call__(self, P, prec=None): False sage: L(P, prec=96) 0.4793482501902193161295330101 + 0.985868850775824102211203849...*I - sage: Q=E([3,5]) + sage: Q = E([3,5]) sage: Q.is_on_identity_component() True sage: L(Q, prec=96) @@ -711,7 +714,8 @@ def _compute_periods_complex(self, prec=None, normalise=True): [False, False, True] sage: L = Ls[0] sage: w1,w2 = L._compute_periods_complex(100); w1,w2 - (-1.3758860416607626645495991458 - 2.5856094662444337042877901304*I, -2.1033990784735587243397865076 + 0.42837877646062187766760569686*I) + (-1.3758860416607626645495991458 - 2.5856094662444337042877901304*I, + -2.1033990784735587243397865076 + 0.42837877646062187766760569686*I) sage: tau = w1/w2; tau 0.38769450503287609349437509561 + 1.3082108821440725664008561928*I sage: tau.real() diff --git a/src/sage/schemes/elliptic_curves/saturation.py b/src/sage/schemes/elliptic_curves/saturation.py index 026d344e224..dfd104df210 100644 --- a/src/sage/schemes/elliptic_curves/saturation.py +++ b/src/sage/schemes/elliptic_curves/saturation.py @@ -627,8 +627,8 @@ def p_projections(Eq, Plist, p, debug=False): sage: G = EF.abelian_group() sage: G Additive abelian group isomorphic to Z/147 + Z/3 - embedded in Abelian group of points on Elliptic Curve - defined by y^2 + y = x^3 + 402*x + 6 over Finite Field of size 409 + embedded in Abelian group of points on Elliptic Curve + defined by y^2 + y = x^3 + 402*x + 6 over Finite Field of size 409 sage: G.order().factor() 3^2 * 7^2 diff --git a/src/sage/schemes/elliptic_curves/sha_tate.py b/src/sage/schemes/elliptic_curves/sha_tate.py index b905a6588fa..33818051b8f 100644 --- a/src/sage/schemes/elliptic_curves/sha_tate.py +++ b/src/sage/schemes/elliptic_curves/sha_tate.py @@ -51,7 +51,7 @@ sage: E = EllipticCurve('389a') sage: S = E.sha(); S Tate-Shafarevich group for the - Elliptic Curve defined by y^2 + y = x^3 + x^2 - 2*x over Rational Field + Elliptic Curve defined by y^2 + y = x^3 + x^2 - 2*x over Rational Field sage: S.an_numerical() 1.00000000000000 sage: S.p_primary_bound(5) @@ -126,7 +126,7 @@ class Sha(SageObject): sage: E = EllipticCurve('389a') sage: S = E.sha(); S Tate-Shafarevich group for the - Elliptic Curve defined by y^2 + y = x^3 + x^2 - 2*x over Rational Field + Elliptic Curve defined by y^2 + y = x^3 + x^2 - 2*x over Rational Field sage: S.an_numerical() 1.00000000000000 sage: S.p_primary_bound(5) # long time @@ -150,7 +150,7 @@ def __init__(self, E): sage: S = E.sha() sage: S Tate-Shafarevich group for the - Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field + Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field sage: S == loads(dumps(S)) True @@ -1105,15 +1105,15 @@ def bound_kato(self): order of `Sha` (by [GJPST2009]_):: sage: E = EllipticCurve([1, -1, 0, -332311, -73733731]) # 1058D1 - sage: E.sha().bound_kato() # long time (about 1 second) + sage: E.sha().bound_kato() # long time (about 1 second) [2, 5, 23] - sage: E.galois_representation().non_surjective() # long time (about 1 second) + sage: E.galois_representation().non_surjective() # long time (about 1 second) [] For this one, `Sha` is divisible by 7:: sage: E = EllipticCurve([0, 0, 0, -4062871, -3152083138]) # 3364C1 - sage: E.sha().bound_kato() # long time (< 10 seconds) + sage: E.sha().bound_kato() # long time (< 10 seconds) [2, 7, 29] No information about curves of rank > 0:: diff --git a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py index ad8d47d7ec2..e0f873be0e7 100644 --- a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py +++ b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py @@ -590,13 +590,13 @@ def _eval(self, P): sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism sage: E = EllipticCurve([i, 0]); E # optional - sage.rings.number_field Elliptic Curve defined by y^2 = x^3 + I*x - over Number Field in I with defining polynomial x^2 + 1 with I = 1*I + over Number Field in I with defining polynomial x^2 + 1 with I = 1*I sage: iso = WeierstrassIsomorphism(E, (i,1,2,3)) # optional - sage.rings.number_field sage: P = E.change_ring(QQbar).lift_x(QQbar.random_element()) # optional - sage.rings.number_field sage: Q = iso._eval(P) # optional - sage.rings.number_field sage: Q.curve() # optional - sage.rings.number_field Elliptic Curve defined by y^2 + (-4*I)*x*y + 6*I*y = x^3 + x^2 + (I-9)*x + (-I+8) - over Algebraic Field + over Algebraic Field sage: y = next(filter(bool, iter(QQbar.random_element, None))) # sample until nonzero # optional - sage.rings.number_field sage: iso._eval((0, y, 0)) == 0 # optional - sage.rings.number_field True @@ -733,9 +733,9 @@ def __repr__(self): sage: E2 = E1.change_weierstrass_model([2,3,4,5]) sage: E1.isomorphism_to(E2) Elliptic-curve morphism: - From: Elliptic Curve defined by y^2 + y = x^3 - 7*x + 6 over Rational Field - To: Elliptic Curve defined by y^2 + 4*x*y + 11/8*y = x^3 - 7/4*x^2 - 3/2*x - 9/32 over Rational Field - Via: (u,r,s,t) = (2, 3, 4, 5) + From: Elliptic Curve defined by y^2 + y = x^3 - 7*x + 6 over Rational Field + To: Elliptic Curve defined by y^2 + 4*x*y + 11/8*y = x^3 - 7/4*x^2 - 3/2*x - 9/32 over Rational Field + Via: (u,r,s,t) = (2, 3, 4, 5) """ return EllipticCurveHom.__repr__(self) + "\n Via: (u,r,s,t) = " + baseWI.__repr__(self) @@ -752,9 +752,9 @@ def rational_maps(self): sage: iso = E1.isomorphism_to(E2); iso Elliptic-curve morphism: From: Elliptic Curve defined by y^2 + 11*x*y + 33*y = x^3 + 22*x^2 + 44*x + 55 - over Rational Field + over Rational Field To: Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 684*x + 6681 - over Rational Field + over Rational Field Via: (u,r,s,t) = (1, -17, -5, 77) sage: iso.rational_maps() (x + 17, 5*x + y + 8) @@ -795,9 +795,9 @@ def x_rational_map(self): sage: iso = E1.isomorphism_to(E2); iso Elliptic-curve morphism: From: Elliptic Curve defined by y^2 + 11*x*y + 33*y = x^3 + 22*x^2 + 44*x + 55 - over Rational Field + over Rational Field To: Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 684*x + 6681 - over Rational Field + over Rational Field Via: (u,r,s,t) = (1, -17, -5, 77) sage: iso.x_rational_map() x + 17 @@ -831,9 +831,9 @@ def kernel_polynomial(self): sage: psi = E1.isogeny(iso.kernel_polynomial(), codomain=E2); psi Isogeny of degree 1 from Elliptic Curve defined by y^2 + 11*x*y + 33*y = x^3 + 22*x^2 + 44*x + 55 - over Rational Field - to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 684*x + 6681 - over Rational Field + over Rational Field + to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 684*x + 6681 + over Rational Field sage: psi in {iso, -iso} True From 9cc0865bb81fab1554cf1754a99553654832c1d8 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 29 Mar 2023 01:51:52 -0700 Subject: [PATCH 099/135] src/sage/schemes/elliptic_curves/{ell_number_field,height,hom_composite}.py: Add # optional --- .../elliptic_curves/ell_number_field.py | 8 +- src/sage/schemes/elliptic_curves/height.py | 308 ++++++++-------- .../schemes/elliptic_curves/hom_composite.py | 346 +++++++++--------- 3 files changed, 338 insertions(+), 324 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py index 91745aa6e22..a3c947a9afc 100644 --- a/src/sage/schemes/elliptic_curves/ell_number_field.py +++ b/src/sage/schemes/elliptic_curves/ell_number_field.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: optional - sage.rings.number_field r""" Elliptic curves over number fields @@ -29,7 +29,7 @@ :: - sage: E.has_good_reduction(2+i) + sage: E.has_good_reduction(2 + i) True sage: E.local_data(4+i) Local data at Fractional ideal (i + 4): @@ -109,7 +109,7 @@ class EllipticCurve_number_field(EllipticCurve_field): EXAMPLES:: - sage: K. = NumberField(x^2+1) + sage: K. = NumberField(x^2 + 1) sage: EllipticCurve([i, i - 1, i + 1, 24*i + 15, 14*i + 35]) Elliptic Curve defined by y^2 + i*x*y + (i+1)*y = x^3 + (i-1)*x^2 + (24*i+15)*x + (14*i+35) @@ -121,7 +121,7 @@ def __init__(self, K, ainvs): A curve from the database of curves over `\QQ`, but over a larger field: - sage: K. = NumberField(x^2+1) + sage: K. = NumberField(x^2 + 1) sage: EllipticCurve(K,'389a1') Elliptic Curve defined by y^2 + y = x^3 + x^2 + (-2)*x over Number Field in i with defining polynomial x^2 + 1 diff --git a/src/sage/schemes/elliptic_curves/height.py b/src/sage/schemes/elliptic_curves/height.py index 5a73acec090..e9eb837d30e 100644 --- a/src/sage/schemes/elliptic_curves/height.py +++ b/src/sage/schemes/elliptic_curves/height.py @@ -60,7 +60,7 @@ class UnionOfIntervals: EXAMPLES:: sage: from sage.schemes.elliptic_curves.height import UnionOfIntervals - sage: R = UnionOfIntervals([1,2,3,infinity]); R + sage: R = UnionOfIntervals([1, 2, 3, infinity]); R ([1, 2] U [3, +Infinity]) sage: R + 5 ([6, 7] U [8, +Infinity]) @@ -83,9 +83,9 @@ def __init__(self, endpoints): EXAMPLES:: sage: from sage.schemes.elliptic_curves.height import UnionOfIntervals - sage: UnionOfIntervals([0,1]) + sage: UnionOfIntervals([0, 1]) ([0, 1]) - sage: UnionOfIntervals([-infinity, pi, 17, infinity]) + sage: UnionOfIntervals([-infinity, pi, 17, infinity]) # optional - sage.symbolic ([-Infinity, pi] U [17, +Infinity]) sage: UnionOfIntervals([]) () @@ -94,7 +94,7 @@ def __init__(self, endpoints): Traceback (most recent call last): ... ValueError: an even number of endpoints must be given (got 1) - sage: UnionOfIntervals([3,2,1,0]) + sage: UnionOfIntervals([3, 2, 1, 0]) Traceback (most recent call last): ... ValueError: endpoints must be given in order @@ -112,7 +112,7 @@ def finite_endpoints(self): EXAMPLES:: sage: from sage.schemes.elliptic_curves.height import UnionOfIntervals - sage: UnionOfIntervals([0,1]).finite_endpoints() + sage: UnionOfIntervals([0, 1]).finite_endpoints() [0, 1] sage: UnionOfIntervals([-infinity, 0, 1, infinity]).finite_endpoints() [0, 1] @@ -140,14 +140,14 @@ def is_empty(self): EXAMPLES:: sage: from sage.schemes.elliptic_curves.height import UnionOfIntervals - sage: UnionOfIntervals([3,4]).is_empty() + sage: UnionOfIntervals([3, 4]).is_empty() False sage: all = UnionOfIntervals([-infinity, infinity]) sage: all.is_empty() False sage: (~all).is_empty() True - sage: A = UnionOfIntervals([0,1]) & UnionOfIntervals([2,3]) + sage: A = UnionOfIntervals([0, 1]) & UnionOfIntervals([2, 3]) sage: A.is_empty() True """ @@ -286,13 +286,13 @@ def join(L, condition): sage: from sage.schemes.elliptic_curves.height import UnionOfIntervals sage: A = UnionOfIntervals([1,3,5,7]); A ([1, 3] U [5, 7]) - sage: B = A+1; B + sage: B = A + 1; B ([2, 4] U [6, 8]) - sage: A.join([A,B],any) # union + sage: A.join([A,B], any) # union ([1, 4] U [5, 8]) - sage: A.join([A,B],all) # intersection + sage: A.join([A,B], all) # intersection ([2, 3] U [6, 7]) - sage: A.join([A,B],sum) # symmetric difference + sage: A.join([A,B], sum) # symmetric difference ([1, 2] U [3, 4] U [5, 6] U [7, 8]) """ all = [] @@ -333,7 +333,7 @@ def union(cls, L): sage: from sage.schemes.elliptic_curves.height import UnionOfIntervals sage: A = UnionOfIntervals([1,3,5,7]); A ([1, 3] U [5, 7]) - sage: B = A+1; B + sage: B = A + 1; B ([2, 4] U [6, 8]) sage: A.union([A,B]) ([1, 4] U [5, 8]) @@ -363,7 +363,7 @@ def intersection(cls, L): sage: from sage.schemes.elliptic_curves.height import UnionOfIntervals sage: A = UnionOfIntervals([1,3,5,7]); A ([1, 3] U [5, 7]) - sage: B = A+1; B + sage: B = A + 1; B ([2, 4] U [6, 8]) sage: A.intersection([A,B]) ([2, 3] U [6, 7]) @@ -390,7 +390,7 @@ def __or__(left, right): sage: from sage.schemes.elliptic_curves.height import UnionOfIntervals sage: A = UnionOfIntervals([1,3,5,7]); A ([1, 3] U [5, 7]) - sage: B = A+1; B + sage: B = A + 1; B ([2, 4] U [6, 8]) sage: A | B ([1, 4] U [5, 8]) @@ -414,7 +414,7 @@ def __and__(left, right): sage: from sage.schemes.elliptic_curves.height import UnionOfIntervals sage: A = UnionOfIntervals([1,3,5,7]); A ([1, 3] U [5, 7]) - sage: B = A+1; B + sage: B = A + 1; B ([2, 4] U [6, 8]) sage: A & B ([2, 3] U [6, 7]) @@ -489,13 +489,13 @@ def nonneg_region(f): sage: from sage.schemes.elliptic_curves.height import nonneg_region sage: x = polygen(RR) - sage: nonneg_region(x^2-1) + sage: nonneg_region(x^2 - 1) ([-Infinity, -1.00000000000000] U [1.00000000000000, +Infinity]) - sage: nonneg_region(1-x^2) + sage: nonneg_region(1 - x^2) ([-1.00000000000000, 1.00000000000000]) - sage: nonneg_region(1-x^3) + sage: nonneg_region(1 - x^3) ([-Infinity, 1.00000000000000]) - sage: nonneg_region(x^3-1) + sage: nonneg_region(x^3 - 1) ([1.00000000000000, +Infinity]) sage: nonneg_region((x-1)*(x-2)) ([-Infinity, 1.00000000000000] U [2.00000000000000, +Infinity]) @@ -505,9 +505,9 @@ def nonneg_region(f): ([1.00000000000000, 2.00000000000000] U [3.00000000000000, +Infinity]) sage: nonneg_region(-(x-1)*(x-2)*(x-3)) ([-Infinity, 1.00000000000000] U [2.00000000000000, 3.00000000000000]) - sage: nonneg_region(x^4+1) + sage: nonneg_region(x^4 + 1) ([-Infinity, +Infinity]) - sage: nonneg_region(-x^4-1) + sage: nonneg_region(-x^4 - 1) () """ roots = sorted(f.roots()) @@ -526,7 +526,7 @@ def inf_max_abs(f, g, D): - ``f``, ``g`` (polynomials) -- real univariate polynomials - - ``D`` (UnionOfIntervals) -- a subset of `\RR` + - ``D`` (:class:`UnionOfIntervals`) -- a subset of `\RR` OUTPUT: @@ -542,14 +542,14 @@ def inf_max_abs(f, g, D): sage: from sage.schemes.elliptic_curves.height import inf_max_abs, UnionOfIntervals sage: x = polygen(RR) - sage: f = (x-10)^4+1 - sage: g = 2*x^3+100 - sage: inf_max_abs(f,g,UnionOfIntervals([1,2,3,4,5,6])) + sage: f = (x-10)^4 + 1 + sage: g = 2*x^3 + 100 + sage: inf_max_abs(f, g, UnionOfIntervals([1,2,3,4,5,6])) 425.638201706391 - sage: r0 = (f-g).roots()[0][0] + sage: r0 = (f - g).roots()[0][0] sage: r0 5.46053402234697 - sage: max(abs(f(r0)),abs(g(r0))) + sage: max(abs(f(r0)), abs(g(r0))) 425.638201706391 """ xs = f.roots() + f.derivative().roots() @@ -583,7 +583,7 @@ def min_on_disk(f, tol, max_iter=10000): EXAMPLES:: sage: from sage.schemes.elliptic_curves.height import min_on_disk - sage: f = lambda x: (x^2+100).abs() + sage: f = lambda x: (x^2 + 100).abs() sage: s, t = min_on_disk(f, 0.0001) sage: s, f(s), t (0.01? + 1.00?*I, 99.01?, 99.0000000000000) @@ -785,9 +785,9 @@ def __init__(self, E): An example over a number field:: - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0,i,0,i,i]) - sage: EllipticCurveCanonicalHeight(E) + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,i,0,i,i]) # optional - sage.rings.number_field + sage: EllipticCurveCanonicalHeight(E) # optional - sage.rings.number_field EllipticCurveCanonicalHeight object associated to Elliptic Curve defined by y^2 = x^3 + i*x^2 + i*x + i over Number Field in i with defining polynomial x^2 + 1 with i = 1*I @@ -797,8 +797,8 @@ def __init__(self, E): The base field must be a number field (or `\QQ`):: sage: from sage.schemes.elliptic_curves.height import EllipticCurveCanonicalHeight - sage: E = EllipticCurve(GF(7), [0,0,0,0,1]) - sage: EllipticCurveCanonicalHeight(E) + sage: E = EllipticCurve(GF(7), [0,0,0,0,1]) # optional - sage.rings.finite_rings + sage: EllipticCurveCanonicalHeight(E) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: EllipticCurveCanonicalHeight class can only be created @@ -883,12 +883,12 @@ def __call__(self, P): Over a number field other than `\QQ`:: - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve(K, [0,0,0,1,-27]) - sage: H = E.height_function() - sage: H.base_field() + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,0,1,-27]) # optional - sage.rings.number_field + sage: H = E.height_function() # optional - sage.rings.number_field + sage: H.base_field() # optional - sage.rings.number_field Number Field in i with defining polynomial x^2 + 1 with i = 1*I - sage: H((1,5*i)) + sage: H((1, 5*i)) # optional - sage.rings.number_field 1.22257115164148 """ return self.E(P).height() @@ -912,16 +912,16 @@ def alpha(self, v, tol=0.01): Example 1 from [CPS2006]_:: - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0, 0, 0, 1 + 5*i, 3 + i]) - sage: H = E.height_function() - sage: alpha = H.alpha(K.places()[0]) - sage: alpha + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, 1 + 5*i, 3 + i]) # optional - sage.rings.number_field + sage: H = E.height_function() # optional - sage.rings.number_field + sage: alpha = H.alpha(K.places()[0]) # optional - sage.rings.number_field + sage: alpha # optional - sage.rings.number_field 1.12272013439355 Compare with `\log(\epsilon_v)=0.344562...` in [CPS2006]_:: - sage: 3*alpha.log() + sage: 3*alpha.log() # optional - sage.rings.number_field 0.347263296676126 """ from sage.rings.polynomial.polynomial_ring import polygen @@ -983,29 +983,29 @@ def e_p(self, p): EXAMPLES:: - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0, 0, 0, 1 + 5*i, 3 + i]) - sage: H = E.height_function() - sage: H.e_p(K.prime_above(2)) + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, 1 + 5*i, 3 + i]) # optional - sage.rings.number_field + sage: H = E.height_function() # optional - sage.rings.number_field + sage: H.e_p(K.prime_above(2)) # optional - sage.rings.number_field 2 - sage: H.e_p(K.prime_above(3)) + sage: H.e_p(K.prime_above(3)) # optional - sage.rings.number_field 10 - sage: H.e_p(K.prime_above(5)) + sage: H.e_p(K.prime_above(5)) # optional - sage.rings.number_field 9 - sage: E.conductor().norm().factor() + sage: E.conductor().norm().factor() # optional - sage.rings.number_field 2^10 * 20921 - sage: p1, p2 = K.primes_above(20921) - sage: E.local_data(p1) + sage: p1, p2 = K.primes_above(20921) # optional - sage.rings.number_field + sage: E.local_data(p1) # optional - sage.rings.number_field Local data at Fractional ideal (-40*i + 139): Reduction type: bad split multiplicative ... - sage: H.e_p(p1) + sage: H.e_p(p1) # optional - sage.rings.number_field 20920 - sage: E.local_data(p2) + sage: E.local_data(p2) # optional - sage.rings.number_field Local data at Fractional ideal (40*i + 139): Reduction type: good ... - sage: H.e_p(p2) + sage: H.e_p(p2) # optional - sage.rings.number_field 20815 """ kp = self.K.residue_field(p) @@ -1035,10 +1035,10 @@ def DE(self, n): EXAMPLES:: - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0, 0, 0, 1+5*i, 3+i]) - sage: H = E.height_function() - sage: [H.DE(n) for n in srange(1,6)] + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, 1+5*i, 3+i]) # optional - sage.rings.number_field + sage: H = E.height_function() # optional - sage.rings.number_field + sage: [H.DE(n) for n in srange(1,6)] # optional - sage.rings.number_field [0, 2*log(5) + 2*log(2), 0, 2*log(13) + 2*log(5) + 4*log(2), 0] """ s = 0 @@ -1063,10 +1063,10 @@ def ME(self): EXAMPLES:: - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0, 0, 0, 1+5*i, 3+i]) - sage: H = E.height_function() - sage: H.ME() + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, 1+5*i, 3+i]) # optional - sage.rings.number_field + sage: H = E.height_function() # optional - sage.rings.number_field + sage: H.ME() # optional - sage.rings.number_field 1 sage: E = EllipticCurve([0,0,0,0,1]) sage: E.height_function().ME() @@ -1102,13 +1102,13 @@ def B(self, n, mu): Example 10.2 from [Tho2010]_:: - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0, 1-i, i, -i, 0]) - sage: H = E.height_function() + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve([0, 1-i, i, -i, 0]) # optional - sage.rings.number_field + sage: H = E.height_function() # optional - sage.rings.number_field In [Tho2010]_ the value is given as 0.772:: - sage: RealField(12)( H.B(5, 0.01) ) + sage: RealField(12)( H.B(5, 0.01) ) # optional - sage.rings.number_field 0.777 """ K = self.K @@ -1161,20 +1161,20 @@ def psi(self, xi, v): An example over a number field:: - sage: K. = NumberField(x^3 - 2) - sage: E = EllipticCurve([0,0,0,0,a]) - sage: P = E.lift_x(1/3*a^2 + a + 5/3) - sage: v = K.real_places()[0] - sage: L = E.period_lattice(v) - sage: L(P) + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,0,0,0,a]) # optional - sage.rings.number_field + sage: P = E.lift_x(1/3*a^2 + a + 5/3) # optional - sage.rings.number_field + sage: v = K.real_places()[0] # optional - sage.rings.number_field + sage: L = E.period_lattice(v) # optional - sage.rings.number_field + sage: L(P) # optional - sage.rings.number_field 3.51086196882538 - sage: L(P) / L.real_period() + sage: L(P) / L.real_period() # optional - sage.rings.number_field 0.867385122699931 - sage: xP = v(P.xy()[0]) - sage: H = E.height_function() - sage: H.psi(xP, v) + sage: xP = v(P.xy()[0]) # optional - sage.rings.number_field + sage: H = E.height_function() # optional - sage.rings.number_field + sage: H.psi(xP, v) # optional - sage.rings.number_field 0.867385122699931 - sage: H.psi(1.23, v) + sage: H.psi(1.23, v) # optional - sage.rings.number_field 0.785854718241495 """ if xi > 1e9: @@ -1216,11 +1216,11 @@ def S(self, xi1, xi2, v): An example over a number field:: - sage: K. = NumberField(x^3 - 2) - sage: E = EllipticCurve([0,0,0,0,a]) - sage: v = K.real_places()[0] - sage: H = E.height_function() - sage: H.S(9, 10, v) + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,0,0,0,a]) # optional - sage.rings.number_field + sage: v = K.real_places()[0] # optional - sage.rings.number_field + sage: H = E.height_function() # optional - sage.rings.number_field + sage: H.S(9, 10, v) # optional - sage.rings.number_field ([0.0781194447253472, 0.0823423732016403] U [0.917657626798360, 0.921880555274653]) """ L = self.E.period_lattice(v) @@ -1267,14 +1267,14 @@ def Sn(self, xi1, xi2, n, v): An example over a number field:: - sage: K. = NumberField(x^3 - 2) - sage: E = EllipticCurve([0,0,0,0,a]) - sage: v = K.real_places()[0] - sage: H = E.height_function() - sage: H.S(2, 3, v), H.Sn(2, 3, 1, v) + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,0,0,0,a]) # optional - sage.rings.number_field + sage: v = K.real_places()[0] # optional - sage.rings.number_field + sage: H = E.height_function() # optional - sage.rings.number_field + sage: H.S(2, 3, v), H.Sn(2, 3, 1, v) # optional - sage.rings.number_field (([0.142172065860075, 0.172845716928584] U [0.827154283071416, 0.857827934139925]), ([0.142172065860075, 0.172845716928584] U [0.827154283071416, 0.857827934139925])) - sage: H.Sn(2, 3, 6, v) + sage: H.Sn(2, 3, 6, v) # optional - sage.rings.number_field ([0.0236953443100124, 0.0288076194880974] U [0.137859047178569, 0.142971322356654] U [0.190362010976679, 0.195474286154764] U [0.304525713845236, 0.309637989023321] U [0.357028677643346, 0.362140952821431] U [0.471192380511903, 0.476304655689988] U [0.523695344310012, 0.528807619488097] U [0.637859047178569, 0.642971322356654] U [0.690362010976679, 0.695474286154764] U [0.804525713845236, 0.809637989023321] U [0.857028677643346, 0.862140952821431] U [0.971192380511903, 0.976304655689988]) """ SS = 1/ZZ(n) * self.S(xi1, xi2, v) @@ -1320,19 +1320,19 @@ def real_intersection_is_empty(self, Bk, v): An example over a number field:: - sage: K. = NumberField(x^3 - 2) - sage: E = EllipticCurve([0,0,0,0,a]) - sage: v = K.real_places()[0] - sage: H = E.height_function() + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,0,0,0,a]) # optional - sage.rings.number_field + sage: v = K.real_places()[0] # optional - sage.rings.number_field + sage: H = E.height_function() # optional - sage.rings.number_field The following two lines prove that the heights of non-torsion points on `E` with everywhere good reduction have canonical height strictly greater than 0.07, but fail to prove the same for 0.08:: - sage: H.real_intersection_is_empty([H.B(n,0.07) for n in srange(1,5)],v) # long time (3.3s) + sage: H.real_intersection_is_empty([H.B(n,0.07) for n in srange(1,5)], v) # long time (3.3s) # optional - sage.rings.number_field True - sage: H.real_intersection_is_empty([H.B(n,0.08) for n in srange(1,5)],v) + sage: H.real_intersection_is_empty([H.B(n,0.08) for n in srange(1,5)], v) # optional - sage.rings.number_field False """ return UnionOfIntervals.intersection([self.Sn(-B, B, k+1, v) for k,B in enumerate(Bk)]).is_empty() @@ -1391,10 +1391,10 @@ def wp_c(self, v): sage: H.wp_c(QQ.places()[0]) 2.68744508779950 - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0, 0, 0, 1 + 5*i, 3 + i]) - sage: H = E.height_function() - sage: H.wp_c(K.places()[0]) + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, 1 + 5*i, 3 + i]) # optional - sage.rings.number_field + sage: H = E.height_function() # optional - sage.rings.number_field + sage: H.wp_c(K.places()[0]) # optional - sage.rings.number_field 2.66213425640096 """ # Note that we normalise w1, w2 differently from [Tho2010]_! @@ -1670,10 +1670,10 @@ def complex_intersection_is_empty(self, Bk, v, verbose=False, use_half=True): EXAMPLES:: - sage: K. = NumberField(x^3 - 2) - sage: E = EllipticCurve([0,0,0,0,a]) - sage: v = K.complex_embeddings()[0] - sage: H = E.height_function() + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,0,0,0,a]) # optional - sage.rings.number_field + sage: v = K.complex_embeddings()[0] # optional - sage.rings.number_field + sage: H = E.height_function() # optional - sage.rings.number_field The following two lines prove that the heights of non-torsion points on `E` with everywhere good reduction have canonical @@ -1681,18 +1681,18 @@ def complex_intersection_is_empty(self, Bk, v, verbose=False, use_half=True): for 0.03. For the first proof, using only `n=1,2,3` is not sufficient:: - sage: H.complex_intersection_is_empty([H.B(n,0.02) for n in [1,2,3]], v) # long time (~6s) + sage: H.complex_intersection_is_empty([H.B(n,0.02) for n in [1,2,3]], v) # long time (~6s) # optional - sage.rings.number_field False - sage: H.complex_intersection_is_empty([H.B(n,0.02) for n in [1,2,3,4]], v) + sage: H.complex_intersection_is_empty([H.B(n,0.02) for n in [1,2,3,4]], v) # optional - sage.rings.number_field True - sage: H.complex_intersection_is_empty([H.B(n,0.03) for n in [1,2,3,4]], v) # long time (4s) + sage: H.complex_intersection_is_empty([H.B(n,0.03) for n in [1,2,3,4]], v) # long time (4s) # optional - sage.rings.number_field False Using `n\le6` enables us to prove the lower bound 0.03. Note that it takes longer when the result is ``False`` than when it is ``True``:: - sage: H.complex_intersection_is_empty([H.B(n,0.03) for n in [1..6]], v) + sage: H.complex_intersection_is_empty([H.B(n,0.03) for n in [1..6]], v) # optional - sage.rings.number_field True """ from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion @@ -1788,28 +1788,28 @@ def test_mu(self, mu, N, verbose=True): EXAMPLES:: - sage: K. = NumberField(x^3 - 2) - sage: E = EllipticCurve([0,0,0,0,a]) - sage: H = E.height_function() + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,0,0,0,a]) # optional - sage.rings.number_field + sage: H = E.height_function() # optional - sage.rings.number_field This curve does have a point of good reduction whose canonical point is approximately 1.68:: - sage: P = E.gens(lim3=5)[0]; P + sage: P = E.gens(lim3=5)[0]; P # optional - sage.rings.number_field (1/3*a^2 + a + 5/3 : -2*a^2 - 4/3*a - 5/3 : 1) - sage: P.height() + sage: P.height() # optional - sage.rings.number_field 1.68038085233673 - sage: P.has_good_reduction() + sage: P.has_good_reduction() # optional - sage.rings.number_field True Using `N=5` we can prove that 0.1 is a lower bound (in fact we only need `N=2`), but not that 0.2 is:: - sage: H.test_mu(0.1, 5) + sage: H.test_mu(0.1, 5) # optional - sage.rings.number_field B_1(0.100000000000000) = 1.51580969677387 B_2(0.100000000000000) = 0.932072561526720 True - sage: H.test_mu(0.2, 5) + sage: H.test_mu(0.2, 5) # optional - sage.rings.number_field B_1(0.200000000000000) = 2.04612906979932 B_2(0.200000000000000) = 3.09458988474327 B_3(0.200000000000000) = 27.6251108409484 @@ -1821,11 +1821,11 @@ def test_mu(self, mu, N, verbose=True): either primitive or divisible by either 2 or 3. In fact it is primitive:: - sage: (P.height()/0.1).sqrt() + sage: (P.height()/0.1).sqrt() # optional - sage.rings.number_field 4.09924487233530 - sage: P.division_points(2) + sage: P.division_points(2) # optional - sage.rings.number_field [] - sage: P.division_points(3) + sage: P.division_points(3) # optional - sage.rings.number_field [] """ # Compute the list of values `B_n(\mu)` for n in 1..N. If any @@ -1896,46 +1896,46 @@ def min_gr(self, tol, n_max, verbose=False): Example 10.1 from [Tho2010]_ (where a lower bound of 0.18 was given):: - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0, 0, 0, 91-26*i, -144-323*i]) - sage: H = E.height_function() - sage: H.min_gr(0.1, 4) # long time (8.1s) + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, 91 - 26*i, -144 - 323*i]) # optional - sage.rings.number_field + sage: H = E.height_function() # optional - sage.rings.number_field + sage: H.min_gr(0.1, 4) # long time (8.1s) # optional - sage.rings.number_field 0.1621049443313762 Example 10.2 from [Tho2010]_:: - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0, 1-i, i, -i, 0]) - sage: H = E.height_function() - sage: H.min_gr(0.01, 5) # long time + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve([0, 1 - i, i, -i, 0]) # optional - sage.rings.number_field + sage: H = E.height_function() # optional - sage.rings.number_field + sage: H.min_gr(0.01, 5) # long time # optional - sage.rings.number_field 0.020153685521979152 In this example the point `P=(0,0)` has height 0.023 so our lower bound is quite good:: - sage: P = E((0,0)) - sage: P.has_good_reduction() + sage: P = E((0,0)) # optional - sage.rings.number_field + sage: P.has_good_reduction() # optional - sage.rings.number_field True - sage: P.height() + sage: P.height() # optional - sage.rings.number_field 0.0230242154471211 Example 10.3 from [Tho2010]_ (where the same bound of 0.25 is given):: - sage: K. = NumberField(x^3 - 2) - sage: E = EllipticCurve([0, 0, 0, -3*a-a^2, a^2]) - sage: H = E.height_function() - sage: H.min_gr(0.1, 5) # long time (7.2s) + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, -3*a - a^2, a^2]) # optional - sage.rings.number_field + sage: H = E.height_function() # optional - sage.rings.number_field + sage: H.min_gr(0.1, 5) # long time (7.2s) # optional - sage.rings.number_field 0.25 TESTS: This example from the LMFDB gave problems before the fix in :trac:`8829`:: - sage: K. = NumberField(x^2 - x - 1) - sage: E = EllipticCurve([phi + 1, -phi + 1, 1, 20*phi - 39, 196*phi + 237]) - sage: H = E.height_function() - sage: H.min_gr(.1, 5, verbose=True) # long time (~22s) + sage: K. = NumberField(x^2 - x - 1) # optional - sage.rings.number_field + sage: E = EllipticCurve([phi + 1, -phi + 1, 1, 20*phi - 39, 196*phi + 237]) # optional - sage.rings.number_field + sage: H = E.height_function() # optional - sage.rings.number_field + sage: H.min_gr(.1, 5, verbose=True) # long time (~22s) # optional - sage.rings.number_field B_1(1) = 1540.199246369678 ... halving mu to 0.25 and increasing n_max to 6 @@ -2017,34 +2017,34 @@ def min(self, tol, n_max, verbose=False): Example 10.1 from [Tho2010]_ (where a lower bound of 0.18 was given):: - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0, 0, 0, 91-26*i, -144-323*i]) - sage: H = E.height_function() - sage: H.min(0.1, 4) # long time (8.1s) + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, 91 - 26*i, -144 - 323*i]) # optional - sage.rings.number_field + sage: H = E.height_function() # optional - sage.rings.number_field + sage: H.min(0.1, 4) # long time (8.1s) # optional - sage.rings.number_field 0.1621049443313762 Example 10.2 from [Tho2010]_:: - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0, 1-i, i, -i, 0]) - sage: H = E.height_function() - sage: H.min(0.01, 5) # long time (4s) + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve([0, 1 - i, i, -i, 0]) # optional - sage.rings.number_field + sage: H = E.height_function() # optional - sage.rings.number_field + sage: H.min(0.01, 5) # long time (4s) # optional - sage.rings.number_field 0.020153685521979152 In this example the point `P=(0,0)` has height 0.023 so our lower bound is quite good:: - sage: P = E((0,0)) - sage: P.height() + sage: P = E((0,0)) # optional - sage.rings.number_field + sage: P.height() # optional - sage.rings.number_field 0.0230242154471211 Example 10.3 from [Tho2010]_ (where the same bound of 0.0625 is given):: - sage: K. = NumberField(x^3 - 2) - sage: E = EllipticCurve([0, 0, 0, -3*a-a^2, a^2]) - sage: H = E.height_function() - sage: H.min(0.1, 5) # long time (7s) + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: E = EllipticCurve([0, 0, 0, -3*a - a^2, a^2]) # optional - sage.rings.number_field + sage: H = E.height_function() # optional - sage.rings.number_field + sage: H.min(0.1, 5) # long time (7s) # optional - sage.rings.number_field 0.0625 More examples over `\QQ`:: @@ -2058,8 +2058,8 @@ def min(self, tol, n_max, verbose=False): After base change the lower bound can decrease:: - sage: K. = QuadraticField(-5) - sage: E.change_ring(K).height_function().min(0.5, 10) # long time (8s) + sage: K. = QuadraticField(-5) # optional - sage.rings.number_field + sage: E.change_ring(K).height_function().min(0.5, 10) # long time (8s) # optional - sage.rings.number_field 0.04419417382415922 sage: E = EllipticCurve('389a') diff --git a/src/sage/schemes/elliptic_curves/hom_composite.py b/src/sage/schemes/elliptic_curves/hom_composite.py index 19bad468141..a117e2e87d0 100644 --- a/src/sage/schemes/elliptic_curves/hom_composite.py +++ b/src/sage/schemes/elliptic_curves/hom_composite.py @@ -15,13 +15,13 @@ sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite sage: p = 3 * 2^143 - 1 - sage: GF(p^2).inject_variables() + sage: GF(p^2).inject_variables() # optional - sage.rings.finite_rings Defining z2 - sage: E = EllipticCurve(GF(p^2), [1,0]) - sage: P = E.lift_x(31415926535897932384626433832795028841971 - z2) - sage: P.order().factor() + sage: E = EllipticCurve(GF(p^2), [1,0]) # optional - sage.rings.finite_rings + sage: P = E.lift_x(31415926535897932384626433832795028841971 - z2) # optional - sage.rings.finite_rings + sage: P.order().factor() # optional - sage.rings.finite_rings 2^143 - sage: EllipticCurveHom_composite(E, P) + sage: EllipticCurveHom_composite(E, P) # optional - sage.rings.finite_rings Composite morphism of degree 11150372599265311570767859136324180752990208 = 2^143: From: Elliptic Curve defined by y^2 = x^3 + x over Finite Field in z2 of size 33451117797795934712303577408972542258970623^2 @@ -33,40 +33,40 @@ is identical to :class:`EllipticCurveIsogeny` and other instantiations of :class:`EllipticCurveHom`:: - sage: E = EllipticCurve(GF(419), [0,1]) - sage: P = E.lift_x(33); P.order() + sage: E = EllipticCurve(GF(419), [0,1]) # optional - sage.rings.finite_rings + sage: P = E.lift_x(33); P.order() # optional - sage.rings.finite_rings 35 - sage: psi = EllipticCurveHom_composite(E, P); psi + sage: psi = EllipticCurveHom_composite(E, P); psi # optional - sage.rings.finite_rings Composite morphism of degree 35 = 5*7: From: Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 419 To: Elliptic Curve defined by y^2 = x^3 + 101*x + 285 over Finite Field of size 419 - sage: psi(E.lift_x(11)) + sage: psi(E.lift_x(11)) # optional - sage.rings.finite_rings (352 : 73 : 1) - sage: psi.rational_maps() + sage: psi.rational_maps() # optional - sage.rings.finite_rings ((x^35 + 162*x^34 + 186*x^33 + 92*x^32 - ... + 44*x^3 + 190*x^2 + 80*x - 72)/(x^34 + 162*x^33 - 129*x^32 + 41*x^31 + ... + 66*x^3 - 191*x^2 + 119*x + 21), (x^51*y - 176*x^50*y + 115*x^49*y - 120*x^48*y + ... + 72*x^3*y + 129*x^2*y + 163*x*y + 178*y)/(x^51 - 176*x^50 + 11*x^49 + 26*x^48 - ... - 77*x^3 + 185*x^2 + 169*x - 128)) - sage: psi.kernel_polynomial() + sage: psi.kernel_polynomial() # optional - sage.rings.finite_rings x^17 + 81*x^16 + 7*x^15 + 82*x^14 + 49*x^13 + 68*x^12 + 109*x^11 + 326*x^10 + 117*x^9 + 136*x^8 + 111*x^7 + 292*x^6 + 55*x^5 + 389*x^4 + 175*x^3 + 43*x^2 + 149*x + 373 - sage: psi.dual() + sage: psi.dual() # optional - sage.rings.finite_rings Composite morphism of degree 35 = 7*5: From: Elliptic Curve defined by y^2 = x^3 + 101*x + 285 over Finite Field of size 419 To: Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 419 - sage: psi.formal() + sage: psi.formal() # optional - sage.rings.finite_rings t + 211*t^5 + 417*t^7 + 159*t^9 + 360*t^11 + 259*t^13 + 224*t^15 + 296*t^17 + 139*t^19 + 222*t^21 + O(t^23) Equality is decided correctly (and, in some cases, much faster than comparing :meth:`EllipticCurveHom.rational_maps`) even when distinct factorizations of the same isogeny are compared:: - sage: psi == EllipticCurveIsogeny(E, P) + sage: psi == EllipticCurveIsogeny(E, P) # optional - sage.rings.finite_rings True We can easily obtain the individual factors of the composite map:: - sage: psi.factors() + sage: psi.factors() # optional - sage.rings.finite_rings (Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 419 to Elliptic Curve defined by y^2 = x^3 + 140*x + 214 over Finite Field of size 419, @@ -103,16 +103,16 @@ def _eval_factored_isogeny(phis, P): EXAMPLES:: sage: from sage.schemes.elliptic_curves import hom_composite - sage: E = EllipticCurve(GF(419), [1,0]) - sage: Q = E(21,8) - sage: phis = [] - sage: while len(phis) < 10: + sage: E = EllipticCurve(GF(419), [1,0]) # optional - sage.rings.finite_rings + sage: Q = E(21, 8) # optional - sage.rings.finite_rings + sage: phis = [] # optional - sage.rings.finite_rings + sage: while len(phis) < 10: # optional - sage.rings.finite_rings ....: P = list(sorted(E(0).division_points(7)))[1] ....: phis.append(E.isogeny(P)) ....: E = phis[-1].codomain() - sage: R = hom_composite._eval_factored_isogeny(phis, Q); R + sage: R = hom_composite._eval_factored_isogeny(phis, Q); R # optional - sage.rings.finite_rings (290 : 183 : 1) - sage: R in E + sage: R in E # optional - sage.rings.finite_rings True """ for phi in phis: @@ -129,13 +129,13 @@ def _compute_factored_isogeny_prime_power(P, l, e): EXAMPLES:: sage: from sage.schemes.elliptic_curves import hom_composite - sage: E = EllipticCurve(GF(8191), [1,0]) - sage: P = E.random_point() - sage: (l,e), = P.order().factor() - sage: phis = hom_composite._compute_factored_isogeny_prime_power(P,l,e) - sage: hom_composite._eval_factored_isogeny(phis, P) + sage: E = EllipticCurve(GF(8191), [1,0]) # optional - sage.rings.finite_rings + sage: P = E.random_point() # optional - sage.rings.finite_rings + sage: (l,e), = P.order().factor() # optional - sage.rings.finite_rings + sage: phis = hom_composite._compute_factored_isogeny_prime_power(P, l, e) # optional - sage.rings.finite_rings + sage: hom_composite._eval_factored_isogeny(phis, P) # optional - sage.rings.finite_rings (0 : 1 : 0) - sage: [phi.degree() for phi in phis] == [l]*e + sage: [phi.degree() for phi in phis] == [l]*e # optional - sage.rings.finite_rings True """ E = P.curve() @@ -158,12 +158,12 @@ def _compute_factored_isogeny_single_generator(P): EXAMPLES:: sage: from sage.schemes.elliptic_curves import hom_composite - sage: E = EllipticCurve(GF(419), [1,0]) - sage: P = E(42,321) - sage: phis = hom_composite._compute_factored_isogeny_single_generator(P) - sage: list(sorted(phi.degree() for phi in phis)) + sage: E = EllipticCurve(GF(419), [1,0]) # optional - sage.rings.finite_rings + sage: P = E(42, 321) # optional - sage.rings.finite_rings + sage: phis = hom_composite._compute_factored_isogeny_single_generator(P) # optional - sage.rings.finite_rings + sage: list(sorted(phi.degree() for phi in phis)) # optional - sage.rings.finite_rings [2, 2, 3, 5, 7] - sage: hom_composite._eval_factored_isogeny(phis, P) + sage: hom_composite._eval_factored_isogeny(phis, P) # optional - sage.rings.finite_rings (0 : 1 : 0) """ phis = [] @@ -185,12 +185,12 @@ def _compute_factored_isogeny(kernel): EXAMPLES:: sage: from sage.schemes.elliptic_curves import hom_composite - sage: E = EllipticCurve(GF(419), [-1,0]) - sage: Ps = [E(41,99), E(41,-99), E(51,14), E(21,21), E(33,17)] - sage: phis = hom_composite._compute_factored_isogeny(Ps) - sage: [phi.degree() for phi in phis] + sage: E = EllipticCurve(GF(419), [-1,0]) # optional - sage.rings.finite_rings + sage: Ps = [E(41,99), E(41,-99), E(51,14), E(21,21), E(33,17)] # optional - sage.rings.finite_rings + sage: phis = hom_composite._compute_factored_isogeny(Ps) # optional - sage.rings.finite_rings + sage: [phi.degree() for phi in phis] # optional - sage.rings.finite_rings [2, 3, 5, 7, 2] - sage: {hom_composite._eval_factored_isogeny(phis, P) for P in Ps} + sage: {hom_composite._eval_factored_isogeny(phis, P) for P in Ps} # optional - sage.rings.finite_rings {(0 : 1 : 0)} """ phis = [] @@ -220,48 +220,53 @@ def __init__(self, E, kernel, codomain=None, model=None): EXAMPLES:: sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(GF(419), [1,0]) - sage: EllipticCurveHom_composite(E, E.lift_x(23)) + sage: E = EllipticCurve(GF(419), [1,0]) # optional - sage.rings.finite_rings + sage: EllipticCurveHom_composite(E, E.lift_x(23)) # optional - sage.rings.finite_rings Composite morphism of degree 105 = 3*5*7: - From: Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 419 - To: Elliptic Curve defined by y^2 = x^3 + 373*x + 126 over Finite Field of size 419 + From: Elliptic Curve defined by y^2 = x^3 + x + over Finite Field of size 419 + To: Elliptic Curve defined by y^2 = x^3 + 373*x + 126 + over Finite Field of size 419 The given kernel generators need not be independent:: - sage: K. = NumberField(x^2 - x - 5) - sage: E = EllipticCurve('210.b6').change_ring(K) - sage: E.torsion_subgroup() + sage: K. = NumberField(x^2 - x - 5) # optional - sage.rings.number_field + sage: E = EllipticCurve('210.b6').change_ring(K) # optional - sage.rings.number_field + sage: E.torsion_subgroup() # optional - sage.rings.number_field Torsion Subgroup isomorphic to Z/12 + Z/2 associated to the Elliptic Curve defined by y^2 + x*y + y = x^3 + (-578)*x + 2756 over Number Field in a with defining polynomial x^2 - x - 5 - sage: EllipticCurveHom_composite(E, E.torsion_points()) + sage: EllipticCurveHom_composite(E, E.torsion_points()) # optional - sage.rings.number_field Composite morphism of degree 24 = 2^3*3: - From: Elliptic Curve defined by y^2 + x*y + y = x^3 + (-578)*x + 2756 over Number Field in a with defining polynomial x^2 - x - 5 - To: Elliptic Curve defined by y^2 + x*y + y = x^3 + (-89915533/16)*x + (-328200928141/64) over Number Field in a with defining polynomial x^2 - x - 5 + From: Elliptic Curve defined by y^2 + x*y + y = x^3 + (-578)*x + 2756 + over Number Field in a with defining polynomial x^2 - x - 5 + To: Elliptic Curve defined by + y^2 + x*y + y = x^3 + (-89915533/16)*x + (-328200928141/64) + over Number Field in a with defining polynomial x^2 - x - 5 TESTS:: - sage: E = EllipticCurve(GF(19), [1,0]) - sage: P = E.random_point() - sage: psi = EllipticCurveHom_composite(E, P) - sage: psi # random + sage: E = EllipticCurve(GF(19), [1,0]) # optional - sage.rings.finite_rings + sage: P = E.random_point() # optional - sage.rings.finite_rings + sage: psi = EllipticCurveHom_composite(E, P) # optional - sage.rings.finite_rings + sage: psi # random # optional - sage.rings.finite_rings Composite morphism of degree 10 = 2*5: From: Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 19 To: Elliptic Curve defined by y^2 = x^3 + 14*x over Finite Field of size 19 :: - sage: EllipticCurveHom_composite(E, E.lift_x(3), codomain=E) + sage: EllipticCurveHom_composite(E, E.lift_x(3), codomain=E) # optional - sage.rings.finite_rings Composite morphism of degree 20 = 2^2*5: From: Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 19 To: Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 19 :: - sage: E = EllipticCurve(GF((2^127-1)^2), [1,0]) - sage: K = 2^30 * E.random_point() - sage: psi = EllipticCurveHom_composite(E, K, model='montgomery') - sage: psi.codomain().a_invariants() + sage: E = EllipticCurve(GF((2^127-1)^2), [1,0]) # optional - sage.rings.finite_rings + sage: K = 2^30 * E.random_point() # optional - sage.rings.finite_rings + sage: psi = EllipticCurveHom_composite(E, K, model='montgomery') # optional - sage.rings.finite_rings + sage: psi.codomain().a_invariants() # optional - sage.rings.finite_rings (0, ..., 0, 1, 0) """ if not isinstance(E, EllipticCurve_generic): @@ -345,11 +350,11 @@ def from_factors(cls, maps, E=None, strict=True): EXAMPLES:: sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(GF(43), [1,0]) - sage: P, = E.gens() - sage: phi = EllipticCurveHom_composite(E, P) - sage: psi = EllipticCurveHom_composite.from_factors(phi.factors()) - sage: psi == phi + sage: E = EllipticCurve(GF(43), [1,0]) # optional - sage.rings.finite_rings + sage: P, = E.gens() # optional - sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P) # optional - sage.rings.finite_rings + sage: psi = EllipticCurveHom_composite.from_factors(phi.factors()) # optional - sage.rings.finite_rings + sage: psi == phi # optional - sage.rings.finite_rings True TESTS:: @@ -360,10 +365,10 @@ def from_factors(cls, maps, E=None, strict=True): :: - sage: E = EllipticCurve(GF(419), [1,0]) - sage: P, = E.gens() - sage: phi = EllipticCurveHom_composite(E, P) - sage: EllipticCurveHom_composite.from_factors(phi.factors()) == phi + sage: E = EllipticCurve(GF(419), [1,0]) # optional - sage.rings.finite_rings + sage: P, = E.gens() # optional - sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P) # optional - sage.rings.finite_rings + sage: EllipticCurveHom_composite.from_factors(phi.factors()) == phi # optional - sage.rings.finite_rings True """ maps = tuple(maps) @@ -397,21 +402,21 @@ def _call_(self, P): TESTS:: sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: K. = NumberField(x^2 - x - 5) - sage: E = EllipticCurve('210.b6').change_ring(K) - sage: psi = EllipticCurveHom_composite(E, E.torsion_points()) - sage: R = E.lift_x(15/4 * (a+3)) - sage: psi(R) # indirect doctest + sage: K. = NumberField(x^2 - x - 5) # optional - sage.rings.number_field + sage: E = EllipticCurve('210.b6').change_ring(K) # optional - sage.rings.number_field + sage: psi = EllipticCurveHom_composite(E, E.torsion_points()) # optional - sage.rings.number_field + sage: R = E.lift_x(15/4 * (a+3)) # optional - sage.rings.number_field + sage: psi(R) # indirect doctest # optional - sage.rings.number_field (1033648757/303450 : 58397496786187/1083316500*a - 62088706165177/2166633000 : 1) Check that copying the order over works:: - sage: E = EllipticCurve(GF(431), [1,0]) - sage: P, = E.gens() - sage: Q = 2^99*P; Q.order() + sage: E = EllipticCurve(GF(431), [1,0]) # optional - sage.rings.finite_rings + sage: P, = E.gens() # optional - sage.rings.finite_rings + sage: Q = 2^99*P; Q.order() # optional - sage.rings.finite_rings 27 - sage: phi = E.isogeny(3^99*P, algorithm='factored') - sage: phi(Q)._order + sage: phi = E.isogeny(3^99*P, algorithm='factored') # optional - sage.rings.finite_rings + sage: phi(Q)._order # optional - sage.rings.finite_rings 27 """ return _eval_factored_isogeny(self._phis, P) @@ -433,8 +438,8 @@ def _eval(self, P): sage: E = EllipticCurve(j=Mod(1728,419)) sage: K, = E.gens() sage: psi = EllipticCurveHom_composite(E, 4*K) - sage: Ps = E.change_ring(GF(419**2))(0).division_points(5) - sage: {psi._eval(P).curve() for P in Ps} + sage: Ps = E.change_ring(GF(419**2))(0).division_points(5) # optional - sage.rings.finite_rings + sage: {psi._eval(P).curve() for P in Ps} # optional - sage.rings.finite_rings {Elliptic Curve defined by y^2 = x^3 + 373*x + 126 over Finite Field in z2 of size 419^2} """ if self._domain.defining_polynomial()(*P): @@ -454,14 +459,14 @@ def _repr_(self): TESTS:: sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(GF(43), [1,0]) - sage: P, = E.gens() - sage: phi = EllipticCurveHom_composite(E, P) - sage: phi # indirect doctest + sage: E = EllipticCurve(GF(43), [1,0]) # optional - sage.rings.finite_rings + sage: P, = E.gens() # optional - sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P) # optional - sage.rings.finite_rings + sage: phi # indirect doctest # optional - sage.rings.finite_rings Composite morphism of degree 44 = 2^2*11: From: Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 43 To: Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 43 - sage: phi * phi * phi * phi * phi * phi * phi # indirect doctest + sage: phi * phi * phi * phi * phi * phi * phi # indirect doctest # optional - sage.rings.finite_rings Composite morphism of degree 319277809664 = 2^2*11*2^2*11*2^2*11*2^2*11*2^2*11*2^2*11*2^2*11: From: Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 43 To: Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 43 @@ -485,10 +490,10 @@ def factors(self): EXAMPLES:: sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(GF(43), [1,0]) - sage: P, = E.gens() - sage: phi = EllipticCurveHom_composite(E, P) - sage: phi.factors() + sage: E = EllipticCurve(GF(43), [1,0]) # optional - sage.rings.finite_rings + sage: P, = E.gens() # optional - sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P) # optional - sage.rings.finite_rings + sage: phi.factors() # optional - sage.rings.finite_rings (Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 43 to Elliptic Curve defined by y^2 = x^3 + 39*x over Finite Field of size 43, @@ -513,29 +518,37 @@ def _composition_impl(left, right): TESTS:: sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve([i+1, i, 0, -4, -6*i]) - sage: P,Q = E.lift_x(i-5), E.lift_x(-4*i) - sage: phi = EllipticCurveHom_composite(E, P) - sage: psi = phi.codomain().isogeny(phi(Q)) + sage: E = EllipticCurve([i + 1, i, 0, -4, -6*i]) # optional - sage.rings.number_field + sage: P,Q = E.lift_x(i - 5), E.lift_x(-4*i) # optional - sage.rings.number_field + sage: phi = EllipticCurveHom_composite(E, P) # optional - sage.rings.number_field + sage: psi = phi.codomain().isogeny(phi(Q)) # optional - sage.rings.number_field sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: iso1 = WeierstrassIsomorphism(E, (-1, 0, -i-1, 0)) - sage: iso2 = psi.codomain().isomorphism_to(E) - sage: psi * phi # indirect doctest + sage: iso1 = WeierstrassIsomorphism(E, (-1, 0, -i - 1, 0)) # optional - sage.rings.number_field + sage: iso2 = psi.codomain().isomorphism_to(E) # optional - sage.rings.number_field + sage: psi * phi # indirect doctest # optional - sage.rings.number_field Composite morphism of degree 16 = 2^2*4: - From: Elliptic Curve defined by y^2 + (I+1)*x*y = x^3 + I*x^2 + (-4)*x + (-6*I) over Number Field in I with defining polynomial x^2 + 1 with I = 1*I - To: Elliptic Curve defined by y^2 + (I+1)*x*y = x^3 + I*x^2 + (-3331/4)*x + (-142593/8*I) over Number Field in I with defining polynomial x^2 + 1 with I = 1*I - sage: iso2 * EllipticCurveHom_composite.from_factors([phi, psi]) # indirect doctest + From: Elliptic Curve defined by y^2 + (I+1)*x*y = x^3 + I*x^2 + (-4)*x + (-6*I) + over Number Field in I with defining polynomial x^2 + 1 with I = 1*I + To: Elliptic Curve defined by y^2 + (I+1)*x*y = x^3 + I*x^2 + (-3331/4)*x + (-142593/8*I) + over Number Field in I with defining polynomial x^2 + 1 with I = 1*I + sage: iso2 * EllipticCurveHom_composite.from_factors([phi, psi]) # indirect doctest # optional - sage.rings.number_field Composite morphism of degree 16 = 4^2: - From: Elliptic Curve defined by y^2 + (I+1)*x*y = x^3 + I*x^2 + (-4)*x + (-6*I) over Number Field in I with defining polynomial x^2 + 1 with I = 1*I - To: Elliptic Curve defined by y^2 + (I+1)*x*y = x^3 + I*x^2 + (-4)*x + (-6*I) over Number Field in I with defining polynomial x^2 + 1 with I = 1*I - sage: phi * iso1 # indirect doctest + From: Elliptic Curve defined by y^2 + (I+1)*x*y = x^3 + I*x^2 + (-4)*x + (-6*I) + over Number Field in I with defining polynomial x^2 + 1 with I = 1*I + To: Elliptic Curve defined by y^2 + (I+1)*x*y = x^3 + I*x^2 + (-4)*x + (-6*I) + over Number Field in I with defining polynomial x^2 + 1 with I = 1*I + sage: phi * iso1 # indirect doctest # optional - sage.rings.number_field Composite morphism of degree 4 = 2^2: - From: Elliptic Curve defined by y^2 + (I+1)*x*y = x^3 + I*x^2 + (-4)*x + (-6*I) over Number Field in I with defining polynomial x^2 + 1 with I = 1*I - To: Elliptic Curve defined by y^2 + (I+1)*x*y = x^3 + I*x^2 + (480*I-694)*x + (-7778*I+5556) over Number Field in I with defining polynomial x^2 + 1 with I = 1*I - sage: iso2 * psi * phi * iso1 # indirect doctest + From: Elliptic Curve defined by y^2 + (I+1)*x*y = x^3 + I*x^2 + (-4)*x + (-6*I) + over Number Field in I with defining polynomial x^2 + 1 with I = 1*I + To: Elliptic Curve defined by y^2 + (I+1)*x*y = x^3 + I*x^2 + (480*I-694)*x + (-7778*I+5556) + over Number Field in I with defining polynomial x^2 + 1 with I = 1*I + sage: iso2 * psi * phi * iso1 # indirect doctest # optional - sage.rings.number_field Composite morphism of degree 16 = 2^2*4: - From: Elliptic Curve defined by y^2 + (I+1)*x*y = x^3 + I*x^2 + (-4)*x + (-6*I) over Number Field in I with defining polynomial x^2 + 1 with I = 1*I - To: Elliptic Curve defined by y^2 + (I+1)*x*y = x^3 + I*x^2 + (-4)*x + (-6*I) over Number Field in I with defining polynomial x^2 + 1 with I = 1*I + From: Elliptic Curve defined by y^2 + (I+1)*x*y = x^3 + I*x^2 + (-4)*x + (-6*I) + over Number Field in I with defining polynomial x^2 + 1 with I = 1*I + To: Elliptic Curve defined by y^2 + (I+1)*x*y = x^3 + I*x^2 + (-4)*x + (-6*I) + over Number Field in I with defining polynomial x^2 + 1 with I = 1*I """ if isinstance(left, EllipticCurveHom_composite): if isinstance(right, WeierstrassIsomorphism) and hasattr(left.factors()[0], '_set_pre_isomorphism'): # XXX bit of a hack @@ -568,25 +581,25 @@ def _comparison_impl(left, right, op): TESTS:: sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(QuadraticField(-3), [0,16]) - sage: P,Q = E.lift_x(0), E.lift_x(-4) - sage: phi = EllipticCurveHom_composite(E, P) - sage: psi = phi.codomain().isogeny(phi(Q)) - sage: psi = psi.codomain().isomorphism_to(E) * psi - sage: comp = psi * phi - sage: mu = E.scalar_multiplication(phi.degree()) - sage: sum(a*comp == mu for a in E.automorphisms()) + sage: E = EllipticCurve(QuadraticField(-3), [0,16]) # optional - sage.rings.number_field + sage: P,Q = E.lift_x(0), E.lift_x(-4) # optional - sage.rings.number_field + sage: phi = EllipticCurveHom_composite(E, P) # optional - sage.rings.number_field + sage: psi = phi.codomain().isogeny(phi(Q)) # optional - sage.rings.number_field + sage: psi = psi.codomain().isomorphism_to(E) * psi # optional - sage.rings.number_field + sage: comp = psi * phi # optional - sage.rings.number_field + sage: mu = E.scalar_multiplication(phi.degree()) # optional - sage.rings.number_field + sage: sum(a*comp == mu for a in E.automorphisms()) # optional - sage.rings.number_field 1 :: - sage: E = EllipticCurve(GF(431**2), [1,0]) - sage: P,Q = E.gens() - sage: phi1 = EllipticCurveHom_composite(E, P) - sage: phi2 = EllipticCurveHom_composite(phi1.codomain(), phi1(Q)) - sage: psi1 = EllipticCurveHom_composite(E, Q) - sage: psi2 = EllipticCurveHom_composite(psi1.codomain(), psi1(P)) - sage: phi2 * phi1 == psi2 * psi1 + sage: E = EllipticCurve(GF(431**2), [1,0]) # optional - sage.rings.finite_rings + sage: P,Q = E.gens() # optional - sage.rings.finite_rings + sage: phi1 = EllipticCurveHom_composite(E, P) # optional - sage.rings.finite_rings + sage: phi2 = EllipticCurveHom_composite(phi1.codomain(), phi1(Q)) # optional - sage.rings.finite_rings + sage: psi1 = EllipticCurveHom_composite(E, Q) # optional - sage.rings.finite_rings + sage: psi2 = EllipticCurveHom_composite(psi1.codomain(), psi1(P)) # optional - sage.rings.finite_rings + sage: phi2 * phi1 == psi2 * psi1 # optional - sage.rings.finite_rings True """ if op != op_EQ: @@ -604,13 +617,13 @@ def rational_maps(self): EXAMPLES:: sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) - sage: P = E.lift_x(7321) - sage: phi = EllipticCurveHom_composite(E, P) - sage: phi.rational_maps() - ((x^9 + 27463*x^8 + 21204*x^7 - 5750*x^6 + 1610*x^5 + 14440*x^4 + 26605*x^3 - - 15569*x^2 - 3341*x + 1267)/(x^8 + 27463*x^7 + 26871*x^6 + 5999*x^5 - - 20194*x^4 - 6310*x^3 + 24366*x^2 - 20905*x - 13867), + sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) # optional - sage.rings.finite_rings + sage: P = E.lift_x(7321) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P) # optional - sage.rings.finite_rings + sage: phi.rational_maps() # optional - sage.rings.finite_rings + ((x^9 + 27463*x^8 + 21204*x^7 - 5750*x^6 + 1610*x^5 + 14440*x^4 + + 26605*x^3 - 15569*x^2 - 3341*x + 1267)/(x^8 + 27463*x^7 + 26871*x^6 + + 5999*x^5 - 20194*x^4 - 6310*x^3 + 24366*x^2 - 20905*x - 13867), (x^12*y + 8426*x^11*y + 5667*x^11 + 27612*x^10*y + 26124*x^10 + 9688*x^9*y - 22715*x^9 + 19864*x^8*y + 498*x^8 + 22466*x^7*y - 14036*x^7 + 8070*x^6*y + 19955*x^6 - 20765*x^5*y - 12481*x^5 + 12672*x^4*y + 24142*x^4 - 23695*x^3*y @@ -620,17 +633,17 @@ def rational_maps(self): TESTS:: - sage: f = phi.codomain().defining_polynomial() - sage: g = E.defining_polynomial().subs({2:1}) - sage: f(*phi.rational_maps(), 1) % g + sage: f = phi.codomain().defining_polynomial() # optional - sage.rings.finite_rings + sage: g = E.defining_polynomial().subs({2:1}) # optional - sage.rings.finite_rings + sage: f(*phi.rational_maps(), 1) % g # optional - sage.rings.finite_rings 0 :: - sage: phi.rational_maps()[0].parent() + sage: phi.rational_maps()[0].parent() # optional - sage.rings.finite_rings Fraction Field of Multivariate Polynomial Ring in x, y over Finite Field of size 65537 - sage: phi.rational_maps()[1].parent() + sage: phi.rational_maps()[1].parent() # optional - sage.rings.finite_rings Fraction Field of Multivariate Polynomial Ring in x, y over Finite Field of size 65537 """ @@ -647,16 +660,17 @@ def x_rational_map(self): EXAMPLES:: sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) - sage: P = E.lift_x(7321) - sage: phi = EllipticCurveHom_composite(E, P) - sage: phi.x_rational_map() == phi.rational_maps()[0] + sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) # optional - sage.rings.finite_rings + sage: P = E.lift_x(7321) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P) # optional - sage.rings.finite_rings + sage: phi.x_rational_map() == phi.rational_maps()[0] # optional - sage.rings.finite_rings True TESTS:: - sage: phi.x_rational_map().parent() - Fraction Field of Univariate Polynomial Ring in x over Finite Field of size 65537 + sage: phi.x_rational_map().parent() # optional - sage.rings.finite_rings + Fraction Field of Univariate Polynomial Ring in x + over Finite Field of size 65537 """ fx = self._phis[-1].x_rational_map() for phi in self._phis[:-1][::-1]: @@ -670,15 +684,15 @@ def kernel_polynomial(self): EXAMPLES:: sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) - sage: P = E.lift_x(7321) - sage: phi = EllipticCurveHom_composite(E, P); phi + sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) # optional - sage.rings.finite_rings + sage: P = E.lift_x(7321) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P); phi # optional - sage.rings.finite_rings Composite morphism of degree 9 = 3^2: From: Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Finite Field of size 65537 To: Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 28339*x + 59518 over Finite Field of size 65537 - sage: phi.kernel_polynomial() + sage: phi.kernel_polynomial() # optional - sage.rings.finite_rings x^4 + 46500*x^3 + 19556*x^2 + 7643*x + 15952 """ # shouldn't there be a better algorithm for this? @@ -692,23 +706,23 @@ def dual(self): EXAMPLES:: sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) - sage: P = E.lift_x(7321) - sage: phi = EllipticCurveHom_composite(E, P); phi + sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) # optional - sage.rings.finite_rings + sage: P = E.lift_x(7321) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P); phi # optional - sage.rings.finite_rings Composite morphism of degree 9 = 3^2: From: Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Finite Field of size 65537 To: Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 28339*x + 59518 over Finite Field of size 65537 - sage: psi = phi.dual(); psi + sage: psi = phi.dual(); psi # optional - sage.rings.finite_rings Composite morphism of degree 9 = 3^2: From: Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 28339*x + 59518 over Finite Field of size 65537 To: Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Finite Field of size 65537 - sage: psi * phi == phi.domain().scalar_multiplication(phi.degree()) + sage: psi * phi == phi.domain().scalar_multiplication(phi.degree()) # optional - sage.rings.finite_rings True - sage: phi * psi == psi.domain().scalar_multiplication(psi.degree()) + sage: phi * psi == psi.domain().scalar_multiplication(psi.degree()) # optional - sage.rings.finite_rings True """ phis = (phi.dual() for phi in self._phis[::-1]) @@ -724,15 +738,15 @@ def is_separable(self): EXAMPLES:: sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(GF(7^2), [3,2]) - sage: P = E.lift_x(1) - sage: phi = EllipticCurveHom_composite(E, P); phi + sage: E = EllipticCurve(GF(7^2), [3,2]) # optional - sage.rings.finite_rings + sage: P = E.lift_x(1) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P); phi # optional - sage.rings.finite_rings Composite morphism of degree 7 = 7: From: Elliptic Curve defined by y^2 = x^3 + 3*x + 2 over Finite Field in z2 of size 7^2 To: Elliptic Curve defined by y^2 = x^3 + 3*x + 2 over Finite Field in z2 of size 7^2 - sage: phi.is_separable() + sage: phi.is_separable() # optional - sage.rings.finite_rings True """ return all(phi.is_separable() for phi in self._phis) @@ -746,15 +760,15 @@ def formal(self, prec=20): EXAMPLES:: sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite - sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) - sage: P = E.lift_x(7321) - sage: phi = EllipticCurveHom_composite(E, P) - sage: phi.formal() + sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) # optional - sage.rings.finite_rings + sage: P = E.lift_x(7321) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P) # optional - sage.rings.finite_rings + sage: phi.formal() # optional - sage.rings.finite_rings t + 54203*t^5 + 48536*t^6 + 40698*t^7 + 37808*t^8 + 21111*t^9 + 42381*t^10 + 46688*t^11 + 657*t^12 + 38916*t^13 + 62261*t^14 + 59707*t^15 + 30767*t^16 + 7248*t^17 + 60287*t^18 + 50451*t^19 + 38305*t^20 + 12312*t^21 + 31329*t^22 + O(t^23) - sage: (phi.dual() * phi).formal(prec=5) + sage: (phi.dual() * phi).formal(prec=5) # optional - sage.rings.finite_rings 9*t + 65501*t^2 + 65141*t^3 + 59183*t^4 + 21491*t^5 + 8957*t^6 + 999*t^7 + O(t^8) """ @@ -778,16 +792,16 @@ def scaling_factor(self): sage: from sage.schemes.elliptic_curves.hom_composite import EllipticCurveHom_composite sage: from sage.schemes.elliptic_curves.weierstrass_morphism import WeierstrassIsomorphism - sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) - sage: P = E.lift_x(7321) - sage: phi = EllipticCurveHom_composite(E, P) - sage: phi = WeierstrassIsomorphism(phi.codomain(), [7,8,9,10]) * phi - sage: phi.formal() + sage: E = EllipticCurve(GF(65537), [1,2,3,4,5]) # optional - sage.rings.finite_rings + sage: P = E.lift_x(7321) # optional - sage.rings.finite_rings + sage: phi = EllipticCurveHom_composite(E, P) # optional - sage.rings.finite_rings + sage: phi = WeierstrassIsomorphism(phi.codomain(), [7,8,9,10]) * phi # optional - sage.rings.finite_rings + sage: phi.formal() # optional - sage.rings.finite_rings 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) - sage: phi.scaling_factor() + sage: phi.scaling_factor() # optional - sage.rings.finite_rings 7 ALGORITHM: The scaling factor is multiplicative under @@ -810,15 +824,15 @@ def is_injective(self): sage: phi = EllipticCurveHom_composite(E, E(0,0)) sage: phi.is_injective() False - sage: E = EllipticCurve_from_j(GF(3).algebraic_closure()(0)) - sage: nu = EllipticCurveHom_composite.from_factors(E.automorphisms()) - sage: nu + sage: E = EllipticCurve_from_j(GF(3).algebraic_closure()(0)) # optional - sage.rings.finite_rings + sage: nu = EllipticCurveHom_composite.from_factors(E.automorphisms()) # optional - sage.rings.finite_rings + sage: nu # optional - sage.rings.finite_rings Composite morphism of degree 1 = 1^12: From: Elliptic Curve defined by y^2 = x^3 + x over Algebraic closure of Finite Field of size 3 To: Elliptic Curve defined by y^2 = x^3 + x over Algebraic closure of Finite Field of size 3 - sage: nu.is_injective() + sage: nu.is_injective() # optional - sage.rings.finite_rings True """ return all(phi.is_injective() for phi in self._phis) From e934a4c07ad1fb1b3c36f5fe4465e130d5585f1f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 29 Mar 2023 02:21:12 -0700 Subject: [PATCH 100/135] src/sage/schemes: Revise indentation of multiline doctest output --- src/sage/schemes/berkovich/berkovich_space.py | 11 +- src/sage/schemes/cyclic_covers/constructor.py | 6 +- src/sage/schemes/elliptic_curves/heegner.py | 161 +++++++++++------- 3 files changed, 108 insertions(+), 70 deletions(-) diff --git a/src/sage/schemes/berkovich/berkovich_space.py b/src/sage/schemes/berkovich/berkovich_space.py index 251d9f8c6c3..1a466ad67a7 100644 --- a/src/sage/schemes/berkovich/berkovich_space.py +++ b/src/sage/schemes/berkovich/berkovich_space.py @@ -366,7 +366,7 @@ class Berkovich_Cp_Affine(Berkovich_Cp): sage: ideal = A.prime_above(3) # optional - sage.rings.number_field sage: B = Berkovich_Cp_Affine(A, ideal); B # optional - sage.rings.number_field Affine Berkovich line over Cp(3), with base - Number Field in a with defining polynomial x^3 + 20 + Number Field in a with defining polynomial x^3 + 20 Number fields have a major advantage of exact computation. @@ -468,8 +468,8 @@ def _repr_(self): sage: A. = NumberField(z^2 + 1) # optional - sage.rings.number_field sage: ideal = A.prime_above(3) # optional - sage.rings.number_field sage: Berkovich_Cp_Affine(A, ideal) # optional - sage.rings.number_field - Affine Berkovich line over Cp(3), with base Number Field - in a with defining polynomial z^2 + 1 + Affine Berkovich line over Cp(3), with base + Number Field in a with defining polynomial z^2 + 1 """ if self._base_type == 'padic field': return "Affine Berkovich line over Cp(%s) of precision %s" %(self.prime(),\ @@ -565,7 +565,7 @@ class Berkovich_Cp_Projective(Berkovich_Cp): sage: ideal = A.prime_above(2) # optional - sage.rings.number_field sage: B = Berkovich_Cp_Projective(A, ideal); B # optional - sage.rings.number_field Projective Berkovich line over Cp(2), with base - Number Field in a with defining polynomial x^2 + 1 + Number Field in a with defining polynomial x^2 + 1 Number fields have the benefit that computation is exact, but lack support for all of `\CC_p`. @@ -701,7 +701,8 @@ def _repr_(self): sage: A. = NumberField(x^2 + 1) # optional - sage.rings.number_field sage: v = A.ideal(a + 1) # optional - sage.rings.number_field sage: Berkovich_Cp_Projective(A, v) # optional - sage.rings.number_field - Projective Berkovich line over Cp(2), with base Number Field in a with defining polynomial x^2 + 1 + Projective Berkovich line over Cp(2), + with base Number Field in a with defining polynomial x^2 + 1 """ if self._base_type == 'padic field': return "Projective Berkovich line over Cp(%s) of precision %s" %(self.prime(),\ diff --git a/src/sage/schemes/cyclic_covers/constructor.py b/src/sage/schemes/cyclic_covers/constructor.py index 9229cfea545..c181d19e416 100644 --- a/src/sage/schemes/cyclic_covers/constructor.py +++ b/src/sage/schemes/cyclic_covers/constructor.py @@ -67,7 +67,7 @@ def CyclicCover(r, f, names=None, check_smooth=True): sage: k. = GF(9); R. = k[] # optional - sage.rings.finite_rings sage: CyclicCover(5, x^9 + x + 1) # optional - sage.rings.finite_rings Cyclic Cover of P^1 over Finite Field in a of size 3^2 - defined by y^5 = x^9 + x + 1 + defined by y^5 = x^9 + x + 1 sage: CyclicCover(15, x^9 + x + 1) # optional - sage.rings.finite_rings Traceback (most recent call last): ... @@ -91,8 +91,8 @@ def CyclicCover(r, f, names=None, check_smooth=True): sage: CyclicCover(2, (x^3-x+2)^2*(x^6-1), check_smooth=False) # optional - sage.rings.finite_rings Cyclic Cover of P^1 over Finite Field of size 7 - defined by y^2 = x^12 - 2*x^10 - 3*x^9 + x^8 + 3*x^7 + 3*x^6 - + 2*x^4 + 3*x^3 - x^2 - 3*x + 3 + defined by y^2 = x^12 - 2*x^10 - 3*x^9 + x^8 + 3*x^7 + 3*x^6 + + 2*x^4 + 3*x^3 - x^2 - 3*x + 3 Input with integer coefficients creates objects with the integers diff --git a/src/sage/schemes/elliptic_curves/heegner.py b/src/sage/schemes/elliptic_curves/heegner.py index f5cc605a09c..d3183642349 100644 --- a/src/sage/schemes/elliptic_curves/heegner.py +++ b/src/sage/schemes/elliptic_curves/heegner.py @@ -1339,7 +1339,7 @@ def __init__(self, parent): sage: G = heegner_point(37,-7,5).ring_class_field().galois_group() sage: sage.schemes.elliptic_curves.heegner.GaloisAutomorphismComplexConjugation(G) Complex conjugation automorphism of Ring class field extension - of QQ[sqrt(-7)] of conductor 5 + of QQ[sqrt(-7)] of conductor 5 """ GaloisAutomorphism.__init__(self, parent) @@ -1916,7 +1916,7 @@ def quadratic_order(self): sage: E = EllipticCurve('37a'); P = E.heegner_point(-40,11) sage: P.quadratic_order() Order in Number Field in sqrt_minus_40 with defining polynomial x^2 + 40 - with sqrt_minus_40 = 6.324555320336759?*I + with sqrt_minus_40 = 6.324555320336759?*I sage: P.quadratic_order().basis() [1, 11*sqrt_minus_40] """ @@ -2514,10 +2514,10 @@ def __getitem__(self, i): 12 sage: H[0] Heegner point 5/778*sqrt(-7) - 147/778 of discriminant -7 and conductor 5 - on X_0(389) + on X_0(389) sage: H[-1] Heegner point 5/5446*sqrt(-7) - 757/778 of discriminant -7 and conductor 5 - on X_0(389) + on X_0(389) """ return self.points()[i] @@ -2582,21 +2582,25 @@ def points(self, beta=None): EXAMPLES:: - sage: H = heegner_points(389,-7,5); H + sage: H = heegner_points(389, -7, 5); H All Heegner points of conductor 5 on X_0(389) associated to QQ[sqrt(-7)] sage: H.points() - (Heegner point 5/778*sqrt(-7) - 147/778 of discriminant -7 and conductor 5 on X_0(389), + (Heegner point 5/778*sqrt(-7) - 147/778 of discriminant -7 and conductor 5 + on X_0(389), ..., - Heegner point 5/5446*sqrt(-7) - 757/778 of discriminant -7 and conductor 5 on X_0(389)) + Heegner point 5/5446*sqrt(-7) - 757/778 of discriminant -7 and conductor 5 + on X_0(389)) sage: H.betas() (147, 631) sage: [x.tau() for x in H.points(147)] - [5/778*sqrt_minus_7 - 147/778, 5/1556*sqrt_minus_7 - 147/1556, 5/1556*sqrt_minus_7 - 925/1556, - 5/3112*sqrt_minus_7 - 1703/3112, 5/3112*sqrt_minus_7 - 2481/3112, 5/5446*sqrt_minus_7 - 21/778] + [5/778*sqrt_minus_7 - 147/778, 5/1556*sqrt_minus_7 - 147/1556, + 5/1556*sqrt_minus_7 - 925/1556, 5/3112*sqrt_minus_7 - 1703/3112, + 5/3112*sqrt_minus_7 - 2481/3112, 5/5446*sqrt_minus_7 - 21/778] sage: [x.tau() for x in H.points(631)] - [5/778*sqrt_minus_7 - 631/778, 5/1556*sqrt_minus_7 - 631/1556, 5/1556*sqrt_minus_7 - 1409/1556, - 5/3112*sqrt_minus_7 - 631/3112, 5/3112*sqrt_minus_7 - 1409/3112, 5/5446*sqrt_minus_7 - 757/778] + [5/778*sqrt_minus_7 - 631/778, 5/1556*sqrt_minus_7 - 631/1556, + 5/1556*sqrt_minus_7 - 1409/1556, 5/3112*sqrt_minus_7 - 631/3112, + 5/3112*sqrt_minus_7 - 1409/3112, 5/5446*sqrt_minus_7 - 757/778] The result is cached and is a tuple (since it is immutable):: @@ -2649,9 +2653,9 @@ def plot(self, *args, **kwds): EXAMPLES:: - sage: heegner_points(389,-7,5).plot(pointsize=50, rgbcolor='red') + sage: heegner_points(389,-7,5).plot(pointsize=50, rgbcolor='red') # optional - sage.plot Graphics object consisting of 12 graphics primitives - sage: heegner_points(53,-7,15).plot(pointsize=50, rgbcolor='purple') + sage: heegner_points(53,-7,15).plot(pointsize=50, rgbcolor='purple') # optional - sage.plot Graphics object consisting of 48 graphics primitives """ return sum(z.plot(*args, **kwds) for z in self) @@ -2664,7 +2668,7 @@ class HeegnerPointOnX0N(HeegnerPoint): EXAMPLES:: - sage: x = heegner_point(37,-7,5); x + sage: x = heegner_point(37, -7, 5); x Heegner point 5/74*sqrt(-7) - 11/74 of discriminant -7 and conductor 5 on X_0(37) sage: type(x) @@ -2761,7 +2765,7 @@ def __hash__(self): EXAMPLES:: - sage: x = heegner_point(37,-7,5) + sage: x = heegner_point(37, -7, 5) sage: from sage.schemes.elliptic_curves.heegner import HeegnerPoint sage: hash(x) == hash( (HeegnerPoint.__hash__(x), x.reduced_quadratic_form()) ) True @@ -2796,7 +2800,7 @@ def _repr_(self): EXAMPLES:: - sage: x = heegner_point(37,-7,5); x._repr_() + sage: x = heegner_point(37, -7, 5); x._repr_() 'Heegner point 5/74*sqrt(-7) - 11/74 of discriminant -7 and conductor 5 on X_0(37)' """ c = self.conductor() @@ -2808,7 +2812,7 @@ def _repr_(self): def atkin_lehner_act(self, Q=None): r""" - Given an integer Q dividing the level N such that `\gcd(Q, N/Q) = 1`, returns the + Given an integer Q dividing the level N such that `\gcd(Q, N/Q) = 1`, return the image of this Heegner point under the Atkin-Lehner operator `W_Q`. INPUT: @@ -3047,9 +3051,9 @@ def satisfies_kolyvagin_hypothesis(self, n=None): sage: EllipticCurve('389a').heegner_point(-7).satisfies_kolyvagin_hypothesis() True - sage: EllipticCurve('389a').heegner_point(-7,5).satisfies_kolyvagin_hypothesis() + sage: EllipticCurve('389a').heegner_point(-7, 5).satisfies_kolyvagin_hypothesis() True - sage: EllipticCurve('389a').heegner_point(-7,11).satisfies_kolyvagin_hypothesis() + sage: EllipticCurve('389a').heegner_point(-7, 11).satisfies_kolyvagin_hypothesis() False """ if n is not None: @@ -3066,7 +3070,7 @@ def __hash__(self): EXAMPLES:: - sage: x = EllipticCurve('389a').heegner_point(-7,5) + sage: x = EllipticCurve('389a').heegner_point(-7, 5) sage: hash(x) == hash( (x.curve(), x.heegner_point_on_X0N()) ) True """ @@ -3077,7 +3081,7 @@ def __eq__(self, right): EXAMPLES:: sage: y1 = EllipticCurve('389a').heegner_point(-7) - sage: y5 = EllipticCurve('389a').heegner_point(-7,5) + sage: y5 = EllipticCurve('389a').heegner_point(-7, 5) sage: y1 == y1 True sage: y5 == y5 @@ -3095,7 +3099,7 @@ def __ne__(self, other): EXAMPLES:: sage: y1 = EllipticCurve('389a').heegner_point(-7) - sage: y5 = EllipticCurve('389a').heegner_point(-7,5) + sage: y5 = EllipticCurve('389a').heegner_point(-7, 5) sage: y1 != y1 False sage: y5 != y5 @@ -3426,7 +3430,8 @@ def x_poly_exact(self, prec=53, algorithm='lll'): of conductor bigger than 1 on a rank 2 curve:: sage: E = EllipticCurve('389a'); P = E.heegner_point(-7, 5); P - Heegner point of discriminant -7 and conductor 5 on elliptic curve of conductor 389 + Heegner point of discriminant -7 and conductor 5 + on elliptic curve of conductor 389 sage: P.x_poly_exact() Traceback (most recent call last): ... @@ -3434,13 +3439,18 @@ def x_poly_exact(self, prec=53, algorithm='lll'): (fails discriminant test) sage: P.x_poly_exact(120) x^6 + 10/7*x^5 - 867/49*x^4 - 76/245*x^3 + 3148/35*x^2 - 25944/245*x + 48771/1225 - sage: E.heegner_point(-7,11).x_poly_exact(500) - x^10 + 282527/52441*x^9 + 27049007420/2750058481*x^8 - 22058564794/2750058481*x^7 - 140054237301/2750058481*x^6 + 696429998952/30250643291*x^5 + 2791387923058/30250643291*x^4 - 3148473886134/30250643291*x^3 + 1359454055022/30250643291*x^2 - 250620385365/30250643291*x + 181599685425/332757076201 + sage: E.heegner_point(-7, 11).x_poly_exact(500) + x^10 + 282527/52441*x^9 + 27049007420/2750058481*x^8 - 22058564794/2750058481*x^7 + - 140054237301/2750058481*x^6 + 696429998952/30250643291*x^5 + + 2791387923058/30250643291*x^4 - 3148473886134/30250643291*x^3 + + 1359454055022/30250643291*x^2 - 250620385365/30250643291*x + + 181599685425/332757076201 Here we compute a Heegner point of conductor 5 on a rank 3 curve:: sage: E = EllipticCurve('5077a'); P = E.heegner_point(-7,5); P - Heegner point of discriminant -7 and conductor 5 on elliptic curve of conductor 5077 + Heegner point of discriminant -7 and conductor 5 + on elliptic curve of conductor 5077 sage: P.x_poly_exact(500) x^6 + 1108754853727159228/72351048803252547*x^5 + 88875505551184048168/1953478317687818769*x^4 - 2216200271166098662132/3255797196146364615*x^3 + 14941627504168839449851/9767391588439093845*x^2 - 3456417460183342963918/3255797196146364615*x + 1306572835857500500459/5426328660243941025 @@ -3482,7 +3492,8 @@ def _check_poly_discriminant(self, f): EXAMPLES:: sage: E = EllipticCurve('389a'); P = E.heegner_point(-7, 5); P - Heegner point of discriminant -7 and conductor 5 on elliptic curve of conductor 389 + Heegner point of discriminant -7 and conductor 5 + on elliptic curve of conductor 389 sage: R. = QQ[] sage: P._check_poly_discriminant(x^2 - 5) True @@ -3539,7 +3550,8 @@ def point_exact(self, prec=53, algorithm='lll', var='a', optimize=False): EXAMPLES:: sage: E = EllipticCurve('389a'); P = E.heegner_point(-7, 5); P - Heegner point of discriminant -7 and conductor 5 on elliptic curve of conductor 389 + Heegner point of discriminant -7 and conductor 5 + on elliptic curve of conductor 389 sage: z = P.point_exact(200, optimize=True) sage: z[1].charpoly() x^12 + 6*x^11 + 90089/1715*x^10 + 71224/343*x^9 + 52563964/588245*x^8 - 483814934/588245*x^7 - 156744579/16807*x^6 - 2041518032/84035*x^5 + 1259355443184/14706125*x^4 + 3094420220918/14706125*x^3 + 123060442043827/367653125*x^2 + 82963044474852/367653125*x + 211679465261391/1838265625 @@ -3617,7 +3629,8 @@ def conjugates_over_K(self): sage: E = EllipticCurve('77a') sage: y = E.heegner_point(-52,5); y - Heegner point of discriminant -52 and conductor 5 on elliptic curve of conductor 77 + Heegner point of discriminant -52 and conductor 5 + on elliptic curve of conductor 77 sage: print([z.quadratic_form() for z in y.conjugates_over_K()]) [77*x^2 + 52*x*y + 13*y^2, 154*x^2 + 206*x*y + 71*y^2, 539*x^2 + 822*x*y + 314*y^2, 847*x^2 + 1284*x*y + 487*y^2, 1001*x^2 + 52*x*y + y^2, 1078*x^2 + 822*x*y + 157*y^2, @@ -3683,7 +3696,8 @@ def _numerical_approx_xy_poly(self, prec=53): sage: y = E.heegner_point(-7,3); y Heegner point of discriminant -7 and conductor 3 on elliptic curve of conductor 37 sage: y._numerical_approx_xy_poly() # rel tol 1e-14 - (X^8 + 6.00000000000000*X^7 + 8.99999999999998*X^6 - 12.0000000000000*X^5 - 42.0000000000000*X^4 - 17.9999999999999*X^3 + 36.0000000000001*X^2 + 35.9999999999999*X + 8.99999999999995, X^8 + 12.0000000000000*X^7 + 72.0000000000000*X^6 + 270.000000000000*X^5 + 678.000000000001*X^4 + 1152.00000000000*X^3 + 1269.00000000000*X^2 + 810.000000000002*X + 225.000000000001) + (X^8 + 6.00000000000000*X^7 + 8.99999999999998*X^6 - 12.0000000000000*X^5 - 42.0000000000000*X^4 - 17.9999999999999*X^3 + 36.0000000000001*X^2 + 35.9999999999999*X + 8.99999999999995, + X^8 + 12.0000000000000*X^7 + 72.0000000000000*X^6 + 270.000000000000*X^5 + 678.000000000001*X^4 + 1152.00000000000*X^3 + 1269.00000000000*X^2 + 810.000000000002*X + 225.000000000001) """ v = self._numerical_approx_conjugates_over_QQ(prec) R = ComplexField(prec)['X'] @@ -3718,7 +3732,7 @@ def _xy_poly_nearby(self, prec=53, max_error=10**(-10)): Heegner point of discriminant -7 and conductor 3 on elliptic curve of conductor 37 sage: y._xy_poly_nearby() [X^8 + 6*X^7 + 9*X^6 - 12*X^5 - 42*X^4 - 18*X^3 + 36*X^2 + 36*X + 9, - X^8 + 12*X^7 + 72*X^6 + 270*X^5 + 678*X^4 + 1152*X^3 + 1269*X^2 + 810*X + 225] + X^8 + 12*X^7 + 72*X^6 + 270*X^5 + 678*X^4 + 1152*X^3 + 1269*X^2 + 810*X + 225] """ v = self._numerical_approx_xy_poly(prec) return [nearby_rational_poly(g, max_error=max_error) for g in v] @@ -4027,7 +4041,8 @@ class KolyvaginPoint(HeegnerPoint): sage: EllipticCurve('37a1').kolyvagin_point(-67) Kolyvagin point of discriminant -67 on elliptic curve of conductor 37 sage: EllipticCurve('389a1').kolyvagin_point(-7, 5) - Kolyvagin point of discriminant -7 and conductor 5 on elliptic curve of conductor 389 + Kolyvagin point of discriminant -7 and conductor 5 + on elliptic curve of conductor 389 One can also associated a Kolyvagin point to a Heegner point:: @@ -4169,7 +4184,8 @@ def numerical_approx(self, prec=53): True sage: P = EllipticCurve('389a1').kolyvagin_point(-7, 5); P - Kolyvagin point of discriminant -7 and conductor 5 on elliptic curve of conductor 389 + Kolyvagin point of discriminant -7 and conductor 5 + on elliptic curve of conductor 389 Numerical approximation is only implemented for points of conductor 1:: @@ -4272,7 +4288,7 @@ def plot(self, prec=53, *args, **kwds): EXAMPLES:: sage: E = EllipticCurve('37a'); P = E.heegner_point(-11).kolyvagin_point() - sage: P.plot(prec=30, pointsize=50, rgbcolor='red') + E.plot() + sage: P.plot(prec=30, pointsize=50, rgbcolor='red') + E.plot() # optional - sage.plot Graphics object consisting of 3 graphics primitives """ if self.conductor() != 1: @@ -4481,12 +4497,12 @@ def kolyvagin_cohomology_class(self, n=None): EXAMPLES:: - sage: y = EllipticCurve('389a').heegner_point(-7,5) + sage: y = EllipticCurve('389a').heegner_point(-7, 5) sage: P = y.kolyvagin_point() sage: P.kolyvagin_cohomology_class(3) Kolyvagin cohomology class c(5) in H^1(K,E[3]) - sage: y = EllipticCurve('37a').heegner_point(-7,5).kolyvagin_point() + sage: y = EllipticCurve('37a').heegner_point(-7, 5).kolyvagin_point() sage: y.kolyvagin_cohomology_class() Kolyvagin cohomology class c(5) in H^1(K,E[2]) """ @@ -4515,7 +4531,7 @@ def __init__(self, kolyvagin_point, n): EXAMPLES:: - sage: y = EllipticCurve('389a').heegner_point(-7,5) + sage: y = EllipticCurve('389a').heegner_point(-7, 5) sage: y.kolyvagin_cohomology_class(3) Kolyvagin cohomology class c(5) in H^1(K,E[3]) """ @@ -4584,7 +4600,7 @@ def conductor(self): EXAMPLES:: - sage: y = EllipticCurve('37a').heegner_point(-7,5) + sage: y = EllipticCurve('37a').heegner_point(-7, 5) sage: t = y.kolyvagin_cohomology_class() sage: t.conductor() 5 @@ -4598,10 +4614,11 @@ class is associated. EXAMPLES:: - sage: y = EllipticCurve('37a').heegner_point(-7,5) + sage: y = EllipticCurve('37a').heegner_point(-7, 5) sage: t = y.kolyvagin_cohomology_class() sage: t.kolyvagin_point() - Kolyvagin point of discriminant -7 and conductor 5 on elliptic curve of conductor 37 + Kolyvagin point of discriminant -7 and conductor 5 + on elliptic curve of conductor 37 """ return self.__kolyvagin_point @@ -4612,10 +4629,11 @@ def heegner_point(self): EXAMPLES:: - sage: y = EllipticCurve('37a').heegner_point(-7,5) + sage: y = EllipticCurve('37a').heegner_point(-7, 5) sage: t = y.kolyvagin_cohomology_class() sage: t.heegner_point() - Heegner point of discriminant -7 and conductor 5 on elliptic curve of conductor 37 + Heegner point of discriminant -7 and conductor 5 + on elliptic curve of conductor 37 """ return self.__kolyvagin_point.heegner_point() @@ -4630,7 +4648,7 @@ def _repr_(self): EXAMPLES:: - sage: y = EllipticCurve('37a').heegner_point(-7,5) + sage: y = EllipticCurve('37a').heegner_point(-7, 5) sage: t = y.kolyvagin_cohomology_class() sage: t._repr_() 'Kolyvagin cohomology class c(5) in H^1(K,E[2])' @@ -5280,12 +5298,24 @@ def kolyvagin_cyclic_subideals(self, I, p, alpha_quaternion): sage: alpha_quaternion = f(g[0]); alpha_quaternion 1 - 77/192*i - 5/128*j - 137/384*k sage: H.kolyvagin_cyclic_subideals(I, 5, alpha_quaternion) - [(Fractional ideal (2 + 2/3*i + 364*j + 231928/3*k, 4/3*i + 946*j + 69338/3*k, 1280*j + 49920*k, 94720*k), 0), - (Fractional ideal (2 + 2/3*i + 108*j + 31480/3*k, 4/3*i + 434*j + 123098/3*k, 1280*j + 49920*k, 94720*k), 1), - (Fractional ideal (2 + 2/3*i + 876*j + 7672/3*k, 4/3*i + 434*j + 236762/3*k, 1280*j + 49920*k, 94720*k), 2), - (Fractional ideal (2 + 2/3*i + 364*j + 61432/3*k, 4/3*i + 178*j + 206810/3*k, 1280*j + 49920*k, 94720*k), 3), - (Fractional ideal (2 + 2/3*i + 876*j + 178168/3*k, 4/3*i + 1202*j + 99290/3*k, 1280*j + 49920*k, 94720*k), 4), - (Fractional ideal (2 + 2/3*i + 1132*j + 208120/3*k, 4/3*i + 946*j + 183002/3*k, 1280*j + 49920*k, 94720*k), 5)] + [(Fractional ideal (2 + 2/3*i + 364*j + 231928/3*k, + 4/3*i + 946*j + 69338/3*k, + 1280*j + 49920*k, 94720*k), 0), + (Fractional ideal (2 + 2/3*i + 108*j + 31480/3*k, + 4/3*i + 434*j + 123098/3*k, + 1280*j + 49920*k, 94720*k), 1), + (Fractional ideal (2 + 2/3*i + 876*j + 7672/3*k, + 4/3*i + 434*j + 236762/3*k, + 1280*j + 49920*k, 94720*k), 2), + (Fractional ideal (2 + 2/3*i + 364*j + 61432/3*k, + 4/3*i + 178*j + 206810/3*k, + 1280*j + 49920*k, 94720*k), 3), + (Fractional ideal (2 + 2/3*i + 876*j + 178168/3*k, + 4/3*i + 1202*j + 99290/3*k, + 1280*j + 49920*k, 94720*k), 4), + (Fractional ideal (2 + 2/3*i + 1132*j + 208120/3*k, + 4/3*i + 946*j + 183002/3*k, + 1280*j + 49920*k, 94720*k), 5)] """ X = I.cyclic_right_subideals(p, alpha_quaternion) return [(J, i) for i, J in enumerate(X)] @@ -5415,9 +5445,11 @@ def kolyvagin_sigma_operator(self, D, c, r, bound=None): sage: V = H.modp_dual_elliptic_curve_factor(E, q, 5) # long time (4s on sage.math, 2012) sage: k118 = H.kolyvagin_sigma_operator(D, c, 118) sage: k104 = H.kolyvagin_sigma_operator(D, c, 104) - sage: [b.dot_product(k104.element().change_ring(GF(3))) for b in V.basis()] # long time + sage: [b.dot_product(k104.element().change_ring(GF(3))) # long time + ....: for b in V.basis()] [0, 0] - sage: [b.dot_product(k118.element().change_ring(GF(3))) for b in V.basis()] # long time + sage: [b.dot_product(k118.element().change_ring(GF(3))) # long time + ....: for b in V.basis()] [0, 0] Next we try again with `c=41` and this does work, in that we @@ -5426,9 +5458,11 @@ def kolyvagin_sigma_operator(self, D, c, r, bound=None): sage: c = 41 sage: k118 = H.kolyvagin_sigma_operator(D, c, 118) sage: k104 = H.kolyvagin_sigma_operator(D, c, 104) - sage: [b.dot_product(k118.element().change_ring(GF(3))) for b in V.basis()] # long time + sage: [b.dot_product(k118.element().change_ring(GF(3))) # long time + ....: for b in V.basis()] [2, 0] - sage: [b.dot_product(k104.element().change_ring(GF(3))) for b in V.basis()] # long time + sage: [b.dot_product(k104.element().change_ring(GF(3))) # long time + ....: for b in V.basis()] [1, 0] By the way, the above is the first ever provable verification @@ -5691,15 +5725,16 @@ def kolyvagin_reduction_data(E, q, first_only=True): A rank 1 example:: - sage: kolyvagin_reduction_data(EllipticCurve('37a1'),3) + sage: kolyvagin_reduction_data(EllipticCurve('37a1'), 3) (17, -7, 1, 52) A rank 3 example:: - sage: kolyvagin_reduction_data(EllipticCurve('5077a1'),3) + sage: kolyvagin_reduction_data(EllipticCurve('5077a1'), 3) (11, -47, 5, 4234) sage: H = heegner_points(5077, -47) - sage: [c for c in H.kolyvagin_conductors(2,10,EllipticCurve('5077a1'),3) if c%11] + sage: [c for c in H.kolyvagin_conductors(2, 10, EllipticCurve('5077a1'), 3) + ....: if c % 11] [667, 943, 1189, 2461] sage: factor(667) 23 * 29 @@ -5718,19 +5753,19 @@ def kolyvagin_reduction_data(E, q, first_only=True): The first rank 2 example:: - sage: kolyvagin_reduction_data(EllipticCurve('389a'),3) + sage: kolyvagin_reduction_data(EllipticCurve('389a'), 3) (5, -7, 1, 130) - sage: kolyvagin_reduction_data(EllipticCurve('389a'),3, first_only=False) + sage: kolyvagin_reduction_data(EllipticCurve('389a'), 3, first_only=False) (5, 17, -7, 1, 130, 520) A large `q = 7`:: - sage: kolyvagin_reduction_data(EllipticCurve('1143c1'),7, first_only=False) + sage: kolyvagin_reduction_data(EllipticCurve('1143c1'), 7, first_only=False) (13, 83, -59, 3, 1536, 10496) Additive reduction:: - sage: kolyvagin_reduction_data(EllipticCurve('2350g1'),5, first_only=False) + sage: kolyvagin_reduction_data(EllipticCurve('2350g1'), 5, first_only=False) (19, 239, -311, 19, 6480, 85680) """ from .ell_generic import is_EllipticCurve @@ -5972,7 +6007,8 @@ def domain(self): sage: H = heegner_points(11).reduce_mod(3); R = H.left_orders()[0] sage: H.optimal_embeddings(-7, 2, R)[0].domain() - Order in Number Field in a with defining polynomial x^2 + 7 with a = 2.645751311064591?*I + Order in Number Field in a with defining polynomial x^2 + 7 + with a = 2.645751311064591?*I """ R, a = quadratic_order(self.__D, self.__c) @@ -6427,7 +6463,8 @@ def ell_heegner_point(self, D, c=ZZ(1), f=None, check=True): We can specify the quadratic form:: sage: P = EllipticCurve('389a').heegner_point(-7, 5, (778,925,275)); P - Heegner point of discriminant -7 and conductor 5 on elliptic curve of conductor 389 + Heegner point of discriminant -7 and conductor 5 + on elliptic curve of conductor 389 sage: P.quadratic_form() 778*x^2 + 925*x*y + 275*y^2 """ From 7e48c6459a3974d034c828d9ef8a4a72fdcaf769 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 29 Mar 2023 09:55:00 -0700 Subject: [PATCH 101/135] src/sage/schemes/elliptic_curves/ell_number_field.py: Fix RST markup --- src/sage/schemes/elliptic_curves/ell_number_field.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py index a3c947a9afc..998cc0d94b4 100644 --- a/src/sage/schemes/elliptic_curves/ell_number_field.py +++ b/src/sage/schemes/elliptic_curves/ell_number_field.py @@ -119,7 +119,7 @@ def __init__(self, K, ainvs): r""" EXAMPLES: - A curve from the database of curves over `\QQ`, but over a larger field: + A curve from the database of curves over `\QQ`, but over a larger field:: sage: K. = NumberField(x^2 + 1) sage: EllipticCurve(K,'389a1') From 7bc2783986611873c125b3d90efc25cb5b24d9a2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 29 Mar 2023 12:51:49 -0700 Subject: [PATCH 102/135] src/sage/schemes: More revisions to the indentation of multiline doctest output --- src/sage/schemes/cyclic_covers/constructor.py | 2 +- .../schemes/elliptic_curves/constructor.py | 13 +- .../elliptic_curves/ell_curve_isogeny.py | 14 +- src/sage/schemes/elliptic_curves/ell_point.py | 4 +- src/sage/schemes/elliptic_curves/heegner.py | 10 +- .../schemes/elliptic_curves/period_lattice.py | 546 +++++++++--------- .../elliptic_curves/weierstrass_morphism.py | 2 +- src/sage/schemes/generic/algebraic_scheme.py | 195 ++++--- src/sage/schemes/generic/homset.py | 14 +- src/sage/schemes/generic/hypersurface.py | 25 +- src/sage/schemes/generic/morphism.py | 21 +- src/sage/schemes/generic/point.py | 4 +- src/sage/schemes/generic/scheme.py | 24 +- .../hyperelliptic_curves/constructor.py | 12 +- .../hyperelliptic_generic.py | 26 +- .../hyperelliptic_curves/jacobian_generic.py | 8 +- .../hyperelliptic_curves/jacobian_homset.py | 2 +- .../hyperelliptic_curves/jacobian_morphism.py | 53 +- .../schemes/hyperelliptic_curves/mestre.py | 12 +- .../schemes/jacobians/abstract_jacobian.py | 12 +- src/sage/schemes/plane_conics/con_field.py | 23 +- .../schemes/plane_conics/con_finite_field.py | 10 +- .../schemes/plane_conics/con_number_field.py | 2 +- src/sage/schemes/plane_conics/constructor.py | 4 +- .../schemes/plane_quartics/quartic_generic.py | 2 +- src/sage/schemes/product_projective/space.py | 28 +- .../schemes/product_projective/subscheme.py | 6 +- .../schemes/projective/projective_homset.py | 8 +- .../schemes/projective/projective_morphism.py | 47 +- .../schemes/projective/projective_point.py | 2 +- .../schemes/projective/projective_space.py | 35 +- .../projective/projective_subscheme.py | 52 +- src/sage/schemes/toric/fano_variety.py | 40 +- src/sage/schemes/toric/ideal.py | 12 +- src/sage/schemes/toric/variety.py | 6 +- 35 files changed, 652 insertions(+), 624 deletions(-) diff --git a/src/sage/schemes/cyclic_covers/constructor.py b/src/sage/schemes/cyclic_covers/constructor.py index c181d19e416..d2975336301 100644 --- a/src/sage/schemes/cyclic_covers/constructor.py +++ b/src/sage/schemes/cyclic_covers/constructor.py @@ -79,7 +79,7 @@ def CyclicCover(r, f, names=None, check_smooth=True): sage: k. = GF(9); R. = k[] # optional - sage.rings.finite_rings sage: CyclicCover(5, x^9 + x + 1, names=["A","B"]) # optional - sage.rings.finite_rings Cyclic Cover of P^1 over Finite Field in a of size 3^2 - defined by B^5 = A^9 + A + 1 + defined by B^5 = A^9 + A + 1 Double roots:: diff --git a/src/sage/schemes/elliptic_curves/constructor.py b/src/sage/schemes/elliptic_curves/constructor.py index 75d1167064f..ac934a14d89 100644 --- a/src/sage/schemes/elliptic_curves/constructor.py +++ b/src/sage/schemes/elliptic_curves/constructor.py @@ -287,12 +287,12 @@ class EllipticCurveFactory(UniqueFactory): sage: t = F.gen() sage: E = EllipticCurve([t,0]); E Elliptic Curve defined by y^2 = x^3 + t*x - over Fraction Field of Univariate Polynomial Ring in t over Rational Field + over Fraction Field of Univariate Polynomial Ring in t over Rational Field sage: type(E) sage: E.category() - Category of schemes over Fraction Field of Univariate Polynomial Ring in t - over Rational Field + Category of schemes over + Fraction Field of Univariate Polynomial Ring in t over Rational Field See :trac:`12517`:: @@ -1057,7 +1057,9 @@ def EllipticCurve_from_cubic(F, P=None, morphism=True): over Number Field in a with defining polynomial x^2 + 3 with a = 1.732050807568878?*I Defn: Defined on coordinates by sending (x : y : z) to - (-16424/127575*x^2 - 231989/680400*x*y - 14371/64800*y^2 - 26689/81648*x*z - 10265/27216*y*z - 2053/163296*z^2 : 24496/315*x^2 + 119243/840*x*y + 4837/80*y^2 + 67259/504*x*z + 25507/168*y*z + 5135/1008*z^2 : 8653002877/2099914709760000*x^2 + 8653002877/699971569920000*x*y + 8653002877/933295426560000*y^2 + 8653002877/419982941952000*x*z + 8653002877/279988627968000*y*z + 8653002877/335986353561600*z^2) + (-16424/127575*x^2 - 231989/680400*x*y - 14371/64800*y^2 - 26689/81648*x*z - 10265/27216*y*z - 2053/163296*z^2 + : 24496/315*x^2 + 119243/840*x*y + 4837/80*y^2 + 67259/504*x*z + 25507/168*y*z + 5135/1008*z^2 + : 8653002877/2099914709760000*x^2 + 8653002877/699971569920000*x*y + 8653002877/933295426560000*y^2 + 8653002877/419982941952000*x*z + 8653002877/279988627968000*y*z + 8653002877/335986353561600*z^2) An example over a function field, using a non-flex:: @@ -1065,7 +1067,8 @@ def EllipticCurve_from_cubic(F, P=None, morphism=True): sage: R. = K[] sage: cubic = x^3 + t*y^3 + (1+t)*z^3 sage: EllipticCurve_from_cubic(cubic, [1,1,-1], morphism=False) - Elliptic Curve defined by y^2 + ((162*t^6+486*t^5+810*t^4+810*t^3+486*t^2+162*t)/(t^6+12*t^5-3*t^4-20*t^3-3*t^2+12*t+1))*x*y + ((314928*t^14+4094064*t^13+23462136*t^12+78102144*t^11+167561379*t^10+243026001*t^9+243026001*t^8+167561379*t^7+78102144*t^6+23462136*t^5+4094064*t^4+314928*t^3)/(t^14+40*t^13+577*t^12+3524*t^11+8075*t^10+5288*t^9-8661*t^8-17688*t^7-8661*t^6+5288*t^5+8075*t^4+3524*t^3+577*t^2+40*t+1))*y = x^3 + ((2187*t^12+13122*t^11-17496*t^10-207765*t^9-516132*t^8-673596*t^7-516132*t^6-207765*t^5-17496*t^4+13122*t^3+2187*t^2)/(t^12+24*t^11+138*t^10-112*t^9-477*t^8+72*t^7+708*t^6+72*t^5-477*t^4-112*t^3+138*t^2+24*t+1))*x^2 over Rational function field in t over Rational Field + Elliptic Curve defined by y^2 + ((162*t^6+486*t^5+810*t^4+810*t^3+486*t^2+162*t)/(t^6+12*t^5-3*t^4-20*t^3-3*t^2+12*t+1))*x*y + ((314928*t^14+4094064*t^13+23462136*t^12+78102144*t^11+167561379*t^10+243026001*t^9+243026001*t^8+167561379*t^7+78102144*t^6+23462136*t^5+4094064*t^4+314928*t^3)/(t^14+40*t^13+577*t^12+3524*t^11+8075*t^10+5288*t^9-8661*t^8-17688*t^7-8661*t^6+5288*t^5+8075*t^4+3524*t^3+577*t^2+40*t+1))*y = x^3 + ((2187*t^12+13122*t^11-17496*t^10-207765*t^9-516132*t^8-673596*t^7-516132*t^6-207765*t^5-17496*t^4+13122*t^3+2187*t^2)/(t^12+24*t^11+138*t^10-112*t^9-477*t^8+72*t^7+708*t^6+72*t^5-477*t^4-112*t^3+138*t^2+24*t+1))*x^2 + over Rational function field in t over Rational Field TESTS: diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index 91a32f85bf6..4db005fe3cc 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -18,8 +18,9 @@ sage: Q = E(6,5) # optional - sage.rings.finite_rings sage: phi = E.isogeny(Q) # optional - sage.rings.finite_rings sage: phi # optional - sage.rings.finite_rings - Isogeny of degree 7 from Elliptic Curve defined by y^2 = x^3 + x + 1 over - Finite Field of size 11 to Elliptic Curve defined by y^2 = x^3 + 7*x + 8 + Isogeny of degree 7 + from Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 11 + to Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 11 sage: P = E(4,5) # optional - sage.rings.finite_rings sage: phi(P) # optional - sage.rings.finite_rings @@ -27,9 +28,10 @@ sage: phi.codomain() # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Finite Field of size 11 sage: phi.rational_maps() # optional - sage.rings.finite_rings - ((x^7 + 4*x^6 - 3*x^5 - 2*x^4 - 3*x^3 + 3*x^2 + x - 2)/(x^6 + 4*x^5 - 4*x^4 - - 5*x^3 + 5*x^2), (x^9*y - 5*x^8*y - x^7*y + x^5*y - x^4*y - 5*x^3*y - - 5*x^2*y - 2*x*y - 5*y)/(x^9 - 5*x^8 + 4*x^6 - 3*x^4 + 2*x^3)) + ((x^7 + 4*x^6 - 3*x^5 - 2*x^4 + - 3*x^3 + 3*x^2 + x - 2)/(x^6 + 4*x^5 - 4*x^4 - 5*x^3 + 5*x^2), + (x^9*y - 5*x^8*y - x^7*y + x^5*y - x^4*y + - 5*x^3*y - 5*x^2*y - 2*x*y - 5*y)/(x^9 - 5*x^8 + 4*x^6 - 3*x^4 + 2*x^3)) The methods directly accessible from an elliptic curve ``E`` over a field are @@ -1048,7 +1050,7 @@ def __init__(self, E, kernel, codomain=None, degree=None, model=None, check=True sage: EllipticCurveIsogeny(E, X^3 - 13*X^2 - 58*X + 503, check=False) Isogeny of degree 7 from Elliptic Curve defined by y^2 + x*y = x^3 - x^2 - 107*x + 552 - over Rational Field + over Rational Field to Elliptic Curve defined by y^2 + x*y = x^3 - x^2 - 5252*x - 178837 over Rational Field """ diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py index 2402ae8036b..368741fbcd7 100644 --- a/src/sage/schemes/elliptic_curves/ell_point.py +++ b/src/sage/schemes/elliptic_curves/ell_point.py @@ -1481,14 +1481,14 @@ def _miller_(self, Q, n): the curve is negative, so it should exercise the `n<0` case in the code:: - sage: p = 2017; A = 1; B = 30; r = 29; t = -70; k = 7; + sage: p = 2017; A = 1; B = 30; r = 29; t = -70; k = 7 sage: F = GF(p); R. = F[] # optional - sage.rings.finite_rings sage: E = EllipticCurve([F(A), F(B)]); P = E(369, 716) # optional - sage.rings.finite_rings sage: K. = GF(p^k, modulus=x^k+2); EK = E.base_extend(K) # optional - sage.rings.finite_rings sage: Qx = 1226*a^6 + 1778*a^5 + 660*a^4 + 1791*a^3 + 1750*a^2 + 867*a + 770 # optional - sage.rings.finite_rings sage: Qy = 1764*a^6 + 198*a^5 + 1206*a^4 + 406*a^3 + 1200*a^2 + 273*a + 1712 # optional - sage.rings.finite_rings sage: Q = EK(Qx, Qy) # optional - sage.rings.finite_rings - sage: Q._miller_(P, t-1) # optional - sage.rings.finite_rings + sage: Q._miller_(P, t - 1) # optional - sage.rings.finite_rings 1311*a^6 + 1362*a^5 + 1177*a^4 + 807*a^3 + 1331*a^2 + 1530*a + 1931 ALGORITHM: diff --git a/src/sage/schemes/elliptic_curves/heegner.py b/src/sage/schemes/elliptic_curves/heegner.py index d3183642349..6b552bafda9 100644 --- a/src/sage/schemes/elliptic_curves/heegner.py +++ b/src/sage/schemes/elliptic_curves/heegner.py @@ -787,7 +787,7 @@ def base_field(self): 6 sage: G.base_field() Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 - with sqrt_minus_7 = 2.645751311064591?*I + with sqrt_minus_7 = 2.645751311064591?*I sage: G = Kc.galois_group(Kc); G Galois group of Ring class field extension of QQ[sqrt(-7)] of conductor 5 over Ring class field extension of QQ[sqrt(-7)] of conductor 5 @@ -1849,7 +1849,7 @@ def conductor(self): 5 sage: E = EllipticCurve('37a1'); P = E.kolyvagin_point(-67,7); P Kolyvagin point of discriminant -67 and conductor 7 - on elliptic curve of conductor 37 + on elliptic curve of conductor 37 sage: P.conductor() 7 sage: E = EllipticCurve('389a'); P = E.heegner_point(-7, 5); P.conductor() @@ -1868,7 +1868,7 @@ def discriminant(self): -7 sage: E = EllipticCurve('37a1'); P = E.kolyvagin_point(-67,7); P Kolyvagin point of discriminant -67 and conductor 7 - on elliptic curve of conductor 37 + on elliptic curve of conductor 37 sage: P.discriminant() -67 sage: E = EllipticCurve('389a'); P = E.heegner_point(-7, 5); P.discriminant() @@ -2136,7 +2136,7 @@ class HeegnerPoints_level_disc(HeegnerPoints): -7 sage: H.quadratic_field() Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 - with sqrt_minus_7 = 2.645751311064591?*I + with sqrt_minus_7 = 2.645751311064591?*I sage: H.kolyvagin_conductors() [1, 3, 5, 13, 15, 17, 19, 31, 39, 41] @@ -2943,7 +2943,7 @@ def galois_orbit_over_K(self): sage: x = heegner_point(389, -7, 3); x Heegner point 3/778*sqrt(-7) - 223/778 of discriminant -7 - and conductor 3 on X_0(389) + and conductor 3 on X_0(389) sage: x.galois_orbit_over_K() [Heegner point 3/778*sqrt(-7) - 223/778 of discriminant -7 and conductor 3 on X_0(389), Heegner point 3/1556*sqrt(-7) - 223/1556 of discriminant -7 and conductor 3 on X_0(389), diff --git a/src/sage/schemes/elliptic_curves/period_lattice.py b/src/sage/schemes/elliptic_curves/period_lattice.py index 61b99b411b3..0b8cb197840 100644 --- a/src/sage/schemes/elliptic_curves/period_lattice.py +++ b/src/sage/schemes/elliptic_curves/period_lattice.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- r""" Period lattices of elliptic curves and related functions @@ -17,13 +16,13 @@ EXAMPLES:: - sage: K. = NumberField(x^3-2) - sage: E = EllipticCurve([0,1,0,a,a]) + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # optional - sage.rings.number_field First we try a real embedding:: - sage: emb = K.embeddings(RealField())[0] - sage: L = E.period_lattice(emb); L + sage: emb = K.embeddings(RealField())[0] # optional - sage.rings.number_field + sage: L = E.period_lattice(emb); L # optional - sage.rings.number_field Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism: @@ -33,22 +32,22 @@ The first basis period is real:: - sage: L.basis() + sage: L.basis() # optional - sage.rings.number_field (3.81452977217855, 1.90726488608927 + 1.34047785962440*I) - sage: L.is_real() + sage: L.is_real() # optional - sage.rings.number_field True For a basis `\omega_1,\omega_2` normalised so that `\omega_1/\omega_2` is in the fundamental region of the upper half-plane, use the function ``normalised_basis()`` instead:: - sage: L.normalised_basis() + sage: L.normalised_basis() # optional - sage.rings.number_field (1.90726488608927 - 1.34047785962440*I, -1.90726488608927 - 1.34047785962440*I) Next a complex embedding:: - sage: emb = K.embeddings(ComplexField())[0] - sage: L = E.period_lattice(emb); L + sage: emb = K.embeddings(ComplexField())[0] # optional - sage.rings.number_field + sage: L = E.period_lattice(emb); L # optional - sage.rings.number_field Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism: @@ -60,21 +59,21 @@ that `\tau = \omega_1/\omega_2` is in the fundamental region in the upper half plane:: - sage: w1,w2 = L.basis(); w1,w2 + sage: w1, w2 = L.basis(); w1, w2 # optional - sage.rings.number_field (-1.37588604166076 - 2.58560946624443*I, -2.10339907847356 + 0.428378776460622*I) - sage: L.is_real() + sage: L.is_real() # optional - sage.rings.number_field False - sage: tau = w1/w2; tau + sage: tau = w1/w2; tau # optional - sage.rings.number_field 0.387694505032876 + 1.30821088214407*I - sage: L.normalised_basis() + sage: L.normalised_basis() # optional - sage.rings.number_field (-1.37588604166076 - 2.58560946624443*I, -2.10339907847356 + 0.428378776460622*I) We test that bug :trac:`8415` (caused by a PARI bug fixed in v2.3.5) is OK:: - sage: E = EllipticCurve('37a') - sage: K. = QuadraticField(-7) - sage: EK = E.change_ring(K) - sage: EK.period_lattice(K.complex_embeddings()[0]) + sage: E = EllipticCurve('37a') # optional - sage.rings.number_field + sage: K. = QuadraticField(-7) # optional - sage.rings.number_field + sage: EK = E.change_ring(K) # optional - sage.rings.number_field + sage: EK.period_lattice(K.complex_embeddings()[0]) # optional - sage.rings.number_field Period lattice associated to Elliptic Curve defined by y^2 + y = x^3 + (-1)*x over Number Field in a with defining polynomial x^2 + 7 with a = 2.645751311064591?*I @@ -180,10 +179,10 @@ def __init__(self, E, embedding=None): :: - sage: K. = NumberField(x^3-2) - sage: emb = K.embeddings(RealField())[0] - sage: E = EllipticCurve([0,1,0,a,a]) - sage: L = PeriodLattice_ell(E,emb); L + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: emb = K.embeddings(RealField())[0] # optional - sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # optional - sage.rings.number_field + sage: L = PeriodLattice_ell(E, emb); L # optional - sage.rings.number_field Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism: @@ -191,8 +190,8 @@ def __init__(self, E, embedding=None): To: Algebraic Real Field Defn: a |--> 1.259921049894873? - sage: emb = K.embeddings(ComplexField())[0] - sage: L = PeriodLattice_ell(E,emb); L + sage: emb = K.embeddings(ComplexField())[0] # optional - sage.rings.number_field + sage: L = PeriodLattice_ell(E, emb); L # optional - sage.rings.number_field Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism: @@ -203,11 +202,11 @@ def __init__(self, E, embedding=None): TESTS:: sage: from sage.schemes.elliptic_curves.period_lattice import PeriodLattice_ell - sage: K. = NumberField(x^3 - 2) - sage: emb = K.embeddings(RealField())[0] - sage: E = EllipticCurve([0,1,0,a,a]) - sage: L = PeriodLattice_ell(E,emb) - sage: L == loads(dumps(L)) + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: emb = K.embeddings(RealField())[0] # optional - sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # optional - sage.rings.number_field + sage: L = PeriodLattice_ell(E,emb) # optional - sage.rings.number_field + sage: L == loads(dumps(L)) # optional - sage.rings.number_field True """ # First we cache the elliptic curve with this period lattice: @@ -280,11 +279,11 @@ def __richcmp__(self, other, op): TESTS:: sage: from sage.schemes.elliptic_curves.period_lattice import PeriodLattice_ell - sage: K. = NumberField(x^3 - 2) - sage: E = EllipticCurve([0,1,0,a,a]) - sage: embs = K.embeddings(ComplexField()) - sage: L1,L2,L3 = [PeriodLattice_ell(E,e) for e in embs] - sage: L1 < L2 < L3 + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # optional - sage.rings.number_field + sage: embs = K.embeddings(ComplexField()) # optional - sage.rings.number_field + sage: L1, L2, L3 = [PeriodLattice_ell(E, e) for e in embs] # optional - sage.rings.number_field + sage: L1 < L2 < L3 # optional - sage.rings.number_field True """ if not isinstance(other, PeriodLattice_ell): @@ -310,10 +309,10 @@ def __repr__(self): :: - sage: K. = NumberField(x^3-2) - sage: emb = K.embeddings(RealField())[0] - sage: E = EllipticCurve([0,1,0,a,a]) - sage: L = E.period_lattice(emb); L + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: emb = K.embeddings(RealField())[0] # optional - sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # optional - sage.rings.number_field + sage: L = E.period_lattice(emb); L # optional - sage.rings.number_field Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism: From: Number Field in a with defining polynomial x^3 - 2 @@ -436,20 +435,20 @@ def basis(self, prec=None, algorithm='sage'): :: - sage: K. = NumberField(x^3 - 2) - sage: emb = K.embeddings(RealField())[0] - sage: E = EllipticCurve([0,1,0,a,a]) - sage: L = E.period_lattice(emb) - sage: L.basis(64) + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: emb = K.embeddings(RealField())[0] # optional - sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # optional - sage.rings.number_field + sage: L = E.period_lattice(emb) # optional - sage.rings.number_field + sage: L.basis(64) # optional - sage.rings.number_field (3.81452977217854509, 1.90726488608927255 + 1.34047785962440202*I) - sage: emb = K.embeddings(ComplexField())[0] - sage: L = E.period_lattice(emb) - sage: w1, w2 = L.basis(); w1, w2 + sage: emb = K.embeddings(ComplexField())[0] # optional - sage.rings.number_field + sage: L = E.period_lattice(emb) # optional - sage.rings.number_field + sage: w1, w2 = L.basis(); w1, w2 # optional - sage.rings.number_field (-1.37588604166076 - 2.58560946624443*I, -2.10339907847356 + 0.428378776460622*I) - sage: L.is_real() + sage: L.is_real() # optional - sage.rings.number_field False - sage: tau = w1/w2; tau + sage: tau = w1/w2; tau # optional - sage.rings.number_field 0.387694505032876 + 1.30821088214407*I """ # We divide into two cases: (1) Q, or a number field with a @@ -537,22 +536,22 @@ def normalised_basis(self, prec=None, algorithm='sage'): :: - sage: K. = NumberField(x^3 - 2) - sage: emb = K.embeddings(RealField())[0] - sage: E = EllipticCurve([0,1,0,a,a]) - sage: L = E.period_lattice(emb) - sage: L.normalised_basis(64) + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: emb = K.embeddings(RealField())[0] # optional - sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # optional - sage.rings.number_field + sage: L = E.period_lattice(emb) # optional - sage.rings.number_field + sage: L.normalised_basis(64) # optional - sage.rings.number_field (1.90726488608927255 - 1.34047785962440202*I, -1.90726488608927255 - 1.34047785962440202*I) - sage: emb = K.embeddings(ComplexField())[0] - sage: L = E.period_lattice(emb) - sage: w1, w2 = L.normalised_basis(); w1, w2 + sage: emb = K.embeddings(ComplexField())[0] # optional - sage.rings.number_field + sage: L = E.period_lattice(emb) # optional - sage.rings.number_field + sage: w1, w2 = L.normalised_basis(); w1, w2 # optional - sage.rings.number_field (-1.37588604166076 - 2.58560946624443*I, -2.10339907847356 + 0.428378776460622*I) - sage: L.is_real() + sage: L.is_real() # optional - sage.rings.number_field False - sage: tau = w1/w2; tau + sage: tau = w1/w2; tau # optional - sage.rings.number_field 0.387694505032876 + 1.30821088214407*I """ w1, w2 = self.basis(prec=prec, algorithm=algorithm) @@ -590,24 +589,24 @@ def tau(self, prec=None, algorithm='sage'): :: - sage: K. = NumberField(x^3 - 2) - sage: emb = K.embeddings(RealField())[0] - sage: E = EllipticCurve([0,1,0,a,a]) - sage: L = E.period_lattice(emb) - sage: tau = L.tau(); tau + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: emb = K.embeddings(RealField())[0] # optional - sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # optional - sage.rings.number_field + sage: L = E.period_lattice(emb) # optional - sage.rings.number_field + sage: tau = L.tau(); tau # optional - sage.rings.number_field -0.338718341018919 + 0.940887817679340*I - sage: tau.abs() + sage: tau.abs() # optional - sage.rings.number_field 1.00000000000000 - sage: -0.5 <= tau.real() <= 0.5 + sage: -0.5 <= tau.real() <= 0.5 # optional - sage.rings.number_field True - sage: emb = K.embeddings(ComplexField())[0] - sage: L = E.period_lattice(emb) - sage: tau = L.tau(); tau + sage: emb = K.embeddings(ComplexField())[0] # optional - sage.rings.number_field + sage: L = E.period_lattice(emb) # optional - sage.rings.number_field + sage: tau = L.tau(); tau # optional - sage.rings.number_field 0.387694505032876 + 1.30821088214407*I - sage: tau.abs() + sage: tau.abs() # optional - sage.rings.number_field 1.36444961115933 - sage: -0.5 <= tau.real() <= 0.5 + sage: -0.5 <= tau.real() <= 0.5 # optional - sage.rings.number_field True """ w1, w2 = self.normalised_basis(prec=prec, algorithm=algorithm) @@ -636,16 +635,16 @@ def _compute_periods_real(self, prec=None, algorithm='sage'): EXAMPLES:: - sage: K. = NumberField(x^3 - 2) - sage: E = EllipticCurve([0,1,0,a,a]) - sage: embs = K.embeddings(CC) - sage: Ls = [E.period_lattice(e) for e in embs] - sage: [L.is_real() for L in Ls] + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # optional - sage.rings.number_field + sage: embs = K.embeddings(CC) # optional - sage.rings.number_field + sage: Ls = [E.period_lattice(e) for e in embs] # optional - sage.rings.number_field + sage: [L.is_real() for L in Ls] # optional - sage.rings.number_field [False, False, True] - sage: Ls[2]._compute_periods_real(100) + sage: Ls[2]._compute_periods_real(100) # optional - sage.rings.number_field (3.8145297721785450936365098936, 1.9072648860892725468182549468 + 1.3404778596244020196600112394*I) - sage: Ls[2]._compute_periods_real(100, algorithm='pari') + sage: Ls[2]._compute_periods_real(100, algorithm='pari') # optional - sage.rings.number_field (3.8145297721785450936365098936, 1.9072648860892725468182549468 - 1.3404778596244020196600112394*I) """ @@ -706,32 +705,32 @@ def _compute_periods_complex(self, prec=None, normalise=True): EXAMPLES:: - sage: K. = NumberField(x^3-2) - sage: E = EllipticCurve([0,1,0,a,a]) - sage: embs = K.embeddings(CC) - sage: Ls = [E.period_lattice(e) for e in embs] - sage: [L.is_real() for L in Ls] + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # optional - sage.rings.number_field + sage: embs = K.embeddings(CC) # optional - sage.rings.number_field + sage: Ls = [E.period_lattice(e) for e in embs] # optional - sage.rings.number_field + sage: [L.is_real() for L in Ls] # optional - sage.rings.number_field [False, False, True] - sage: L = Ls[0] - sage: w1,w2 = L._compute_periods_complex(100); w1,w2 + sage: L = Ls[0] # optional - sage.rings.number_field + sage: w1,w2 = L._compute_periods_complex(100); w1,w2 # optional - sage.rings.number_field (-1.3758860416607626645495991458 - 2.5856094662444337042877901304*I, -2.1033990784735587243397865076 + 0.42837877646062187766760569686*I) - sage: tau = w1/w2; tau + sage: tau = w1/w2; tau # optional - sage.rings.number_field 0.38769450503287609349437509561 + 1.3082108821440725664008561928*I - sage: tau.real() + sage: tau.real() # optional - sage.rings.number_field 0.38769450503287609349437509561 - sage: tau.abs() + sage: tau.abs() # optional - sage.rings.number_field 1.3644496111593345713923386773 Without normalisation:: - sage: w1,w2 = L._compute_periods_complex(normalise=False); w1,w2 + sage: w1,w2 = L._compute_periods_complex(normalise=False); w1,w2 # optional - sage.rings.number_field (2.10339907847356 - 0.428378776460622*I, 0.727513036812796 - 3.01398824270506*I) - sage: tau = w1/w2; tau + sage: tau = w1/w2; tau # optional - sage.rings.number_field 0.293483964608883 + 0.627038168678760*I - sage: tau.real() + sage: tau.real() # optional - sage.rings.number_field 0.293483964608883 - sage: tau.abs() # > 1 + sage: tau.abs() # > 1 # optional - sage.rings.number_field 0.692321964451917 """ if prec is None: @@ -768,18 +767,18 @@ def is_real(self): :: - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve(K, [0,0,0,i,2*i]) - sage: emb = K.embeddings(ComplexField())[0] - sage: L = E.period_lattice(emb) - sage: L.is_real() + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,0,i,2*i]) # optional - sage.rings.number_field + sage: emb = K.embeddings(ComplexField())[0] # optional - sage.rings.number_field + sage: L = E.period_lattice(emb) # optional - sage.rings.number_field + sage: L.is_real() # optional - sage.rings.number_field False :: - sage: K. = NumberField(x^3 - 2) - sage: E = EllipticCurve([0,1,0,a,a]) - sage: [E.period_lattice(emb).is_real() for emb in K.embeddings(CC)] + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # optional - sage.rings.number_field + sage: [E.period_lattice(emb).is_real() for emb in K.embeddings(CC)] # optional - sage.rings.number_field [False, False, True] ALGORITHM: @@ -851,11 +850,11 @@ def real_period(self, prec=None, algorithm='sage'): :: - sage: K. = NumberField(x^3 - 2) - sage: emb = K.embeddings(RealField())[0] - sage: E = EllipticCurve([0,1,0,a,a]) - sage: L = E.period_lattice(emb) - sage: L.real_period(64) + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: emb = K.embeddings(RealField())[0] # optional - sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # optional - sage.rings.number_field + sage: L = E.period_lattice(emb) # optional - sage.rings.number_field + sage: L.real_period(64) # optional - sage.rings.number_field 3.81452977217854509 """ if self.is_real(): @@ -912,11 +911,11 @@ def omega(self, prec=None, bsd_normalise=False): :: - sage: K. = NumberField(x^3 - 2) - sage: emb = K.embeddings(RealField())[0] - sage: E = EllipticCurve([0,1,0,a,a]) - sage: L = E.period_lattice(emb) - sage: L.omega(64) + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: emb = K.embeddings(RealField())[0] # optional - sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # optional - sage.rings.number_field + sage: L = E.period_lattice(emb) # optional - sage.rings.number_field + sage: L.omega(64) # optional - sage.rings.number_field 3.81452977217854509 A complex example (taken from J.E.Cremona and E.Whitley, @@ -924,14 +923,14 @@ def omega(self, prec=None, bsd_normalise=False): quadratic fields*, Mathematics of Computation 62 No. 205 (1994), 407-429). See :trac:`29645` and :trac:`29782`:: - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0,1-i,i,-i,0]) - sage: L = E.period_lattice(K.embeddings(CC)[0]) - sage: L.omega() + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,1-i,i,-i,0]) # optional - sage.rings.number_field + sage: L = E.period_lattice(K.embeddings(CC)[0]) # optional - sage.rings.number_field + sage: L.omega() # optional - sage.rings.number_field 8.80694160502647 - sage: L.omega(prec=200) + sage: L.omega(prec=200) # optional - sage.rings.number_field 8.8069416050264741493250743632295462227858630765392114070032 - sage: L.omega(bsd_normalise=True) + sage: L.omega(bsd_normalise=True) # optional - sage.rings.number_field 17.6138832100529 """ if self.is_real(): @@ -969,11 +968,11 @@ def basis_matrix(self, prec=None, normalised=False): :: - sage: K. = NumberField(x^3 - 2) - sage: emb = K.embeddings(RealField())[0] - sage: E = EllipticCurve([0,1,0,a,a]) - sage: L = E.period_lattice(emb) - sage: L.basis_matrix(64) + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: emb = K.embeddings(RealField())[0] # optional - sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # optional - sage.rings.number_field + sage: L = E.period_lattice(emb) # optional - sage.rings.number_field + sage: L.basis_matrix(64) # optional - sage.rings.number_field [ 3.81452977217854509 0.000000000000000000] [ 1.90726488608927255 1.34047785962440202] @@ -1092,21 +1091,22 @@ def curve(self): :: - sage: K. = NumberField(x^3 - 2) - sage: E = EllipticCurve([0,1,0,a,a]) - sage: L = E.period_lattice(K.embeddings(RealField())[0]) - sage: L.curve() is E + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # optional - sage.rings.number_field + sage: L = E.period_lattice(K.embeddings(RealField())[0]) # optional - sage.rings.number_field + sage: L.curve() is E # optional - sage.rings.number_field True - sage: L = E.period_lattice(K.embeddings(ComplexField())[0]) - sage: L.curve() is E + sage: L = E.period_lattice(K.embeddings(ComplexField())[0]) # optional - sage.rings.number_field + sage: L.curve() is E # optional - sage.rings.number_field True """ return self.E def ei(self): r""" - Return the x-coordinates of the 2-division points of the elliptic curve associated with this period lattice, as elements of QQbar. + Return the x-coordinates of the 2-division points of the elliptic curve associated + with this period lattice, as elements of ``QQbar``. EXAMPLES:: @@ -1120,22 +1120,22 @@ def ei(self): :: - sage: K. = NumberField(x^3 - 2) - sage: E = EllipticCurve([0,1,0,a,a]) - sage: L = E.period_lattice(K.embeddings(RealField())[0]) - sage: x1,x2,x3 = L.ei() - sage: abs(x1.real()) + abs(x2.real()) < 1e-14 + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,1,0,a,a]) # optional - sage.rings.number_field + sage: L = E.period_lattice(K.embeddings(RealField())[0]) # optional - sage.rings.number_field + sage: x1,x2,x3 = L.ei() # optional - sage.rings.number_field + sage: abs(x1.real()) + abs(x2.real()) < 1e-14 # optional - sage.rings.number_field True - sage: x1.imag(), x2.imag(), x3 + sage: x1.imag(), x2.imag(), x3 # optional - sage.rings.number_field (-1.122462048309373?, 1.122462048309373?, -1.000000000000000?) :: - sage: L = E.period_lattice(K.embeddings(ComplexField())[0]) - sage: L.ei() + sage: L = E.period_lattice(K.embeddings(ComplexField())[0]) # optional - sage.rings.number_field + sage: L.ei() # optional - sage.rings.number_field [-1.000000000000000? + 0.?e-1...*I, - -0.9720806486198328? - 0.561231024154687?*I, - 0.9720806486198328? + 0.561231024154687?*I] + -0.9720806486198328? - 0.561231024154687?*I, + 0.9720806486198328? + 0.561231024154687?*I] """ return self._ei @@ -1157,12 +1157,12 @@ def coordinates(self, z, rounding=None): are a basis for the lattice (normalised in the case of complex embeddings). - When ``rounding`` is 'round', returns a tuple of integers `n_1`, + When ``rounding`` is ``'round'``, returns a tuple of integers `n_1`, `n_2` which are the closest integers to the `x`, `y` defined above. If `z` is in the lattice these are the coordinates of `z` with respect to the lattice basis. - When ``rounding`` is 'floor', returns a tuple of integers + When ``rounding`` is ``'floor'``, returns a tuple of integers `n_1`, `n_2` which are the integer parts to the `x`, `y` defined above. These are used in :meth:`.reduce` @@ -1176,14 +1176,14 @@ def coordinates(self, z, rounding=None): 0.47934825019021931612953301006 + 0.98586885077582410221120384908*I sage: L.coordinates(zP) (0.19249290511394227352563996419, 0.50000000000000000000000000000) - sage: sum([x*w for x,w in zip(L.coordinates(zP), L.basis(prec=100))]) + sage: sum([x*w for x, w in zip(L.coordinates(zP), L.basis(prec=100))]) 0.47934825019021931612953301006 + 0.98586885077582410221120384908*I - sage: L.coordinates(12*w1+23*w2) + sage: L.coordinates(12*w1 + 23*w2) (12.000000000000000000000000000, 23.000000000000000000000000000) - sage: L.coordinates(12*w1+23*w2, rounding='floor') + sage: L.coordinates(12*w1 + 23*w2, rounding='floor') (11, 22) - sage: L.coordinates(12*w1+23*w2, rounding='round') + sage: L.coordinates(12*w1 + 23*w2, rounding='round') (12, 23) """ C = z.parent() @@ -1239,7 +1239,7 @@ def reduce(self, z): sage: P = E([-1,1]) sage: zP = P.elliptic_logarithm(precision=100); zP 0.47934825019021931612953301006 + 0.98586885077582410221120384908*I - sage: z = zP+10*w1-20*w2; z + sage: z = zP + 10*w1 - 20*w2; z 25.381473858740770069343110929 - 38.448885180257139986236950114*I sage: L.reduce(z) 0.47934825019021931612953301006 + 0.98586885077582410221120384908*I @@ -1247,7 +1247,7 @@ def reduce(self, z): 0.958696500380439 sage: L.reduce(L.elliptic_logarithm(2*P)) 0.958696500380439 - sage: L.reduce(L.elliptic_logarithm(2*P)+10*w1-20*w2) + sage: L.reduce(L.elliptic_logarithm(2*P) + 10*w1 - 20*w2) 0.958696500380444 """ C = z.parent() @@ -1335,44 +1335,44 @@ def e_log_RC(self, xP, yP, prec=None, reduce=True): A number field example:: - sage: K. = NumberField(x^3 - 2) - sage: E = EllipticCurve([0,0,0,0,a]) - sage: v = K.real_places()[0] - sage: L = E.period_lattice(v) - sage: P = E.lift_x(1/3*a^2 + a + 5/3) - sage: L(P) + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,0,0,0,a]) # optional - sage.rings.number_field + sage: v = K.real_places()[0] # optional - sage.rings.number_field + sage: L = E.period_lattice(v) # optional - sage.rings.number_field + sage: P = E.lift_x(1/3*a^2 + a + 5/3) # optional - sage.rings.number_field + sage: L(P) # optional - sage.rings.number_field 3.51086196882538 - sage: xP, yP = [v(c) for c in P.xy()] - sage: L.e_log_RC(xP, yP) + sage: xP, yP = [v(c) for c in P.xy()] # optional - sage.rings.number_field + sage: L.e_log_RC(xP, yP) # optional - sage.rings.number_field 3.51086196882538 Elliptic logs of real points which do not come from algebraic points:: - sage: ER = EllipticCurve([v(ai) for ai in E.a_invariants()]) - sage: P = ER.lift_x(12.34) - sage: xP, yP = P.xy() - sage: xP, yP + sage: ER = EllipticCurve([v(ai) for ai in E.a_invariants()]) # optional - sage.rings.number_field + sage: P = ER.lift_x(12.34) # optional - sage.rings.number_field + sage: xP, yP = P.xy() # optional - sage.rings.number_field + sage: xP, yP # optional - sage.rings.number_field (12.3400000000000, 43.3628968710567) - sage: L.e_log_RC(xP, yP) + sage: L.e_log_RC(xP, yP) # optional - sage.rings.number_field 3.76298229503967 - sage: xP, yP = ER.lift_x(0).xy() - sage: L.e_log_RC(xP, yP) + sage: xP, yP = ER.lift_x(0).xy() # optional - sage.rings.number_field + sage: L.e_log_RC(xP, yP) # optional - sage.rings.number_field 2.69842609082114 Elliptic logs of complex points:: - sage: v = K.complex_embeddings()[0] - sage: L = E.period_lattice(v) - sage: P = E.lift_x(1/3*a^2 + a + 5/3) - sage: L(P) + sage: v = K.complex_embeddings()[0] # optional - sage.rings.number_field + sage: L = E.period_lattice(v) # optional - sage.rings.number_field + sage: P = E.lift_x(1/3*a^2 + a + 5/3) # optional - sage.rings.number_field + sage: L(P) # optional - sage.rings.number_field 1.68207104397706 - 1.87873661686704*I - sage: xP, yP = [v(c) for c in P.xy()] - sage: L.e_log_RC(xP, yP) + sage: xP, yP = [v(c) for c in P.xy()] # optional - sage.rings.number_field + sage: L.e_log_RC(xP, yP) # optional - sage.rings.number_field 1.68207104397706 - 1.87873661686704*I - sage: EC = EllipticCurve([v(ai) for ai in E.a_invariants()]) - sage: xP, yP = EC.lift_x(0).xy() - sage: L.e_log_RC(xP, yP) + sage: EC = EllipticCurve([v(ai) for ai in E.a_invariants()]) # optional - sage.rings.number_field + sage: xP, yP = EC.lift_x(0).xy() # optional - sage.rings.number_field + sage: L.e_log_RC(xP, yP) # optional - sage.rings.number_field 1.03355715602040 - 0.867257428417356*I """ if prec is None: @@ -1556,32 +1556,34 @@ def elliptic_logarithm(self, P, prec=None, reduce=True): An example where precision is problematic:: - sage: E = EllipticCurve([1, 0, 1, -85357462, 303528987048]) #18074g1 + sage: E = EllipticCurve([1, 0, 1, -85357462, 303528987048]) #18074g1 sage: P = E([4458713781401/835903744, -64466909836503771/24167649046528, 1]) sage: L = E.period_lattice() sage: L.ei() - [5334.003952567705? - 1.964393150436?e-6*I, 5334.003952567705? + 1.964393150436?e-6*I, -10668.25790513541?] + [5334.003952567705? - 1.964393150436?e-6*I, + 5334.003952567705? + 1.964393150436?e-6*I, + -10668.25790513541?] sage: L.elliptic_logarithm(P,prec=100) 0.27656204014107061464076203097 Some complex examples, taken from the paper by Cremona and Thongjunthug:: - sage: K. = QuadraticField(-1) - sage: a4 = 9*i-10 - sage: a6 = 21-i - sage: E = EllipticCurve([0,0,0,a4,a6]) - sage: e1 = 3-2*i; e2 = 1+i; e3 = -4+i - sage: emb = K.embeddings(CC)[1] - sage: L = E.period_lattice(emb) - sage: P = E(2-i,4+2*i) + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: a4 = 9*i - 10 # optional - sage.rings.number_field + sage: a6 = 21 - i # optional - sage.rings.number_field + sage: E = EllipticCurve([0,0,0,a4,a6]) # optional - sage.rings.number_field + sage: e1 = 3 - 2*i; e2 = 1 + i; e3 = -4 + i # optional - sage.rings.number_field + sage: emb = K.embeddings(CC)[1] # optional - sage.rings.number_field + sage: L = E.period_lattice(emb) # optional - sage.rings.number_field + sage: P = E(2 - i, 4 + 2*i) # optional - sage.rings.number_field By default, the output is reduced with respect to the normalised lattice basis, so that its coordinates with respect to that basis lie in the interval [0,1):: - sage: z = L.elliptic_logarithm(P,prec=100); z + sage: z = L.elliptic_logarithm(P, prec=100); z # optional - sage.rings.number_field 0.70448375537782208460499649302 - 0.79246725643650979858266018068*I - sage: L.coordinates(z) + sage: L.coordinates(z) # optional - sage.rings.number_field (0.46247636364807931766105406092, 0.79497588726808704200760395829) Using ``reduce=False`` this step can be omitted. In this case @@ -1589,76 +1591,76 @@ def elliptic_logarithm(self, P, prec=None, reduce=True): this is not guaranteed. This option is mainly for testing purposes:: - sage: z = L.elliptic_logarithm(P,prec=100, reduce=False); z + sage: z = L.elliptic_logarithm(P, prec=100, reduce=False); z # optional - sage.rings.number_field 0.57002153834710752778063503023 + 0.46476340520469798857457031393*I - sage: L.coordinates(z) + sage: L.coordinates(z) # optional - sage.rings.number_field (0.46247636364807931766105406092, -0.20502411273191295799239604171) The elliptic logs of the 2-torsion points are half-periods:: - sage: L.elliptic_logarithm(E(e1,0), prec=100) + sage: L.elliptic_logarithm(E(e1, 0), prec=100) # optional - sage.rings.number_field 0.64607575874356525952487867052 + 0.22379609053909448304176885364*I - sage: L.elliptic_logarithm(E(e2,0), prec=100) + sage: L.elliptic_logarithm(E(e2, 0), prec=100) # optional - sage.rings.number_field 0.71330686725892253793705940192 - 0.40481924028150941053684639367*I - sage: L.elliptic_logarithm(E(e3,0), prec=100) + sage: L.elliptic_logarithm(E(e3, 0), prec=100) # optional - sage.rings.number_field 0.067231108515357278412180731396 - 0.62861533082060389357861524731*I We check this by doubling and seeing that the resulting coordinates are integers:: - sage: L.coordinates(2*L.elliptic_logarithm(E(e1,0), prec=100)) + sage: L.coordinates(2*L.elliptic_logarithm(E(e1, 0), prec=100)) # optional - sage.rings.number_field (1.0000000000000000000000000000, 0.00000000000000000000000000000) - sage: L.coordinates(2*L.elliptic_logarithm(E(e2,0), prec=100)) + sage: L.coordinates(2*L.elliptic_logarithm(E(e2, 0), prec=100)) # optional - sage.rings.number_field (1.0000000000000000000000000000, 1.0000000000000000000000000000) - sage: L.coordinates(2*L.elliptic_logarithm(E(e3,0), prec=100)) + sage: L.coordinates(2*L.elliptic_logarithm(E(e3, 0), prec=100)) # optional - sage.rings.number_field (0.00000000000000000000000000000, 1.0000000000000000000000000000) :: - sage: a4 = -78*i + 104 - sage: a6 = -216*i - 312 - sage: E = EllipticCurve([0,0,0,a4,a6]) - sage: emb = K.embeddings(CC)[1] - sage: L = E.period_lattice(emb) - sage: P = E(3+2*i, 14-7*i) - sage: L.elliptic_logarithm(P) + sage: a4 = -78*i + 104 # optional - sage.rings.number_field + sage: a6 = -216*i - 312 # optional - sage.rings.number_field + sage: E = EllipticCurve([0,0,0,a4,a6]) # optional - sage.rings.number_field + sage: emb = K.embeddings(CC)[1] # optional - sage.rings.number_field + sage: L = E.period_lattice(emb) # optional - sage.rings.number_field + sage: P = E(3 + 2*i, 14 - 7*i) # optional - sage.rings.number_field + sage: L.elliptic_logarithm(P) # optional - sage.rings.number_field 0.297147783912228 - 0.546125549639461*I - sage: L.coordinates(L.elliptic_logarithm(P)) + sage: L.coordinates(L.elliptic_logarithm(P)) # optional - sage.rings.number_field (0.628653378040238, 0.371417754610223) - sage: e1 = 1+3*i; e2 = -4-12*i; e3 = -e1-e2 - sage: L.coordinates(L.elliptic_logarithm(E(e1,0))) + sage: e1 = 1 + 3*i; e2 = -4 - 12*i; e3 = -e1 - e2 # optional - sage.rings.number_field + sage: L.coordinates(L.elliptic_logarithm(E(e1, 0))) # optional - sage.rings.number_field (0.500000000000000, 0.500000000000000) - sage: L.coordinates(L.elliptic_logarithm(E(e2,0))) + sage: L.coordinates(L.elliptic_logarithm(E(e2, 0))) # optional - sage.rings.number_field (1.00000000000000, 0.500000000000000) - sage: L.coordinates(L.elliptic_logarithm(E(e3,0))) + sage: L.coordinates(L.elliptic_logarithm(E(e3, 0))) # optional - sage.rings.number_field (0.500000000000000, 0.000000000000000) TESTS: See :trac:`10026` and :trac:`11767`:: - sage: K. = QuadraticField(2) - sage: E = EllipticCurve([ 0, -1, 1, -3*w -4, 3*w + 4 ]) - sage: T = E.simon_two_descent(lim1=20,lim3=5,limtriv=20) - sage: P,Q = T[2] - sage: embs = K.embeddings(CC) - sage: Lambda = E.period_lattice(embs[0]) - sage: Lambda.elliptic_logarithm(P, 100) + sage: K. = QuadraticField(2) # optional - sage.rings.number_field + sage: E = EllipticCurve([0, -1, 1, -3*w - 4, 3*w + 4]) # optional - sage.rings.number_field + sage: T = E.simon_two_descent(lim1=20, lim3=5, limtriv=20) # optional - sage.rings.number_field + sage: P, Q = T[2] # optional - sage.rings.number_field + sage: embs = K.embeddings(CC) # optional - sage.rings.number_field + sage: Lambda = E.period_lattice(embs[0]) # optional - sage.rings.number_field + sage: Lambda.elliptic_logarithm(P, 100) # optional - sage.rings.number_field 4.7100131126199672766973600998 sage: R. = QQ[] - sage: K. = NumberField(x^2 + x + 5) - sage: E = EllipticCurve(K, [0,0,1,-3,-5]) - sage: P = E([0,a]) - sage: Lambda = P.curve().period_lattice(K.embeddings(ComplexField(600))[0]) - sage: Lambda.elliptic_logarithm(P, prec=600) + sage: K. = NumberField(x^2 + x + 5) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,1,-3,-5]) # optional - sage.rings.number_field + sage: P = E([0,a]) # optional - sage.rings.number_field + sage: Lambda = P.curve().period_lattice(K.embeddings(ComplexField(600))[0]) # optional - sage.rings.number_field + sage: Lambda.elliptic_logarithm(P, prec=600) # optional - sage.rings.number_field -0.842248166487739393375018008381693990800588864069506187033873183845246233548058477561706400464057832396643843146464236956684557207157300006542470428493573195030603817094900751609464 - 0.571366031453267388121279381354098224265947866751130917440598461117775339240176310729173301979590106474259885638797913383502735083088736326391919063211421189027226502851390118943491*I - sage: K. = QuadraticField(-5) - sage: E = EllipticCurve([1,1,a,a,0]) - sage: P = E(0,0) - sage: L = P.curve().period_lattice(K.embeddings(ComplexField())[0]) - sage: L.elliptic_logarithm(P, prec=500) + sage: K. = QuadraticField(-5) # optional - sage.rings.number_field + sage: E = EllipticCurve([1,1,a,a,0]) # optional - sage.rings.number_field + sage: P = E(0, 0) # optional - sage.rings.number_field + sage: L = P.curve().period_lattice(K.embeddings(ComplexField())[0]) # optional - sage.rings.number_field + sage: L.elliptic_logarithm(P, prec=500) # optional - sage.rings.number_field 1.17058357737548897849026170185581196033579563441850967539191867385734983296504066660506637438866628981886518901958717288150400849746892393771983141354 - 1.13513899565966043682474529757126359416758251309237866586896869548539516543734207347695898664875799307727928332953834601460994992792519799260968053875*I - sage: L.elliptic_logarithm(P, prec=1000) + sage: L.elliptic_logarithm(P, prec=1000) # optional - sage.rings.number_field 1.17058357737548897849026170185581196033579563441850967539191867385734983296504066660506637438866628981886518901958717288150400849746892393771983141354014895386251320571643977497740116710952913769943240797618468987304985625823413440999754037939123032233879499904283600304184828809773650066658885672885 - 1.13513899565966043682474529757126359416758251309237866586896869548539516543734207347695898664875799307727928332953834601460994992792519799260968053875387282656993476491590607092182964878750169490985439873220720963653658829712494879003124071110818175013453207439440032582917366703476398880865439217473*I """ if not P.curve() is self.E: @@ -1710,62 +1712,76 @@ def elliptic_exponential(self, z, to_curve=True): EXAMPLES:: sage: E = EllipticCurve([1,1,1,-8,6]) - sage: P = E(1,-2) + sage: P = E(1, -2) sage: L = E.period_lattice() sage: z = L(P); z 1.17044757240090 sage: L.elliptic_exponential(z) (0.999999999999999 : -2.00000000000000 : 1.00000000000000) sage: _.curve() - Elliptic Curve defined by y^2 + 1.00000000000000*x*y + 1.00000000000000*y = x^3 + 1.00000000000000*x^2 - 8.00000000000000*x + 6.00000000000000 over Real Field with 53 bits of precision + Elliptic Curve defined by y^2 + 1.00000000000000*x*y + 1.00000000000000*y + = x^3 + 1.00000000000000*x^2 - 8.00000000000000*x + 6.00000000000000 + over Real Field with 53 bits of precision sage: L.elliptic_exponential(z,to_curve=False) (1.41666666666667, -2.00000000000000) - sage: z = L(P,prec=201); z + sage: z = L(P, prec=201); z 1.17044757240089592298992188482371493504472561677451007994189 sage: L.elliptic_exponential(z) - (1.00000000000000000000000000000000000000000000000000000000000 : -2.00000000000000000000000000000000000000000000000000000000000 : 1.00000000000000000000000000000000000000000000000000000000000) + (1.00000000000000000000000000000000000000000000000000000000000 + : -2.00000000000000000000000000000000000000000000000000000000000 + : 1.00000000000000000000000000000000000000000000000000000000000) Examples over number fields:: sage: x = polygen(QQ) - sage: K. = NumberField(x^3-2) - sage: embs = K.embeddings(CC) - sage: E = EllipticCurve('37a') - sage: EK = E.change_ring(K) - sage: Li = [EK.period_lattice(e) for e in embs] - sage: P = EK(-1,-1) - sage: Q = EK(a-1,1-a^2) - sage: zi = [L.elliptic_logarithm(P) for L in Li] - sage: [c.real() for c in Li[0].elliptic_exponential(zi[0])] + sage: K. = NumberField(x^3 - 2) # optional - sage.rings.number_field + sage: embs = K.embeddings(CC) # optional - sage.rings.number_field + sage: E = EllipticCurve('37a') # optional - sage.rings.number_field + sage: EK = E.change_ring(K) # optional - sage.rings.number_field + sage: Li = [EK.period_lattice(e) for e in embs] # optional - sage.rings.number_field + sage: P = EK(-1, -1) # optional - sage.rings.number_field + sage: Q = EK(a - 1, 1 - a^2) # optional - sage.rings.number_field + sage: zi = [L.elliptic_logarithm(P) for L in Li] # optional - sage.rings.number_field + sage: [c.real() for c in Li[0].elliptic_exponential(zi[0])] # optional - sage.rings.number_field [-1.00000000000000, -1.00000000000000, 1.00000000000000] - sage: [c.real() for c in Li[0].elliptic_exponential(zi[1])] + sage: [c.real() for c in Li[0].elliptic_exponential(zi[1])] # optional - sage.rings.number_field [-1.00000000000000, -1.00000000000000, 1.00000000000000] - sage: [c.real() for c in Li[0].elliptic_exponential(zi[2])] + sage: [c.real() for c in Li[0].elliptic_exponential(zi[2])] # optional - sage.rings.number_field [-1.00000000000000, -1.00000000000000, 1.00000000000000] - sage: zi = [L.elliptic_logarithm(Q) for L in Li] - sage: Li[0].elliptic_exponential(zi[0]) - (-1.62996052494744 - 1.09112363597172*I : 1.79370052598410 - 1.37472963699860*I : 1.00000000000000) - sage: [embs[0](c) for c in Q] - [-1.62996052494744 - 1.09112363597172*I, 1.79370052598410 - 1.37472963699860*I, 1.00000000000000] - sage: Li[1].elliptic_exponential(zi[1]) - (-1.62996052494744 + 1.09112363597172*I : 1.79370052598410 + 1.37472963699860*I : 1.00000000000000) - sage: [embs[1](c) for c in Q] - [-1.62996052494744 + 1.09112363597172*I, 1.79370052598410 + 1.37472963699860*I, 1.00000000000000] - sage: [c.real() for c in Li[2].elliptic_exponential(zi[2])] + sage: zi = [L.elliptic_logarithm(Q) for L in Li] # optional - sage.rings.number_field + sage: Li[0].elliptic_exponential(zi[0]) # optional - sage.rings.number_field + (-1.62996052494744 - 1.09112363597172*I + : 1.79370052598410 - 1.37472963699860*I + : 1.00000000000000) + sage: [embs[0](c) for c in Q] # optional - sage.rings.number_field + [-1.62996052494744 - 1.09112363597172*I, + 1.79370052598410 - 1.37472963699860*I, + 1.00000000000000] + sage: Li[1].elliptic_exponential(zi[1]) # optional - sage.rings.number_field + (-1.62996052494744 + 1.09112363597172*I + : 1.79370052598410 + 1.37472963699860*I + : 1.00000000000000) + sage: [embs[1](c) for c in Q] # optional - sage.rings.number_field + [-1.62996052494744 + 1.09112363597172*I, + 1.79370052598410 + 1.37472963699860*I, + 1.00000000000000] + sage: [c.real() for c in Li[2].elliptic_exponential(zi[2])] # optional - sage.rings.number_field [0.259921049894873, -0.587401051968199, 1.00000000000000] - sage: [embs[2](c) for c in Q] + sage: [embs[2](c) for c in Q] # optional - sage.rings.number_field [0.259921049894873, -0.587401051968200, 1.00000000000000] Test to show that :trac:`8820` is fixed:: sage: E = EllipticCurve('37a') - sage: K. = QuadraticField(-5) - sage: L = E.change_ring(K).period_lattice(K.places()[0]) - sage: L.elliptic_exponential(CDF(.1,.1)) - (0.0000142854026029... - 49.9960001066650*I : 249.520141250950 + 250.019855549131*I : 1.00000000000000) - sage: L.elliptic_exponential(CDF(.1,.1), to_curve=False) - (0.0000142854026029447 - 49.9960001066650*I, 500.040282501900 + 500.039711098263*I) + sage: K. = QuadraticField(-5) # optional - sage.rings.number_field + sage: L = E.change_ring(K).period_lattice(K.places()[0]) # optional - sage.rings.number_field + sage: L.elliptic_exponential(CDF(.1,.1)) # optional - sage.rings.number_field + (0.0000142854026029... - 49.9960001066650*I + : 249.520141250950 + 250.019855549131*I : 1.00000000000000) + sage: L.elliptic_exponential(CDF(.1,.1), to_curve=False) # optional - sage.rings.number_field + (0.0000142854026029447 - 49.9960001066650*I, + 500.040282501900 + 500.039711098263*I) `z=0` is treated as a special case:: @@ -1779,21 +1795,21 @@ def elliptic_exponential(self, z, to_curve=True): :: sage: E = EllipticCurve('37a') - sage: K. = QuadraticField(-5) - sage: L = E.change_ring(K).period_lattice(K.places()[0]) - sage: P = L.elliptic_exponential(0); P + sage: K. = QuadraticField(-5) # optional - sage.rings.number_field + sage: L = E.change_ring(K).period_lattice(K.places()[0]) # optional - sage.rings.number_field + sage: P = L.elliptic_exponential(0); P # optional - sage.rings.number_field (0.000000000000000 : 1.00000000000000 : 0.000000000000000) - sage: P.parent() + sage: P.parent() # optional - sage.rings.number_field Abelian group of points on Elliptic Curve defined by - y^2 + 1.00000000000000*y = x^3 + (-1.00000000000000)*x - over Complex Field with 53 bits of precision + y^2 + 1.00000000000000*y = x^3 + (-1.00000000000000)*x + over Complex Field with 53 bits of precision Very small `z` are handled properly (see :trac:`8820`):: - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0,0,0,a,0]) - sage: L = E.period_lattice(K.complex_embeddings()[0]) - sage: L.elliptic_exponential(1e-100) + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,0,0,a,0]) # optional - sage.rings.number_field + sage: L = E.period_lattice(K.complex_embeddings()[0]) # optional - sage.rings.number_field + sage: L.elliptic_exponential(1e-100) # optional - sage.rings.number_field (0.000000000000000 : 1.00000000000000 : 0.000000000000000) The elliptic exponential of `z` is returned as (0 : 1 : 0) if @@ -1802,9 +1818,9 @@ def elliptic_exponential(self, z, to_curve=True): sage: (100/log(2.0,10))/0.8 415.241011860920 - sage: L.elliptic_exponential((RealField(415)(1e-100))).is_zero() + sage: L.elliptic_exponential((RealField(415)(1e-100))).is_zero() # optional - sage.rings.number_field True - sage: L.elliptic_exponential((RealField(420)(1e-100))).is_zero() + sage: L.elliptic_exponential((RealField(420)(1e-100))).is_zero() # optional - sage.rings.number_field False """ C = z.parent() @@ -1940,7 +1956,7 @@ def normalise_periods(w1, w2): sage: w2 = CC(1.234, 3.456000001) sage: w1/w2 # in lower half plane! 0.999999999743367 - 9.16334785827644e-11*I - sage: w1w2, abcd = normalise_periods(w1,w2) + sage: w1w2, abcd = normalise_periods(w1, w2) sage: a,b,c,d = abcd sage: w1w2 == (a*w1+b*w2, c*w1+d*w2) True @@ -1979,7 +1995,7 @@ def extended_agm_iteration(a, b, c): sage: from sage.schemes.elliptic_curves.period_lattice import extended_agm_iteration sage: extended_agm_iteration(RR(1), RR(2), RR(3)) (1.45679103104691, 1.45679103104691, 3.21245294970054) - sage: extended_agm_iteration(CC(1,2),CC(2,3),CC(3,4)) + sage: extended_agm_iteration(CC(1,2), CC(2,3), CC(3,4)) (1.46242448156430 + 2.47791311676267*I, 1.46242448156430 + 2.47791311676267*I, 3.22202144343535 + 4.28383734262540*I) diff --git a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py index e0f873be0e7..91bd26dd30e 100644 --- a/src/sage/schemes/elliptic_curves/weierstrass_morphism.py +++ b/src/sage/schemes/elliptic_curves/weierstrass_morphism.py @@ -897,7 +897,7 @@ def __neg__(self): Elliptic-curve morphism: From: Elliptic Curve defined by y^2 + 11*x*y + 33*y = x^3 + 22*x^2 + 44*x + 55 over Rational Field To: Elliptic Curve defined by y^2 + 17/6*x*y + 49/13068*y = x^3 - 769/396*x^2 - 3397/862488*x + 44863/7513995456 - over Rational Field + over Rational Field Via: (u,r,s,t) = (-66, 77, -99, -979) sage: -(-w) == w True diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index 419b6a43724..c1434b7c5b4 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -45,8 +45,7 @@ example, one equation cuts out a curve (a one-dimensional subscheme):: sage: V = A2.subscheme([x^2 + y^2 - 1]); V - Closed subscheme of Affine Space of dimension 2 - over Rational Field defined by: + Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: x^2 + y^2 - 1 sage: V.dimension() 1 @@ -303,7 +302,7 @@ def coordinate_ring(self): sage: S = P.subscheme([x - y, x - z]) sage: S.coordinate_ring() Quotient of Multivariate Polynomial Ring in x, y, z over Integer Ring - by the ideal (x - y, x - z) + by the ideal (x - y, x - z) """ try: return self._coordinate_ring @@ -437,8 +436,7 @@ def embedding_morphism(self): Scheme morphism: From: 2-d affine toric variety To: 2-d CPR-Fano toric variety covered by 4 affine patches - Defn: Defined on coordinates by sending [y : u] to - [1 : y : u : 1] + Defn: Defined on coordinates by sending [y : u] to [1 : y : u : 1] sage: subpatch = P1.affine_patch(1) sage: subpatch Closed subscheme of 2-d affine toric variety defined by: @@ -614,11 +612,12 @@ class AlgebraicScheme_quasi(AlgebraicScheme): sage: S = P.subscheme([]) sage: T = P.subscheme([x - y]) sage: T.complement(S) - Quasi-projective subscheme X - Y of Projective Space of dimension 2 over - Integer Ring, where X is defined by: - (no polynomials) - and Y is defined by: - x - y + Quasi-projective subscheme X - Y + of Projective Space of dimension 2 over Integer Ring, + where X is defined by: + (no polynomials) + and Y is defined by: + x - y """ def __init__(self, X, Y): @@ -636,10 +635,11 @@ def __init__(self, X, Y): sage: T = P.subscheme([x - y]) sage: from sage.schemes.generic.algebraic_scheme import AlgebraicScheme_quasi sage: AlgebraicScheme_quasi(S, T) - Quasi-projective subscheme X - Y of Projective Space of dimension 2 over Integer Ring, where X is defined by: - (no polynomials) - and Y is defined by: - x - y + Quasi-projective subscheme X - Y of Projective Space of dimension 2 over Integer Ring, + where X is defined by: + (no polynomials) + and Y is defined by: + x - y """ self.__X = X self.__Y = Y @@ -666,11 +666,11 @@ def _latex_(self): sage: S = P.subscheme([]) sage: T = P.subscheme([x - y]) sage: U = AlgebraicScheme_quasi(S, T); U - Quasi-projective subscheme X - Y of Projective Space of dimension 2 - over Integer Ring, where X is defined by: - (no polynomials) - and Y is defined by: - x - y + Quasi-projective subscheme X - Y of Projective Space of dimension 2 over Integer Ring, + where X is defined by: + (no polynomials) + and Y is defined by: + x - y sage: U._latex_() '\\text{Quasi-projective subscheme } (X\\setminus Y)\\subset {\\mathbf P}_{\\Bold{Z}}^2,\\text{ where } @@ -703,10 +703,11 @@ def _repr_(self): sage: S = P.subscheme([]) sage: T = P.subscheme([x - y]) sage: U = AlgebraicScheme_quasi(S, T); U - Quasi-projective subscheme X - Y of Projective Space of dimension 2 over Integer Ring, where X is defined by: - (no polynomials) - and Y is defined by: - x - y + Quasi-projective subscheme X - Y of Projective Space of dimension 2 over Integer Ring, + where X is defined by: + (no polynomials) + and Y is defined by: + x - y sage: U._repr_() 'Quasi-projective subscheme X - Y of Projective Space of dimension 2 over Integer Ring, where X is defined by:\n (no polynomials)\nand Y is defined by:\n x - y' """ @@ -766,11 +767,11 @@ def _check_satisfies_equations(self, v): Traceback (most recent call last): ... TypeError: Coordinates [1, 1, 0] do not define a point on - Quasi-projective subscheme X - Y of Projective Space of dimension 2 - over Integer Ring, where X is defined by: - (no polynomials) - and Y is defined by: - x - y + Quasi-projective subscheme X - Y of Projective Space of dimension 2 over Integer Ring, + where X is defined by: + (no polynomials) + and Y is defined by: + x - y sage: U._check_satisfies_equations([1, 4]) Traceback (most recent call last): @@ -1000,8 +1001,9 @@ def base_extend(self, R): sage: P. = ProjectiveSpace(2, GF(11)) # optional - sage.rings.finite_rings sage: S = P.subscheme([x^2 - y*z]) # optional - sage.rings.finite_rings sage: S.base_extend(GF(11^2, 'b')) # optional - sage.rings.finite_rings - Closed subscheme of Projective Space of dimension 2 over Finite Field in b - of size 11^2 defined by: x^2 - y*z + Closed subscheme of Projective Space of dimension 2 + over Finite Field in b of size 11^2 + defined by: x^2 - y*z sage: S.base_extend(ZZ) # optional - sage.rings.finite_rings Traceback (most recent call last): ... @@ -1160,7 +1162,7 @@ def defining_ideal(self): sage: S = P.subscheme([x^2 - y*z, x^3 + z^3]) sage: S.defining_ideal() Ideal (x^2 - y*z, x^3 + z^3) of Multivariate Polynomial Ring in x, y, z - over Integer Ring + over Integer Ring """ try: return self.__I @@ -1357,12 +1359,13 @@ def Jacobian(self): sage: P3. = ProjectiveSpace(3, QQ) sage: twisted_cubic = P3.subscheme(matrix([[w, x, y], [x, y, z]]).minors(2)) sage: twisted_cubic.Jacobian() - Ideal (-x^2 + w*y, -x*y + w*z, -y^2 + x*z, x*z, -2*w*z, w*y, 3*w*y, -2*w*x, - w^2, y*z, -2*x*z, w*z, 3*w*z, -2*w*y, w*x, z^2, -2*y*z, x*z, 3*x*z, -2*w*z, w*y) - of Multivariate Polynomial Ring in w, x, y, z over Rational Field + Ideal (-x^2 + w*y, -x*y + w*z, -y^2 + x*z, x*z, -2*w*z, w*y, 3*w*y, + -2*w*x, w^2, y*z, -2*x*z, w*z, 3*w*z, -2*w*y, w*x, z^2, -2*y*z, + x*z, 3*x*z, -2*w*z, w*y) + of Multivariate Polynomial Ring in w, x, y, z over Rational Field sage: twisted_cubic.defining_ideal() - Ideal (-x^2 + w*y, -x*y + w*z, -y^2 + x*z) of Multivariate Polynomial Ring - in w, x, y, z over Rational Field + Ideal (-x^2 + w*y, -x*y + w*z, -y^2 + x*z) + of Multivariate Polynomial Ring in w, x, y, z over Rational Field This example addresses issue :trac:`20512`:: @@ -1482,7 +1485,7 @@ def __pow__(self, m): sage: Z = P2.subscheme([y0^2 - y1*y2, y2]) sage: Z**3 Closed subscheme of Product of projective spaces P^2 x P^2 x P^2 over - Integer Ring defined by: + Integer Ring defined by: x0^2 - x1*x2, x2, x3^2 - x4*x5, @@ -1494,7 +1497,7 @@ def __pow__(self, m): sage: V = A2.subscheme([x^2 - y, x - 1]) sage: V**4 Closed subscheme of Affine Space of dimension 8 over Rational Field - defined by: + defined by: x0^2 - x1, x0 - 1, x2^2 - x3, @@ -1508,14 +1511,14 @@ def __pow__(self, m): sage: X = T.subscheme([x0*x4 - x1*x3]) sage: X^2 Closed subscheme of Product of projective spaces P^2 x P^2 x P^2 x P^2 - over Integer Ring defined by: + over Integer Ring defined by: -x1*x3 + x0*x4, -x7*x9 + x6*x10 sage: E = EllipticCurve([0,0,0,0,1]) sage: E^2 - Closed subscheme of Product of projective spaces P^2 x P^2 over Rational - Field defined by: + Closed subscheme of Product of projective spaces P^2 x P^2 + over Rational Field defined by: -x0^3 + x1^2*x2 - x2^3, -x3^3 + x4^2*x5 - x5^3 """ @@ -1545,8 +1548,9 @@ def __mul__(self, right): Defining x0, x1, x2, x3, x4, x5 sage: X = T.subscheme([x0*x4 - x1*x3]) sage: X*S - Closed subscheme of Product of projective spaces P^2 x P^2 x P^1 x P^2 x - P^1 over Integer Ring defined by: + Closed subscheme of + Product of projective spaces P^2 x P^2 x P^1 x P^2 x P^1 over Integer Ring + defined by: -x1*x3 + x0*x4 :: @@ -1555,8 +1559,8 @@ def __mul__(self, right): sage: T. = ProjectiveSpace(ZZ, 3) sage: X = T.subscheme([x0*x2 - x1*x3]) sage: X*S - Closed subscheme of Product of projective spaces P^3 x P^2 - over Integer Ring defined by: + Closed subscheme of Product of projective spaces P^3 x P^2 over Integer Ring + defined by: x0*x2 - x1*x3 :: @@ -1566,7 +1570,7 @@ def __mul__(self, right): sage: X = A3.subscheme([x0*x2 - x1]) sage: X*A2 Closed subscheme of Affine Space of dimension 5 over Integer Ring - defined by: + defined by: x0*x2 - x1 :: @@ -1575,7 +1579,7 @@ def __mul__(self, right): sage: X = T.subscheme([x0*x4 - x1*x3]) sage: X*X Closed subscheme of Product of projective spaces P^2 x P^2 x P^2 x P^2 - over Integer Ring defined by: + over Integer Ring defined by: -x1*x3 + x0*x4, -x7*x9 + x6*x10 @@ -1586,8 +1590,8 @@ def __mul__(self, right): sage: T. = ProductProjectiveSpaces([2,2], ZZ) sage: X = T.subscheme([x0*x4 - x1*x3]) sage: X*Y - Closed subscheme of Product of projective spaces P^2 x P^2 x P^1 over - Integer Ring defined by: + Closed subscheme of Product of projective spaces P^2 x P^2 x P^1 + over Integer Ring defined by: -x1*x3 + x0*x4, z0 - z1 @@ -1604,7 +1608,8 @@ def __mul__(self, right): sage: Y*X Traceback (most recent call last): ... - TypeError: Affine Space of dimension 3 over Integer Ring must be a projective space, product of projective spaces, or subscheme + TypeError: Affine Space of dimension 3 over Integer Ring must be a projective space, + product of projective spaces, or subscheme sage: PP. = ProductProjectiveSpaces(ZZ, [1,1]) sage: Z = PP.subscheme([a*d - b*c]) sage: X*Z @@ -1614,7 +1619,8 @@ def __mul__(self, right): sage: Z*X Traceback (most recent call last): ... - TypeError: Affine Space of dimension 3 over Integer Ring must be a projective space, product of projective spaces, or subscheme + TypeError: Affine Space of dimension 3 over Integer Ring must be a projective space, + product of projective spaces, or subscheme """ #This will catch any ambient space mismatches AS = self.ambient_space()*right.ambient_space() @@ -1664,32 +1670,36 @@ def complement(self, other=None): sage: X = A.subscheme([x + y - z]) sage: Y = A.subscheme([x - y + z]) sage: Y.complement(X) - Quasi-affine subscheme X - Y of Affine Space of - dimension 3 over Integer Ring, where X is defined by: - x + y - z - and Y is defined by: - x - y + z + Quasi-affine subscheme X - Y of + Affine Space of dimension 3 over Integer Ring, + where X is defined by: + x + y - z + and Y is defined by: + x - y + z sage: Y.complement() - Quasi-affine subscheme X - Y of Affine Space of - dimension 3 over Integer Ring, where X is defined by: - (no polynomials) - and Y is defined by: - x - y + z + Quasi-affine subscheme X - Y of + Affine Space of dimension 3 over Integer Ring, + where X is defined by: + (no polynomials) + and Y is defined by: + x - y + z sage: P. = ProjectiveSpace(2, QQ) sage: X = P.subscheme([x^2 + y^2 + z^2]) sage: Y = P.subscheme([x*y + y*z + z*x]) sage: Y.complement(X) - Quasi-projective subscheme X - Y of Projective Space of - dimension 2 over Rational Field, where X is defined by: - x^2 + y^2 + z^2 - and Y is defined by: - x*y + x*z + y*z + Quasi-projective subscheme X - Y of + Projective Space of dimension 2 over Rational Field, + where X is defined by: + x^2 + y^2 + z^2 + and Y is defined by: + x*y + x*z + y*z sage: Y.complement(P) - Quasi-projective subscheme X - Y of Projective Space of - dimension 2 over Rational Field, where X is defined by: - (no polynomials) - and Y is defined by: - x*y + x*z + y*z + Quasi-projective subscheme X - Y of + Projective Space of dimension 2 over Rational Field, + where X is defined by: + (no polynomials) + and Y is defined by: + x*y + x*z + y*z """ A = self.ambient_space() if other is None: @@ -1850,8 +1860,8 @@ def change_ring(self, R): sage: X = P.subscheme([3*x^2 - y^2]) sage: H = Hom(X, X) sage: X.change_ring(GF(3)) # optional - sage.rings.finite_rings - Closed subscheme of Projective Space of dimension 1 over Finite Field of size 3 - defined by: -y^2 + Closed subscheme of Projective Space of dimension 1 + over Finite Field of size 3 defined by: -y^2 :: @@ -1861,9 +1871,9 @@ def change_ring(self, R): sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field sage: X = P.subscheme(x - w*y) # optional - sage.rings.number_field sage: X.change_ring(L) # optional - sage.rings.number_field - Closed subscheme of Projective Space of dimension 1 over Number Field in v with - defining polynomial z^3 - 5 over its base field defined by: - x + (-w)*y + Closed subscheme of Projective Space of dimension 1 over + Number Field in v with defining polynomial z^3 - 5 over its base field + defined by: x + (-w)*y :: @@ -1875,7 +1885,7 @@ def change_ring(self, R): sage: emb = L.embeddings(QQbar) # optional - sage.rings.number_field sage: X.change_ring(emb[0]) # optional - sage.rings.number_field Closed subscheme of Affine Space of dimension 3 over Algebraic Field - defined by: + defined by: x + (-1.414213562373095? + 0.?e-16*I)*y, z^2 + (0.8549879733383485? + 1.480882609682365?*I)*x @@ -1889,7 +1899,7 @@ def change_ring(self, R): sage: emb = L.embeddings(QQbar) # optional - sage.rings.number_field sage: X.change_ring(emb[1]) # optional - sage.rings.number_field Closed subscheme of Affine Space of dimension 3 over Algebraic Field - defined by: + defined by: x + (-1.414213562373095? + 0.?e-16*I)*y, z^2 + (0.8549879733383485? - 1.480882609682365?*I)*x @@ -1899,8 +1909,8 @@ def change_ring(self, R): sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field sage: X = P.subscheme(x - w*y) # optional - sage.rings.number_field sage: X.change_ring(CC) # optional - sage.rings.number_field - Closed subscheme of Projective Space of dimension 1 over Complex Field - with 53 bits of precision defined by: + Closed subscheme of Projective Space of dimension 1 + over Complex Field with 53 bits of precision defined by: x + (-1.73205080756888*I)*y :: @@ -1909,8 +1919,8 @@ def change_ring(self, R): sage: P. = ProjectiveSpace(K, 1) # optional - sage.rings.number_field sage: X = P.subscheme(x - w*y) # optional - sage.rings.number_field sage: X.change_ring(RR) # optional - sage.rings.number_field - Closed subscheme of Projective Space of dimension 1 over Real Field - with 53 bits of precision defined by: + Closed subscheme of Projective Space of dimension 1 + over Real Field with 53 bits of precision defined by: x - 1.73205080756888*y :: @@ -1920,11 +1930,12 @@ def change_ring(self, R): sage: P. = ProjectiveSpace(O, 1) # optional - sage.rings.number_field sage: X = P.subscheme([x^2 + O(v)*y^2]) # optional - sage.rings.number_field sage: X.change_ring(CC) # optional - sage.rings.number_field - Closed subscheme of Projective Space of dimension 1 over Complex Field - with 53 bits of precision defined by: + Closed subscheme of Projective Space of dimension 1 + over Complex Field with 53 bits of precision defined by: x^2 + (0.623489801858734 + 0.781831482468030*I)*y^2 sage: X.change_ring(K).change_ring(K.embeddings(QQbar)[3]) # optional - sage.rings.number_field - Closed subscheme of Projective Space of dimension 1 over Algebraic Field defined by: + Closed subscheme of Projective Space of dimension 1 + over Algebraic Field defined by: x^2 + (-0.9009688679024191? - 0.4338837391175581?*I)*y^2 :: @@ -1936,8 +1947,8 @@ def change_ring(self, R): sage: H = Hom(A, A) # optional - sage.rings.number_field sage: X = A.subscheme([b*x^2, y^2]) # optional - sage.rings.number_field sage: X.change_ring(CC) # optional - sage.rings.number_field - Closed subscheme of Affine Space of dimension 2 over Complex Field with - 53 bits of precision defined by: + Closed subscheme of Affine Space of dimension 2 + over Complex Field with 53 bits of precision defined by: (-0.561231024154687 - 0.972080648619833*I)*x^2, y^2 """ @@ -1988,8 +1999,8 @@ def weil_restriction(self): sage: A. = AffineSpace(L, 2) # optional - sage.rings.number_field sage: X = A.subscheme([y^2 - L(w)*x^3 - v]) # optional - sage.rings.number_field sage: X.weil_restriction() # optional - sage.rings.number_field - Closed subscheme of Affine Space of dimension 4 over Number Field in w - with defining polynomial x^5 - 2 defined by: + Closed subscheme of Affine Space of dimension 4 + over Number Field in w with defining polynomial x^5 - 2 defined by: (-w)*z0^3 + (3*w)*z0*z1^2 + z2^2 - z3^2, (-3*w)*z0^2*z1 + w*z1^3 + 2*z2*z3 - 1 sage: X.weil_restriction().ambient_space() is A.weil_restriction() # optional - sage.rings.number_field @@ -2000,8 +2011,8 @@ def weil_restriction(self): sage: A. = AffineSpace(GF(5^2, 't'), 3) # optional - sage.rings.finite_rings sage: X = A.subscheme([y^2 - x*z, z^2 + 2*y]) # optional - sage.rings.finite_rings sage: X.weil_restriction() # optional - sage.rings.finite_rings - Closed subscheme of Affine Space of dimension 6 over Finite Field of - size 5 defined by: + Closed subscheme of Affine Space of dimension 6 + over Finite Field of size 5 defined by: z2^2 - 2*z3^2 - z0*z4 + 2*z1*z5, 2*z2*z3 + z3^2 - z1*z4 - z0*z5 - z1*z5, z4^2 - 2*z5^2 + 2*z2, @@ -2060,7 +2071,7 @@ def specialization(self, D=None, phi=None): sage: phi = SpecializationMorphism(P.coordinate_ring(), dict({c: 2, a: 1})) sage: X.specialization(phi=phi) Closed subscheme of Affine Space of dimension 3 - over Univariate Polynomial Ring in b over Rational Field defined by: + over Univariate Polynomial Ring in b over Rational Field defined by: x^2 + 2*y^2 + (-b)*z^2 """ if D is None: diff --git a/src/sage/schemes/generic/homset.py b/src/sage/schemes/generic/homset.py index 262e880f253..8534b9b2fa0 100644 --- a/src/sage/schemes/generic/homset.py +++ b/src/sage/schemes/generic/homset.py @@ -375,10 +375,10 @@ def _element_constructor_(self, x, check=True): sage: C = A.subscheme(x*y - 1) sage: H = C.Hom(C); H Set of morphisms - From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - x*y - 1 - To: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by: - x*y - 1 + From: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: x*y - 1 + To: Closed subscheme of Affine Space of dimension 2 over Rational Field + defined by: x*y - 1 sage: H(1) Traceback (most recent call last): ... @@ -671,14 +671,14 @@ def extended_codomain(self): sage: K. = NumberField(x^2 + x - (3^3-3)) # optional - sage.rings.number_field sage: K_points = P2(K); K_points # optional - sage.rings.number_field Set of rational points of Projective Space of dimension 2 - over Number Field in a with defining polynomial x^2 + x - 24 + over Number Field in a with defining polynomial x^2 + x - 24 sage: K_points.codomain() # optional - sage.rings.number_field Projective Space of dimension 2 over Rational Field sage: K_points.extended_codomain() # optional - sage.rings.number_field - Projective Space of dimension 2 over Number Field in a with - defining polynomial x^2 + x - 24 + Projective Space of dimension 2 + over Number Field in a with defining polynomial x^2 + x - 24 """ if '_extended_codomain' in self.__dict__: return self._extended_codomain diff --git a/src/sage/schemes/generic/hypersurface.py b/src/sage/schemes/generic/hypersurface.py index e5fbb2aac42..fa2326d43e5 100644 --- a/src/sage/schemes/generic/hypersurface.py +++ b/src/sage/schemes/generic/hypersurface.py @@ -58,23 +58,22 @@ class ProjectiveHypersurface(AlgebraicScheme_subscheme_projective): sage: P. = ProjectiveSpace(ZZ, 2) sage: ProjectiveHypersurface(x - y, P) Projective hypersurface defined by x - y - in Projective Space of dimension 2 over Integer Ring + in Projective Space of dimension 2 over Integer Ring :: sage: R. = QQ[] sage: ProjectiveHypersurface(x - y) Projective hypersurface defined by x - y - in Projective Space of dimension 2 over Rational Field + in Projective Space of dimension 2 over Rational Field """ def __init__(self, poly, ambient=None): """ Return the projective hypersurface in the space ambient - defined by the polynomial poly. + defined by the polynomial ``poly``. - If ambient is not given, it will be constructed based on - poly. + If ambient is not given, it will be constructed based on ``poly``. EXAMPLES:: @@ -116,7 +115,7 @@ def _repr_(self): sage: H = ProjectiveHypersurface(x*z + y^2) sage: H Projective hypersurface defined by y^2 + x*z - in Projective Space of dimension 2 over Integer Ring + in Projective Space of dimension 2 over Integer Ring sage: H._repr_() 'Projective hypersurface defined by y^2 + x*z in Projective Space of dimension 2 over Integer Ring' """ @@ -146,15 +145,15 @@ class AffineHypersurface(AlgebraicScheme_subscheme_affine): sage: A. = AffineSpace(ZZ, 3) sage: AffineHypersurface(x*y - z^3, A) - Affine hypersurface defined by -z^3 + x*y in Affine Space of dimension 3 - over Integer Ring + Affine hypersurface defined by -z^3 + x*y + in Affine Space of dimension 3 over Integer Ring :: sage: A. = QQ[] sage: AffineHypersurface(x*y - z^3) - Affine hypersurface defined by -z^3 + x*y in Affine Space of dimension 3 - over Rational Field + Affine hypersurface defined by -z^3 + x*y + in Affine Space of dimension 3 over Rational Field """ def __init__(self, poly, ambient=None): """ @@ -169,14 +168,14 @@ def __init__(self, poly, ambient=None): sage: A. = AffineSpace(ZZ, 3) sage: AffineHypersurface(x*y - z^3, A) Affine hypersurface defined by -z^3 + x*y - in Affine Space of dimension 3 over Integer Ring + in Affine Space of dimension 3 over Integer Ring :: sage: A. = QQ[] sage: AffineHypersurface(x*y - z^3) Affine hypersurface defined by -z^3 + x*y - in Affine Space of dimension 3 over Rational Field + in Affine Space of dimension 3 over Rational Field TESTS:: @@ -204,7 +203,7 @@ def _repr_(self): sage: H = AffineHypersurface(x*z + y^2) sage: H Affine hypersurface defined by y^2 + x*z - in Affine Space of dimension 3 over Integer Ring + in Affine Space of dimension 3 over Integer Ring sage: H._repr_() 'Affine hypersurface defined by y^2 + x*z in Affine Space of dimension 3 over Integer Ring' """ diff --git a/src/sage/schemes/generic/morphism.py b/src/sage/schemes/generic/morphism.py index 1f3b9dcf50e..086c2960755 100644 --- a/src/sage/schemes/generic/morphism.py +++ b/src/sage/schemes/generic/morphism.py @@ -1442,12 +1442,12 @@ def change_ring(self, R, check=True): sage: emb = K.embeddings(QQbar) # optional - sage.rings.number_field sage: f.change_ring(emb[0]) # optional - sage.rings.number_field Scheme endomorphism of Projective Space of dimension 1 - over Algebraic Field + over Algebraic Field Defn: Defined on coordinates by sending (x : y) to (x^2 + (-1.324717957244746?)*x*y + 1.754877666246693?*y^2 : y^2) sage: f.change_ring(emb[1]) # optional - sage.rings.number_field Scheme endomorphism of Projective Space of dimension 1 - over Algebraic Field + over Algebraic Field Defn: Defined on coordinates by sending (x : y) to (x^2 + (0.6623589786223730? - 0.5622795120623013?*I)*x*y + (0.1225611668766537? - 0.744861766619745?*I)*y^2 : y^2) @@ -1460,7 +1460,7 @@ def change_ring(self, R, check=True): sage: f = H([x^2 + v*y^2, y^2]) # optional - sage.rings.number_field sage.symbolic sage: f.change_ring(QQbar) # optional - sage.rings.number_field sage.symbolic Scheme endomorphism of Projective Space of dimension 1 - over Algebraic Field + over Algebraic Field Defn: Defined on coordinates by sending (x : y) to (x^2 + 1.414213562373095?*y^2 : y^2) @@ -1475,7 +1475,7 @@ def change_ring(self, R, check=True): sage: f = H([6*x^2 + 2*x*y + 16*y^2, -w*x^2 - 4*x*y - 4*y^2]) # optional - sage.rings.number_field sage.symbolic sage: f.change_ring(QQbar) # optional - sage.rings.number_field sage.symbolic Scheme endomorphism of Closed subscheme of Projective Space of dimension 1 - over Algebraic Field defined by: x - y + over Algebraic Field defined by: x - y Defn: Defined on coordinates by sending (x : y) to (6*x^2 + 2*x*y + 16*y^2 : 1.414213562373095?*x^2 + (-4)*x*y + (-4)*y^2) @@ -1602,7 +1602,7 @@ def specialization(self, D=None, phi=None, homset=None): sage: f = H([x^2, c*y^2]) sage: f.specialization({c: 2}) Scheme endomorphism of Closed subscheme of Projective Space of dimension 1 - over Rational Field defined by: x - 2*y + over Rational Field defined by: x - 2*y Defn: Defined on coordinates by sending (x : y) to (x^2 : 2*y^2) :: @@ -1727,9 +1727,9 @@ def _composition_(self, other, homset): sage: g*f1 # optional - sage.rings.number_field Composite map: From: Affine Space of dimension 2 over Number Field in a - with defining polynomial x^2 - 2 + with defining polynomial x^2 - 2 To: Affine Space of dimension 2 over Number Field in a - with defining polynomial x^2 - 2 + with defining polynomial x^2 - 2 Defn: Generic endomorphism of Affine Space of dimension 2 over Number Field in a with defining polynomial x^2 - 2 then @@ -1992,7 +1992,8 @@ def change_ring(self, R, check=True): sage: H = End(P) # optional - sage.rings.number_field sage: F = H([x^2 + O(v)*y^2, y^2]) # optional - sage.rings.number_field sage: F.change_ring(K).change_ring(K.embeddings(QQbar)[0]) # optional - sage.rings.number_field - Scheme endomorphism of Projective Space of dimension 1 over Algebraic Field + Scheme endomorphism of Projective Space of dimension 1 + over Algebraic Field Defn: Defined on coordinates by sending (x : y) to (x^2 + (-2.645751311064591?*I)*y^2 : y^2) @@ -2102,8 +2103,8 @@ def specialization(self, D=None, phi=None, ambient=None): sage: Q2 = Q.specialization({c:2}); Q2 (2 : 1) sage: Q2.codomain() - Closed subscheme of Projective Space of dimension 1 over Rational Field defined by: - x - 2*y + Closed subscheme of Projective Space of dimension 1 over Rational Field + defined by: x - 2*y :: diff --git a/src/sage/schemes/generic/point.py b/src/sage/schemes/generic/point.py index 6bd3599d943..5b2d26550fd 100644 --- a/src/sage/schemes/generic/point.py +++ b/src/sage/schemes/generic/point.py @@ -166,7 +166,7 @@ def __init__(self, S, P, check=False): sage: P2. = ProjectiveSpace(2, QQ) sage: SchemeTopologicalPoint_prime_ideal(P2, y*z - x^2) Point on Projective Space of dimension 2 over Rational Field defined by - the Ideal (-x^2 + y*z) of Multivariate Polynomial Ring in x, y, z over Rational Field + the Ideal (-x^2 + y*z) of Multivariate Polynomial Ring in x, y, z over Rational Field """ R = S.coordinate_ring() from sage.rings.ideal import is_Ideal @@ -192,7 +192,7 @@ def _repr_(self): sage: P2. = ProjectiveSpace(2, QQ) sage: pt = SchemeTopologicalPoint_prime_ideal(P2, y*z - x^2); pt Point on Projective Space of dimension 2 over Rational Field defined by - the Ideal (-x^2 + y*z) of Multivariate Polynomial Ring in x, y, z over Rational Field + the Ideal (-x^2 + y*z) of Multivariate Polynomial Ring in x, y, z over Rational Field sage: pt._repr_() 'Point on Projective Space of dimension 2 over Rational Field defined by the Ideal (-x^2 + y*z) of Multivariate Polynomial Ring in x, y, z over Rational Field' """ diff --git a/src/sage/schemes/generic/scheme.py b/src/sage/schemes/generic/scheme.py index 451b9da335d..960a1a928ea 100644 --- a/src/sage/schemes/generic/scheme.py +++ b/src/sage/schemes/generic/scheme.py @@ -167,7 +167,7 @@ def _morphism(self, *args, **kwds): sage: S = Spec(ZZ) sage: f = S.identity_morphism() sage: from sage.schemes.generic.glue import GluedScheme - sage: T = GluedScheme(f,f) + sage: T = GluedScheme(f, f) sage: S.hom([1],T) Traceback (most recent call last): ... @@ -217,15 +217,15 @@ def __call__(self, *args): sage: A(QQ) Set of rational points of Affine Space of dimension 2 over Rational Field sage: A(RR) - Set of rational points of Affine Space of dimension 2 over Real Field - with 53 bits of precision + Set of rational points of Affine Space of dimension 2 + over Real Field with 53 bits of precision Space of dimension 2 over Rational Field:: sage: R. = PolynomialRing(QQ) sage: A(NumberField(x^2 + 1, 'a')) # optional - sage.rings.number_field - Set of rational points of Affine Space of dimension 2 over Number Field - in a with defining polynomial x^2 + 1 + Set of rational points of Affine Space of dimension 2 + over Number Field in a with defining polynomial x^2 + 1 sage: A(GF(7)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... @@ -287,7 +287,7 @@ def point_homset(self, S=None): Set of rational points of Projective Space of dimension 3 over Rational Field sage: P.point_homset(GF(11)) # optional - sage.rings.finite_rings Set of rational points of Projective Space of dimension 3 over - Finite Field of size 11 + Finite Field of size 11 TESTS:: @@ -507,7 +507,7 @@ def coordinate_ring(self): sage: X = Spec(R.quotient(I)) sage: X.coordinate_ring() Quotient of Multivariate Polynomial Ring in x, y over Rational Field - by the ideal (x^2 - y^2) + by the ideal (x^2 - y^2) """ try: return self._coordinate_ring @@ -960,8 +960,8 @@ def __call__(self, *args): sage: S = Spec(R) sage: P = S(R.ideal(x, y, z)); P Point on Spectrum of Multivariate Polynomial Ring - in x, y, z over Rational Field defined by the Ideal (x, y, z) - of Multivariate Polynomial Ring in x, y, z over Rational Field + in x, y, z over Rational Field defined by the Ideal (x, y, z) + of Multivariate Polynomial Ring in x, y, z over Rational Field This indicates the fix of :trac:`12734`:: @@ -991,7 +991,8 @@ def __call__(self, *args): sage: R = S.coordinate_ring() sage: S(R.ideal(0)) - Point on Affine Space of dimension 1 over Integer Ring defined by the Ideal (0) of Multivariate Polynomial Ring in x over Integer Ring + Point on Affine Space of dimension 1 over Integer Ring + defined by the Ideal (0) of Multivariate Polynomial Ring in x over Integer Ring This explains why the following example raises an error rather than constructing the topological point defined by the prime @@ -1208,8 +1209,7 @@ def hom(self, x, Y=None): Scheme morphism: From: Affine Space of dimension 1 over Rational Field To: Affine Plane Curve over Rational Field defined by p - 2 - Defn: Defined on coordinates by sending (r) to - (2, r) + Defn: Defined on coordinates by sending (r) to (2, r) """ from sage.categories.map import Map from sage.categories.rings import Rings diff --git a/src/sage/schemes/hyperelliptic_curves/constructor.py b/src/sage/schemes/hyperelliptic_curves/constructor.py index d1d1391d57a..121da1bf072 100644 --- a/src/sage/schemes/hyperelliptic_curves/constructor.py +++ b/src/sage/schemes/hyperelliptic_curves/constructor.py @@ -77,17 +77,17 @@ def HyperellipticCurve(f, h=0, names=None, PP=None, check_squarefree=True): sage: k. = GF(9); R. = k[] # optional - sage.rings.finite_rings sage: HyperellipticCurve(x^3 + x - 1, x+a) # optional - sage.rings.finite_rings Hyperelliptic Curve over Finite Field in a of size 3^2 - defined by y^2 + (x + a)*y = x^3 + x + 2 + defined by y^2 + (x + a)*y = x^3 + x + 2 Characteristic two:: sage: P. = GF(8, 'a')[] # optional - sage.rings.finite_rings sage: HyperellipticCurve(x^7 + 1, x) # optional - sage.rings.finite_rings Hyperelliptic Curve over Finite Field in a of size 2^3 - defined by y^2 + x*y = x^7 + 1 + defined by y^2 + x*y = x^7 + 1 sage: HyperellipticCurve(x^8 + x^7 + 1, x^4 + 1) # optional - sage.rings.finite_rings Hyperelliptic Curve over Finite Field in a of size 2^3 - defined by y^2 + (x^4 + 1)*y = x^8 + x^7 + 1 + defined by y^2 + (x^4 + 1)*y = x^8 + x^7 + 1 sage: HyperellipticCurve(x^8 + 1, x) # optional - sage.rings.finite_rings Traceback (most recent call last): @@ -103,14 +103,14 @@ def HyperellipticCurve(f, h=0, names=None, PP=None, check_squarefree=True): sage: P. = PolynomialRing(FractionField(F)) # optional - sage.rings.finite_rings sage: HyperellipticCurve(x^5 + t, x) # optional - sage.rings.finite_rings Hyperelliptic Curve over Laurent Series Ring in t over Finite Field of size 2 - defined by y^2 + x*y = x^5 + t + defined by y^2 + x*y = x^5 + t We can change the names of the variables in the output:: sage: k. = GF(9); R. = k[] # optional - sage.rings.finite_rings sage: HyperellipticCurve(x^3 + x - 1, x + a, names=['X','Y']) # optional - sage.rings.finite_rings Hyperelliptic Curve over Finite Field in a of size 3^2 - defined by Y^2 + (X + a)*Y = X^3 + X + 2 + defined by Y^2 + (X + a)*Y = X^3 + X + 2 This class also allows curves of genus zero or one, which are strictly speaking not hyperelliptic:: @@ -133,7 +133,7 @@ def HyperellipticCurve(f, h=0, names=None, PP=None, check_squarefree=True): sage: HyperellipticCurve((x^3-x+2)^2*(x^6-1), check_squarefree=False) # optional - sage.rings.finite_rings Hyperelliptic Curve over Finite Field of size 7 defined by - y^2 = x^12 + 5*x^10 + 4*x^9 + x^8 + 3*x^7 + 3*x^6 + 2*x^4 + 3*x^3 + 6*x^2 + 4*x + 3 + y^2 = x^12 + 5*x^10 + 4*x^9 + x^8 + 3*x^7 + 3*x^6 + 2*x^4 + 3*x^3 + 6*x^2 + 4*x + 3 The input for a (smooth) hyperelliptic curve of genus `g` should not contain polynomials of degree greater than `2g+2`. In the following diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py index bb39a5badba..47dd8025a3f 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py @@ -7,7 +7,7 @@ sage: f = x^5 - 3*x^4 - 2*x^3 + 6*x^2 + 3*x - 1 # optional - sage.rings.finite_rings sage: C = HyperellipticCurve(f); C # optional - sage.rings.finite_rings Hyperelliptic Curve over Finite Field of size 5 - defined by y^2 = x^5 + 2*x^4 + 3*x^3 + x^2 + 3*x + 4 + defined by y^2 = x^5 + 2*x^4 + 3*x^3 + x^2 + 3*x + 4 :: @@ -133,15 +133,15 @@ def change_ring(self, R): sage: HK = H.change_ring(K) # optional - sage.rings.padics sage: HL = HK.change_ring(L); HL # optional - sage.rings.padics Hyperelliptic Curve - over 3-adic Eisenstein Extension Field in a defined by x^30 - 3 - defined by (1 + O(a^150))*y^2 = (1 + O(a^150))*x^5 - + (2 + 2*a^30 + a^60 + 2*a^90 + 2*a^120 + O(a^150))*x + a^60 + O(a^210) + over 3-adic Eisenstein Extension Field in a defined by x^30 - 3 + defined by (1 + O(a^150))*y^2 = (1 + O(a^150))*x^5 + + (2 + 2*a^30 + a^60 + 2*a^90 + 2*a^120 + O(a^150))*x + a^60 + O(a^210) sage: R. = FiniteField(7)[] # optional - sage.rings.finite_rings sage: H = HyperellipticCurve(x^8 + x + 5) # optional - sage.rings.finite_rings sage: H.base_extend(FiniteField(7^2, 'a')) # optional - sage.rings.finite_rings Hyperelliptic Curve over Finite Field in a of size 7^2 - defined by y^2 = x^8 + x + 5 + defined by y^2 = x^8 + x + 5 """ from .constructor import HyperellipticCurve f, h = self._hyperelliptic_polynomials @@ -294,14 +294,14 @@ def odd_degree_model(self): sage: K2 = QuadraticField(-2, 'a') # optional - sage.rings.number_field sage: Hp2 = H.change_ring(K2).odd_degree_model(); Hp2 # optional - sage.rings.number_field Hyperelliptic Curve over Number Field in a - with defining polynomial x^2 + 2 with a = 1.414213562373095?*I - defined by y^2 = 6*a*x^5 - 29*x^4 - 20*x^2 + 6*a*x + 1 + with defining polynomial x^2 + 2 with a = 1.414213562373095?*I + defined by y^2 = 6*a*x^5 - 29*x^4 - 20*x^2 + 6*a*x + 1 sage: K3 = QuadraticField(-3, 'b') # optional - sage.rings.number_field sage: Hp3 = H.change_ring(QuadraticField(-3, 'b')).odd_degree_model(); Hp3 # optional - sage.rings.number_field Hyperelliptic Curve over Number Field in b - with defining polynomial x^2 + 3 with b = 1.732050807568878?*I - defined by y^2 = -4*b*x^5 - 14*x^4 - 20*b*x^3 - 35*x^2 + 6*b*x + 1 + with defining polynomial x^2 + 3 with b = 1.732050807568878?*I + defined by y^2 = -4*b*x^5 - 14*x^4 - 20*b*x^3 - 35*x^2 + 6*b*x + 1 Of course, ``Hp2`` and ``Hp3`` are isomorphic over the composite extension. One consequence of this is that odd degree models @@ -444,13 +444,13 @@ def local_coordinates_at_nonweierstrass(self, P, prec=20, name='t'): sage: R. = QQ['x'] sage: H = HyperellipticCurve(x^5 - 23*x^3 + 18*x^2 + 40*x) sage: P = H(1, 6) - sage: x,y = H.local_coordinates_at_nonweierstrass(P, prec=5) + sage: x, y = H.local_coordinates_at_nonweierstrass(P, prec=5) sage: x 1 + t + O(t^5) sage: y 6 + t - 7/2*t^2 - 1/2*t^3 - 25/48*t^4 + O(t^5) sage: Q = H(-2, 12) - sage: x,y = H.local_coordinates_at_nonweierstrass(Q, prec=5) + sage: x, y = H.local_coordinates_at_nonweierstrass(Q, prec=5) sage: x -2 + t + O(t^5) sage: y @@ -547,7 +547,7 @@ def local_coordinates_at_infinity(self, prec=20, name='t'): sage: R. = QQ['x'] sage: H = HyperellipticCurve(x^5 - 5*x^2 + 1) - sage: x,y = H.local_coordinates_at_infinity(10) + sage: x, y = H.local_coordinates_at_infinity(10) sage: x t^-2 + 5*t^4 - t^8 - 50*t^10 + O(t^12) sage: y @@ -557,7 +557,7 @@ def local_coordinates_at_infinity(self, prec=20, name='t'): sage: R. = QQ['x'] sage: H = HyperellipticCurve(x^3 - x + 1) - sage: x,y = H.local_coordinates_at_infinity(10) + sage: x, y = H.local_coordinates_at_infinity(10) sage: x t^-2 + t^2 - t^4 - t^6 + 3*t^8 + O(t^12) sage: y diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py b/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py index b8c224a5db9..ec04cfd8801 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_generic.py @@ -57,19 +57,19 @@ class HyperellipticJacobian_generic(Jacobian_generic): -x0^5 + x0*x1*x2^3 + x1^2*x2^3 + x0*x2^4 - x2^5 sage: C(QQ) Set of rational points of Hyperelliptic Curve over Rational Field - defined by v^2 + u*v = u^5 - u + 1 + defined by v^2 + u*v = u^5 - u + 1 sage: K. = NumberField(x^2 - 2) # optional - sage.rings.number_field sage: C(K) # optional - sage.rings.number_field Set of rational points of Hyperelliptic Curve - over Number Field in t with defining polynomial x^2 - 2 - defined by v^2 + u*v = u^5 - u + 1 + over Number Field in t with defining polynomial x^2 - 2 + defined by v^2 + u*v = u^5 - u + 1 sage: P = C(QQ)(0,1,1); P (0 : 1 : 1) sage: P == C(0,1,1) True sage: C(0,1,1).parent() Set of rational points of Hyperelliptic Curve over Rational Field - defined by v^2 + u*v = u^5 - u + 1 + defined by v^2 + u*v = u^5 - u + 1 sage: P1 = C(K)(P) # optional - sage.rings.number_field sage: P2 = C(K)([2, 4*t - 1, 1]) # optional - sage.rings.number_field sage: P3 = C(K)([-1/2, 1/8*(7*t+2), 1]) # optional - sage.rings.number_field diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py b/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py index 8ed4e0d3f45..f205b79b433 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_homset.py @@ -9,7 +9,7 @@ Hyperelliptic Curve over Rational Field defined by y^2 = x^5 + x + 1 sage: C(QQ) Set of rational points of Hyperelliptic Curve over Rational Field - defined by y^2 = x^5 + x + 1 + defined by y^2 = x^5 + x + 1 sage: P = C([0,1,1]) sage: J = C.jacobian(); J Jacobian of Hyperelliptic Curve over Rational Field defined by y^2 = x^5 + x + 1 diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py b/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py index ae36bc6a727..69eed3ee979 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py @@ -39,17 +39,17 @@ sage: x = GF(37)['x'].gen() # optional - sage.rings.finite_rings sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x); H # optional - sage.rings.finite_rings Hyperelliptic Curve over Finite Field of size 37 defined - by y^2 = x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x + by y^2 = x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x At this time, Jacobians of hyperelliptic curves are handled differently than elliptic curves:: sage: J = H.jacobian(); J # optional - sage.rings.finite_rings Jacobian of Hyperelliptic Curve over Finite Field of size 37 defined - by y^2 = x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x + by y^2 = x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x sage: J = J(J.base_ring()); J # optional - sage.rings.finite_rings Set of rational points of Jacobian of Hyperelliptic Curve over Finite Field - of size 37 defined by y^2 = x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x + of size 37 defined by y^2 = x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x Points on the Jacobian are represented by Mumford's polynomials. First we find a couple of points on the curve:: @@ -136,7 +136,7 @@ def cantor_reduction_simple(a, b, f, genus): Hyperelliptic Curve over Rational Field defined by y^2 = x^5 - x sage: J = H.jacobian()(QQ); J Set of rational points of Jacobian of Hyperelliptic Curve over Rational Field - defined by y^2 = x^5 - x + defined by y^2 = x^5 - x The following point is 2-torsion:: @@ -175,7 +175,7 @@ def cantor_reduction(a, b, f, h, genus): Hyperelliptic Curve over Rational Field defined by y^2 + x*y = x^5 - x sage: J = H.jacobian()(QQ); J Set of rational points of Jacobian of Hyperelliptic Curve over - Rational Field defined by y^2 + x*y = x^5 - x + Rational Field defined by y^2 + x*y = x^5 - x The following point is 2-torsion:: @@ -233,8 +233,7 @@ def cantor_composition_simple(D1,D2,f,genus): sage: F. = NumberField(x^2 - 2, 'a') # optional - sage.rings.number_field sage: J = H.jacobian()(F); J # optional - sage.rings.number_field Set of rational points of Jacobian of Hyperelliptic Curve over - Number Field in a with defining polynomial x^2 - 2 defined - by y^2 = x^5 + x + Number Field in a with defining polynomial x^2 - 2 defined by y^2 = x^5 + x :: @@ -277,10 +276,10 @@ def cantor_composition(D1,D2,f,h,genus): sage: f = x^7 + x^2 + a # optional - sage.rings.finite_rings sage: H = HyperellipticCurve(f, 2*x); H # optional - sage.rings.finite_rings Hyperelliptic Curve over Finite Field in a of size 7^2 - defined by y^2 + 2*x*y = x^7 + x^2 + a + defined by y^2 + 2*x*y = x^7 + x^2 + a sage: J = H.jacobian()(F); J # optional - sage.rings.finite_rings Set of rational points of Jacobian of Hyperelliptic Curve over - Finite Field in a of size 7^2 defined by y^2 + 2*x*y = x^7 + x^2 + a + Finite Field in a of size 7^2 defined by y^2 + 2*x*y = x^7 + x^2 + a :: @@ -306,11 +305,11 @@ def cantor_composition(D1,D2,f,h,genus): sage: f = x^7 + x^2 + 1 # optional - sage.rings.finite_rings sage: H = HyperellipticCurve(f, 2*x); H # optional - sage.rings.finite_rings Hyperelliptic Curve over Finite Field of size 1000000000000000000000000000057 - defined by y^2 + 2*x*y = x^7 + x^2 + 1 + defined by y^2 + 2*x*y = x^7 + x^2 + 1 sage: J = H.jacobian()(F); J # optional - sage.rings.finite_rings - Set of rational points of Jacobian of Hyperelliptic Curve over - Finite Field of size 1000000000000000000000000000057 defined - by y^2 + 2*x*y = x^7 + x^2 + 1 + Set of rational points of Jacobian of Hyperelliptic Curve + over Finite Field of size 1000000000000000000000000000057 + defined by y^2 + 2*x*y = x^7 + x^2 + 1 sage: Q = J(H.lift_x(F(1))); Q # optional - sage.rings.finite_rings (x + 1000000000000000000000000000056, y + 1000000000000000000000000000056) sage: 10*Q # indirect doctest # optional - sage.rings.finite_rings @@ -376,7 +375,7 @@ def __init__(self, parent, polys, check=True): sage: H = HyperellipticCurve(x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x) # optional - sage.rings.finite_rings sage: J = H.jacobian()(GF(37)); J # optional - sage.rings.finite_rings Set of rational points of Jacobian of Hyperelliptic Curve over - Finite Field of size 37 defined by + Finite Field of size 37 defined by y^2 = x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x :: @@ -385,7 +384,7 @@ def __init__(self, parent, polys, check=True): (x + 35, y + 26) sage: P1.parent() # optional - sage.rings.finite_rings Set of rational points of Jacobian of Hyperelliptic Curve over - Finite Field of size 37 defined by + Finite Field of size 37 defined by y^2 = x^5 + 12*x^4 + 13*x^3 + 15*x^2 + 33*x sage: type(P1) # optional - sage.rings.finite_rings @@ -500,9 +499,9 @@ def scheme(self): sage: H = HyperellipticCurve(f) sage: F. = NumberField(x^2 - 2, 'a') # optional - sage.rings.number_field sage: J = H.jacobian()(F); J # optional - sage.rings.number_field - Set of rational points of Jacobian of Hyperelliptic Curve over - Number Field in a with defining polynomial x^2 - 2 defined - by y^2 = x^5 + x + Set of rational points of Jacobian of Hyperelliptic Curve + over Number Field in a with defining polynomial x^2 - 2 + defined by y^2 = x^5 + x :: @@ -525,9 +524,9 @@ def __list__(self): sage: H = HyperellipticCurve(f) sage: F. = NumberField(x^2 - 2, 'a') # optional - sage.rings.number_field sage: J = H.jacobian()(F); J # optional - sage.rings.number_field - Set of rational points of Jacobian of Hyperelliptic Curve over - Number Field in a with defining polynomial x^2 - 2 defined - by y^2 = x^5 + x + Set of rational points of Jacobian of Hyperelliptic Curve + over Number Field in a with defining polynomial x^2 - 2 + defined by y^2 = x^5 + x :: @@ -549,9 +548,9 @@ def __tuple__(self): sage: H = HyperellipticCurve(f) sage: F. = NumberField(x^2 - 2, 'a') # optional - sage.rings.number_field sage: J = H.jacobian()(F); J # optional - sage.rings.number_field - Set of rational points of Jacobian of Hyperelliptic Curve over - Number Field in a with defining polynomial x^2 - 2 defined - by y^2 = x^5 + x + Set of rational points of Jacobian of Hyperelliptic Curve + over Number Field in a with defining polynomial x^2 - 2 + defined by y^2 = x^5 + x :: @@ -573,9 +572,9 @@ def __getitem__(self, n): sage: H = HyperellipticCurve(f) sage: F. = NumberField(x^2 - 2, 'a') # optional - sage.rings.number_field sage: J = H.jacobian()(F); J # optional - sage.rings.number_field - Set of rational points of Jacobian of Hyperelliptic Curve over - Number Field in a with defining polynomial x^2 - 2 defined - by y^2 = x^5 + x + Set of rational points of Jacobian of Hyperelliptic Curve + over Number Field in a with defining polynomial x^2 - 2 + defined by y^2 = x^5 + x :: diff --git a/src/sage/schemes/hyperelliptic_curves/mestre.py b/src/sage/schemes/hyperelliptic_curves/mestre.py index d7b9e0a5f68..e1685cdd86e 100644 --- a/src/sage/schemes/hyperelliptic_curves/mestre.py +++ b/src/sage/schemes/hyperelliptic_curves/mestre.py @@ -72,7 +72,7 @@ def HyperellipticCurve_from_invariants(i, reduced=True, precision=None, sage: HyperellipticCurve_from_invariants([3840,414720,491028480,2437709561856], ....: reduced=False) Hyperelliptic Curve over Rational Field defined by - y^2 = -46656*x^6 + 46656*x^5 - 19440*x^4 + 4320*x^3 - 540*x^2 + 4410*x - 1 + y^2 = -46656*x^6 + 46656*x^5 - 19440*x^4 + 4320*x^3 - 540*x^2 + 4410*x - 1 sage: HyperellipticCurve_from_invariants([21, 225/64, 22941/512, 1]) Traceback (most recent call last): ... @@ -249,11 +249,11 @@ def Mestre_conic(i, xyz=False, names='u,v,w'): sage: k = NumberField(x^2 - 41, 'a') # optional - sage.rings.number_field sage: a = k.an_element() # optional - sage.rings.number_field - sage: Mestre_conic([1, 2+a, a, 4+a]) # optional - sage.rings.number_field + sage: Mestre_conic([1, 2 + a, a, 4 + a]) # optional - sage.rings.number_field Projective Conic Curve over Number Field in a with defining polynomial x^2 - 41 - defined by (-801900000*a + 343845000)*u^2 + (855360000*a + 15795864000)*u*v - + (312292800000*a + 1284808579200)*v^2 + (624585600000*a + 2569617158400)*u*w - + (15799910400*a + 234573143040)*v*w + (2034199306240*a + 16429854656512)*w^2 + defined by (-801900000*a + 343845000)*u^2 + (855360000*a + 15795864000)*u*v + + (312292800000*a + 1284808579200)*v^2 + (624585600000*a + 2569617158400)*u*w + + (15799910400*a + 234573143040)*v*w + (2034199306240*a + 16429854656512)*w^2 And over finite fields:: @@ -261,7 +261,7 @@ def Mestre_conic(i, xyz=False, names='u,v,w'): Projective Conic Curve over Finite Field of size 7 defined by -2*u*v - v^2 - 2*u*w + 2*v*w - 3*w^2 - An example with xyz:: + An example with ``xyz``:: sage: Mestre_conic([5,6,7,8], xyz=True) (Projective Conic Curve over Rational Field diff --git a/src/sage/schemes/jacobians/abstract_jacobian.py b/src/sage/schemes/jacobians/abstract_jacobian.py index 8f57a14be36..08bee459739 100644 --- a/src/sage/schemes/jacobians/abstract_jacobian.py +++ b/src/sage/schemes/jacobians/abstract_jacobian.py @@ -221,11 +221,11 @@ def change_ring(self, R): sage: R. = QQ['x'] sage: H = HyperellipticCurve(x^3 - 10*x + 9) sage: Jac = H.jacobian(); Jac - Jacobian of Hyperelliptic Curve over Rational - Field defined by y^2 = x^3 - 10*x + 9 + Jacobian of Hyperelliptic Curve over Rational Field + defined by y^2 = x^3 - 10*x + 9 sage: Jac.change_ring(RDF) - Jacobian of Hyperelliptic Curve over Real Double - Field defined by y^2 = x^3 - 10.0*x + 9.0 + Jacobian of Hyperelliptic Curve over Real Double Field + defined by y^2 = x^3 - 10.0*x + 9.0 """ return self.curve().change_ring(R).jacobian() @@ -245,11 +245,11 @@ def base_extend(self, R): sage: H = HyperellipticCurve(x^3 - 10*x + 9) sage: Jac = H.jacobian(); Jac Jacobian of Hyperelliptic Curve over Rational Field - defined by y^2 = x^3 - 10*x + 9 + defined by y^2 = x^3 - 10*x + 9 sage: F. = QQ.extension(x^2 + 1) # optional - sage.rings.number_field sage: Jac.base_extend(F) # optional - sage.rings.number_field Jacobian of Hyperelliptic Curve over Number Field in a with defining - polynomial x^2 + 1 defined by y^2 = x^3 - 10*x + 9 + polynomial x^2 + 1 defined by y^2 = x^3 - 10*x + 9 """ if R not in _Fields: raise ValueError('Not a field: ' + str(R)) diff --git a/src/sage/schemes/plane_conics/con_field.py b/src/sage/schemes/plane_conics/con_field.py index 7386b41bfc0..fa813565f7a 100644 --- a/src/sage/schemes/plane_conics/con_field.py +++ b/src/sage/schemes/plane_conics/con_field.py @@ -52,7 +52,7 @@ class ProjectiveConic_field(ProjectivePlaneCurve_field): sage: P. = K[] sage: Conic(X^2 + Y^2 - Z^2) Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t - over Rational Field defined by X^2 + Y^2 - Z^2 + over Rational Field defined by X^2 + Y^2 - Z^2 TESTS:: @@ -107,7 +107,7 @@ def base_extend(self, S): False sage: d = c.base_extend(QuadraticField(-1, 'i')); d # optional - sage.rings.number_field Projective Conic Curve over Number Field in i - with defining polynomial x^2 + 1 with i = 1*I defined by x^2 + y^2 + z^2 + with defining polynomial x^2 + 1 with i = 1*I defined by x^2 + y^2 + z^2 sage: d.rational_point(algorithm='rnfisnorm') # optional - sage.rings.number_field (i : 1 : 0) """ @@ -196,9 +196,9 @@ def derivative_matrix(self): sage: P. = GF(2)[] # optional - sage.rings.finite_rings sage: c = Conic([t, 1, t^2, 1, 1, 0]); c # optional - sage.rings.finite_rings - Projective Conic Curve over Fraction Field of Univariate Polynomial - Ring in t over Finite Field of size 2 (using GF2X) - defined by t*x^2 + x*y + y^2 + (t^2)*x*z + y*z + Projective Conic Curve over Fraction Field of Univariate + Polynomial Ring in t over Finite Field of size 2 (using GF2X) + defined by t*x^2 + x*y + y^2 + (t^2)*x*z + y*z sage: c.is_smooth() # optional - sage.rings.finite_rings True sage: c.derivative_matrix() # optional - sage.rings.finite_rings @@ -396,7 +396,8 @@ def gens(self): sage: C. = Conic(GF(3), [1, 1, 1]) # optional - sage.rings.finite_rings sage: C # optional - sage.rings.finite_rings - Projective Conic Curve over Finite Field of size 3 defined by a^2 + b^2 + c^2 + Projective Conic Curve over + Finite Field of size 3 defined by a^2 + b^2 + c^2 """ return self.coordinate_ring().gens() @@ -581,7 +582,7 @@ def has_singular_point(self, point=False): sage: P. = GF(7)[] # optional - sage.rings.finite_rings sage: e = Conic((x+y+z)*(x-y+2*z)); e # optional - sage.rings.finite_rings Projective Conic Curve over Finite Field of size 7 - defined by x^2 - y^2 + 3*x*z + y*z + 2*z^2 + defined by x^2 - y^2 + 3*x*z + y*z + 2*z^2 sage: e.has_singular_point(point = True) # optional - sage.rings.finite_rings (True, (2 : 4 : 1)) @@ -602,7 +603,7 @@ def has_singular_point(self, point=False): sage: P. = GF(2)[] # optional - sage.rings.finite_rings sage: C = Conic(P, [t,t,1]); C # optional - sage.rings.finite_rings Projective Conic Curve over Fraction Field of Univariate Polynomial Ring - in t over Finite Field of size 2 (using GF2X) defined by t*x^2 + t*y^2 + z^2 + in t over Finite Field of size 2 (using GF2X) defined by t*x^2 + t*y^2 + z^2 sage: C.has_singular_point(point = False) # optional - sage.rings.finite_rings Traceback (most recent call last): ... @@ -736,7 +737,7 @@ def is_diagonal(self): sage: c = Conic([1,1,0,1,0,1]); c Projective Conic Curve over Rational Field defined by x^2 + x*y + y^2 + z^2 - sage: d,t = c.diagonal_matrix() + sage: d, t = c.diagonal_matrix() sage: c.is_diagonal() False sage: c.diagonalization()[0].is_diagonal() @@ -869,7 +870,7 @@ def parametrization(self, point=None, morphism=True): sage: h = g*f; h # optional - sage.rings.finite_rings Scheme endomorphism of Projective Space of dimension 1 - over Finite Field of size 2 + over Finite Field of size 2 Defn: Defined on coordinates by sending (x : y) to ... sage: h[0]/h[1] # optional - sage.rings.finite_rings x/y @@ -878,7 +879,7 @@ def parametrization(self, point=None, morphism=True): sage: (x,y,z) = c.gens() # optional - sage.rings.finite_rings sage: x.parent() # optional - sage.rings.finite_rings Quotient of Multivariate Polynomial Ring in x, y, z - over Finite Field of size 2 by the ideal (x^2 + x*y + y^2 + x*z + y*z) + over Finite Field of size 2 by the ideal (x^2 + x*y + y^2 + x*z + y*z) sage: k = f*g # optional - sage.rings.finite_rings sage: k[0]*z-k[2]*x # optional - sage.rings.finite_rings 0 diff --git a/src/sage/schemes/plane_conics/con_finite_field.py b/src/sage/schemes/plane_conics/con_finite_field.py index af97eaec4a2..5a6ef94bd7e 100644 --- a/src/sage/schemes/plane_conics/con_finite_field.py +++ b/src/sage/schemes/plane_conics/con_finite_field.py @@ -39,7 +39,7 @@ class ProjectiveConic_finite_field(ProjectiveConic_field, ProjectivePlaneCurve_f sage: P. = K[] sage: Conic(X^2 + Y^2 - a*Z^2) Projective Conic Curve over Finite Field in a of size 3^2 - defined by X^2 + Y^2 + (-a)*Z^2 + defined by X^2 + Y^2 + (-a)*Z^2 :: @@ -97,7 +97,7 @@ def has_rational_point(self, point=False, read_cache=True, sage: C = Conic(FiniteField(2), [1, 1, 1, 1, 1, 0]); C Projective Conic Curve over Finite Field of size 2 - defined by x^2 + x*y + y^2 + x*z + y*z + defined by x^2 + x*y + y^2 + x*z + y*z sage: C.has_rational_point(point = True) # output is random (True, (0 : 0 : 1)) @@ -105,8 +105,8 @@ def has_rational_point(self, point=False, read_cache=True, sage: F = FiniteField(p) sage: C = Conic(F, [1, 2, 3]); C Projective Conic Curve over Finite Field - of size 100000000000000000000000000000000000000000000000151 - defined by x^2 + 2*y^2 + 3*z^2 + of size 100000000000000000000000000000000000000000000000151 + defined by x^2 + 2*y^2 + 3*z^2 sage: C.has_rational_point(point = True) # output is random (True, (14971942941468509742682168602989039212496867586852 @@ -115,7 +115,7 @@ def has_rational_point(self, point=False, read_cache=True, sage: F. = FiniteField(7^20) sage: C = Conic([1, a, -5]); C Projective Conic Curve over Finite Field in a of size 7^20 - defined by x^2 + a*y^2 + 2*z^2 + defined by x^2 + a*y^2 + 2*z^2 sage: C.has_rational_point(point = True) # output is random (True, (a^18 + 2*a^17 + 4*a^16 + 6*a^13 + a^12 + 6*a^11 + 3*a^10 + 4*a^9 + 2*a^8 diff --git a/src/sage/schemes/plane_conics/con_number_field.py b/src/sage/schemes/plane_conics/con_number_field.py index fcd100d3707..2844329e195 100644 --- a/src/sage/schemes/plane_conics/con_number_field.py +++ b/src/sage/schemes/plane_conics/con_number_field.py @@ -38,7 +38,7 @@ class ProjectiveConic_number_field(ProjectiveConic_field): sage: P. = K[] sage: Conic(X^2 + Y^2 - a*Z^2) Projective Conic Curve over Number Field in a with defining polynomial x^3 - 2 - defined by X^2 + Y^2 + (-a)*Z^2 + defined by X^2 + Y^2 + (-a)*Z^2 TESTS:: diff --git a/src/sage/schemes/plane_conics/constructor.py b/src/sage/schemes/plane_conics/constructor.py index 0ce41ae724e..c84e0ef5b2b 100644 --- a/src/sage/schemes/plane_conics/constructor.py +++ b/src/sage/schemes/plane_conics/constructor.py @@ -109,7 +109,7 @@ def Conic(base_field, F=None, names=None, unique=True): sage: x,y = GF(7)['x,y'].gens() # optional - sage.rings.finite_rings sage: Conic(x^2 - x + 2*y^2 - 3, 'U,V,W') # optional - sage.rings.finite_rings Projective Conic Curve over Finite Field of size 7 - defined by U^2 + 2*V^2 - U*W - 3*W^2 + defined by U^2 + 2*V^2 - U*W - 3*W^2 Conic curves given by matrices :: @@ -134,7 +134,7 @@ def Conic(base_field, F=None, names=None, unique=True): sage: C = Conic(QQ, [[10,2],[3,4],[-7,6],[7,8],[9,10]]); C Projective Conic Curve over Rational Field - defined by x^2 + 13/4*x*y - 17/4*y^2 - 35/2*x*z + 91/4*y*z - 37/2*z^2 + defined by x^2 + 13/4*x*y - 17/4*y^2 - 35/2*x*z + 91/4*y*z - 37/2*z^2 sage: C.rational_point() (10 : 2 : 1) sage: C.point([3,4]) diff --git a/src/sage/schemes/plane_quartics/quartic_generic.py b/src/sage/schemes/plane_quartics/quartic_generic.py index 537bf760c9a..ac2cdd84d82 100644 --- a/src/sage/schemes/plane_quartics/quartic_generic.py +++ b/src/sage/schemes/plane_quartics/quartic_generic.py @@ -9,7 +9,7 @@ sage: f = X^4 + Y^4 + Z^4 - 3*X*Y*Z*(X+Y+Z) sage: C = QuarticCurve(f); C Quartic Curve over Rational Field - defined by X^4 + Y^4 - 3*X^2*Y*Z - 3*X*Y^2*Z - 3*X*Y*Z^2 + Z^4 + defined by X^4 + Y^4 - 3*X^2*Y*Z - 3*X*Y^2*Z - 3*X*Y*Z^2 + Z^4 """ #***************************************************************************** diff --git a/src/sage/schemes/product_projective/space.py b/src/sage/schemes/product_projective/space.py index 6625c809fc9..c17524ed163 100644 --- a/src/sage/schemes/product_projective/space.py +++ b/src/sage/schemes/product_projective/space.py @@ -398,8 +398,8 @@ def __pow__(self, m): sage: P1 = ProductProjectiveSpaces([2, 1], QQ, 'x') sage: P1^3 - Product of projective spaces P^2 x P^1 x P^2 x P^1 x P^2 x P^1 over - Rational Field + Product of projective spaces P^2 x P^1 x P^2 x P^1 x P^2 x P^1 + over Rational Field As you see, custom variable names are not preserved by power operator, since there is no natural way to make new ones in general. @@ -840,14 +840,14 @@ def subscheme(self, X): sage: P. = ProductProjectiveSpaces([1, 1], GF(5)) # optional - sage.rings.finite_rings sage: X = P.subscheme([x - y, z - w]); X # optional - sage.rings.finite_rings Closed subscheme of Product of projective spaces P^1 x P^1 - over Finite Field of size 5 defined by: - x - y, - z - w + over Finite Field of size 5 defined by: + x - y, + z - w sage: X.defining_polynomials() # optional - sage.rings.finite_rings [x - y, z - w] sage: I = X.defining_ideal(); I # optional - sage.rings.finite_rings - Ideal (x - y, z - w) of Multivariate Polynomial Ring in x, y, z, w over - Finite Field of size 5 + Ideal (x - y, z - w) of Multivariate Polynomial Ring in x, y, z, w + over Finite Field of size 5 sage: X.dimension() # optional - sage.rings.finite_rings 0 sage: X.base_ring() # optional - sage.rings.finite_rings @@ -1106,7 +1106,7 @@ def _point_homset(self, *args, **kwds): sage: P. = ProductProjectiveSpaces([1, 1], GF(5)) # optional - sage.rings.finite_rings sage: P._point_homset(Spec(GF(5)), P) # optional - sage.rings.finite_rings Set of rational points of Product of projective spaces P^1 x P^1 - over Finite Field of size 5 + over Finite Field of size 5 """ return SchemeHomset_points_product_projective_spaces_field(*args, **kwds) @@ -1240,12 +1240,12 @@ def __iter__(self): sage: P = ProductProjectiveSpaces([2, 1], GF(3)) # optional - sage.rings.finite_rings sage: [x for x in P] # optional - sage.rings.finite_rings [(0 : 0 : 1 , 0 : 1), - (0 : 1 : 1 , 0 : 1), - (0 : 2 : 1 , 0 : 1), - ... - (1 : 1 : 0 , 1 : 0), - (2 : 1 : 0 , 1 : 0), - (1 : 0 : 0 , 1 : 0)] + (0 : 1 : 1 , 0 : 1), + (0 : 2 : 1 , 0 : 1), + ... + (1 : 1 : 0 , 1 : 0), + (2 : 1 : 0 , 1 : 0), + (1 : 0 : 0 , 1 : 0)] """ iters = [iter(T) for T in self._components] L = [] diff --git a/src/sage/schemes/product_projective/subscheme.py b/src/sage/schemes/product_projective/subscheme.py index 98d2633690b..1678ab2f472 100644 --- a/src/sage/schemes/product_projective/subscheme.py +++ b/src/sage/schemes/product_projective/subscheme.py @@ -48,7 +48,7 @@ class AlgebraicScheme_subscheme_product_projective(AlgebraicScheme_subscheme_pro sage: P. = ProductProjectiveSpaces([1, 1], QQ) sage: P.subscheme([u*x^2 - v*y*x]) Closed subscheme of Product of projective spaces P^1 x P^1 over Rational Field - defined by: + defined by: x^2*u - x*y*v TESTS:: @@ -56,8 +56,8 @@ class AlgebraicScheme_subscheme_product_projective(AlgebraicScheme_subscheme_pro sage: from sage.schemes.product_projective.subscheme \ import AlgebraicScheme_subscheme_product_projective sage: AlgebraicScheme_subscheme_product_projective(P, [u*x^2 - v*y*x]) - Closed subscheme of Product of projective spaces P^1 x P^1 over Rational - Field defined by: + Closed subscheme of Product of projective spaces P^1 x P^1 + over Rational Field defined by: x^2*u - x*y*v """ diff --git a/src/sage/schemes/projective/projective_homset.py b/src/sage/schemes/projective/projective_homset.py index 04a906eb43a..c11736d7b25 100644 --- a/src/sage/schemes/projective/projective_homset.py +++ b/src/sage/schemes/projective/projective_homset.py @@ -583,9 +583,9 @@ class SchemeHomset_points_abelian_variety_field(SchemeHomset_points_projective_f sage: E = EllipticCurve('37a') # optional - sage.rings.number_field sage: X = E(K) # optional - sage.rings.number_field sage: X # optional - sage.rings.number_field - Abelian group of points on Elliptic Curve defined by - y^2 + y = x^3 + (-1)*x over Number Field in a with - defining polynomial x^2 + x - 24 + Abelian group of points on + Elliptic Curve defined by y^2 + y = x^3 + (-1)*x + over Number Field in a with defining polynomial x^2 + x - 24 sage: P = X([3,a]) # optional - sage.rings.number_field sage: P # optional - sage.rings.number_field (3 : a : 1) @@ -678,7 +678,7 @@ def base_extend(self, R): sage: E = EllipticCurve('37a') sage: Hom = E.point_homset(); Hom Abelian group of points on Elliptic Curve defined - by y^2 + y = x^3 - x over Rational Field + by y^2 + y = x^3 - x over Rational Field sage: Hom.base_ring() Rational Field sage: Hom.base_extend(QQ) diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 27bbfdc4c75..2514af41022 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -764,8 +764,8 @@ def scale_by(self, t): sage: H = Hom(P,P) sage: f = H([3/5*x^2, 6*y^2]) sage: f.scale_by(5/3*t); f - Scheme endomorphism of Projective Space of dimension 1 over Univariate - Polynomial Ring in t over Rational Field + Scheme endomorphism of Projective Space of dimension 1 over + Univariate Polynomial Ring in t over Rational Field Defn: Defined on coordinates by sending (x : y) to (t*x^2 : 10*t*y^2) :: @@ -776,7 +776,7 @@ def scale_by(self, t): sage: f = H([x^2, y^2, z^2]) # optional - sage.rings.finite_rings sage: f.scale_by(x - y); f # optional - sage.rings.finite_rings Scheme endomorphism of Closed subscheme of Projective Space of dimension 2 - over Finite Field of size 7 defined by: x^2 - y^2 + over Finite Field of size 7 defined by: x^2 - y^2 Defn: Defined on coordinates by sending (x : y : z) to (x*y^2 - y^3 : x*y^2 - y^3 : x*z^2 - y*z^2) """ @@ -841,7 +841,7 @@ def normalize_coordinates(self, **kwds): sage: f = H([x^3 + x*y^2, x*y^2, x*z^2]) # optional - sage.rings.finite_rings sage: f.normalize_coordinates(); f # optional - sage.rings.finite_rings Scheme endomorphism of Closed subscheme of Projective Space of dimension 2 - over Finite Field of size 7 defined by: x^2 - y^2 + over Finite Field of size 7 defined by: x^2 - y^2 Defn: Defined on coordinates by sending (x : y : z) to (2*y^2 : y^2 : z^2) :: @@ -851,8 +851,8 @@ def normalize_coordinates(self, **kwds): sage: H = End(P) sage: f = H([a*(x*z + y^2)*x^2, a*b*(x*z + y^2)*y^2, a*(x*z + y^2)*z^2]) sage: f.normalize_coordinates(); f - Scheme endomorphism of Projective Space of dimension 2 over Multivariate - Polynomial Ring in a, b over Rational Field + Scheme endomorphism of Projective Space of dimension 2 over + Multivariate Polynomial Ring in a, b over Rational Field Defn: Defined on coordinates by sending (x : y : z) to (x^2 : b*y^2 : z^2) :: @@ -862,7 +862,7 @@ def normalize_coordinates(self, **kwds): sage: f = DynamicalSystem([w*x^2 + (1/5*w)*y^2, w*y^2]) # optional - sage.rings.number_field sage: f.normalize_coordinates(); f # optional - sage.rings.number_field Dynamical System of Projective Space of dimension 1 over Number Field in w - with defining polynomial x^2 - 5 with w = 2.236067977499790? + with defining polynomial x^2 - 5 with w = 2.236067977499790? Defn: Defined on coordinates by sending (x : y) to (5*x^2 + y^2 : 5*y^2) :: @@ -876,8 +876,8 @@ def normalize_coordinates(self, **kwds): Dynamical System of Projective Space of dimension 1 over Number Field in b with defining polynomial t^3 - 11 Defn: Defined on coordinates by sending (x : y) to - (-100*x^2 + (140*b^2 + 140*b + 140)*x*y + (-77*b^2 - 567*b - 1057)*y^2 : - 100*y^2) + (-100*x^2 + (140*b^2 + 140*b + 140)*x*y + (-77*b^2 - 567*b - 1057)*y^2 + : 100*y^2) We can used ``ideal`` to scale with respect to a norm defined by an ideal:: @@ -897,7 +897,7 @@ def normalize_coordinates(self, **kwds): sage: f = H([(a+1)*x^3 + 2*x*y^2, 4*x*y^2, 8*x*z^2]) # optional - sage.rings.number_field sage: f.normalize_coordinates(ideal=A.prime_above(2)); f # optional - sage.rings.number_field Scheme endomorphism of Closed subscheme of Projective Space of dimension 2 over - Number Field in a with defining polynomial w^2 + 1 defined by: x^2 - y^2 + Number Field in a with defining polynomial w^2 + 1 defined by: x^2 - y^2 Defn: Defined on coordinates by sending (x : y : z) to ((-a + 2)*x*y^2 : (-2*a + 2)*x*y^2 : (-4*a + 4)*x*z^2) @@ -1495,7 +1495,7 @@ def wronskian_ideal(self): sage: f = H([x^2 - w*y^2, w*y^2]) # optional - sage.rings.number_field sage: f.wronskian_ideal() # optional - sage.rings.number_field Ideal ((4*w)*x*y) of Multivariate Polynomial Ring in x, y - over Number Field in w with defining polynomial x^2 + 11 + over Number Field in w with defining polynomial x^2 + 11 :: @@ -1504,8 +1504,8 @@ def wronskian_ideal(self): sage: H = Hom(P,P2) sage: f = H([x^2 - 2*y^2, y^2, x*y]) sage: f.wronskian_ideal() - Ideal (4*x*y, 2*x^2 + 4*y^2, -2*y^2) of Multivariate Polynomial Ring - in x, y over Rational Field + Ideal (4*x*y, 2*x^2 + 4*y^2, -2*y^2) of + Multivariate Polynomial Ring in x, y over Rational Field """ dom = self.domain() from sage.schemes.projective.projective_space import is_ProjectiveSpace @@ -1627,8 +1627,7 @@ def rational_preimages(self, Q, k=1): sage: f = H([x^2 - y^2, y^2]) sage: f.rational_preimages(P.subscheme([x])) Closed subscheme of Projective Space of dimension 1 over Rational Field - defined by: - x^2 - y^2 + defined by: x^2 - y^2 :: @@ -1702,8 +1701,8 @@ def _number_field_from_algebraics(self): sage: f = H([QQbar(3^(1/3))*x^2 + QQbar(sqrt(-2))*y^2, y^2]) # optional - sage.rings.number_field sage: f._number_field_from_algebraics() # optional - sage.rings.number_field Scheme endomorphism of Projective Space of dimension 1 over Number - Field in a with defining polynomial y^6 + 6*y^4 - 6*y^3 + 12*y^2 + 36*y + 17 - with a = 1.442249570307409? + 1.414213562373095?*I + Field in a with defining polynomial y^6 + 6*y^4 - 6*y^3 + 12*y^2 + 36*y + 17 + with a = 1.442249570307409? + 1.414213562373095?*I Defn: Defined on coordinates by sending (x : y) to ((-48/269*a^5 + 27/269*a^4 - 320/269*a^3 + 468/269*a^2 - 772/269*a - 1092/269)*x^2 + (48/269*a^5 - 27/269*a^4 + 320/269*a^3 - 468/269*a^2 @@ -1814,7 +1813,7 @@ def base_indeterminacy_locus(self): sage: f = H([x^2, y^2, z^2]) sage: f.base_indeterminacy_locus() Closed subscheme of Projective Space of dimension 2 over Rational Field - defined by: + defined by: x^2, y^2, z^2 @@ -1826,8 +1825,8 @@ def base_indeterminacy_locus(self): sage: H = Hom(P1, P2) sage: h = H([y^3*z^3, x^3*z^3, y^3*z^3, x^2*y^2*z^2]) sage: h.base_indeterminacy_locus() - Closed subscheme of Projective Space of dimension 2 over Real Field with - 53 bits of precision defined by: + Closed subscheme of Projective Space of dimension 2 over + Real Field with 53 bits of precision defined by: y^3*z^3, x^3*z^3, y^3*z^3, @@ -1840,7 +1839,7 @@ def base_indeterminacy_locus(self): sage: f = H([x*x^2,x*y^2,x*z^2]) sage: f.base_indeterminacy_locus() Closed subscheme of Projective Space of dimension 2 over Rational Field - defined by: + defined by: x^3, x*y^2, x*z^2 @@ -2025,7 +2024,7 @@ def reduce_base_field(self): sage: f = H([x^2 + (2*t^3 + 2*t^2 + 1)*y^2, y^2]) # optional - sage.rings.finite_rings sage: f.reduce_base_field() # optional - sage.rings.finite_rings Scheme endomorphism of Projective Space of dimension 1 - over Finite Field in t2 of size 3^2 + over Finite Field in t2 of size 3^2 Defn: Defined on coordinates by sending (x : y) to (x^2 + t2*y^2 : y^2) sage: f2 = H2([x^2 + 5*y^2, y^2, 2*x*y]) # optional - sage.rings.finite_rings sage: f2.reduce_base_field() # optional - sage.rings.finite_rings @@ -2635,10 +2634,10 @@ def graph(self): sage: mor = phi.homogenize(0) sage: G = mor.graph(); G Closed subscheme of Product of projective spaces P^1 x P^1 - over Rational Field defined by: x1^2*x2 - x0^2*x3 + over Rational Field defined by: x1^2*x2 - x0^2*x3 sage: G.affine_patch([0, 0]) Closed subscheme of Affine Space of dimension 2 - over Rational Field defined by: x0^2 - x1 + over Rational Field defined by: x0^2 - x1 """ X = self.domain() Y = self.codomain() diff --git a/src/sage/schemes/projective/projective_point.py b/src/sage/schemes/projective/projective_point.py index 38da1544b2e..8be2127e724 100644 --- a/src/sage/schemes/projective/projective_point.py +++ b/src/sage/schemes/projective/projective_point.py @@ -1218,7 +1218,7 @@ def _number_field_from_algebraics(self): (1/2*a^3 + a^2 - 1/2*a : 1) sage: S.codomain() # optional - sage.rings.number_field sage.symbolic Projective Space of dimension 1 over Number Field in a with defining - polynomial y^4 + 1 with a = 0.7071067811865475? + 0.7071067811865475?*I + polynomial y^4 + 1 with a = 0.7071067811865475? + 0.7071067811865475?*I The following was fixed in :trac:`23808`:: diff --git a/src/sage/schemes/projective/projective_space.py b/src/sage/schemes/projective/projective_space.py index 1ff2372957c..046d3905d8a 100644 --- a/src/sage/schemes/projective/projective_space.py +++ b/src/sage/schemes/projective/projective_space.py @@ -2044,8 +2044,8 @@ def subscheme_from_Chow_form(self, Ch, dim): sage: Ch = X.Chow_form(); Ch # optional - sage.rings.finite_rings t0^2 - 2*t0*t3 + t3^2 - t2*t4 - t4*t5 sage: Y = P.subscheme_from_Chow_form(Ch, 1); Y # optional - sage.rings.finite_rings - Closed subscheme of Projective Space of dimension 3 over Finite Field of - size 7 defined by: + Closed subscheme of Projective Space of dimension 3 + over Finite Field of size 7 defined by: x1*x2 + x3^2, -x0*x2 + x2^2, -x0*x1 - x1*x2 - 2*x3^2, @@ -2057,7 +2057,7 @@ def subscheme_from_Chow_form(self, Ch, dim): sage: I = Y.defining_ideal() # optional - sage.rings.finite_rings sage: I.saturation(I.ring().ideal(list(I.ring().gens())))[0] # optional - sage.rings.finite_rings Ideal (x0 - x2, x1*x2 + x3^2) of Multivariate Polynomial Ring - in x0, x1, x2, x3 over Finite Field of size 7 + in x0, x1, x2, x3 over Finite Field of size 7 """ if not Ch.is_homogeneous(): raise ValueError("Chow form must be a homogeneous polynomial") @@ -2135,8 +2135,9 @@ def line_through(self, p, q): sage: p1 = P3(1, 2, 3, 4) sage: p2 = P3(4, 3, 2, 1) sage: P3.line_through(p1, p2) - Projective Curve over Rational Field defined by -5/4*x0 + 5/2*x1 - 5/4*x2, - -5/2*x0 + 15/4*x1 - 5/4*x3, -5/4*x0 + 15/4*x2 - 5/2*x3, -5/4*x1 + 5/2*x2 - 5/4*x3 + Projective Curve over Rational Field defined by + -5/4*x0 + 5/2*x1 - 5/4*x2, -5/2*x0 + 15/4*x1 - 5/4*x3, + -5/4*x0 + 15/4*x2 - 5/2*x3, -5/4*x1 + 5/2*x2 - 5/4*x3 sage: p3 = P3(2,4,6,8) sage: P3.line_through(p1, p3) Traceback (most recent call last): @@ -2207,18 +2208,18 @@ def __iter__(self): sage: PP = ProjectiveSpace(2, FF) # optional - sage.rings.finite_rings sage: [ x for x in PP ] # optional - sage.rings.finite_rings [(0 : 0 : 1), - (0 : 1 : 1), - (0 : 2 : 1), - (1 : 0 : 1), - (1 : 1 : 1), - (1 : 2 : 1), - (2 : 0 : 1), - (2 : 1 : 1), - (2 : 2 : 1), - (0 : 1 : 0), - (1 : 1 : 0), - (2 : 1 : 0), - (1 : 0 : 0)] + (0 : 1 : 1), + (0 : 2 : 1), + (1 : 0 : 1), + (1 : 1 : 1), + (1 : 2 : 1), + (2 : 0 : 1), + (2 : 1 : 1), + (2 : 2 : 1), + (0 : 1 : 0), + (1 : 1 : 0), + (2 : 1 : 0), + (1 : 0 : 0)] AUTHORS: diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index 34666453ec8..e6caf19ba74 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -149,14 +149,12 @@ def _morphism(self, *args, **kwds): Scheme morphism: From: Projective Space of dimension 1 over Rational Field To: Projective Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x^2 : x*y : y^2) + Defn: Defined on coordinates by sending (x : y) to (x^2 : x*y : y^2) sage: P1._morphism(H12, [x^2, x*y, y^2]) Scheme morphism: From: Projective Space of dimension 1 over Rational Field To: Projective Space of dimension 2 over Rational Field - Defn: Defined on coordinates by sending (x : y) to - (x^2 : x*y : y^2) + Defn: Defined on coordinates by sending (x : y) to (x^2 : x*y : y^2) """ return self.ambient_space()._morphism(*args, **kwds) @@ -549,7 +547,7 @@ def nth_iterate(self, f, n): sage: f = DynamicalSystem_projective([y^2, z^2, x^2, w^2]) sage: f.nth_iterate(P.subscheme([x - w, y - z]), 3) Closed subscheme of Projective Space of dimension 3 over Rational Field - defined by: + defined by: y - z, x - w @@ -619,7 +617,7 @@ def _forward_image(self, f, check=True): sage: X = PS.subscheme(y - 2*z) sage: X._forward_image(f) Closed subscheme of Projective Space of dimension 2 over Rational Field - defined by: + defined by: y - 2*z :: @@ -631,7 +629,7 @@ def _forward_image(self, f, check=True): sage: X = PS.subscheme([z^2 + y*w, x - w]) sage: f(X) Closed subscheme of Projective Space of dimension 3 over Integer Ring - defined by: + defined by: y - z, x*z - w^2 @@ -643,7 +641,7 @@ def _forward_image(self, f, check=True): sage: X = PS.subscheme([z - 2*w]) sage: f(X) Closed subscheme of Projective Space of dimension 3 over Complex Field - with 53 bits of precision defined by: + with 53 bits of precision defined by: y + z + (-4.00000000000000)*w :: @@ -654,7 +652,7 @@ def _forward_image(self, f, check=True): sage: f = H([x^2 + 2*y*z, t^2*y^2, z^2]) sage: f([t^2*y - z]) Closed subscheme of Projective Space of dimension 2 over Fraction Field - of Univariate Polynomial Ring in t over Rational Field defined by: + of Univariate Polynomial Ring in t over Rational Field defined by: y - 1/(t^2)*z :: @@ -666,7 +664,7 @@ def _forward_image(self, f, check=True): sage: X = PS.subscheme([2*x - y, z]) # optional - sage.rings.padics sage: f(X) # optional - sage.rings.padics Closed subscheme of Projective Space of dimension 2 over 3-adic Field - with capped relative precision 20 defined by: + with capped relative precision 20 defined by: z, x + (1 + 3^2 + 3^4 + 3^6 + 3^8 + 3^10 + 3^12 + 3^14 + 3^16 + 3^18 + O(3^20))*y @@ -679,8 +677,8 @@ def _forward_image(self, f, check=True): sage: X = P.subscheme(x*z) sage: X._forward_image(f) Closed subscheme of Projective Space of dimension 2 over Fraction Field - of Multivariate Polynomial Ring in y0, y1, y2, y3 over Rational Field - defined by: + of Multivariate Polynomial Ring in y0, y1, y2, y3 over Rational Field + defined by: x*z + (-y1)*z^2 :: @@ -692,7 +690,7 @@ def _forward_image(self, f, check=True): sage: X = P2.subscheme([]) sage: f(X) Closed subscheme of Projective Space of dimension 5 over Rational Field - defined by: + defined by: -z4^2 + z3*z5, -z2*z4 + z1*z5, -z2*z3 + z1*z4, @@ -709,7 +707,7 @@ def _forward_image(self, f, check=True): sage: f = H([x^2, y^2, z^2, x*y]) sage: f(X) Closed subscheme of Projective Space of dimension 3 over Rational Field - defined by: + defined by: w - t, v - t, u - t @@ -805,7 +803,7 @@ def preimage(self, f, k=1, check=True): sage: X = PS.subscheme([x - y]) sage: X.preimage(f) Closed subscheme of Projective Space of dimension 2 over Integer Ring - defined by: + defined by: -x^2 + y^2 :: @@ -815,7 +813,7 @@ def preimage(self, f, k=1, check=True): sage: f = H([x^2 - y^2, y^2, z^2, w^2, t^2 + w^2]) sage: f.rational_preimages(P.subscheme([x - z, t^2, w - t])) Closed subscheme of Projective Space of dimension 4 over Rational Field - defined by: + defined by: x^2 - y^2 - z^2, w^4 + 2*w^2*t^2 + t^4, -t^2 @@ -829,7 +827,7 @@ def preimage(self, f, k=1, check=True): sage: f = H([x^2, y^2, x^2 + y^2, x*y]) sage: X.preimage(f) Closed subscheme of Projective Space of dimension 1 over Rational Field - defined by: + defined by: x^2 - y^2, x^2 - y^2, x^2 + x*y @@ -877,7 +875,7 @@ def preimage(self, f, k=1, check=True): sage: f = H([x^2, y^2, z^2]) sage: Y.preimage(f, k=2) Closed subscheme of Projective Space of dimension 2 over Rational Field - defined by: + defined by: x^4 - y^4 """ dom = f.domain() @@ -923,7 +921,8 @@ def dual(self): sage: I = R.ideal(x^2 + y^2 + z^2) sage: X = P.subscheme(I) sage: X.dual() - Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: + Closed subscheme of Projective Space of dimension 2 over Rational Field + defined by: y0^2 + y1^2 + y2^2 The dual of the twisted cubic curve in projective 3-space is a singular @@ -937,7 +936,7 @@ def dual(self): sage: X = P.subscheme(I) sage: X.dual() Closed subscheme of Projective Space of dimension 3 over - Rational Field defined by: + Rational Field defined by: y2^2 - y1*y3, y1*y2 - y0*y3, y1^2 - y0*y2 @@ -956,7 +955,7 @@ def dual(self): sage: X = P.subscheme(R.ideal(a*a + 2*b*b + 3*c*c)) # optional - sage.rings.finite_rings sage: X.dual() # optional - sage.rings.finite_rings Closed subscheme of Projective Space of dimension 2 over - Finite Field of size 61 defined by: + Finite Field of size 61 defined by: y0^2 - 30*y1^2 - 20*y2^2 TESTS:: @@ -1090,9 +1089,8 @@ def intersection_multiplicity(self, X, P): Traceback (most recent call last): ... TypeError: the intersection of this subscheme and (=Closed subscheme of Affine Space of dimension 3 - over Rational Field defined by: - z^2 + w^2 - 2*y, - y^2 - w^2) must be proper and finite + over Rational Field defined by: z^2 + w^2 - 2*y, y^2 - w^2) + must be proper and finite """ try: self.ambient_space()(P) @@ -1317,7 +1315,7 @@ def Chow_form(self): t2^3 + 2*t2^2*t3 + t2*t3^2 - 3*t1*t2*t4 - t1*t3*t4 + t0*t4^2 + t1^2*t5 sage: Y = P.subscheme_from_Chow_form(Ch, 1); Y Closed subscheme of Projective Space of dimension 3 over Rational Field - defined by: + defined by: x2^2*x3 - x1*x3^2, -x2^3 + x0*x3^2, -x2^2*x3 + x1*x3^2, x1*x2*x3 - x0*x3^2, 3*x1*x2^2 - 3*x0*x2*x3, -2*x1^2*x3 + 2*x0*x2*x3, @@ -1328,8 +1326,8 @@ def Chow_form(self): -x1^3 + x0*x1*x2, x0*x1^2 - x0^2*x2 sage: I = Y.defining_ideal() sage: I.saturation(I.ring().ideal(list(I.ring().gens())))[0] - Ideal (x2^2 - x1*x3, x1*x2 - x0*x3, x1^2 - x0*x2) of Multivariate - Polynomial Ring in x0, x1, x2, x3 over Rational Field + Ideal (x2^2 - x1*x3, x1*x2 - x0*x3, x1^2 - x0*x2) + of Multivariate Polynomial Ring in x0, x1, x2, x3 over Rational Field """ I = self.defining_ideal() P = self.ambient_space() diff --git a/src/sage/schemes/toric/fano_variety.py b/src/sage/schemes/toric/fano_variety.py index 7e0fb7b8c49..c7d05455d97 100644 --- a/src/sage/schemes/toric/fano_variety.py +++ b/src/sage/schemes/toric/fano_variety.py @@ -752,7 +752,7 @@ def anticanonical_hypersurface(self, **kwds): sage: P2.anticanonical_hypersurface(monomial_points="all") Closed subscheme of 2-d CPR-Fano toric variety - covered by 3 affine patches defined by: + covered by 3 affine patches defined by: a0*z0^3 + a9*z0^2*z1 + a7*z0*z1^2 + a1*z1^3 + a8*z0^2*z2 + a6*z0*z1*z2 + a4*z1^2*z2 + a5*z0*z2^2 + a3*z1*z2^2 + a2*z2^3 @@ -761,7 +761,7 @@ def anticanonical_hypersurface(self, **kwds): sage: P2.anticanonical_hypersurface(monomial_points="simplified") Closed subscheme of 2-d CPR-Fano toric variety - covered by 3 affine patches defined by: + covered by 3 affine patches defined by: a0*z0^3 + a1*z1^3 + a6*z0*z1*z2 + a2*z2^3 The mirror family to these hypersurfaces lives inside the Fano toric @@ -772,7 +772,7 @@ def anticanonical_hypersurface(self, **kwds): ....: coordinate_points="all") sage: FTV.anticanonical_hypersurface(monomial_points="simplified") Closed subscheme of 2-d CPR-Fano toric variety - covered by 9 affine patches defined by: + covered by 9 affine patches defined by: a2*z2^3*z3^2*z4*z5^2*z8 + a1*z1^3*z3*z4^2*z7^2*z9 + a3*z0*z1*z2*z3*z4*z5*z7*z8*z9 + a0*z0^3*z5*z7*z8^2*z9^2 @@ -785,7 +785,7 @@ def anticanonical_hypersurface(self, **kwds): ....: coordinate_points="all but facets") sage: FTV.anticanonical_hypersurface(monomial_points="simplified") Closed subscheme of 2-d CPR-Fano toric variety - covered by 3 affine patches defined by: + covered by 3 affine patches defined by: a0*z0^3 + a1*z1^3 + a3*z0*z1*z2 + a2*z2^3 This looks very similar to our second anticanonical @@ -798,14 +798,14 @@ def anticanonical_hypersurface(self, **kwds): sage: FTV.anticanonical_hypersurface(coefficient_names="a b c d") Closed subscheme of 2-d CPR-Fano toric variety - covered by 3 affine patches defined by: + covered by 3 affine patches defined by: a*z0^3 + b*z1^3 + d*z0*z1*z2 + c*z2^3 or give concrete coefficients :: sage: FTV.anticanonical_hypersurface(coefficients=[1, 2, 3, 4]) Closed subscheme of 2-d CPR-Fano toric variety - covered by 3 affine patches defined by: + covered by 3 affine patches defined by: z0^3 + 2*z1^3 + 4*z0*z1*z2 + 3*z2^3 or even mix numerical coefficients with some expressions :: @@ -814,12 +814,12 @@ def anticanonical_hypersurface(self, **kwds): ....: coefficients=[0, "t", "1/t", "psi/(psi^2 + phi)"]) sage: H Closed subscheme of 2-d CPR-Fano toric variety - covered by 3 affine patches defined by: + covered by 3 affine patches defined by: t*z1^3 + psi/(phi + psi^2)*z0*z1*z2 + 1/t*z2^3 sage: R = H.ambient_space().base_ring() sage: R Fraction Field of - Multivariate Polynomial Ring in phi, psi, t over Rational Field + Multivariate Polynomial Ring in phi, psi, t over Rational Field """ # The example above is also copied to the tutorial section in the # main documentation of the module. @@ -863,7 +863,7 @@ def change_ring(self, F): Traceback (most recent call last): ... TypeError: need a field to construct a Fano toric variety! - Got Multivariate Polynomial Ring in a0, a1 over Rational Field + Got Multivariate Polynomial Ring in a0, a1 over Rational Field """ if self.base_ring() == F: return self @@ -1052,7 +1052,7 @@ def nef_complete_intersection(self, nef_partition, **kwds): sage: X = CPRFanoToricVariety(Delta_polar=p) sage: X.nef_complete_intersection(np) Closed subscheme of 3-d CPR-Fano toric variety - covered by 10 affine patches defined by: + covered by 10 affine patches defined by: a0*z1*z4^2*z5^2*z7^3 + a2*z2*z4*z5*z6*z7^2*z8^2 + a3*z2*z3*z4*z7*z8 + a1*z0*z2, b3*z1*z4*z5^2*z6^2*z7^2*z8^2 + b0*z2*z5*z6^3*z7*z8^4 @@ -1063,7 +1063,7 @@ def nef_complete_intersection(self, nef_partition, **kwds): sage: X.nef_complete_intersection(np, monomial_points="vertices") Closed subscheme of 3-d CPR-Fano toric variety - covered by 10 affine patches defined by: + covered by 10 affine patches defined by: a0*z1*z4^2*z5^2*z7^3 + a2*z2*z4*z5*z6*z7^2*z8^2 + a3*z2*z3*z4*z7*z8 + a1*z0*z2, b3*z1*z4*z5^2*z6^2*z7^2*z8^2 + b0*z2*z5*z6^3*z7*z8^4 @@ -1076,7 +1076,7 @@ def nef_complete_intersection(self, nef_partition, **kwds): ....: monomial_points="vertices", ....: coefficients=[("a", "a^2", "a/e", "c_i"), list(range(1,6))]) Closed subscheme of 3-d CPR-Fano toric variety - covered by 10 affine patches defined by: + covered by 10 affine patches defined by: a*z1*z4^2*z5^2*z7^3 + a/e*z2*z4*z5*z6*z7^2*z8^2 + (c_i)*z2*z3*z4*z7*z8 + (a^2)*z0*z2, 4*z1*z4*z5^2*z6^2*z7^2*z8^2 + z2*z5*z6^3*z7*z8^4 @@ -1089,7 +1089,7 @@ def nef_complete_intersection(self, nef_partition, **kwds): ....: coordinate_points="all") sage: X.nef_complete_intersection(np) Closed subscheme of 3-d CPR-Fano toric variety - covered by 22 affine patches defined by: + covered by 22 affine patches defined by: a2*z2*z4*z5*z6*z7^2*z8^2*z9^2*z10^2*z11*z12*z13 + a0*z1*z4^2*z5^2*z7^3*z9*z10^2*z12*z13 + a3*z2*z3*z4*z7*z8*z9*z10*z11*z12 + a1*z0*z2, @@ -1279,7 +1279,7 @@ class AnticanonicalHypersurface(AlgebraicScheme_subscheme_toric): sage: import sage.schemes.toric.fano_variety as ftv sage: ftv.AnticanonicalHypersurface(P1xP1) Closed subscheme of 2-d CPR-Fano toric variety - covered by 4 affine patches defined by: + covered by 4 affine patches defined by: a0*s^2*x^2 + a3*t^2*x^2 + a6*s*t*x*y + a1*s^2*y^2 + a2*t^2*y^2 See :meth:`~CPRFanoToricVariety_field.anticanonical_hypersurface()` for a @@ -1297,7 +1297,7 @@ def __init__(self, P_Delta, monomial_points=None, coefficient_names=None, sage: import sage.schemes.toric.fano_variety as ftv sage: ftv.AnticanonicalHypersurface(P1xP1) Closed subscheme of 2-d CPR-Fano toric variety - covered by 4 affine patches defined by: + covered by 4 affine patches defined by: a0*s^2*x^2 + a3*t^2*x^2 + a6*s*t*x*y + a1*s^2*y^2 + a2*t^2*y^2 Check that finite fields are handled correctly :trac:`14899`:: @@ -1307,7 +1307,7 @@ def __init__(self, P_Delta, monomial_points=None, coefficient_names=None, sage: X.anticanonical_hypersurface(monomial_points="all", # optional - sage.rings.finite_rings ....: coefficients=[1]*X.Delta().npoints()) Closed subscheme of 2-d CPR-Fano toric variety - covered by 4 affine patches defined by: + covered by 4 affine patches defined by: s^2*x^2 + s*t*x^2 + t^2*x^2 + s^2*x*y + s*t*x*y + t^2*x*y + s^2*y^2 + s*t*y^2 + t^2*y^2 """ @@ -1395,7 +1395,7 @@ class NefCompleteIntersection(AlgebraicScheme_subscheme_toric): sage: X = CPRFanoToricVariety(Delta_polar=o) sage: X.nef_complete_intersection(np) Closed subscheme of 3-d CPR-Fano toric variety - covered by 8 affine patches defined by: + covered by 8 affine patches defined by: a2*z0^2*z1 + a5*z0*z1*z3 + a1*z1*z3^2 + a3*z0^2*z4 + a4*z0*z3*z4 + a0*z3^2*z4, b1*z1*z2^2 + b2*z2^2*z4 + b5*z1*z2*z5 + b4*z2*z4*z5 + b3*z1*z5^2 + b0*z4*z5^2 @@ -1419,7 +1419,7 @@ def __init__(self, P_Delta, nef_partition, sage: from sage.schemes.toric.fano_variety import * sage: NefCompleteIntersection(X, np) Closed subscheme of 3-d CPR-Fano toric variety - covered by 8 affine patches defined by: + covered by 8 affine patches defined by: a2*z0^2*z1 + a5*z0*z1*z3 + a1*z1*z3^2 + a3*z0^2*z4 + a4*z0*z3*z4 + a0*z3^2*z4, b1*z1*z2^2 + b2*z2^2*z4 + b5*z1*z2*z5 @@ -1512,7 +1512,7 @@ def cohomology_class(self): sage: X = CPRFanoToricVariety(Delta_polar=o) sage: CI = X.nef_complete_intersection(np); CI Closed subscheme of 3-d CPR-Fano toric variety - covered by 8 affine patches defined by: + covered by 8 affine patches defined by: a2*z0^2*z1 + a5*z0*z1*z3 + a1*z1*z3^2 + a3*z0^2*z4 + a4*z0*z3*z4 + a0*z3^2*z4, b1*z1*z2^2 + b2*z2^2*z4 + b5*z1*z2*z5 + b4*z2*z4*z5 + b3*z1*z5^2 + b0*z4*z5^2 sage: CI.cohomology_class() @@ -1538,7 +1538,7 @@ def nef_partition(self): sage: X = CPRFanoToricVariety(Delta_polar=o) sage: CI = X.nef_complete_intersection(np); CI Closed subscheme of 3-d CPR-Fano toric variety - covered by 8 affine patches defined by: + covered by 8 affine patches defined by: a2*z0^2*z1 + a5*z0*z1*z3 + a1*z1*z3^2 + a3*z0^2*z4 + a4*z0*z3*z4 + a0*z3^2*z4, b1*z1*z2^2 + b2*z2^2*z4 + b5*z1*z2*z5 + b4*z2*z4*z5 + b3*z1*z5^2 + b0*z4*z5^2 sage: CI.nef_partition() diff --git a/src/sage/schemes/toric/ideal.py b/src/sage/schemes/toric/ideal.py index 28613a5a7b0..c598d05f3ed 100644 --- a/src/sage/schemes/toric/ideal.py +++ b/src/sage/schemes/toric/ideal.py @@ -223,7 +223,7 @@ def __init__(self, A, sage: ToricIdeal(A, names='x', base_ring=FractionField(QQ['t'])) Ideal (-x1^2 + x0*x2) of Multivariate Polynomial Ring in x0, x1, x2 over - Fraction Field of Univariate Polynomial Ring in t over Rational Field + Fraction Field of Univariate Polynomial Ring in t over Rational Field """ self._A = matrix(ZZ, A) if polynomial_ring: @@ -273,8 +273,7 @@ def ker(self): sage: IA = ToricIdeal(A) sage: IA.ker() Free module of degree 3 and rank 1 over Integer Ring - User basis matrix: - [-1 2 -1] + User basis matrix: [-1 2 -1] """ if '_ker' in self.__dict__: @@ -352,8 +351,7 @@ def _naive_ideal(self, ring): sage: IA = ToricIdeal(A) sage: IA.ker() Free module of degree 3 and rank 1 over Integer Ring - User basis matrix: - [-1 2 -1] + User basis matrix: [-1 2 -1] sage: IA._naive_ideal(IA.ring()) Ideal (z1^2 - z0*z2) of Multivariate Polynomial Ring in z0, z1, z2 over Rational Field """ @@ -394,7 +392,7 @@ def _ideal_quotient_by_variable(self, ring, ideal, n): sage: IA._ideal_quotient_by_variable(R, J0, 0) Ideal (z2*z3^2 - z0*z1*z4, z1*z3 - z0*z2, z2^2*z3 - z1^2*z4, z1^3*z4 - z0*z2^3) - of Multivariate Polynomial Ring in z0, z1, z2, z3, z4 over Rational Field + of Multivariate Polynomial Ring in z0, z1, z2, z3, z4 over Rational Field """ N = self.nvariables() y = list(ring.gens()) @@ -438,7 +436,7 @@ def _ideal_HostenSturmfels(self): sage: A = matrix([[3,2,1,0], [0,1,2,3]]) sage: IA = ToricIdeal(A); IA Ideal (-z1*z2 + z0*z3, -z1^2 + z0*z2, z2^2 - z1*z3) - of Multivariate Polynomial Ring in z0, z1, z2, z3 over Rational Field + of Multivariate Polynomial Ring in z0, z1, z2, z3 over Rational Field sage: R = IA.ring() sage: IA == IA._ideal_HostenSturmfels() True diff --git a/src/sage/schemes/toric/variety.py b/src/sage/schemes/toric/variety.py index f794a3e7c16..c594610f15d 100644 --- a/src/sage/schemes/toric/variety.py +++ b/src/sage/schemes/toric/variety.py @@ -1817,8 +1817,8 @@ def subscheme(self, polynomials): sage: X.defining_polynomials() (x*s + y*t, x^3 + y^3) sage: X.defining_ideal() - Ideal (x*s + y*t, x^3 + y^3) of Multivariate Polynomial Ring in x, y, s, t - over Rational Field + Ideal (x*s + y*t, x^3 + y^3) of + Multivariate Polynomial Ring in x, y, s, t over Rational Field sage: X.base_ring() Rational Field sage: X.base_scheme() @@ -1916,7 +1916,7 @@ def cohomology_ring(self): Rational cohomology ring of a 2-d CPR-Fano toric variety covered by 6 affine patches sage: X.cohomology_ring().defining_ideal() Ideal (-u - y + z + w, x - y - v + w, x*y, x*v, x*z, u*v, u*z, u*w, y*z, y*w, v*w) - of Multivariate Polynomial Ring in x, u, y, v, z, w over Rational Field + of Multivariate Polynomial Ring in x, u, y, v, z, w over Rational Field sage: X.cohomology_ring().defining_ideal().ring() Multivariate Polynomial Ring in x, u, y, v, z, w over Rational Field sage: X.variable_names() From ad355772ae27143b6e19c1119bcd9c1f385dd8d8 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 29 Mar 2023 18:47:48 -0700 Subject: [PATCH 103/135] src/sage/schemes/berkovich/berkovich_space.py: Fix up # optional --- src/sage/schemes/berkovich/berkovich_space.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/schemes/berkovich/berkovich_space.py b/src/sage/schemes/berkovich/berkovich_space.py index 1a466ad67a7..5a73c368c7d 100644 --- a/src/sage/schemes/berkovich/berkovich_space.py +++ b/src/sage/schemes/berkovich/berkovich_space.py @@ -355,8 +355,8 @@ class Berkovich_Cp_Affine(Berkovich_Cp): extensions of `\QQ_p`:: sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics - sage: A. = Qp(3).extension(x^3 - 3) # optional - sage.rings.number_field - sage: B(a) # optional - sage.rings.number_field sage.rings.padics + sage: A. = Qp(3).extension(x^3 - 3) # optional - sage.rings.padics + sage: B(a) # optional - sage.rings.padics Type I point centered at a + O(a^61) For exact computation, a number field can be used:: From 25645101268c20b596314a410317ab3d492b9e02 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 29 Mar 2023 21:31:27 -0700 Subject: [PATCH 104/135] src/sage/schemes/elliptic_curves/hom_frobenius.py: Mark sage.doctest: optional - sage.rings.finite_rings --- src/sage/schemes/elliptic_curves/hom_frobenius.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/hom_frobenius.py b/src/sage/schemes/elliptic_curves/hom_frobenius.py index 66120753cdf..38f22f1fcdf 100644 --- a/src/sage/schemes/elliptic_curves/hom_frobenius.py +++ b/src/sage/schemes/elliptic_curves/hom_frobenius.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.rings.finite_rings r""" Frobenius isogenies of elliptic curves @@ -17,18 +18,22 @@ sage: E = EllipticCurve([z5,1]) sage: pi = EllipticCurveHom_frobenius(E); pi Frobenius isogeny of degree 17: - From: Elliptic Curve defined by y^2 = x^3 + z5*x + 1 over Finite Field in z5 of size 17^5 - To: Elliptic Curve defined by y^2 = x^3 + (9*z5^4+7*z5^3+10*z5^2+z5+14)*x + 1 over Finite Field in z5 of size 17^5 + From: Elliptic Curve defined by y^2 = x^3 + z5*x + 1 + over Finite Field in z5 of size 17^5 + To: Elliptic Curve defined by y^2 = x^3 + (9*z5^4+7*z5^3+10*z5^2+z5+14)*x + 1 + over Finite Field in z5 of size 17^5 By passing `n`, we can also construct higher-power Frobenius maps, such as the Frobenius *endo*\morphism:: sage: z5, = GF(7^5).gens() sage: E = EllipticCurve([z5,1]) - sage: pi = EllipticCurveHom_frobenius(E,5); pi + sage: pi = EllipticCurveHom_frobenius(E, 5); pi Frobenius endomorphism of degree 16807 = 7^5: - From: Elliptic Curve defined by y^2 = x^3 + z5*x + 1 over Finite Field in z5 of size 7^5 - To: Elliptic Curve defined by y^2 = x^3 + z5*x + 1 over Finite Field in z5 of size 7^5 + From: Elliptic Curve defined by y^2 = x^3 + z5*x + 1 + over Finite Field in z5 of size 7^5 + To: Elliptic Curve defined by y^2 = x^3 + z5*x + 1 + over Finite Field in z5 of size 7^5 The usual :class:`EllipticCurveHom` methods are supported:: From fcdd127feadf09ec2796d9795c44e1fe644297b2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 29 Mar 2023 21:33:43 -0700 Subject: [PATCH 105/135] src/sage/schemes/elliptic_curves/isogeny_class.py: Mark sage.doctest: optional - sage.rings.finite_rings --- src/sage/schemes/elliptic_curves/isogeny_class.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/isogeny_class.py b/src/sage/schemes/elliptic_curves/isogeny_class.py index 4e2c6ac2dc9..43495d65293 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_class.py +++ b/src/sage/schemes/elliptic_curves/isogeny_class.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: optional - sage.rings.number_field r""" Isogeny class of elliptic curves over number fields @@ -400,7 +400,9 @@ def graph(self): sage: isocls = EllipticCurve('15a3').isogeny_class() sage: G = isocls.graph() sage: sorted(G._pos.items()) - [(1, [-0.8660254, 0.5]), (2, [-0.8660254, 1.5]), (3, [-1.7320508, 0]), (4, [0, 0]), (5, [0, -1]), (6, [0.8660254, 0.5]), (7, [0.8660254, 1.5]), (8, [1.7320508, 0])] + [(1, [-0.8660254, 0.5]), (2, [-0.8660254, 1.5]), (3, [-1.7320508, 0]), + (4, [0, 0]), (5, [0, -1]), (6, [0.8660254, 0.5]), + (7, [0.8660254, 1.5]), (8, [1.7320508, 0])] """ from sage.graphs.graph import Graph @@ -774,7 +776,7 @@ def _compute(self, verbose=False): Check that :trac:`19030` is fixed (codomains of reverse isogenies were wrong):: - sage: K. = NumberField(x^2+1) + sage: K. = NumberField(x^2 + 1) sage: E = EllipticCurve([1, i + 1, 1, -72*i + 8, 95*i + 146]) sage: C = E.isogeny_class() sage: curves = C.curves From 7f9cb68175a982797cbc3c86f226a228ed919b3a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 29 Mar 2023 22:53:51 -0700 Subject: [PATCH 106/135] src/sage/schemes/elliptic_curves/isogeny_small_degree.py: Add # optional, reformat doctests --- .../elliptic_curves/isogeny_small_degree.py | 953 ++++++++++++------ 1 file changed, 636 insertions(+), 317 deletions(-) diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py index 1588770b73b..8c4fd1e3455 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py +++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py @@ -79,7 +79,9 @@ def Fricke_polynomial(l): sage: Fricke_polynomial(7) t^8 + 28*t^7 + 322*t^6 + 1904*t^5 + 5915*t^4 + 8624*t^3 + 4018*t^2 + 748*t + 49 sage: Fricke_polynomial(13) - t^14 + 26*t^13 + 325*t^12 + 2548*t^11 + 13832*t^10 + 54340*t^9 + 157118*t^8 + 333580*t^7 + 509366*t^6 + 534820*t^5 + 354536*t^4 + 124852*t^3 + 15145*t^2 + 746*t + 13 + t^14 + 26*t^13 + 325*t^12 + 2548*t^11 + 13832*t^10 + 54340*t^9 + 157118*t^8 + + 333580*t^7 + 509366*t^6 + 534820*t^5 + 354536*t^4 + 124852*t^3 + + 15145*t^2 + 746*t + 13 """ t = PolynomialRing(ZZ, 't').gen() if l == 2: @@ -129,7 +131,9 @@ def Fricke_module(l): sage: Fricke_module(7) (t^8 + 28*t^7 + 322*t^6 + 1904*t^5 + 5915*t^4 + 8624*t^3 + 4018*t^2 + 748*t + 49)/t sage: Fricke_module(13) - (t^14 + 26*t^13 + 325*t^12 + 2548*t^11 + 13832*t^10 + 54340*t^9 + 157118*t^8 + 333580*t^7 + 509366*t^6 + 534820*t^5 + 354536*t^4 + 124852*t^3 + 15145*t^2 + 746*t + 13)/t + (t^14 + 26*t^13 + 325*t^12 + 2548*t^11 + 13832*t^10 + + 54340*t^9 + 157118*t^8 + 333580*t^7 + 509366*t^6 + + 534820*t^5 + 354536*t^4 + 124852*t^3 + 15145*t^2 + 746*t + 13)/t """ t = PolynomialRing(QQ, 't').gen() return Fricke_polynomial(l) / t @@ -269,8 +273,10 @@ def isogenies_prime_degree_genus_0(E, l=None, minimal_models=True): sage: E = EllipticCurve('1450c1') sage: isogenies_prime_degree_genus_0(E) [Isogeny of degree 3 - from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 + 300*x - 1000 over Rational Field - to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 5950*x - 182250 over Rational Field] + from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 + 300*x - 1000 + over Rational Field + to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 5950*x - 182250 + over Rational Field] sage: E = EllipticCurve('50a1') sage: isogenies_prime_degree_genus_0(E) @@ -595,26 +601,34 @@ def isogenies_sporadic_Q(E, l=None, minimal_models=True): sage: E = EllipticCurve('121a1') sage: isogenies_sporadic_Q(E, 11) [Isogeny of degree 11 - from Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 30*x - 76 over Rational Field - to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 305*x + 7888 over Rational Field] + from Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 30*x - 76 + over Rational Field + to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 305*x + 7888 + over Rational Field] sage: isogenies_sporadic_Q(E, 13) [] sage: isogenies_sporadic_Q(E, 17) [] sage: isogenies_sporadic_Q(E) [Isogeny of degree 11 - from Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 30*x - 76 over Rational Field - to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 305*x + 7888 over Rational Field] + from Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 30*x - 76 + over Rational Field + to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 305*x + 7888 + over Rational Field] sage: E = EllipticCurve([1, 1, 0, -660, -7600]) sage: isogenies_sporadic_Q(E, 17) [Isogeny of degree 17 - from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 660*x - 7600 over Rational Field - to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 878710*x + 316677750 over Rational Field] + from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 660*x - 7600 + over Rational Field + to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 878710*x + 316677750 + over Rational Field] sage: isogenies_sporadic_Q(E) [Isogeny of degree 17 - from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 660*x - 7600 over Rational Field - to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 878710*x + 316677750 over Rational Field] + from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 660*x - 7600 + over Rational Field + to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 878710*x + 316677750 + over Rational Field] sage: isogenies_sporadic_Q(E, 11) [] @@ -623,52 +637,66 @@ def isogenies_sporadic_Q(E, l=None, minimal_models=True): [] sage: isogenies_sporadic_Q(E, 19) [Isogeny of degree 19 - from Elliptic Curve defined by y^2 + y = x^3 - 1862*x - 30956 over Rational Field - to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 over Rational Field] + from Elliptic Curve defined by y^2 + y = x^3 - 1862*x - 30956 + over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 + over Rational Field] sage: isogenies_sporadic_Q(E) [Isogeny of degree 19 - from Elliptic Curve defined by y^2 + y = x^3 - 1862*x - 30956 over Rational Field - to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 over Rational Field] + from Elliptic Curve defined by y^2 + y = x^3 - 1862*x - 30956 + over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 + over Rational Field] sage: E = EllipticCurve([0, -1, 0, -6288, 211072]) sage: E.conductor() 19600 sage: isogenies_sporadic_Q(E,37) [Isogeny of degree 37 - from Elliptic Curve defined by y^2 = x^3 - x^2 - 6288*x + 211072 over Rational Field - to Elliptic Curve defined by y^2 = x^3 - x^2 - 163137088*x - 801950801728 over Rational Field] + from Elliptic Curve defined by y^2 = x^3 - x^2 - 6288*x + 211072 + over Rational Field + to Elliptic Curve defined by y^2 = x^3 - x^2 - 163137088*x - 801950801728 + over Rational Field] sage: E = EllipticCurve([1, 1, 0, -25178045, 48616918750]) sage: E.conductor() 148225 sage: isogenies_sporadic_Q(E,37) [Isogeny of degree 37 - from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 25178045*x + 48616918750 over Rational Field - to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 970*x - 13075 over Rational Field] + from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 25178045*x + 48616918750 + over Rational Field + to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 970*x - 13075 + over Rational Field] sage: E = EllipticCurve([-3440, 77658]) sage: E.conductor() 118336 sage: isogenies_sporadic_Q(E,43) [Isogeny of degree 43 - from Elliptic Curve defined by y^2 = x^3 - 3440*x + 77658 over Rational Field - to Elliptic Curve defined by y^2 = x^3 - 6360560*x - 6174354606 over Rational Field] + from Elliptic Curve defined by y^2 = x^3 - 3440*x + 77658 + over Rational Field + to Elliptic Curve defined by y^2 = x^3 - 6360560*x - 6174354606 + over Rational Field] sage: E = EllipticCurve([-29480, -1948226]) sage: E.conductor() 287296 sage: isogenies_sporadic_Q(E,67) [Isogeny of degree 67 - from Elliptic Curve defined by y^2 = x^3 - 29480*x - 1948226 over Rational Field - to Elliptic Curve defined by y^2 = x^3 - 132335720*x + 585954296438 over Rational Field] + from Elliptic Curve defined by y^2 = x^3 - 29480*x - 1948226 + over Rational Field + to Elliptic Curve defined by y^2 = x^3 - 132335720*x + 585954296438 + over Rational Field] sage: E = EllipticCurve([-34790720, -78984748304]) sage: E.conductor() 425104 sage: isogenies_sporadic_Q(E,163) [Isogeny of degree 163 - from Elliptic Curve defined by y^2 = x^3 - 34790720*x - 78984748304 over Rational Field - to Elliptic Curve defined by y^2 = x^3 - 924354639680*x + 342062961763303088 over Rational Field] + from Elliptic Curve defined by y^2 = x^3 - 34790720*x - 78984748304 + over Rational Field + to Elliptic Curve defined by y^2 = x^3 - 924354639680*x + 342062961763303088 + over Rational Field] """ j = E.j_invariant() j = QQ(j) @@ -723,9 +751,9 @@ def isogenies_2(E, minimal_models=True): Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Rational Field sage: [phi.codomain().ainvs() for phi in isogenies_2(E)] [] - sage: E = EllipticCurve(QQbar, [9,8]); E + sage: E = EllipticCurve(QQbar, [9,8]); E # optional - sage.rings.number_field Elliptic Curve defined by y^2 = x^3 + 9*x + 8 over Algebraic Field - sage: isogenies_2(E) # not implemented + sage: isogenies_2(E) # not implemented # optional - sage.rings.number_field """ f2 = E.division_polynomial(2) x2 = sorted(f2.roots(multiplicities=False)) @@ -759,12 +787,12 @@ def isogenies_3(E, minimal_models=True): EXAMPLES:: sage: from sage.schemes.elliptic_curves.isogeny_small_degree import isogenies_3 - sage: E = EllipticCurve(GF(17), [1,1]) - sage: [phi.codomain().ainvs() for phi in isogenies_3(E)] + sage: E = EllipticCurve(GF(17), [1,1]) # optional - sage.rings.finite_rings + sage: [phi.codomain().ainvs() for phi in isogenies_3(E)] # optional - sage.rings.finite_rings [(0, 0, 0, 9, 7), (0, 0, 0, 0, 1)] - sage: E = EllipticCurve(GF(17^2,'a'), [1,1]) - sage: [phi.codomain().ainvs() for phi in isogenies_3(E)] + sage: E = EllipticCurve(GF(17^2,'a'), [1,1]) # optional - sage.rings.finite_rings + sage: [phi.codomain().ainvs() for phi in isogenies_3(E)] # optional - sage.rings.finite_rings [(0, 0, 0, 9, 7), (0, 0, 0, 0, 1), (0, 0, 0, 5*a + 1, a + 13), (0, 0, 0, 12*a + 6, 16*a + 14)] sage: E = EllipticCurve('19a1') @@ -822,36 +850,50 @@ def isogenies_5_0(E, minimal_models=True): sage: isogenies_5_0(E) [] - sage: E = EllipticCurve(GF(13^2,'a'),[0,-3]) - sage: isogenies_5_0(E) + sage: E = EllipticCurve(GF(13^2,'a'), [0,-3]) # optional - sage.rings.finite_rings + sage: isogenies_5_0(E) # optional - sage.rings.finite_rings [Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 - to Elliptic Curve defined by y^2 = x^3 + (4*a+6)*x + (2*a+10) over Finite Field in a of size 13^2, + to Elliptic Curve defined by y^2 = x^3 + (4*a+6)*x + (2*a+10) + over Finite Field in a of size 13^2, Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 - to Elliptic Curve defined by y^2 = x^3 + (12*a+5)*x + (2*a+10) over Finite Field in a of size 13^2, + to Elliptic Curve defined by y^2 = x^3 + (12*a+5)*x + (2*a+10) + over Finite Field in a of size 13^2, Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 - to Elliptic Curve defined by y^2 = x^3 + (10*a+2)*x + (2*a+10) over Finite Field in a of size 13^2, + to Elliptic Curve defined by y^2 = x^3 + (10*a+2)*x + (2*a+10) + over Finite Field in a of size 13^2, Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 - to Elliptic Curve defined by y^2 = x^3 + (3*a+12)*x + (11*a+12) over Finite Field in a of size 13^2, + to Elliptic Curve defined by y^2 = x^3 + (3*a+12)*x + (11*a+12) + over Finite Field in a of size 13^2, Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 - to Elliptic Curve defined by y^2 = x^3 + (a+4)*x + (11*a+12) over Finite Field in a of size 13^2, + to Elliptic Curve defined by y^2 = x^3 + (a+4)*x + (11*a+12) + over Finite Field in a of size 13^2, Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 - to Elliptic Curve defined by y^2 = x^3 + (9*a+10)*x + (11*a+12) over Finite Field in a of size 13^2] + to Elliptic Curve defined by y^2 = x^3 + (9*a+10)*x + (11*a+12) + over Finite Field in a of size 13^2] - sage: K. = NumberField(x**6 - 320*x**3 - 320) - sage: E = EllipticCurve(K,[0,0,1,0,0]) - sage: isogenies_5_0(E) + sage: K. = NumberField(x**6 - 320*x**3 - 320) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,1,0,0]) # optional - sage.rings.number_field + sage: isogenies_5_0(E) # optional - sage.rings.number_field [Isogeny of degree 5 - from Elliptic Curve defined by y^2 + y = x^3 over Number Field in a with defining polynomial x^6 - 320*x^3 - 320 - to Elliptic Curve defined by y^2 + y = x^3 + (241565/32*a^5-362149/48*a^4+180281/24*a^3-9693307/4*a^2+14524871/6*a-7254985/3)*x + (1660391123/192*a^5-829315373/96*a^4+77680504/9*a^3-66622345345/24*a^2+33276655441/12*a-24931615912/9) over Number Field in a with defining polynomial x^6 - 320*x^3 - 320, + from Elliptic Curve defined by y^2 + y = x^3 + over Number Field in a with defining polynomial x^6 - 320*x^3 - 320 + to Elliptic Curve defined by + y^2 + y = x^3 + (241565/32*a^5-362149/48*a^4+180281/24*a^3-9693307/4*a^2+14524871/6*a-7254985/3)*x + + (1660391123/192*a^5-829315373/96*a^4+77680504/9*a^3-66622345345/24*a^2+33276655441/12*a-24931615912/9) + over Number Field in a with defining polynomial x^6 - 320*x^3 - 320, Isogeny of degree 5 - from Elliptic Curve defined by y^2 + y = x^3 over Number Field in a with defining polynomial x^6 - 320*x^3 - 320 - to Elliptic Curve defined by y^2 + y = x^3 + (47519/32*a^5-72103/48*a^4+32939/24*a^3-1909753/4*a^2+2861549/6*a-1429675/3)*x + (-131678717/192*a^5+65520419/96*a^4-12594215/18*a^3+5280985135/24*a^2-2637787519/12*a+1976130088/9) over Number Field in a with defining polynomial x^6 - 320*x^3 - 320] + from Elliptic Curve defined by y^2 + y = x^3 + over Number Field in a with defining polynomial x^6 - 320*x^3 - 320 + to Elliptic Curve defined by + y^2 + y = x^3 + (47519/32*a^5-72103/48*a^4+32939/24*a^3-1909753/4*a^2+2861549/6*a-1429675/3)*x + + (-131678717/192*a^5+65520419/96*a^4-12594215/18*a^3+5280985135/24*a^2-2637787519/12*a+1976130088/9) + over Number Field in a with defining polynomial x^6 - 320*x^3 - 320] """ F = E.base_field() if E.j_invariant() != 0: @@ -912,8 +954,8 @@ def isogenies_5_1728(E, minimal_models=True): sage: isogenies_5_1728(E) [] - sage: E = EllipticCurve(GF(13),[11,0]) - sage: isogenies_5_1728(E) + sage: E = EllipticCurve(GF(13), [11,0]) # optional - sage.rings.finite_rings + sage: isogenies_5_1728(E) # optional - sage.rings.finite_rings [Isogeny of degree 5 from Elliptic Curve defined by y^2 = x^3 + 11*x over Finite Field of size 13 to Elliptic Curve defined by y^2 = x^3 + 11*x over Finite Field of size 13, @@ -923,41 +965,55 @@ def isogenies_5_1728(E, minimal_models=True): An example of endomorphisms of degree 5:: - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve(K,[0,0,0,1,0]) - sage: isogenies_5_1728(E) + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0,0,0,1,0]) # optional - sage.rings.number_field + sage: isogenies_5_1728(E) # optional - sage.rings.number_field [Isogeny of degree 5 - from Elliptic Curve defined by y^2 = x^3 + x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I - to Elliptic Curve defined by y^2 = x^3 + x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I, + from Elliptic Curve defined by y^2 = x^3 + x over Number Field in i + with defining polynomial x^2 + 1 with i = 1*I + to Elliptic Curve defined by y^2 = x^3 + x over Number Field in i + with defining polynomial x^2 + 1 with i = 1*I, Isogeny of degree 5 - from Elliptic Curve defined by y^2 = x^3 + x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I - to Elliptic Curve defined by y^2 = x^3 + x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I] - sage: _[0].rational_maps() - (((4/25*i + 3/25)*x^5 + (4/5*i - 2/5)*x^3 - x)/(x^4 + (-4/5*i + 2/5)*x^2 + (-4/25*i - 3/25)), - ((11/125*i + 2/125)*x^6*y + (-23/125*i + 64/125)*x^4*y + (141/125*i + 162/125)*x^2*y + (3/25*i - 4/25)*y)/(x^6 + (-6/5*i + 3/5)*x^4 + (-12/25*i - 9/25)*x^2 + (2/125*i - 11/125))) + from Elliptic Curve defined by y^2 = x^3 + x over Number Field in i + with defining polynomial x^2 + 1 with i = 1*I + to Elliptic Curve defined by y^2 = x^3 + x over Number Field in i + with defining polynomial x^2 + 1 with i = 1*I] + sage: _[0].rational_maps() # optional - sage.rings.number_field + (((4/25*i + 3/25)*x^5 + + (4/5*i - 2/5)*x^3 - x)/(x^4 + (-4/5*i + 2/5)*x^2 + (-4/25*i - 3/25)), + ((11/125*i + 2/125)*x^6*y + (-23/125*i + 64/125)*x^4*y + + (141/125*i + 162/125)*x^2*y + + (3/25*i - 4/25)*y)/(x^6 + (-6/5*i + 3/5)*x^4 + + (-12/25*i - 9/25)*x^2 + (2/125*i - 11/125))) An example of 5-isogenies over a number field:: - sage: K. = NumberField(x**4 + 20*x**2 - 80) - sage: K(5).is_square() # necessary but not sufficient! + sage: K. = NumberField(x**4 + 20*x**2 - 80) # optional - sage.rings.number_field + sage: K(5).is_square() # necessary but not sufficient! # optional - sage.rings.number_field True - sage: E = EllipticCurve(K,[0,0,0,1,0]) - sage: isogenies_5_1728(E) + sage: E = EllipticCurve(K, [0,0,0,1,0]) # optional - sage.rings.number_field + sage: isogenies_5_1728(E) # optional - sage.rings.number_field [Isogeny of degree 5 - from Elliptic Curve defined by y^2 = x^3 + x over Number Field in a with defining polynomial x^4 + 20*x^2 - 80 - to Elliptic Curve defined by y^2 = x^3 + (-753/4*a^2-4399)*x + (2779*a^3+65072*a) over Number Field in a with defining polynomial x^4 + 20*x^2 - 80, + from Elliptic Curve defined by y^2 = x^3 + x + over Number Field in a with defining polynomial x^4 + 20*x^2 - 80 + to Elliptic Curve defined by y^2 = x^3 + (-753/4*a^2-4399)*x + (2779*a^3+65072*a) + over Number Field in a with defining polynomial x^4 + 20*x^2 - 80, Isogeny of degree 5 - from Elliptic Curve defined by y^2 = x^3 + x over Number Field in a with defining polynomial x^4 + 20*x^2 - 80 - to Elliptic Curve defined by y^2 = x^3 + (-753/4*a^2-4399)*x + (-2779*a^3-65072*a) over Number Field in a with defining polynomial x^4 + 20*x^2 - 80] + from Elliptic Curve defined by y^2 = x^3 + x + over Number Field in a with defining polynomial x^4 + 20*x^2 - 80 + to Elliptic Curve defined by y^2 = x^3 + (-753/4*a^2-4399)*x + (-2779*a^3-65072*a) + over Number Field in a with defining polynomial x^4 + 20*x^2 - 80] See :trac:`19840`:: - sage: K. = NumberField(x^4 - 5*x^2 + 5) - sage: E = EllipticCurve([a^2 + a + 1, a^3 + a^2 + a + 1, a^2 + a, 17*a^3 + 34*a^2 - 16*a - 37, 54*a^3 + 105*a^2 - 66*a - 135]) - sage: len(E.isogenies_prime_degree(5)) + sage: K. = NumberField(x^4 - 5*x^2 + 5) # optional - sage.rings.number_field + sage: E = EllipticCurve([a^2 + a + 1, a^3 + a^2 + a + 1, a^2 + a, + ....: 17*a^3 + 34*a^2 - 16*a - 37, + ....: 54*a^3 + 105*a^2 - 66*a - 135]) + sage: len(E.isogenies_prime_degree(5)) # optional - sage.rings.number_field 2 sage: from sage.schemes.elliptic_curves.isogeny_small_degree import isogenies_5_1728 - sage: [phi.codomain().j_invariant() for phi in isogenies_5_1728(E)] + sage: [phi.codomain().j_invariant() for phi in isogenies_5_1728(E)] # optional - sage.rings.number_field [19691491018752*a^2 - 27212977933632, 19691491018752*a^2 - 27212977933632] """ F = E.base_field() @@ -1026,18 +1082,22 @@ def isogenies_7_0(E, minimal_models=True): First some examples of endomorphisms:: sage: from sage.schemes.elliptic_curves.isogeny_small_degree import isogenies_7_0 - sage: K. = QuadraticField(-3) - sage: E = EllipticCurve(K, [0,1]) - sage: isogenies_7_0(E) + sage: K. = QuadraticField(-3) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0,1]) # optional - sage.rings.number_field + sage: isogenies_7_0(E) # optional - sage.rings.number_field [Isogeny of degree 7 - from Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I - to Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I, + from Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in r + with defining polynomial x^2 + 3 with r = 1.732050807568878?*I + to Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in r + with defining polynomial x^2 + 3 with r = 1.732050807568878?*I, Isogeny of degree 7 - from Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I - to Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I] + from Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in r + with defining polynomial x^2 + 3 with r = 1.732050807568878?*I + to Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in r + with defining polynomial x^2 + 3 with r = 1.732050807568878?*I] - sage: E = EllipticCurve(GF(13^2,'a'),[0,-3]) - sage: isogenies_7_0(E) + sage: E = EllipticCurve(GF(13^2,'a'), [0,-3]) # optional - sage.rings.finite_rings + sage: isogenies_7_0(E) # optional - sage.rings.finite_rings [Isogeny of degree 7 from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 to Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2, @@ -1047,9 +1107,9 @@ def isogenies_7_0(E, minimal_models=True): Now some examples of 7-isogenies which are not endomorphisms:: - sage: K = GF(101) - sage: E = EllipticCurve(K, [0,1]) - sage: isogenies_7_0(E) + sage: K = GF(101) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(K, [0,1]) # optional - sage.rings.finite_rings + sage: isogenies_7_0(E) # optional - sage.rings.finite_rings [Isogeny of degree 7 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 101 to Elliptic Curve defined by y^2 = x^3 + 55*x + 100 over Finite Field of size 101, @@ -1060,30 +1120,36 @@ def isogenies_7_0(E, minimal_models=True): Examples over a number field:: sage: from sage.schemes.elliptic_curves.isogeny_small_degree import isogenies_7_0 - sage: E = EllipticCurve('27a1').change_ring(QuadraticField(-3,'r')) - sage: isogenies_7_0(E) + sage: E = EllipticCurve('27a1').change_ring(QuadraticField(-3,'r')) # optional - sage.rings.number_field + sage: isogenies_7_0(E) # optional - sage.rings.number_field [Isogeny of degree 7 - from Elliptic Curve defined by y^2 + y = x^3 + (-7) over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I - to Elliptic Curve defined by y^2 + y = x^3 + (-7) over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I, + from Elliptic Curve defined by y^2 + y = x^3 + (-7) over Number Field in r + with defining polynomial x^2 + 3 with r = 1.732050807568878?*I + to Elliptic Curve defined by y^2 + y = x^3 + (-7) over Number Field in r + with defining polynomial x^2 + 3 with r = 1.732050807568878?*I, Isogeny of degree 7 - from Elliptic Curve defined by y^2 + y = x^3 + (-7) over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I - to Elliptic Curve defined by y^2 + y = x^3 + (-7) over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I] - - sage: K. = NumberField(x^6 + 1512*x^3 - 21168) - sage: E = EllipticCurve(K, [0,1]) - sage: isogs = isogenies_7_0(E) - sage: [phi.codomain().a_invariants() for phi in isogs] + from Elliptic Curve defined by y^2 + y = x^3 + (-7) over Number Field in r + with defining polynomial x^2 + 3 with r = 1.732050807568878?*I + to Elliptic Curve defined by y^2 + y = x^3 + (-7) over Number Field in r + with defining polynomial x^2 + 3 with r = 1.732050807568878?*I] + + sage: K. = NumberField(x^6 + 1512*x^3 - 21168) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0,1]) # optional - sage.rings.number_field + sage: isogs = isogenies_7_0(E) # optional - sage.rings.number_field + sage: [phi.codomain().a_invariants() for phi in isogs] # optional - sage.rings.number_field [(0, 0, 0, -415/98*a^5 - 675/14*a^4 + 2255/7*a^3 - 74700/7*a^2 - 25110*a - 66420, - -141163/56*a^5 + 1443453/112*a^4 - 374275/2*a^3 - 3500211/2*a^2 - 17871975/4*a - 7710065), + -141163/56*a^5 + 1443453/112*a^4 - 374275/2*a^3 + - 3500211/2*a^2 - 17871975/4*a - 7710065), (0, 0, 0, -24485/392*a^5 - 1080/7*a^4 - 2255/7*a^3 - 1340865/14*a^2 - 230040*a - 553500, - 1753037/56*a^5 + 8345733/112*a^4 + 374275/2*a^3 + 95377029/2*a^2 + 458385345/4*a + 275241835)] - sage: [phi.codomain().j_invariant() for phi in isogs] + 1753037/56*a^5 + 8345733/112*a^4 + 374275/2*a^3 + + 95377029/2*a^2 + 458385345/4*a + 275241835)] + sage: [phi.codomain().j_invariant() for phi in isogs] # optional - sage.rings.number_field [158428486656000/7*a^3 - 313976217600000, -158428486656000/7*a^3 - 34534529335296000] """ @@ -1150,8 +1216,8 @@ def isogenies_7_1728(E, minimal_models=True): EXAMPLES:: sage: from sage.schemes.elliptic_curves.isogeny_small_degree import isogenies_7_1728 - sage: E = EllipticCurve(GF(47), [1, 0]) - sage: isogenies_7_1728(E) + sage: E = EllipticCurve(GF(47), [1, 0]) # optional - sage.rings.finite_rings + sage: isogenies_7_1728(E) # optional - sage.rings.finite_rings [Isogeny of degree 7 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 47 to Elliptic Curve defined by y^2 = x^3 + 26 over Finite Field of size 47, @@ -1162,28 +1228,30 @@ def isogenies_7_1728(E, minimal_models=True): An example in characteristic 53 (for which an earlier implementation did not work):: sage: from sage.schemes.elliptic_curves.isogeny_small_degree import isogenies_7_1728 - sage: E = EllipticCurve(GF(53), [1, 0]) - sage: isogenies_7_1728(E) + sage: E = EllipticCurve(GF(53), [1, 0]) # optional - sage.rings.finite_rings + sage: isogenies_7_1728(E) # optional - sage.rings.finite_rings [] - sage: E = EllipticCurve(GF(53^2,'a'), [1, 0]) - sage: [iso.codomain().ainvs() for iso in isogenies_7_1728(E)] + sage: E = EllipticCurve(GF(53^2,'a'), [1, 0]) # optional - sage.rings.finite_rings + sage: [iso.codomain().ainvs() for iso in isogenies_7_1728(E)] # optional - sage.rings.finite_rings [(0, 0, 0, 36, 19*a + 15), (0, 0, 0, 36, 34*a + 38), (0, 0, 0, 33, 39*a + 28), (0, 0, 0, 33, 14*a + 25), (0, 0, 0, 19, 45*a + 16), (0, 0, 0, 19, 8*a + 37), (0, 0, 0, 3, 45*a + 16), (0, 0, 0, 3, 8*a + 37)] :: - sage: K. = NumberField(x^8 + 84*x^6 - 1890*x^4 + 644*x^2 - 567) - sage: E = EllipticCurve(K, [1, 0]) - sage: isogs = isogenies_7_1728(E) - sage: [phi.codomain().j_invariant() for phi in isogs] - [-526110256146528/53*a^6 + 183649373229024*a^4 - 3333881559996576/53*a^2 + 2910267397643616/53, - -526110256146528/53*a^6 + 183649373229024*a^4 - 3333881559996576/53*a^2 + 2910267397643616/53] - sage: E1 = isogs[0].codomain() - sage: E2 = isogs[1].codomain() - sage: E1.is_isomorphic(E2) + sage: K. = NumberField(x^8 + 84*x^6 - 1890*x^4 + 644*x^2 - 567) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [1, 0]) # optional - sage.rings.number_field + sage: isogs = isogenies_7_1728(E) # optional - sage.rings.number_field + sage: [phi.codomain().j_invariant() for phi in isogs] # optional - sage.rings.number_field + [-526110256146528/53*a^6 + 183649373229024*a^4 + - 3333881559996576/53*a^2 + 2910267397643616/53, + -526110256146528/53*a^6 + 183649373229024*a^4 + - 3333881559996576/53*a^2 + 2910267397643616/53] + sage: E1 = isogs[0].codomain() # optional - sage.rings.number_field + sage: E2 = isogs[1].codomain() # optional - sage.rings.number_field + sage: E1.is_isomorphic(E2) # optional - sage.rings.number_field False - sage: E1.is_quadratic_twist(E2) + sage: E1.is_quadratic_twist(E2) # optional - sage.rings.number_field -1 """ if E.j_invariant()!=1728: @@ -1248,42 +1316,57 @@ def isogenies_13_0(E, minimal_models=True): Endomorphisms of degree 13 will exist when -3 is a square:: - sage: K. = QuadraticField(-3) - sage: E = EllipticCurve(K, [0, r]); E + sage: K. = QuadraticField(-3) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0, r]); E # optional - sage.rings.number_field Elliptic Curve defined by y^2 = x^3 + r over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I - sage: isogenies_13_0(E) + sage: isogenies_13_0(E) # optional - sage.rings.number_field [Isogeny of degree 13 - from Elliptic Curve defined by y^2 = x^3 + r over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I - to Elliptic Curve defined by y^2 = x^3 + r over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I, + from Elliptic Curve defined by y^2 = x^3 + r over Number Field in r + with defining polynomial x^2 + 3 with r = 1.732050807568878?*I + to Elliptic Curve defined by y^2 = x^3 + r over Number Field in r + with defining polynomial x^2 + 3 with r = 1.732050807568878?*I, Isogeny of degree 13 - from Elliptic Curve defined by y^2 = x^3 + r over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I - to Elliptic Curve defined by y^2 = x^3 + r over Number Field in r with defining polynomial x^2 + 3 with r = 1.732050807568878?*I] - sage: isogenies_13_0(E)[0].rational_maps() - (((7/338*r + 23/338)*x^13 + (-164/13*r - 420/13)*x^10 + (720/13*r + 3168/13)*x^7 + (3840/13*r - 576/13)*x^4 + (4608/13*r + 2304/13)*x)/(x^12 + (4*r + 36)*x^9 + (1080/13*r + 3816/13)*x^6 + (2112/13*r - 5184/13)*x^3 + (-17280/169*r - 1152/169)), - ((18/2197*r + 35/2197)*x^18*y + (23142/2197*r + 35478/2197)*x^15*y + (-1127520/2197*r - 1559664/2197)*x^12*y + (-87744/2197*r + 5992704/2197)*x^9*y + (-6625152/2197*r - 9085824/2197)*x^6*y + (-28919808/2197*r - 2239488/2197)*x^3*y + (-1990656/2197*r - 3870720/2197)*y)/(x^18 + (6*r + 54)*x^15 + (3024/13*r + 11808/13)*x^12 + (31296/13*r + 51840/13)*x^9 + (487296/169*r - 2070144/169)*x^6 + (-940032/169*r + 248832/169)*x^3 + (1990656/2197*r + 3870720/2197))) + from Elliptic Curve defined by y^2 = x^3 + r over Number Field in r + with defining polynomial x^2 + 3 with r = 1.732050807568878?*I + to Elliptic Curve defined by y^2 = x^3 + r over Number Field in r + with defining polynomial x^2 + 3 with r = 1.732050807568878?*I] + sage: isogenies_13_0(E)[0].rational_maps() # optional - sage.rings.number_field + (((7/338*r + 23/338)*x^13 + (-164/13*r - 420/13)*x^10 + + (720/13*r + 3168/13)*x^7 + (3840/13*r - 576/13)*x^4 + + (4608/13*r + 2304/13)*x)/(x^12 + (4*r + 36)*x^9 + (1080/13*r + 3816/13)*x^6 + + (2112/13*r - 5184/13)*x^3 + (-17280/169*r - 1152/169)), + ((18/2197*r + 35/2197)*x^18*y + (23142/2197*r + 35478/2197)*x^15*y + + (-1127520/2197*r - 1559664/2197)*x^12*y + (-87744/2197*r + 5992704/2197)*x^9*y + + (-6625152/2197*r - 9085824/2197)*x^6*y + (-28919808/2197*r - 2239488/2197)*x^3*y + + (-1990656/2197*r - 3870720/2197)*y)/(x^18 + (6*r + 54)*x^15 + + (3024/13*r + 11808/13)*x^12 + (31296/13*r + 51840/13)*x^9 + + (487296/169*r - 2070144/169)*x^6 + (-940032/169*r + 248832/169)*x^3 + + (1990656/2197*r + 3870720/2197))) An example of endomorphisms over a finite field:: - sage: K = GF(19^2,'a') - sage: E = EllipticCurve(j=K(0)); E - Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2 - sage: isogenies_13_0(E) + sage: K = GF(19^2,'a') # optional - sage.rings.finite_rings + sage: E = EllipticCurve(j=K(0)); E # optional - sage.rings.finite_rings + Elliptic Curve defined by y^2 = x^3 + 1 + over Finite Field in a of size 19^2 + sage: isogenies_13_0(E) # optional - sage.rings.finite_rings [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2 to Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2, Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2 to Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 19^2] - sage: isogenies_13_0(E)[0].rational_maps() + sage: isogenies_13_0(E)[0].rational_maps() # optional - sage.rings.finite_rings ((6*x^13 - 6*x^10 - 3*x^7 + 6*x^4 + x)/(x^12 - 5*x^9 - 9*x^6 - 7*x^3 + 5), - (-8*x^18*y - 9*x^15*y + 9*x^12*y - 5*x^9*y + 5*x^6*y - 7*x^3*y + 7*y)/(x^18 + 2*x^15 + 3*x^12 - x^9 + 8*x^6 - 9*x^3 + 7)) + (-8*x^18*y - 9*x^15*y + 9*x^12*y - 5*x^9*y + + 5*x^6*y - 7*x^3*y + 7*y)/(x^18 + 2*x^15 + 3*x^12 - x^9 + 8*x^6 - 9*x^3 + 7)) A previous implementation did not work in some characteristics:: - sage: K = GF(29) - sage: E = EllipticCurve(j=K(0)) - sage: isogenies_13_0(E) + sage: K = GF(29) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(j=K(0)) # optional - sage.rings.finite_rings + sage: isogenies_13_0(E) # optional - sage.rings.finite_rings [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field of size 29 to Elliptic Curve defined by y^2 = x^3 + 26*x + 12 over Finite Field of size 29, @@ -1293,20 +1376,21 @@ def isogenies_13_0(E, minimal_models=True): :: - sage: K = GF(101) - sage: E = EllipticCurve(j=K(0)); E.ainvs() + sage: K = GF(101) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(j=K(0)); E.ainvs() # optional - sage.rings.finite_rings (0, 0, 0, 0, 1) - sage: [phi.codomain().ainvs() for phi in isogenies_13_0(E)] + sage: [phi.codomain().ainvs() for phi in isogenies_13_0(E)] # optional - sage.rings.finite_rings [(0, 0, 0, 64, 36), (0, 0, 0, 42, 66)] :: sage: x = polygen(QQ) sage: f = x^12 + 78624*x^9 - 130308048*x^6 + 2270840832*x^3 - 54500179968 - sage: K. = NumberField(f) - sage: E = EllipticCurve(j=K(0)); E.ainvs() + sage: K. = NumberField(f) # optional - sage.rings.number_field + sage: E = EllipticCurve(j=K(0)); E.ainvs() # optional - sage.rings.number_field (0, 0, 0, 0, 1) - sage: len([phi.codomain().ainvs() for phi in isogenies_13_0(E)]) # long time (4s) + sage: len([phi.codomain().ainvs() # long time (4s) # optional - sage.rings.number_field + ....: for phi in isogenies_13_0(E)]) 2 """ if E.j_invariant()!=0: @@ -1381,28 +1465,32 @@ def isogenies_13_1728(E, minimal_models=True): sage: from sage.schemes.elliptic_curves.isogeny_small_degree import isogenies_13_1728 - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve([0,0,0,i,0]); E.ainvs() + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve([0,0,0,i,0]); E.ainvs() # optional - sage.rings.number_field (0, 0, 0, i, 0) - sage: isogenies_13_1728(E) + sage: isogenies_13_1728(E) # optional - sage.rings.number_field [Isogeny of degree 13 - from Elliptic Curve defined by y^2 = x^3 + i*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I - to Elliptic Curve defined by y^2 = x^3 + i*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I, + from Elliptic Curve defined by y^2 = x^3 + i*x over Number Field in i + with defining polynomial x^2 + 1 with i = 1*I + to Elliptic Curve defined by y^2 = x^3 + i*x over Number Field in i + with defining polynomial x^2 + 1 with i = 1*I, Isogeny of degree 13 - from Elliptic Curve defined by y^2 = x^3 + i*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I - to Elliptic Curve defined by y^2 = x^3 + i*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I] + from Elliptic Curve defined by y^2 = x^3 + i*x over Number Field in i + with defining polynomial x^2 + 1 with i = 1*I + to Elliptic Curve defined by y^2 = x^3 + i*x over Number Field in i + with defining polynomial x^2 + 1 with i = 1*I] :: - sage: K = GF(83) - sage: E = EllipticCurve(K, [0,0,0,5,0]); E.ainvs() + sage: K = GF(83) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(K, [0,0,0,5,0]); E.ainvs() # optional - sage.rings.finite_rings (0, 0, 0, 5, 0) - sage: isogenies_13_1728(E) + sage: isogenies_13_1728(E) # optional - sage.rings.finite_rings [] - sage: K = GF(89) - sage: E = EllipticCurve(K, [0,0,0,5,0]); E.ainvs() + sage: K = GF(89) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(K, [0,0,0,5,0]); E.ainvs() # optional - sage.rings.finite_rings (0, 0, 0, 5, 0) - sage: isogenies_13_1728(E) + sage: isogenies_13_1728(E) # optional - sage.rings.finite_rings [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 89 to Elliptic Curve defined by y^2 = x^3 + 5*x over Finite Field of size 89, @@ -1412,9 +1500,9 @@ def isogenies_13_1728(E, minimal_models=True): :: - sage: K = GF(23) - sage: E = EllipticCurve(K, [1,0]) - sage: isogenies_13_1728(E) + sage: K = GF(23) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(K, [1,0]) # optional - sage.rings.finite_rings + sage: isogenies_13_1728(E) # optional - sage.rings.finite_rings [Isogeny of degree 13 from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 23 to Elliptic Curve defined by y^2 = x^3 + 16 over Finite Field of size 23, @@ -1425,20 +1513,30 @@ def isogenies_13_1728(E, minimal_models=True): :: sage: x = polygen(QQ) - sage: f = x^12 + 1092*x^10 - 432432*x^8 + 6641024*x^6 - 282896640*x^4 - 149879808*x^2 - 349360128 - sage: K. = NumberField(f) - sage: E = EllipticCurve(K, [1,0]) - sage: [phi.codomain().ainvs() for phi in isogenies_13_1728(E)] # long time (3s) + sage: f = (x^12 + 1092*x^10 - 432432*x^8 + 6641024*x^6 + ....: - 282896640*x^4 - 149879808*x^2 - 349360128) + sage: K. = NumberField(f) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [1,0]) # optional - sage.rings.number_field + sage: [phi.codomain().ainvs() # long time (3s) # optional - sage.rings.number_field + ....: for phi in isogenies_13_1728(E)] [(0, 0, 0, - -4225010072113/3063768069807341568*a^10 - 24841071989413/15957125363579904*a^8 + 11179537789374271/21276167151439872*a^6 - 407474562289492049/47871376090739712*a^4 + 1608052769560747/4522994717568*a^2 + 7786720245212809/36937790193472, - -363594277511/574456513088876544*a^11 - 7213386922793/2991961005671232*a^9 - 2810970361185589/1329760446964992*a^7 + 281503836888046601/8975883017013696*a^5 - 1287313166530075/848061509544*a^3 + 9768837984886039/6925835661276*a), + -4225010072113/3063768069807341568*a^10 - 24841071989413/15957125363579904*a^8 + + 11179537789374271/21276167151439872*a^6 - 407474562289492049/47871376090739712*a^4 + + 1608052769560747/4522994717568*a^2 + 7786720245212809/36937790193472, + -363594277511/574456513088876544*a^11 - 7213386922793/2991961005671232*a^9 + - 2810970361185589/1329760446964992*a^7 + 281503836888046601/8975883017013696*a^5 + - 1287313166530075/848061509544*a^3 + 9768837984886039/6925835661276*a), (0, 0, 0, - -4225010072113/3063768069807341568*a^10 - 24841071989413/15957125363579904*a^8 + 11179537789374271/21276167151439872*a^6 - 407474562289492049/47871376090739712*a^4 + 1608052769560747/4522994717568*a^2 + 7786720245212809/36937790193472, - 363594277511/574456513088876544*a^11 + 7213386922793/2991961005671232*a^9 + 2810970361185589/1329760446964992*a^7 - 281503836888046601/8975883017013696*a^5 + 1287313166530075/848061509544*a^3 - 9768837984886039/6925835661276*a)] + -4225010072113/3063768069807341568*a^10 - 24841071989413/15957125363579904*a^8 + + 11179537789374271/21276167151439872*a^6 - 407474562289492049/47871376090739712*a^4 + + 1608052769560747/4522994717568*a^2 + 7786720245212809/36937790193472, + 363594277511/574456513088876544*a^11 + 7213386922793/2991961005671232*a^9 + + 2810970361185589/1329760446964992*a^7 - 281503836888046601/8975883017013696*a^5 + + 1287313166530075/848061509544*a^3 - 9768837984886039/6925835661276*a)] """ if E.j_invariant()!=1728: raise ValueError("j-invariant must be 1728.") @@ -1651,7 +1749,12 @@ def Psi2(l): sage: from sage.schemes.elliptic_curves.isogeny_small_degree import Psi2 sage: Psi2(11) - x^5 - 55*x^4*u + 994*x^3*u^2 - 8774*x^2*u^3 + 41453*x*u^4 - 928945/11*u^5 + 33*x^4 + 276*x^3*u - 7794*x^2*u^2 + 4452*x*u^3 + 1319331/11*u^4 + 216*x^3*v - 4536*x^2*u*v + 31752*x*u^2*v - 842616/11*u^3*v + 162*x^3 + 38718*x^2*u - 610578*x*u^2 + 33434694/11*u^3 - 4536*x^2*v + 73872*x*u*v - 2745576/11*u^2*v - 16470*x^2 + 580068*x*u - 67821354/11*u^2 - 185976*x*v + 14143896/11*u*v + 7533*x - 20437029/11*u - 12389112/11*v + 19964151/11 + x^5 - 55*x^4*u + 994*x^3*u^2 - 8774*x^2*u^3 + 41453*x*u^4 - 928945/11*u^5 + + 33*x^4 + 276*x^3*u - 7794*x^2*u^2 + 4452*x*u^3 + 1319331/11*u^4 + 216*x^3*v + - 4536*x^2*u*v + 31752*x*u^2*v - 842616/11*u^3*v + 162*x^3 + 38718*x^2*u + - 610578*x*u^2 + 33434694/11*u^3 - 4536*x^2*v + 73872*x*u*v - 2745576/11*u^2*v + - 16470*x^2 + 580068*x*u - 67821354/11*u^2 - 185976*x*v + 14143896/11*u*v + + 7533*x - 20437029/11*u - 12389112/11*v + 19964151/11 sage: p = Psi2(71) # long time sage: (x,u,v) = p.variables() # long time sage: p.coefficient({x: 0, u: 210, v: 0}) # long time @@ -1737,45 +1840,77 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True): sage: E = EllipticCurve('121a1') sage: isogenies_prime_degree_genus_plus_0(E, 11) [Isogeny of degree 11 - from Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 30*x - 76 over Rational Field - to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 305*x + 7888 over Rational Field] + from Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 30*x - 76 + over Rational Field + to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 305*x + 7888 + over Rational Field] sage: E = EllipticCurve([1, 1, 0, -660, -7600]) sage: isogenies_prime_degree_genus_plus_0(E, 17) [Isogeny of degree 17 - from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 660*x - 7600 over Rational Field - to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 878710*x + 316677750 over Rational Field] + from Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 660*x - 7600 + over Rational Field + to Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 878710*x + 316677750 + over Rational Field] sage: E = EllipticCurve([0, 0, 1, -1862, -30956]) sage: isogenies_prime_degree_genus_plus_0(E, 19) [Isogeny of degree 19 - from Elliptic Curve defined by y^2 + y = x^3 - 1862*x - 30956 over Rational Field - to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 over Rational Field] - - sage: K = QuadraticField(-295,'a') - sage: a = K.gen() - sage: E = EllipticCurve_from_j(-484650135/16777216*a + 4549855725/16777216) - sage: isogenies_prime_degree_genus_plus_0(E, 23) + from Elliptic Curve defined by y^2 + y = x^3 - 1862*x - 30956 + over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 + over Rational Field] + + sage: K = QuadraticField(-295,'a') # optional - sage.rings.number_field + sage: a = K.gen() # optional - sage.rings.number_field + sage: E = EllipticCurve_from_j(-484650135/16777216*a + 4549855725/16777216) # optional - sage.rings.number_field + sage: isogenies_prime_degree_genus_plus_0(E, 23) # optional - sage.rings.number_field [Isogeny of degree 23 - from Elliptic Curve defined by y^2 = x^3 + (-14460494784192904095/140737488355328*a+270742665778826768325/140737488355328)*x + (37035998788154488846811217135/590295810358705651712*a-1447451882571839266752561148725/590295810358705651712) over Number Field in a with defining polynomial x^2 + 295 with a = 17.17556403731767?*I - to Elliptic Curve defined by y^2 = x^3 + (-5130542435555445498495/140737488355328*a+173233955029127361005925/140737488355328)*x + (-1104699335561165691575396879260545/590295810358705651712*a+3169785826904210171629535101419675/590295810358705651712) over Number Field in a with defining polynomial x^2 + 295 with a = 17.17556403731767?*I] - - sage: K = QuadraticField(-199,'a') - sage: a = K.gen() - sage: E = EllipticCurve_from_j(94743000*a + 269989875) - sage: isogenies_prime_degree_genus_plus_0(E, 29) - [Isogeny of degree 29 from Elliptic Curve defined by y^2 = x^3 + (-153477413215038000*a+5140130723072965125)*x + (297036215130547008455526000*a+2854277047164317800973582250) over Number Field in a with defining polynomial x^2 + 199 with a = 14.106735979665884?*I to Elliptic Curve defined by y^2 = x^3 + (251336161378040805000*a-3071093219933084341875)*x + (-8411064283162168580187643221000*a+34804337770798389546017184785250) over Number Field in a with defining polynomial x^2 + 199 with a = 14.106735979665884?*I] - - sage: K = QuadraticField(253,'a') - sage: a = K.gen() - sage: E = EllipticCurve_from_j(208438034112000*a - 3315409892960000) - sage: isogenies_prime_degree_genus_plus_0(E, 31) + from Elliptic Curve defined by + y^2 = x^3 + (-14460494784192904095/140737488355328*a+270742665778826768325/140737488355328)*x + + (37035998788154488846811217135/590295810358705651712*a-1447451882571839266752561148725/590295810358705651712) + over Number Field in a with defining polynomial x^2 + 295 + with a = 17.17556403731767?*I + to Elliptic Curve defined by + y^2 = x^3 + (-5130542435555445498495/140737488355328*a+173233955029127361005925/140737488355328)*x + + (-1104699335561165691575396879260545/590295810358705651712*a+3169785826904210171629535101419675/590295810358705651712) + over Number Field in a with defining polynomial x^2 + 295 + with a = 17.17556403731767?*I] + + sage: K = QuadraticField(-199,'a') # optional - sage.rings.number_field + sage: a = K.gen() # optional - sage.rings.number_field + sage: E = EllipticCurve_from_j(94743000*a + 269989875) # optional - sage.rings.number_field + sage: isogenies_prime_degree_genus_plus_0(E, 29) # optional - sage.rings.number_field + [Isogeny of degree 29 + from Elliptic Curve defined by + y^2 = x^3 + (-153477413215038000*a+5140130723072965125)*x + + (297036215130547008455526000*a+2854277047164317800973582250) + over Number Field in a with defining polynomial x^2 + 199 + with a = 14.106735979665884?*I + to Elliptic Curve defined by + y^2 = x^3 + (251336161378040805000*a-3071093219933084341875)*x + + (-8411064283162168580187643221000*a+34804337770798389546017184785250) + over Number Field in a with defining polynomial x^2 + 199 + with a = 14.106735979665884?*I] + + sage: K = QuadraticField(253,'a') # optional - sage.rings.number_field + sage: a = K.gen() # optional - sage.rings.number_field + sage: E = EllipticCurve_from_j(208438034112000*a - 3315409892960000) # optional - sage.rings.number_field + sage: isogenies_prime_degree_genus_plus_0(E, 31) # optional - sage.rings.number_field [Isogeny of degree 31 - from Elliptic Curve defined by y^2 = x^3 + (4146345122185433034677956608000*a-65951656549965037259634800640000)*x + (-18329111516954473474583425393698245080252416000*a+291542366110383928366510368064204147260129280000) over Number Field in a with defining polynomial x^2 - 253 with a = 15.905973720586867? - to Elliptic Curve defined by y^2 = x^3 + (200339763852548615776123686912000*a-3186599019027216904280948275200000)*x + (7443671791411479629112717260182286294850207744000*a-118398847898864757209685951728838895495168655360000) over Number Field in a with defining polynomial x^2 - 253 with a = 15.905973720586867?] - - sage: E = EllipticCurve_from_j(GF(5)(1)) - sage: isogenies_prime_degree_genus_plus_0(E, 41) + from Elliptic Curve defined by + y^2 = x^3 + (4146345122185433034677956608000*a-65951656549965037259634800640000)*x + + (-18329111516954473474583425393698245080252416000*a+291542366110383928366510368064204147260129280000) + over Number Field in a with defining polynomial x^2 - 253 + with a = 15.905973720586867? + to Elliptic Curve defined by + y^2 = x^3 + (200339763852548615776123686912000*a-3186599019027216904280948275200000)*x + + (7443671791411479629112717260182286294850207744000*a-118398847898864757209685951728838895495168655360000) + over Number Field in a with defining polynomial x^2 - 253 + with a = 15.905973720586867?] + + sage: E = EllipticCurve_from_j(GF(5)(1)) # optional - sage.rings.finite_rings + sage: isogenies_prime_degree_genus_plus_0(E, 41) # optional - sage.rings.finite_rings [Isogeny of degree 41 from Elliptic Curve defined by y^2 = x^3 + x + 2 over Finite Field of size 5 to Elliptic Curve defined by y^2 = x^3 + x + 3 over Finite Field of size 5, @@ -1783,35 +1918,68 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True): from Elliptic Curve defined by y^2 = x^3 + x + 2 over Finite Field of size 5 to Elliptic Curve defined by y^2 = x^3 + x + 3 over Finite Field of size 5] - sage: K = QuadraticField(5,'a') - sage: a = K.gen() - sage: E = EllipticCurve_from_j(184068066743177379840*a - 411588709724712960000) - sage: isogenies_prime_degree_genus_plus_0(E, 47) # long time (2s) + sage: K = QuadraticField(5,'a') # optional - sage.rings.number_field + sage: a = K.gen() # optional - sage.rings.number_field + sage: E = EllipticCurve_from_j(184068066743177379840*a # optional - sage.rings.number_field + ....: - 411588709724712960000) + sage: isogenies_prime_degree_genus_plus_0(E, 47) # long time (2s) # optional - sage.rings.number_field [Isogeny of degree 47 - from Elliptic Curve defined by y^2 = x^3 + (454562028554080355857852049849975895490560*a-1016431595837124114668689286176511361024000)*x + (-249456798429896080881440540950393713303830363999480904280965120*a+557802358738710443451273320227578156598454035482869042774016000) over Number Field in a with defining polynomial x^2 - 5 with a = 2.236067977499790? - to Elliptic Curve defined by y^2 = x^3 + (39533118442361013730577638493616965245992960*a-88398740199669828340617478832005245173760000)*x + (214030321479466610282320528611562368963830105830555363061803253760*a-478586348074220699687616322532666163722004497458452316582576128000) over Number Field in a with defining polynomial x^2 - 5 with a = 2.236067977499790?] - - sage: K = QuadraticField(-66827,'a') - sage: a = K.gen() - sage: E = EllipticCurve_from_j(-98669236224000*a + 4401720074240000) + from Elliptic Curve defined by + y^2 = x^3 + (454562028554080355857852049849975895490560*a-1016431595837124114668689286176511361024000)*x + + (-249456798429896080881440540950393713303830363999480904280965120*a+557802358738710443451273320227578156598454035482869042774016000) + over Number Field in a with defining polynomial x^2 - 5 + with a = 2.236067977499790? + to Elliptic Curve defined by + y^2 = x^3 + (39533118442361013730577638493616965245992960*a-88398740199669828340617478832005245173760000)*x + + (214030321479466610282320528611562368963830105830555363061803253760*a-478586348074220699687616322532666163722004497458452316582576128000) + over Number Field in a with defining polynomial x^2 - 5 + with a = 2.236067977499790?] + + sage: K = QuadraticField(-66827,'a') # optional - sage.rings.number_field + sage: a = K.gen() # optional - sage.rings.number_field + sage: E = EllipticCurve_from_j(-98669236224000*a + 4401720074240000) # optional - sage.rings.number_field sage: isogenies_prime_degree_genus_plus_0(E, 59) # long time (5s) [Isogeny of degree 59 - from Elliptic Curve defined by y^2 = x^3 + (2605886146782144762297974784000*a+1893681048912773634944634716160000)*x + (-116918454256410782232296183198067568744071168000*a+17012043538294664027185882358514011304812871680000) over Number Field in a with defining polynomial x^2 + 66827 with a = 258.5091874576221?*I - to Elliptic Curve defined by y^2 = x^3 + (-19387084027159786821400775098368000*a-4882059104868154225052787156713472000)*x + (-25659862010101415428713331477227179429538847260672000*a-2596038148441293485938798119003462972840818381946880000) over Number Field in a with defining polynomial x^2 + 66827 with a = 258.5091874576221?*I] - - sage: E = EllipticCurve_from_j(GF(13)(5)) - sage: isogenies_prime_degree_genus_plus_0(E, 71) - [Isogeny of degree 71 from Elliptic Curve defined by y^2 = x^3 + x + 4 over Finite Field of size 13 to Elliptic Curve defined by y^2 = x^3 + 10*x + 7 over Finite Field of size 13, - Isogeny of degree 71 from Elliptic Curve defined by y^2 = x^3 + x + 4 over Finite Field of size 13 to Elliptic Curve defined by y^2 = x^3 + 10*x + 7 over Finite Field of size 13] - - sage: E = EllipticCurve(GF(13),[0,1,1,1,0]) - sage: isogenies_prime_degree_genus_plus_0(E) - [Isogeny of degree 17 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 10*x + 1 over Finite Field of size 13, - Isogeny of degree 17 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 12*x + 4 over Finite Field of size 13, - Isogeny of degree 29 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 12*x + 6 over Finite Field of size 13, - Isogeny of degree 29 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 5*x + 6 over Finite Field of size 13, - Isogeny of degree 41 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 12*x + 4 over Finite Field of size 13, - Isogeny of degree 41 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 5*x + 6 over Finite Field of size 13] + from Elliptic Curve defined by + y^2 = x^3 + (2605886146782144762297974784000*a+1893681048912773634944634716160000)*x + + (-116918454256410782232296183198067568744071168000*a+17012043538294664027185882358514011304812871680000) + over Number Field in a with defining polynomial x^2 + 66827 + with a = 258.5091874576221?*I + to Elliptic Curve defined by + y^2 = x^3 + (-19387084027159786821400775098368000*a-4882059104868154225052787156713472000)*x + + (-25659862010101415428713331477227179429538847260672000*a-2596038148441293485938798119003462972840818381946880000) + over Number Field in a with defining polynomial x^2 + 66827 + with a = 258.5091874576221?*I] + + sage: E = EllipticCurve_from_j(GF(13)(5)) # optional - sage.rings.finite_rings + sage: isogenies_prime_degree_genus_plus_0(E, 71) # optional - sage.rings.finite_rings + [Isogeny of degree 71 + from Elliptic Curve defined by y^2 = x^3 + x + 4 over Finite Field of size 13 + to Elliptic Curve defined by y^2 = x^3 + 10*x + 7 over Finite Field of size 13, + Isogeny of degree 71 + from Elliptic Curve defined by y^2 = x^3 + x + 4 over Finite Field of size 13 + to Elliptic Curve defined by y^2 = x^3 + 10*x + 7 over Finite Field of size 13] + + sage: E = EllipticCurve(GF(13), [0,1,1,1,0]) # optional - sage.rings.finite_rings + sage: isogenies_prime_degree_genus_plus_0(E) # optional - sage.rings.finite_rings + [Isogeny of degree 17 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 10*x + 1 over Finite Field of size 13, + Isogeny of degree 17 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 12*x + 4 over Finite Field of size 13, + Isogeny of degree 29 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 12*x + 6 over Finite Field of size 13, + Isogeny of degree 29 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 5*x + 6 over Finite Field of size 13, + Isogeny of degree 41 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 12*x + 4 over Finite Field of size 13, + Isogeny of degree 41 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 13 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 5*x + 6 over Finite Field of size 13] """ if l is None: return sum([isogenies_prime_degree_genus_plus_0(E, ell, minimal_models=minimal_models) @@ -1898,11 +2066,25 @@ def isogenies_prime_degree_genus_plus_0_j0(E, l, minimal_models=True): sage: from sage.schemes.elliptic_curves.isogeny_small_degree import isogenies_prime_degree_genus_plus_0_j0 sage: u = polygen(QQ) - sage: K. = NumberField(u^4 + 228*u^3 + 486*u^2 - 540*u + 225) - sage: E = EllipticCurve(K, [0,-121/5*a^3-20691/5*a^2-29403/5*a+3267]) - sage: isogenies_prime_degree_genus_plus_0_j0(E,11) - [Isogeny of degree 11 from Elliptic Curve defined by y^2 = x^3 + (-121/5*a^3-20691/5*a^2-29403/5*a+3267) over Number Field in a with defining polynomial x^4 + 228*x^3 + 486*x^2 - 540*x + 225 to Elliptic Curve defined by y^2 = x^3 + (-44286*a^2+178596*a-32670)*x + (-17863351/5*a^3+125072739/5*a^2-74353653/5*a-682803) over Number Field in a with defining polynomial x^4 + 228*x^3 + 486*x^2 - 540*x + 225, - Isogeny of degree 11 from Elliptic Curve defined by y^2 = x^3 + (-121/5*a^3-20691/5*a^2-29403/5*a+3267) over Number Field in a with defining polynomial x^4 + 228*x^3 + 486*x^2 - 540*x + 225 to Elliptic Curve defined by y^2 = x^3 + (-3267*a^3-740157*a^2+600039*a-277695)*x + (-17863351/5*a^3-4171554981/5*a^2+3769467867/5*a-272366523) over Number Field in a with defining polynomial x^4 + 228*x^3 + 486*x^2 - 540*x + 225] + sage: K. = NumberField(u^4 + 228*u^3 + 486*u^2 - 540*u + 225) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0, -121/5*a^3 - 20691/5*a^2 - 29403/5*a + 3267]) # optional - sage.rings.number_field + sage: isogenies_prime_degree_genus_plus_0_j0(E, 11) # optional - sage.rings.number_field + [Isogeny of degree 11 + from Elliptic Curve defined by + y^2 = x^3 + (-121/5*a^3-20691/5*a^2-29403/5*a+3267) over + Number Field in a with defining polynomial x^4 + 228*x^3 + 486*x^2 - 540*x + 225 + to Elliptic Curve defined by + y^2 = x^3 + (-44286*a^2+178596*a-32670)*x + + (-17863351/5*a^3+125072739/5*a^2-74353653/5*a-682803) over + Number Field in a with defining polynomial x^4 + 228*x^3 + 486*x^2 - 540*x + 225, + Isogeny of degree 11 + from Elliptic Curve defined by + y^2 = x^3 + (-121/5*a^3-20691/5*a^2-29403/5*a+3267) over + Number Field in a with defining polynomial x^4 + 228*x^3 + 486*x^2 - 540*x + 225 + to Elliptic Curve defined by + y^2 = x^3 + (-3267*a^3-740157*a^2+600039*a-277695)*x + + (-17863351/5*a^3-4171554981/5*a^2+3769467867/5*a-272366523) over + Number Field in a with defining polynomial x^4 + 228*x^3 + 486*x^2 - 540*x + 225] sage: E = EllipticCurve(GF(5^6,'a'),[0,1]) sage: isogenies_prime_degree_genus_plus_0_j0(E,17) @@ -1986,26 +2168,48 @@ def isogenies_prime_degree_genus_plus_0_j1728(E, l, minimal_models=True): sage: from sage.schemes.elliptic_curves.isogeny_small_degree import isogenies_prime_degree_genus_plus_0_j1728 sage: u = polygen(QQ) - sage: K. = NumberField(u^6 - 522*u^5 - 10017*u^4 + 2484*u^3 - 5265*u^2 + 12150*u - 5103) - sage: E = EllipticCurve(K, [-75295/1335852*a^5+13066735/445284*a^4+44903485/74214*a^3+17086861/24738*a^2+11373021/16492*a-1246245/2356,0]) - sage: isogenies_prime_degree_genus_plus_0_j1728(E,11) + sage: K. = NumberField(u^6 - 522*u^5 - 10017*u^4 # optional - sage.rings.number_field + ....: + 2484*u^3 - 5265*u^2 + 12150*u - 5103) + sage: E = EllipticCurve(K, [-75295/1335852*a^5 + 13066735/445284*a^4 # optional - sage.rings.number_field + ....: + 44903485/74214*a^3 + 17086861/24738*a^2 + ....: + 11373021/16492*a - 1246245/2356, 0]) + sage: isogenies_prime_degree_genus_plus_0_j1728(E, 11) # optional - sage.rings.number_field [Isogeny of degree 11 - from Elliptic Curve defined by y^2 = x^3 + (-75295/1335852*a^5+13066735/445284*a^4+44903485/74214*a^3+17086861/24738*a^2+11373021/16492*a-1246245/2356)*x over Number Field in a with defining polynomial x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103 - to Elliptic Curve defined by y^2 = x^3 + (9110695/1335852*a^5-1581074935/445284*a^4-5433321685/74214*a^3-3163057249/24738*a^2+1569269691/16492*a+73825125/2356)*x + (-3540460*a^3+30522492*a^2-7043652*a-5031180) over Number Field in a with defining polynomial x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103, + from Elliptic Curve defined by + y^2 = x^3 + (-75295/1335852*a^5+13066735/445284*a^4+44903485/74214*a^3+17086861/24738*a^2+11373021/16492*a-1246245/2356)*x + over Number Field in a with defining polynomial + x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103 + to Elliptic Curve defined by + y^2 = x^3 + (9110695/1335852*a^5-1581074935/445284*a^4-5433321685/74214*a^3-3163057249/24738*a^2+1569269691/16492*a+73825125/2356)*x + + (-3540460*a^3+30522492*a^2-7043652*a-5031180) + over Number Field in a with defining polynomial + x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103, Isogeny of degree 11 - from Elliptic Curve defined by y^2 = x^3 + (-75295/1335852*a^5+13066735/445284*a^4+44903485/74214*a^3+17086861/24738*a^2+11373021/16492*a-1246245/2356)*x over Number Field in a with defining polynomial x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103 - to Elliptic Curve defined by y^2 = x^3 + (9110695/1335852*a^5-1581074935/445284*a^4-5433321685/74214*a^3-3163057249/24738*a^2+1569269691/16492*a+73825125/2356)*x + (3540460*a^3-30522492*a^2+7043652*a+5031180) over Number Field in a with defining polynomial x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103] - sage: i = QuadraticField(-1,'i').gen() - sage: E = EllipticCurve([-1-2*i, 0]) - sage: isogenies_prime_degree_genus_plus_0_j1728(E, 17) + from Elliptic Curve defined by + y^2 = x^3 + (-75295/1335852*a^5+13066735/445284*a^4+44903485/74214*a^3+17086861/24738*a^2+11373021/16492*a-1246245/2356)*x + over Number Field in a with defining polynomial + x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103 + to Elliptic Curve defined by + y^2 = x^3 + (9110695/1335852*a^5-1581074935/445284*a^4-5433321685/74214*a^3-3163057249/24738*a^2+1569269691/16492*a+73825125/2356)*x + + (3540460*a^3-30522492*a^2+7043652*a+5031180) + over Number Field in a with defining polynomial + x^6 - 522*x^5 - 10017*x^4 + 2484*x^3 - 5265*x^2 + 12150*x - 5103] + sage: i = QuadraticField(-1,'i').gen() # optional - sage.rings.number_field + sage: E = EllipticCurve([-1 - 2*i, 0]) # optional - sage.rings.number_field + sage: isogenies_prime_degree_genus_plus_0_j1728(E, 17) # optional - sage.rings.number_field [Isogeny of degree 17 - from Elliptic Curve defined by y^2 = x^3 + (-2*i-1)*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I - to Elliptic Curve defined by y^2 = x^3 + (-82*i-641)*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I, + from Elliptic Curve defined by y^2 = x^3 + (-2*i-1)*x + over Number Field in i with defining polynomial x^2 + 1 with i = 1*I + to Elliptic Curve defined by y^2 = x^3 + (-82*i-641)*x + over Number Field in i with defining polynomial x^2 + 1 with i = 1*I, Isogeny of degree 17 - from Elliptic Curve defined by y^2 = x^3 + (-2*i-1)*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I - to Elliptic Curve defined by y^2 = x^3 + (-562*i+319)*x over Number Field in i with defining polynomial x^2 + 1 with i = 1*I] - sage: Emin = E.global_minimal_model() - sage: [(p,len(isogenies_prime_degree_genus_plus_0_j1728(Emin,p))) for p in [17, 29, 41]] + from Elliptic Curve defined by y^2 = x^3 + (-2*i-1)*x + over Number Field in i with defining polynomial x^2 + 1 with i = 1*I + to Elliptic Curve defined by y^2 = x^3 + (-562*i+319)*x + over Number Field in i with defining polynomial x^2 + 1 with i = 1*I] + sage: Emin = E.global_minimal_model() # optional - sage.rings.number_field + sage: [(p, len(isogenies_prime_degree_genus_plus_0_j1728(Emin, p))) # optional - sage.rings.number_field + ....: for p in [17, 29, 41]] [(17, 2), (29, 2), (41, 2)] """ if l not in hyperelliptic_primes: @@ -2138,13 +2342,13 @@ def is_kernel_polynomial(E, m, f): into 14 factors each of degree 6, but only two of these is a kernel polynomial for a 13-isogeny:: - sage: F = GF(3) - sage: E = EllipticCurve(F, [0,0,0,-1,0]) - sage: f13 = E.division_polynomial(13) - sage: factors = [f for f, e in f13.factor()] - sage: all(f.degree() == 6 for f in factors) + sage: F = GF(3) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F, [0,0,0,-1,0]) # optional - sage.rings.finite_rings + sage: f13 = E.division_polynomial(13) # optional - sage.rings.finite_rings + sage: factors = [f for f, e in f13.factor()] # optional - sage.rings.finite_rings + sage: all(f.degree() == 6 for f in factors) # optional - sage.rings.finite_rings True - sage: [is_kernel_polynomial(E, 13, f) for f in factors] + sage: [is_kernel_polynomial(E, 13, f) for f in factors] # optional - sage.rings.finite_rings [True, True, False, @@ -2162,15 +2366,15 @@ def is_kernel_polynomial(E, m, f): See :trac:`22232`:: - sage: K = GF(47^2) - sage: E = EllipticCurve([0, K.gen()]) - sage: psi7 = E.division_polynomial(7) - sage: f = psi7.factor()[4][0] - sage: f + sage: K = GF(47^2) # optional - sage.rings.finite_rings + sage: E = EllipticCurve([0, K.gen()]) # optional - sage.rings.finite_rings + sage: psi7 = E.division_polynomial(7) # optional - sage.rings.finite_rings + sage: f = psi7.factor()[4][0] # optional - sage.rings.finite_rings + sage: f # optional - sage.rings.finite_rings x^3 + (7*z2 + 11)*x^2 + (25*z2 + 33)*x + 25*z2 - sage: f.divides(psi7) + sage: f.divides(psi7) # optional - sage.rings.finite_rings True - sage: is_kernel_polynomial(E, 7, f) + sage: is_kernel_polynomial(E, 7, f) # optional - sage.rings.finite_rings False """ m2 = m // 2 @@ -2236,28 +2440,57 @@ def isogenies_prime_degree_general(E, l, minimal_models=True): EXAMPLES:: sage: from sage.schemes.elliptic_curves.isogeny_small_degree import isogenies_prime_degree_general - sage: E = EllipticCurve_from_j(GF(2^6,'a')(1)) - sage: isogenies_prime_degree_general(E, 7) - [Isogeny of degree 7 from Elliptic Curve defined by y^2 + x*y = x^3 + 1 over Finite Field in a of size 2^6 to Elliptic Curve defined by y^2 + x*y = x^3 + x over Finite Field in a of size 2^6] - sage: E = EllipticCurve_from_j(GF(3^12,'a')(2)) - sage: isogenies_prime_degree_general(E, 17) - [Isogeny of degree 17 from Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2 over Finite Field in a of size 3^12 to Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2*x over Finite Field in a of size 3^12, - Isogeny of degree 17 from Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2 over Finite Field in a of size 3^12 to Elliptic Curve defined by y^2 = x^3 + 2*x^2 + x + 2 over Finite Field in a of size 3^12] + sage: E = EllipticCurve_from_j(GF(2^6,'a')(1)) # optional - sage.rings.finite_rings + sage: isogenies_prime_degree_general(E, 7) # optional - sage.rings.finite_rings + [Isogeny of degree 7 + from Elliptic Curve defined by y^2 + x*y = x^3 + 1 + over Finite Field in a of size 2^6 + to Elliptic Curve defined by y^2 + x*y = x^3 + x + over Finite Field in a of size 2^6] + sage: E = EllipticCurve_from_j(GF(3^12,'a')(2)) # optional - sage.rings.finite_rings + sage: isogenies_prime_degree_general(E, 17) # optional - sage.rings.finite_rings + [Isogeny of degree 17 + from Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2 + over Finite Field in a of size 3^12 + to Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2*x + over Finite Field in a of size 3^12, + Isogeny of degree 17 + from Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2 + over Finite Field in a of size 3^12 + to Elliptic Curve defined by y^2 = x^3 + 2*x^2 + x + 2 + over Finite Field in a of size 3^12] sage: E = EllipticCurve('50a1') sage: isogenies_prime_degree_general(E, 3) - [Isogeny of degree 3 from Elliptic Curve defined by y^2 + x*y + y = x^3 - x - 2 over Rational Field to Elliptic Curve defined by y^2 + x*y + y = x^3 - 126*x - 552 over Rational Field] + [Isogeny of degree 3 + from Elliptic Curve defined by y^2 + x*y + y = x^3 - x - 2 over Rational Field + to Elliptic Curve defined by y^2 + x*y + y = x^3 - 126*x - 552 + over Rational Field] sage: isogenies_prime_degree_general(E, 5) - [Isogeny of degree 5 from Elliptic Curve defined by y^2 + x*y + y = x^3 - x - 2 over Rational Field to Elliptic Curve defined by y^2 + x*y + y = x^3 - 76*x + 298 over Rational Field] + [Isogeny of degree 5 + from Elliptic Curve defined by y^2 + x*y + y = x^3 - x - 2 over Rational Field + to Elliptic Curve defined by y^2 + x*y + y = x^3 - 76*x + 298 + over Rational Field] sage: E = EllipticCurve([0, 0, 1, -1862, -30956]) sage: isogenies_prime_degree_general(E, 19) - [Isogeny of degree 19 from Elliptic Curve defined by y^2 + y = x^3 - 1862*x - 30956 over Rational Field to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 over Rational Field] + [Isogeny of degree 19 + from Elliptic Curve defined by y^2 + y = x^3 - 1862*x - 30956 + over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 + over Rational Field] sage: E = EllipticCurve([0, -1, 0, -6288, 211072]) sage: isogenies_prime_degree_general(E, 37) # long time (2s) - [Isogeny of degree 37 from Elliptic Curve defined by y^2 = x^3 - x^2 - 6288*x + 211072 over Rational Field to Elliptic Curve defined by y^2 = x^3 - x^2 - 163137088*x - 801950801728 over Rational Field] + [Isogeny of degree 37 + from Elliptic Curve defined by y^2 = x^3 - x^2 - 6288*x + 211072 + over Rational Field + to Elliptic Curve defined by y^2 = x^3 - x^2 - 163137088*x - 801950801728 + over Rational Field] sage: E = EllipticCurve([-3440, 77658]) sage: isogenies_prime_degree_general(E, 43) # long time (2s) - [Isogeny of degree 43 from Elliptic Curve defined by y^2 = x^3 - 3440*x + 77658 over Rational Field to Elliptic Curve defined by y^2 = x^3 - 6360560*x - 6174354606 over Rational Field] + [Isogeny of degree 43 + from Elliptic Curve defined by y^2 = x^3 - 3440*x + 77658 over Rational Field + to Elliptic Curve defined by y^2 = x^3 - 6360560*x - 6174354606 + over Rational Field] Isogenies of degree equal to the characteristic are computed (but only the separable isogeny). In the following example we consider @@ -2266,15 +2499,33 @@ def isogenies_prime_degree_general(E, l, minimal_models=True): sage: from sage.schemes.elliptic_curves.isogeny_small_degree import isogenies_prime_degree_general sage: ainvs = (0,1,1,-1,-1) - sage: for l in prime_range(50): + sage: for l in prime_range(50): # optional - sage.rings.finite_rings ....: E = EllipticCurve(GF(l),ainvs) ....: isogenies_prime_degree_general(E,l) [] - [Isogeny of degree 3 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 2*x + 2 over Finite Field of size 3 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 3] - [Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 4*x + 4 over Finite Field of size 5 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 4*x + 4 over Finite Field of size 5] - [Isogeny of degree 7 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 6*x + 6 over Finite Field of size 7 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 4 over Finite Field of size 7] - [Isogeny of degree 11 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 10*x + 10 over Finite Field of size 11 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + x + 1 over Finite Field of size 11] - [Isogeny of degree 13 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 12*x + 12 over Finite Field of size 13 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 12*x + 12 over Finite Field of size 13] + [Isogeny of degree 3 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 2*x + 2 + over Finite Field of size 3 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 3] + [Isogeny of degree 5 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 4*x + 4 + over Finite Field of size 5 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 4*x + 4 + over Finite Field of size 5] + [Isogeny of degree 7 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 6*x + 6 + over Finite Field of size 7 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 4 over Finite Field of size 7] + [Isogeny of degree 11 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 10*x + 10 + over Finite Field of size 11 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + x + 1 + over Finite Field of size 11] + [Isogeny of degree 13 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 12*x + 12 + over Finite Field of size 13 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 12*x + 12 + over Finite Field of size 13] [Isogeny of degree 17 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 16*x + 16 over Finite Field of size 17 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 15 over Finite Field of size 17] [Isogeny of degree 19 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 18*x + 18 over Finite Field of size 19 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 3*x + 12 over Finite Field of size 19] [Isogeny of degree 23 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 22*x + 22 over Finite Field of size 23 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 22*x + 22 over Finite Field of size 23] @@ -2285,33 +2536,35 @@ def isogenies_prime_degree_general(E, l, minimal_models=True): [Isogeny of degree 43 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 42*x + 42 over Finite Field of size 43 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 36 over Finite Field of size 43] [Isogeny of degree 47 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 46*x + 46 over Finite Field of size 47 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 42*x + 34 over Finite Field of size 47] - Note that not all factors of degree (l-1)/2 of the l-division + Note that not all factors of degree `(l-1)/2` of the `l`-division polynomial are kernel polynomials. In this example, the 13-division polynomial factors as a product of 14 irreducible factors of degree 6 each, but only two those are kernel polynomials:: - sage: F3 = GF(3) - sage: E = EllipticCurve(F3,[0,0,0,-1,0]) - sage: Psi13 = E.division_polynomial(13) - sage: len([f for f,e in Psi13.factor() if f.degree()==6]) + sage: F3 = GF(3) # optional - sage.rings.finite_rings + sage: E = EllipticCurve(F3, [0,0,0,-1,0]) # optional - sage.rings.finite_rings + sage: Psi13 = E.division_polynomial(13) # optional - sage.rings.finite_rings + sage: len([f for f, e in Psi13.factor() if f.degree() == 6]) # optional - sage.rings.finite_rings 14 - sage: len(E.isogenies_prime_degree(13)) + sage: len(E.isogenies_prime_degree(13)) # optional - sage.rings.finite_rings 2 Over GF(9) the other factors of degree 6 split into pairs of cubics which can be rearranged to give the remaining 12 kernel polynomials:: - sage: len(E.change_ring(GF(3^2,'a')).isogenies_prime_degree(13)) + sage: len(E.change_ring(GF(3^2,'a')).isogenies_prime_degree(13)) # optional - sage.rings.finite_rings 14 See :trac:`18589`: the following example took 20s before, now only 4s:: - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve(K,[0,0,0,1,0]) - sage: [phi.codomain().ainvs() for phi in E.isogenies_prime_degree(37)] # long time (6s) - [(0, 0, 0, -840*i + 1081, 0), (0, 0, 0, 840*i + 1081, 0)] + sage: K. = QuadraticField(-1) # optional - sage.rings.number_field + sage: E = EllipticCurve(K,[0,0,0,1,0]) # optional - sage.rings.number_field + sage: [phi.codomain().ainvs() # long time (6s) # optional - sage.rings.number_field + ....: for phi in E.isogenies_prime_degree(37)] + [(0, 0, 0, -840*i + 1081, 0), + (0, 0, 0, 840*i + 1081, 0)] """ if not l.is_prime(): raise ValueError("%s is not prime." % l) @@ -2411,24 +2664,48 @@ def isogenies_prime_degree(E, l, minimal_models=True): EXAMPLES:: sage: from sage.schemes.elliptic_curves.isogeny_small_degree import isogenies_prime_degree - sage: E = EllipticCurve_from_j(GF(2^6,'a')(1)) - sage: isogenies_prime_degree(E, 7) - [Isogeny of degree 7 from Elliptic Curve defined by y^2 + x*y = x^3 + 1 over Finite Field in a of size 2^6 to Elliptic Curve defined by y^2 + x*y = x^3 + x over Finite Field in a of size 2^6] - sage: E = EllipticCurve_from_j(GF(3^12,'a')(2)) - sage: isogenies_prime_degree(E, 17) - [Isogeny of degree 17 from Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2 over Finite Field in a of size 3^12 to Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2*x over Finite Field in a of size 3^12, - Isogeny of degree 17 from Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2 over Finite Field in a of size 3^12 to Elliptic Curve defined by y^2 = x^3 + 2*x^2 + x + 2 over Finite Field in a of size 3^12] + sage: E = EllipticCurve_from_j(GF(2^6,'a')(1)) # optional - sage.rings.finite_rings + sage: isogenies_prime_degree(E, 7) # optional - sage.rings.finite_rings + [Isogeny of degree 7 + from Elliptic Curve defined by y^2 + x*y = x^3 + 1 + over Finite Field in a of size 2^6 + to Elliptic Curve defined by y^2 + x*y = x^3 + x + over Finite Field in a of size 2^6] + sage: E = EllipticCurve_from_j(GF(3^12,'a')(2)) # optional - sage.rings.finite_rings + sage: isogenies_prime_degree(E, 17) # optional - sage.rings.finite_rings + [Isogeny of degree 17 + from Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2 + over Finite Field in a of size 3^12 + to Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2*x + over Finite Field in a of size 3^12, + Isogeny of degree 17 + from Elliptic Curve defined by y^2 = x^3 + 2*x^2 + 2 + over Finite Field in a of size 3^12 + to Elliptic Curve defined by y^2 = x^3 + 2*x^2 + x + 2 + over Finite Field in a of size 3^12] sage: E = EllipticCurve('50a1') sage: isogenies_prime_degree(E, 3) - [Isogeny of degree 3 from Elliptic Curve defined by y^2 + x*y + y = x^3 - x - 2 over Rational Field to Elliptic Curve defined by y^2 + x*y + y = x^3 - 126*x - 552 over Rational Field] + [Isogeny of degree 3 + from Elliptic Curve defined by y^2 + x*y + y = x^3 - x - 2 over Rational Field + to Elliptic Curve defined by y^2 + x*y + y = x^3 - 126*x - 552 over Rational Field] sage: isogenies_prime_degree(E, 5) - [Isogeny of degree 5 from Elliptic Curve defined by y^2 + x*y + y = x^3 - x - 2 over Rational Field to Elliptic Curve defined by y^2 + x*y + y = x^3 - 76*x + 298 over Rational Field] + [Isogeny of degree 5 + from Elliptic Curve defined by y^2 + x*y + y = x^3 - x - 2 over Rational Field + to Elliptic Curve defined by y^2 + x*y + y = x^3 - 76*x + 298 over Rational Field] sage: E = EllipticCurve([0, 0, 1, -1862, -30956]) sage: isogenies_prime_degree(E, 19) - [Isogeny of degree 19 from Elliptic Curve defined by y^2 + y = x^3 - 1862*x - 30956 over Rational Field to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 over Rational Field] + [Isogeny of degree 19 + from Elliptic Curve defined by y^2 + y = x^3 - 1862*x - 30956 + over Rational Field + to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 + over Rational Field] sage: E = EllipticCurve([0, -1, 0, -6288, 211072]) sage: isogenies_prime_degree(E, 37) - [Isogeny of degree 37 from Elliptic Curve defined by y^2 = x^3 - x^2 - 6288*x + 211072 over Rational Field to Elliptic Curve defined by y^2 = x^3 - x^2 - 163137088*x - 801950801728 over Rational Field] + [Isogeny of degree 37 + from Elliptic Curve defined by y^2 = x^3 - x^2 - 6288*x + 211072 + over Rational Field + to Elliptic Curve defined by y^2 = x^3 - x^2 - 163137088*x - 801950801728 + over Rational Field] Isogenies of degree equal to the characteristic are computed (but only the separable isogeny). In the following example we consider @@ -2437,43 +2714,85 @@ def isogenies_prime_degree(E, l, minimal_models=True): sage: from sage.schemes.elliptic_curves.isogeny_small_degree import isogenies_prime_degree sage: ainvs = (0,1,1,-1,-1) - sage: for l in prime_range(50): - ....: E = EllipticCurve(GF(l),ainvs) - ....: isogenies_prime_degree(E,l) + sage: for l in prime_range(50): # optional - sage.rings.finite_rings + ....: E = EllipticCurve(GF(l), ainvs) + ....: isogenies_prime_degree(E, l) [] - [Isogeny of degree 3 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 2*x + 2 over Finite Field of size 3 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 3] - [Isogeny of degree 5 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 4*x + 4 over Finite Field of size 5 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 4*x + 4 over Finite Field of size 5] - [Isogeny of degree 7 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 6*x + 6 over Finite Field of size 7 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 4 over Finite Field of size 7] - [Isogeny of degree 11 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 10*x + 10 over Finite Field of size 11 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + x + 1 over Finite Field of size 11] - [Isogeny of degree 13 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 12*x + 12 over Finite Field of size 13 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 12*x + 12 over Finite Field of size 13] - [Isogeny of degree 17 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 16*x + 16 over Finite Field of size 17 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 15 over Finite Field of size 17] - [Isogeny of degree 19 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 18*x + 18 over Finite Field of size 19 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 3*x + 12 over Finite Field of size 19] - [Isogeny of degree 23 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 22*x + 22 over Finite Field of size 23 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 22*x + 22 over Finite Field of size 23] - [Isogeny of degree 29 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 28*x + 28 over Finite Field of size 29 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 7*x + 27 over Finite Field of size 29] - [Isogeny of degree 31 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 30*x + 30 over Finite Field of size 31 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 15*x + 16 over Finite Field of size 31] - [Isogeny of degree 37 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 36*x + 36 over Finite Field of size 37 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 16*x + 17 over Finite Field of size 37] - [Isogeny of degree 41 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 40*x + 40 over Finite Field of size 41 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 33*x + 16 over Finite Field of size 41] - [Isogeny of degree 43 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 42*x + 42 over Finite Field of size 43 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 36 over Finite Field of size 43] - [Isogeny of degree 47 from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 46*x + 46 over Finite Field of size 47 to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 42*x + 34 over Finite Field of size 47] + [Isogeny of degree 3 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 2*x + 2 over Finite Field of size 3 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + x over Finite Field of size 3] + [Isogeny of degree 5 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 4*x + 4 over Finite Field of size 5 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 4*x + 4 over Finite Field of size 5] + [Isogeny of degree 7 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 6*x + 6 over Finite Field of size 7 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 4 over Finite Field of size 7] + [Isogeny of degree 11 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 10*x + 10 over Finite Field of size 11 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + x + 1 over Finite Field of size 11] + [Isogeny of degree 13 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 12*x + 12 over Finite Field of size 13 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 12*x + 12 over Finite Field of size 13] + [Isogeny of degree 17 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 16*x + 16 over Finite Field of size 17 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 15 over Finite Field of size 17] + [Isogeny of degree 19 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 18*x + 18 over Finite Field of size 19 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 3*x + 12 over Finite Field of size 19] + [Isogeny of degree 23 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 22*x + 22 over Finite Field of size 23 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 22*x + 22 over Finite Field of size 23] + [Isogeny of degree 29 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 28*x + 28 over Finite Field of size 29 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 7*x + 27 over Finite Field of size 29] + [Isogeny of degree 31 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 30*x + 30 over Finite Field of size 31 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 15*x + 16 over Finite Field of size 31] + [Isogeny of degree 37 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 36*x + 36 over Finite Field of size 37 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 16*x + 17 over Finite Field of size 37] + [Isogeny of degree 41 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 40*x + 40 over Finite Field of size 41 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 33*x + 16 over Finite Field of size 41] + [Isogeny of degree 43 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 42*x + 42 over Finite Field of size 43 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 36 over Finite Field of size 43] + [Isogeny of degree 47 + from Elliptic Curve defined by y^2 + y = x^3 + x^2 + 46*x + 46 over Finite Field of size 47 + to Elliptic Curve defined by y^2 + y = x^3 + x^2 + 42*x + 34 over Finite Field of size 47] Note that the computation is faster for degrees equal to one of the genus 0 primes (2, 3, 5, 7, 13) or one of the hyperelliptic primes (11, 17, 19, 23, 29, 31, 41, 47, 59, 71) than when the generic code must be used:: - sage: E = EllipticCurve(GF(101), [-3440, 77658]) - sage: E.isogenies_prime_degree(71) # fast + sage: E = EllipticCurve(GF(101), [-3440, 77658]) # optional - sage.rings.finite_rings + sage: E.isogenies_prime_degree(71) # fast # optional - sage.rings.finite_rings [] - sage: E.isogenies_prime_degree(73) # long time (2s) + sage: E.isogenies_prime_degree(73) # long time (2s) # optional - sage.rings.finite_rings [] Test that :trac:`32269` is fixed:: - sage: K = QuadraticField(-11) - sage: E = EllipticCurve(K, [0,1,0,-117,-541]) - sage: E.isogenies_prime_degree(37) # long time (9s) - [Isogeny of degree 37 from Elliptic Curve defined by y^2 = x^3 + x^2 + (-117)*x + (-541) over Number Field in a with defining polynomial x^2 + 11 with a = 3.316624790355400?*I to Elliptic Curve defined by y^2 = x^3 + x^2 + (30800*a+123963)*x + (3931312*a-21805005) over Number Field in a with defining polynomial x^2 + 11 with a = 3.316624790355400?*I, - Isogeny of degree 37 from Elliptic Curve defined by y^2 = x^3 + x^2 + (-117)*x + (-541) over Number Field in a with defining polynomial x^2 + 11 with a = 3.316624790355400?*I to Elliptic Curve defined by y^2 = x^3 + x^2 + (-30800*a+123963)*x + (-3931312*a-21805005) over Number Field in a with defining polynomial x^2 + 11 with a = 3.316624790355400?*I] + sage: K = QuadraticField(-11) # optional - sage.rings.number_field + sage: E = EllipticCurve(K, [0,1,0,-117,-541]) # optional - sage.rings.number_field + sage: E.isogenies_prime_degree(37) # long time (9s) # optional - sage.rings.number_field + [Isogeny of degree 37 + from Elliptic Curve defined by y^2 = x^3 + x^2 + (-117)*x + (-541) + over Number Field in a with defining polynomial x^2 + 11 + with a = 3.316624790355400?*I + to Elliptic Curve defined by + y^2 = x^3 + x^2 + (30800*a+123963)*x + (3931312*a-21805005) + over Number Field in a with defining polynomial x^2 + 11 + with a = 3.316624790355400?*I, + Isogeny of degree 37 + from Elliptic Curve defined by y^2 = x^3 + x^2 + (-117)*x + (-541) + over Number Field in a with defining polynomial x^2 + 11 + with a = 3.316624790355400?*I + to Elliptic Curve defined by + y^2 = x^3 + x^2 + (-30800*a+123963)*x + (-3931312*a-21805005) + over Number Field in a with defining polynomial x^2 + 11 + with a = 3.316624790355400?*I] """ if not l.is_prime(): raise ValueError("%s is not prime."%l) From 3b34a780d4e100bcaa10538379af18dac49376fd Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 30 Mar 2023 04:27:13 -0700 Subject: [PATCH 107/135] src/sage/schemes/overview.py: Fix up # optional --- src/sage/schemes/overview.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/schemes/overview.py b/src/sage/schemes/overview.py index e210d76f76b..bd83daafac0 100644 --- a/src/sage/schemes/overview.py +++ b/src/sage/schemes/overview.py @@ -117,9 +117,9 @@ :: sage: R. = ZZ[] - sage: S. = R.quo(x^2 + 5) # optional - sage.rings.number_field - sage: P. = ProjectiveSpace(2, S) # optional - sage.rings.number_field - sage: P(S) # optional - sage.rings.number_field + sage: S. = R.quo(x^2 + 5) + sage: P. = ProjectiveSpace(2, S) + sage: P(S) Set of rational points of Projective Space of dimension 2 over Univariate Quotient Polynomial Ring in t over Integer Ring with modulus x^2 + 5 @@ -132,7 +132,7 @@ :: - sage: P([2, 1 + t]) # optional - sage.rings.number_field + sage: P([2, 1 + t]) (2 : t + 1 : 1) In fact, we need a test ``R.ideal([2, 1 + t]) == R.ideal([1])`` in order to make From a9588d129682a1c16e0a061b0aaf92ffbff7db3f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 30 Mar 2023 11:07:29 -0700 Subject: [PATCH 108/135] src/sage/schemes/{affine,projective}: Cosmetic changes to doctests --- src/sage/schemes/affine/affine_morphism.py | 36 +++++++++---------- src/sage/schemes/affine/affine_space.py | 20 +++++------ src/sage/schemes/affine/affine_subscheme.py | 10 +++--- .../schemes/projective/projective_morphism.py | 18 +++++----- .../schemes/projective/projective_point.py | 11 +++--- .../schemes/projective/projective_space.py | 13 ++++--- 6 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py index 4025f2085fc..ed82a6d52bf 100644 --- a/src/sage/schemes/affine/affine_morphism.py +++ b/src/sage/schemes/affine/affine_morphism.py @@ -140,7 +140,7 @@ def __init__(self, parent, polys, check=True): sage: H = Hom(X, X) sage: H([9/4*x^2, 3/2*y]) Scheme endomorphism of Closed subscheme of Affine Space of dimension 2 - over Rational Field defined by: -y^2 + x + over Rational Field defined by: -y^2 + x Defn: Defined on coordinates by sending (x, y) to (9/4*x^2, 3/2*y) sage: P. = ProjectiveSpace(ZZ, 2) @@ -159,7 +159,7 @@ def __init__(self, parent, polys, check=True): sage: u,v,w = X.coordinate_ring().gens() sage: H([u, v, u + v]) Scheme endomorphism of Closed subscheme of Affine Space of dimension 3 - over Rational Field defined by: x - y + over Rational Field defined by: x - y Defn: Defined on coordinates by sending (x, y, z) to (y, y, 2*y) You must use the ambient space variables to create rational functions:: @@ -174,7 +174,7 @@ def __init__(self, parent, polys, check=True): ArithmeticError: Division failed. The numerator is not a multiple of the denominator. sage: H([x, y, (x+1)/y]) Scheme endomorphism of Closed subscheme of Affine Space of dimension 3 - over Rational Field defined by: + over Rational Field defined by: x^2 - y^2 Defn: Defined on coordinates by sending (x, y, z) to (x, y, (x + 1)/y) @@ -187,7 +187,7 @@ def __init__(self, parent, polys, check=True): sage: H = End(X) sage: H([x^2/(t*y), t*y^2, x*z]) Scheme endomorphism of Closed subscheme of Affine Space of dimension 3 - over Univariate Polynomial Ring in t over Rational Field defined by: + over Univariate Polynomial Ring in t over Rational Field defined by: x^2 - y^2 Defn: Defined on coordinates by sending (x, y, z) to (x^2/(t*y), t*y^2, x*z) @@ -459,7 +459,7 @@ def homogenize(self, n): sage: f = H([(x^2-2)/(x*y), y^2 - x]) sage: f.homogenize((2, 0)) Scheme endomorphism of Projective Space of dimension 2 - over Complex Field with 53 bits of precision + over Complex Field with 53 bits of precision Defn: Defined on coordinates by sending (x0 : x1 : x2) to (x0*x1*x2^2 : x0^2*x2^2 + (-2.00000000000000)*x2^4 : x0*x1^3 - x0^2*x1*x2) @@ -471,7 +471,7 @@ def homogenize(self, n): sage: f = H([9*y^2, 3*y]) sage: f.homogenize(2) Scheme endomorphism of Closed subscheme of Projective Space - of dimension 2 over Integer Ring defined by: x1^2 - x0*x2 + of dimension 2 over Integer Ring defined by: x1^2 - x0*x2 Defn: Defined on coordinates by sending (x0 : x1 : x2) to (9*x1^2 : 3*x1*x2 : x2^2) @@ -483,7 +483,7 @@ def homogenize(self, n): sage: f = H([(x^2-2)/y, y^2 - x]) sage: f.homogenize((2, 0)) Scheme endomorphism of Projective Space of dimension 2 - over Univariate Polynomial Ring in t over Integer Ring + over Univariate Polynomial Ring in t over Integer Ring Defn: Defined on coordinates by sending (x0 : x1 : x2) to (x1*x2^2 : x0^2*x2 + (-2)*x2^3 : x1^3 - x0*x1*x2) @@ -505,7 +505,7 @@ def homogenize(self, n): sage: f = H([QQbar(sqrt(2))*x*y, a*x^2]) # optional - sage.rings.number_field sage.symbolic sage: f.homogenize(2) # optional - sage.rings.number_field sage.symbolic Scheme endomorphism of Projective Space of dimension 2 - over Univariate Polynomial Ring in a over Algebraic Field + over Univariate Polynomial Ring in a over Algebraic Field Defn: Defined on coordinates by sending (x0 : x1 : x2) to (1.414213562373095?*x0*x1 : a*x0^2 : x2^2) @@ -523,8 +523,8 @@ def homogenize(self, n): sage: A. = AffineSpace(K, 1) sage: f = Hom(A, A)([x^2 + c]) sage: f.homogenize(1) - Scheme endomorphism of Projective Space of - dimension 1 over Rational function field in c over Rational Field + Scheme endomorphism of Projective Space of dimension 1 + over Rational function field in c over Rational Field Defn: Defined on coordinates by sending (x0 : x1) to (x0^2 + c*x1^2 : x1^2) @@ -535,7 +535,7 @@ def homogenize(self, n): sage: f = H([2*z / (z^2 + 2*z + 3)]) # optional - sage.rings.number_field sage: f.homogenize(1) # optional - sage.rings.number_field Scheme endomorphism of Projective Space of dimension 1 - over Algebraic Field + over Algebraic Field Defn: Defined on coordinates by sending (x0 : x1) to (x0*x1 : 1/2*x0^2 + x0*x1 + 3/2*x1^2) @@ -547,7 +547,7 @@ def homogenize(self, n): sage: F = H([d*x^2 + c]) # optional - sage.rings.number_field sage: F.homogenize(1) # optional - sage.rings.number_field Scheme endomorphism of Projective Space of dimension 1 - over Multivariate Polynomial Ring in c, d over Algebraic Field + over Multivariate Polynomial Ring in c, d over Algebraic Field Defn: Defined on coordinates by sending (x0 : x1) to (d*x0^2 + c*x1^2 : x1^2) @@ -1103,7 +1103,7 @@ def reduce_base_field(self): sage: f = H([x^2 + 2*(t^3 + t^2 + t + 3)]) # optional - sage.rings.finite_rings sage: f.reduce_base_field() # optional - sage.rings.finite_rings Scheme endomorphism of Affine Space of dimension 1 - over Finite Field in t2 of size 5^2 + over Finite Field in t2 of size 5^2 Defn: Defined on coordinates by sending (x) to (x^2 + (2*t2)) sage: f2 = H2([x^2 + 4, 2*x]) # optional - sage.rings.finite_rings sage: f2.reduce_base_field() # optional - sage.rings.finite_rings @@ -1125,8 +1125,8 @@ def reduce_base_field(self): sage: H = End(A) # optional - sage.rings.number_field sage: f = H([x^2 + v]) # optional - sage.rings.number_field sage: g = f.reduce_base_field(); g # optional - sage.rings.number_field - Scheme endomorphism of Affine Space of dimension 1 over - Cyclotomic Field of order 4 and degree 2 + Scheme endomorphism of Affine Space of dimension 1 + over Cyclotomic Field of order 4 and degree 2 Defn: Defined on coordinates by sending (x) to (x^2 + v) sage: g.base_ring() is K # optional - sage.rings.number_field True @@ -1151,7 +1151,7 @@ def reduce_base_field(self): sage: f.reduce_base_field() # optional - sage.rings.number_field Scheme endomorphism of Affine Space of dimension 1 over Number Field in a with defining polynomial y^6 + 6*y^4 - 6*y^3 + 12*y^2 + 36*y + 17 - with a = 1.442249570307409? + 1.414213562373095?*I + with a = 1.442249570307409? + 1.414213562373095?*I Defn: Defined on coordinates by sending (x) to ((-48/269*a^5 + 27/269*a^4 - 320/269*a^3 + 468/269*a^2 - 772/269*a - 1092/269)*x^2 + (48/269*a^5 - 27/269*a^4 + 320/269*a^3 - 468/269*a^2 @@ -1191,8 +1191,8 @@ def reduce_base_field(self): sage: H = End(A) # optional - sage.rings.finite_rings sage: f = H([x^2 + x*(t^3 + 2*t^2 + 4*t) + (t^5 + 3*t^4 + t^2 + 4*t)]) # optional - sage.rings.finite_rings sage: f.reduce_base_field() # optional - sage.rings.finite_rings - Scheme endomorphism of Affine Space of dimension 1 over - Finite Field in t of size 5^6 + Scheme endomorphism of Affine Space of dimension 1 + over Finite Field in t of size 5^6 Defn: Defined on coordinates by sending (x) to (x^2 + (t^3 + 2*t^2 - t)*x + (t^5 - 2*t^4 + t^2 - t)) """ diff --git a/src/sage/schemes/affine/affine_space.py b/src/sage/schemes/affine/affine_space.py index cdacc283b1c..3319950fcbc 100644 --- a/src/sage/schemes/affine/affine_space.py +++ b/src/sage/schemes/affine/affine_space.py @@ -882,14 +882,14 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): sage: A. = AffineSpace(QQ, 1) sage: A.chebyshev_polynomial(5, 'first') Dynamical System of Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x) to (16*x^5 - 20*x^3 + 5*x) + Defn: Defined on coordinates by sending (x) to (16*x^5 - 20*x^3 + 5*x) :: sage: A. = AffineSpace(QQ, 1) sage: A.chebyshev_polynomial(3, 'second') Dynamical System of Affine Space of dimension 1 over Rational Field - Defn: Defined on coordinates by sending (x) to (8*x^3 - 4*x) + Defn: Defined on coordinates by sending (x) to (8*x^3 - 4*x) :: @@ -1039,12 +1039,12 @@ def points_of_bounded_height(self, **kwds): sage: A. = AffineSpace(QQ, 2) sage: list(A.points_of_bounded_height(bound=3)) [(0, 0), (1, 0), (-1, 0), (1/2, 0), (-1/2, 0), (2, 0), (-2, 0), (0, 1), - (1, 1), (-1, 1), (1/2, 1), (-1/2, 1), (2, 1), (-2, 1), (0, -1), (1, -1), - (-1, -1), (1/2, -1), (-1/2, -1), (2, -1), (-2, -1), (0, 1/2), (1, 1/2), - (-1, 1/2), (1/2, 1/2), (-1/2, 1/2), (2, 1/2), (-2, 1/2), (0, -1/2), (1, -1/2), - (-1, -1/2), (1/2, -1/2), (-1/2, -1/2), (2, -1/2), (-2, -1/2), (0, 2), (1, 2), - (-1, 2), (1/2, 2), (-1/2, 2), (2, 2), (-2, 2), (0, -2), (1, -2), (-1, -2), - (1/2, -2), (-1/2, -2), (2, -2), (-2, -2)] + (1, 1), (-1, 1), (1/2, 1), (-1/2, 1), (2, 1), (-2, 1), (0, -1), (1, -1), + (-1, -1), (1/2, -1), (-1/2, -1), (2, -1), (-2, -1), (0, 1/2), (1, 1/2), + (-1, 1/2), (1/2, 1/2), (-1/2, 1/2), (2, 1/2), (-2, 1/2), (0, -1/2), (1, -1/2), + (-1, -1/2), (1/2, -1/2), (-1/2, -1/2), (2, -1/2), (-2, -1/2), (0, 2), (1, 2), + (-1, 2), (1/2, 2), (-1/2, 2), (2, 2), (-2, 2), (0, -2), (1, -2), (-1, -2), + (1/2, -2), (-1/2, -2), (2, -2), (-2, -2)] :: @@ -1113,7 +1113,7 @@ def weil_restriction(self): sage: AL. = AffineSpace(L, 2) # optional - sage.rings.number_field sage: AL.weil_restriction() # optional - sage.rings.number_field Affine Space of dimension 4 over Number Field in w - with defining polynomial x^5 - 2 + with defining polynomial x^5 - 2 """ try: X = self.__weil_restriction @@ -1166,7 +1166,7 @@ def line_through(self, p, q): sage: p2 = A3(4, 5, 6) sage: A3.line_through(p1, p2) Affine Curve over Rational Field defined by -1/6*x + 1/6*y - 1/6, - -1/6*x + 1/6*z - 1/3, -1/6*y + 1/6*z - 1/6, -1/6*x + 1/3*y - 1/6*z + -1/6*x + 1/6*z - 1/3, -1/6*y + 1/6*z - 1/6, -1/6*x + 1/3*y - 1/6*z sage: L = _ sage: L(p1) (1, 2, 3) diff --git a/src/sage/schemes/affine/affine_subscheme.py b/src/sage/schemes/affine/affine_subscheme.py index 476c6b4be20..3b98319527d 100644 --- a/src/sage/schemes/affine/affine_subscheme.py +++ b/src/sage/schemes/affine/affine_subscheme.py @@ -264,7 +264,7 @@ def projective_closure(self, i=None, PP=None): sage: X = A.subscheme([x^2 - y, x*y - z, y^2 - w, x*z - w, y*z - x*w, z^2 - y*w]) sage: X.projective_closure() Closed subscheme of Projective Space of dimension 4 over Rational Field - defined by: + defined by: x0^2 - x1*x4, x0*x1 - x2*x4, x1^2 - x3*x4, @@ -545,11 +545,11 @@ def tangent_space(self, p): sage: X = A3.subscheme(z - x*y) sage: X.tangent_space(A3.origin()) Closed subscheme of Affine Space of dimension 3 over Rational Field - defined by: + defined by: z sage: X.tangent_space(X(1,1,1)) Closed subscheme of Affine Space of dimension 3 over Rational Field - defined by: + defined by: -x - y + z Tangent space at a point may have higher dimension than the dimension @@ -561,14 +561,14 @@ def tangent_space(self, p): sage: p = C(0,0,0) sage: C.tangent_space(p) Closed subscheme of Affine Space of dimension 3 over Rational Field - defined by: + defined by: x + y + z sage: _.dimension() 2 sage: q = C(1,0,-1) sage: C.tangent_space(q) Closed subscheme of Affine Space of dimension 3 over Rational Field - defined by: + defined by: x + y + z, 2*x + 3*z sage: _.dimension() diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py index 2514af41022..43e51dac3c3 100644 --- a/src/sage/schemes/projective/projective_morphism.py +++ b/src/sage/schemes/projective/projective_morphism.py @@ -169,7 +169,7 @@ class SchemeMorphism_polynomial_projective_space(SchemeMorphism_polynomial): sage: X = P.subscheme(y-z) sage: f(f(f(X))) Closed subscheme of Projective Space of dimension 2 over Rational Field - defined by: + defined by: y - z :: @@ -179,7 +179,7 @@ class SchemeMorphism_polynomial_projective_space(SchemeMorphism_polynomial): sage: f = H([(x-2*y)^2, (x-2*z)^2, (x-2*w)^2, x^2]) sage: f(P.subscheme([x,y,z])) Closed subscheme of Projective Space of dimension 3 over Rational Field - defined by: + defined by: w, y, x @@ -204,9 +204,8 @@ def __init__(self, parent, polys, check=True): sage: X = P.subscheme([x]) sage: H = End(X) sage: H([x^2, t*y^2, x*z]) - Scheme endomorphism of Closed subscheme of Projective Space of dimension - 2 over Univariate Polynomial Ring in t over Rational Field defined by: - x + Scheme endomorphism of Closed subscheme of Projective Space of dimension 2 + over Univariate Polynomial Ring in t over Rational Field defined by: x Defn: Defined on coordinates by sending (x : y : z) to (x^2 : t*y^2 : x*z) @@ -217,9 +216,8 @@ def __init__(self, parent, polys, check=True): sage: u,v,w = X.coordinate_ring().gens() sage: H = End(X) sage: H([u^2, v^2, w*u]) - Scheme endomorphism of Closed subscheme of Projective Space of dimension - 2 over Complex Field with 53 bits of precision defined by: - x - y + Scheme endomorphism of Closed subscheme of Projective Space of dimension 2 + over Complex Field with 53 bits of precision defined by: x - y Defn: Defined on coordinates by sending (x : y : z) to (y^2 : y^2 : y*z) """ @@ -1118,7 +1116,7 @@ def dehomogenize(self, n): sage: f = H([x^2 + t*y^2, t*y^2 - z^2, t*z^2]) sage: f.dehomogenize(2) Scheme endomorphism of Affine Space of dimension 2 over Fraction Field - of Univariate Polynomial Ring in t over Rational Field + of Univariate Polynomial Ring in t over Rational Field Defn: Defined on coordinates by sending (x, y) to (1/t*x^2 + y^2, y^2 - 1/t) @@ -1130,7 +1128,7 @@ def dehomogenize(self, n): sage: f = H([x^2, y^2, x*z]) sage: f.dehomogenize(2) Scheme endomorphism of Closed subscheme of Affine Space of dimension 2 - over Integer Ring defined by: x^2 - y^2 + over Integer Ring defined by: x^2 - y^2 Defn: Defined on coordinates by sending (x, y) to (x, y^2/x) :: diff --git a/src/sage/schemes/projective/projective_point.py b/src/sage/schemes/projective/projective_point.py index 8be2127e724..5844592b1ed 100644 --- a/src/sage/schemes/projective/projective_point.py +++ b/src/sage/schemes/projective/projective_point.py @@ -105,7 +105,8 @@ def __init__(self, X, v, check=True): sage: P(0,0,0,0) Traceback (most recent call last): ... - ValueError: [0, 0, 0, 0] does not define a point in Projective Space of dimension 3 over Integer Ring since all entries are zero + ValueError: [0, 0, 0, 0] does not define a point in Projective Space of dimension 3 + over Integer Ring since all entries are zero :: @@ -119,7 +120,8 @@ def __init__(self, X, v, check=True): sage: P(0,5,10,15) Traceback (most recent call last): ... - ValueError: [0, 5, 10, 0] does not define a point in Projective Space of dimension 3 over Ring of integers modulo 15 since it is a multiple of a zero divisor + ValueError: [0, 5, 10, 0] does not define a point in Projective Space of dimension 3 + over Ring of integers modulo 15 since it is a multiple of a zero divisor It is possible to avoid the possibly time-consuming checks, but be careful!! :: @@ -859,7 +861,7 @@ def multiplier(self, f, n, check=True): EXAMPLES:: - sage: P. = ProjectiveSpace(QQ,3) + sage: P. = ProjectiveSpace(QQ, 3) sage: f = DynamicalSystem_projective([x^2, y^2, 4*w^2, 4*z^2], domain=P) sage: Q = P.point([4, 4, 1, 1], False) sage: Q.multiplier(f, 1) @@ -1075,7 +1077,8 @@ def __init__(self, X, v, check=True): sage: P(0, 0, 0, 0) Traceback (most recent call last): ... - ValueError: [0, 0, 0, 0] does not define a point in Projective Space of dimension 3 over Rational Field since all entries are zero + ValueError: [0, 0, 0, 0] does not define a point in Projective Space of dimension 3 + over Rational Field since all entries are zero :: diff --git a/src/sage/schemes/projective/projective_space.py b/src/sage/schemes/projective/projective_space.py index 046d3905d8a..221dca45981 100644 --- a/src/sage/schemes/projective/projective_space.py +++ b/src/sage/schemes/projective/projective_space.py @@ -57,8 +57,8 @@ sage: V = P2.subscheme([x + y + z, x + y - z]); V Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: - x + y + z, - x + y - z + x + y + z, + x + y - z sage: V.dimension() 0 @@ -660,8 +660,7 @@ def _linear_system_as_kernel(self, d, pt, m): sage: P._linear_system_as_kernel(3, pt, 2) # optional - sage.rings.finite_rings Traceback (most recent call last): ... - TypeError: at least one component of pt=[3, 3, 0] must be equal - to 1 + TypeError: at least one component of pt=[3, 3, 0] must be equal to 1 The components of the list do not have to be elements of the base ring of the projective space. It suffices if there exists a common parent. @@ -962,7 +961,7 @@ def subscheme(self, X): (x*z^2, y^2*z, x*y^2) sage: I = X.defining_ideal(); I Ideal (x*z^2, y^2*z, x*y^2) of Multivariate Polynomial Ring in x, y, z - over Rational Field + over Rational Field sage: I.groebner_basis() [x*y^2, y^2*z, x*z^2] sage: X.dimension() @@ -1233,7 +1232,7 @@ def chebyshev_polynomial(self, n, kind='first', monic=False): sage: P. = ProjectiveSpace(F, 1) sage: P.chebyshev_polynomial(4, monic=True) Dynamical System of Projective Space of dimension 1 - over Rational function field in t over Rational Field + over Rational function field in t over Rational Field Defn: Defined on coordinates by sending (y : z) to (y^4 + (-4)*y^2*z^2 + 2*z^4 : z^4) """ @@ -1293,7 +1292,7 @@ def veronese_embedding(self, d, CS=None, order='lex'): (x^2 : x*y : x*z : y^2 : y*z : z^2) sage: vd(P.subscheme([])) Closed subscheme of Projective Space of dimension 5 over Rational Field - defined by: + defined by: -u^2 + t*v, -s*u + r*v, -s*t + r*u, From 1e6a9e02ae62398fb0b938882bfa6d059f22b1c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sat, 1 Apr 2023 20:25:20 +0200 Subject: [PATCH 109/135] fixing some pep8 E303 (folders before l* and after t*) --- src/sage/categories/simplicial_sets.py | 8 ++++---- src/sage/graphs/generic_graph.py | 2 -- src/sage/groups/braid.py | 2 -- src/sage/knots/knotinfo.py | 17 ----------------- src/sage/knots/link.py | 3 --- src/sage/libs/eclib/interface.py | 1 - src/sage/libs/gap/all_documented_functions.py | 2 -- src/sage/libs/gap/gap_functions.py | 3 +-- src/sage/logic/logic.py | 7 +++---- src/sage/numerical/linear_tensor.py | 5 ++--- .../tensor/modules/alternating_contr_tensor.py | 2 -- src/sage/tensor/modules/comp.py | 7 ------- src/sage/tensor/modules/free_module_basis.py | 1 - src/sage/tensor/modules/free_module_element.py | 1 - src/sage/tensor/modules/free_module_homset.py | 1 - .../tensor/modules/free_module_linear_group.py | 2 -- src/sage/tensor/modules/free_module_morphism.py | 1 - src/sage/tensor/modules/free_module_tensor.py | 3 --- src/sage/tensor/modules/tensor_with_indices.py | 2 -- src/sage/tests/benchmark.py | 9 --------- src/sage/topology/simplicial_set_examples.py | 3 +-- 21 files changed, 11 insertions(+), 71 deletions(-) diff --git a/src/sage/categories/simplicial_sets.py b/src/sage/categories/simplicial_sets.py index 6021558c3ec..0bfcae1d2a2 100644 --- a/src/sage/categories/simplicial_sets.py +++ b/src/sage/categories/simplicial_sets.py @@ -1,12 +1,12 @@ """ Simplicial Sets """ -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2015 John H. Palmieri # # Distributed under the terms of the GNU General Public License (GPL) -# http://www.gnu.org/licenses/ -#****************************************************************************** +# https://www.gnu.org/licenses/ +# ***************************************************************************** from sage.misc.cachefunc import cached_method from sage.categories.category_singleton import Category_singleton @@ -16,6 +16,7 @@ from sage.rings.infinity import Infinity from sage.rings.integer import Integer + class SimplicialSets(Category_singleton): r""" The category of simplicial sets. @@ -384,7 +385,6 @@ def _universal_cover_dict(self): char[e] = G.one() return (G, char) - def universal_cover_map(self): r""" Return the universal covering map of the simplicial set. diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index d46792f9e07..ff4a29fd65d 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -615,7 +615,6 @@ def __eq__(self, other): return self._backend.is_subgraph(other._backend, self, ignore_labels=not self.weighted()) - def _use_labels_for_hash(self): r""" Helper method for method ``__hash__``. @@ -648,7 +647,6 @@ def _use_labels_for_hash(self): self._hash_labels = self.weighted() return self._hash_labels - @cached_method def __hash__(self): """ diff --git a/src/sage/groups/braid.py b/src/sage/groups/braid.py index 56dfe58be5b..67f1f8e4dd9 100644 --- a/src/sage/groups/braid.py +++ b/src/sage/groups/braid.py @@ -1467,7 +1467,6 @@ def annular_khovanov_homology(self, qagrad=None, ring=IntegerRing()): return {qa: C[qa].homology() for qa in C} return self.annular_khovanov_complex(qagrad, ring).homology() - @cached_method def left_normal_form(self, algorithm='libbraiding'): r""" @@ -1867,7 +1866,6 @@ def pure_conjugating_braid(self, other): n2 = len(b2.Tietze()) return b2 if n2 <= n0 else b0 - def ultra_summit_set(self): """ Return a list with the orbits of the ultra summit set of ``self`` diff --git a/src/sage/knots/knotinfo.py b/src/sage/knots/knotinfo.py index 90fa21c65a0..c6c8f554fd5 100644 --- a/src/sage/knots/knotinfo.py +++ b/src/sage/knots/knotinfo.py @@ -239,7 +239,6 @@ ############################################################################## - from enum import Enum from sage.misc.cachefunc import cached_method from sage.misc.sage_eval import sage_eval @@ -251,8 +250,6 @@ from sage.databases.knotinfo_db import KnotInfoColumns, db - - def eval_knotinfo(string, locals={}, to_tuple=True): r""" Preparse a string from the KnotInfo database and evaluate it by ``sage_eval``. @@ -301,7 +298,6 @@ def knotinfo_bool(string): raise ValueError('%s is not a KnotInfo boolean') - # --------------------------------------------------------------------------------- # KnotInfoBase # --------------------------------------------------------------------------------- @@ -447,7 +443,6 @@ def _braid_group(self): else: return BraidGroup(n) - @cached_method def _homfly_pol_ring(self, var1, var2): r""" @@ -1159,7 +1154,6 @@ def is_oriented(self): """ return not knotinfo_bool(self[self.items.unoriented]) - @cached_method def homfly_polynomial(self, var1='v', var2='z', original=False): r""" @@ -1345,7 +1339,6 @@ def kauffman_polynomial(self, var1='a', var2='z', original=False): lc = {'a': a, 'z': z} return R(eval_knotinfo(kauffman_polynomial, locals=lc)) - @cached_method def jones_polynomial(self, variab=None, skein_normalization=False, puiseux=False, original=False, use_sqrt=False): r""" @@ -1534,10 +1527,8 @@ def jones_polynomial(self, variab=None, skein_normalization=False, puiseux=False else: lc = {'x': t} - return R(eval_knotinfo(jones_polynomial, locals=lc)) - @cached_method def alexander_polynomial(self, var='t', original=False, laurent_poly=False): r""" @@ -1958,7 +1949,6 @@ def link(self, use_item=db.columns().pd_notation, snappy=False): raise ValueError('Link construction using %s not possible' %use_item) - @cached_method def is_unique(self): r""" @@ -2170,7 +2160,6 @@ def diagram(self, single=False, new=0, autoraise=True): else: return webbrowser.open(filename.diagram_url(self[self.items.name]), new=new, autoraise=autoraise) - def knot_atlas_webpage(self, new=0, autoraise=True): r""" Launch the Knot Atlas web-page for ``self``. @@ -2212,7 +2201,6 @@ def knotilus_webpage(self, new=0, autoraise=True): return webbrowser.open(self[self.items.knotilus_page_anon], new=new, autoraise=autoraise) - # -------------------------------------------------------------------------------------------- # KnotInfoSeries # -------------------------------------------------------------------------------------------- @@ -2256,7 +2244,6 @@ class KnotInfoSeries(UniqueRepresentation, SageObject): True """ - def __init__(self, crossing_number, is_knot, is_alternating, name_unoriented=None): r""" Python constructor. @@ -2363,7 +2350,6 @@ def list(self, oriented=False, comp=None, det=None, homfly=None): res.append(KnotInfoSeries(cross_nr, is_knot, is_alt, curr_n_unori)) return res - @cached_method def lower_list(self, oriented=False, comp=None, det=None, homfly=None): r""" @@ -2408,7 +2394,6 @@ def lower_list(self, oriented=False, comp=None, det=None, homfly=None): l = LS.lower_list(oriented=oriented, comp=comp, det=det, homfly=homfly) return l + self.list(oriented=oriented, comp=comp, det=det, homfly=homfly) - def __repr__(self): r""" Return the representation string of ``self``. @@ -2426,7 +2411,6 @@ def __repr__(self): else: return 'Series of links %s' %(self._name()) - def __getitem__(self, item): r""" Return the given ``item`` from the list of ``self`` @@ -2586,7 +2570,6 @@ def _test_recover(self, **options): else: tester.assertTrue(self.is_recoverable(unique=False)) - def inject(self, verbose=True): r""" Inject ``self`` with its name into the namespace of the diff --git a/src/sage/knots/link.py b/src/sage/knots/link.py index 00907779ec9..4d845139d17 100644 --- a/src/sage/knots/link.py +++ b/src/sage/knots/link.py @@ -3612,7 +3612,6 @@ def delta(u, v): ims += sum(line(a[0], **kwargs) for a in im) return image - def _markov_move_cmp(self, braid): r""" Return whether ``self`` can be transformed to the closure of ``braid`` @@ -4083,7 +4082,6 @@ def answer_list(l): raise NotImplementedError('this link cannot be uniquely determined%s' %non_unique_hint) - self_m = self.mirror_image() ls, proved_s = self._knotinfo_matching_list() lm, proved_m = self_m._knotinfo_matching_list() @@ -4130,7 +4128,6 @@ def answer_list(l): return answer_list(l) - def is_isotopic(self, other): r""" Check whether ``self`` is isotopic to ``other``. diff --git a/src/sage/libs/eclib/interface.py b/src/sage/libs/eclib/interface.py index 0faee97661e..4c842dca48e 100644 --- a/src/sage/libs/eclib/interface.py +++ b/src/sage/libs/eclib/interface.py @@ -194,7 +194,6 @@ def set_verbose(self, verbose): """ self.__verbose = verbose - def _curve_data(self): r""" Returns the underlying :class:`_Curvedata` class for this mwrank elliptic curve. diff --git a/src/sage/libs/gap/all_documented_functions.py b/src/sage/libs/gap/all_documented_functions.py index 7554a08f91f..0820dc71064 100644 --- a/src/sage/libs/gap/all_documented_functions.py +++ b/src/sage/libs/gap/all_documented_functions.py @@ -14,11 +14,9 @@ sage: List(_, Order) [ 2, 4, 2 ] """ - from sage.libs.gap.libgap import libgap from sage.libs.gap.assigned_names import FUNCTIONS as _FUNCTIONS - for _f in _FUNCTIONS: globals()[_f] = libgap.function_factory(_f) diff --git a/src/sage/libs/gap/gap_functions.py b/src/sage/libs/gap/gap_functions.py index 8fb29399479..5e35ca672bf 100644 --- a/src/sage/libs/gap/gap_functions.py +++ b/src/sage/libs/gap/gap_functions.py @@ -7,11 +7,10 @@ # Distributed under the terms of the GNU General Public License (GPL) # as published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. -# http://www.gnu.org/licenses/ +# https://www.gnu.org/licenses/ ############################################################################### - # selected gap functions to use in tab completion common_gap_functions = set([ 'AbelianGroup', diff --git a/src/sage/logic/logic.py b/src/sage/logic/logic.py index 13a45b337ff..16a9cf9a1da 100644 --- a/src/sage/logic/logic.py +++ b/src/sage/logic/logic.py @@ -326,10 +326,9 @@ def combine(self, statement1, statement2): var_order = statement1[2] + statement2[2] return [toks, variables, var_order] - - #TODO: implement the simplify function which calls - #a c++ implementation of the ESPRESSO algorithm - #to simplify the truthtable: probably Minilog + # TODO: implement the simplify function which calls + # a c++ implementation of the ESPRESSO algorithm + # to simplify the truthtable: probably Minilog def simplify(self, table): """ Call a C++ implementation of the ESPRESSO algorithm to simplify the diff --git a/src/sage/numerical/linear_tensor.py b/src/sage/numerical/linear_tensor.py index 34dc8e934ff..2402845b896 100644 --- a/src/sage/numerical/linear_tensor.py +++ b/src/sage/numerical/linear_tensor.py @@ -181,12 +181,11 @@ def LinearTensorParent(free_module_parent, linear_functions_parent): return LinearTensorParent_class(free_module_parent, linear_functions_parent) - -#***************************************************************************** +# **************************************************************************** # # Parent of linear functions tensored with a free module # -#***************************************************************************** +# **************************************************************************** class LinearTensorParent_class(Parent): r""" diff --git a/src/sage/tensor/modules/alternating_contr_tensor.py b/src/sage/tensor/modules/alternating_contr_tensor.py index 03047253b36..3ef51967bc6 100644 --- a/src/sage/tensor/modules/alternating_contr_tensor.py +++ b/src/sage/tensor/modules/alternating_contr_tensor.py @@ -311,7 +311,6 @@ def degree(self): """ return self._tensor_rank - def display(self, basis=None, format_spec=None): r""" Display the alternating contravariant tensor ``self`` in terms @@ -470,7 +469,6 @@ def display(self, basis=None, format_spec=None): disp = display - def wedge(self, other): r""" Exterior product of ``self`` with the alternating contravariant diff --git a/src/sage/tensor/modules/comp.py b/src/sage/tensor/modules/comp.py index 8648e693fa1..653b65d529e 100644 --- a/src/sage/tensor/modules/comp.py +++ b/src/sage/tensor/modules/comp.py @@ -1683,7 +1683,6 @@ def __radd__(self, other): """ return self + other - def __sub__(self, other): r""" Component subtraction. @@ -1758,7 +1757,6 @@ def __rsub__(self, other): """ return (-self) + other - def __mul__(self, other): r""" Component tensor product. @@ -1922,7 +1920,6 @@ def paral_mul(a, b, local_list_ind): result._comp[ind_s + ind_o] = val_s * val_o return result - def __rmul__(self, other): r""" Reflected multiplication (multiplication on the left by ``other``). @@ -2526,7 +2523,6 @@ def non_redundant_index_generator(self): for ind in self.index_generator(): yield ind - def symmetrize(self, *pos): r""" Symmetrization over the given index positions. @@ -3996,7 +3992,6 @@ def trace(self, pos1, pos2): result[[ind_res]] = res return result - def non_redundant_index_generator(self): r""" Generator of indices, with only ordered indices in case of symmetries, @@ -4439,7 +4434,6 @@ def symmetrize(self, *pos): result[[ind]] = sum / sym_group.order() return result - def antisymmetrize(self, *pos): r""" Antisymmetrization over the given index positions. @@ -5340,7 +5334,6 @@ def _new_instance(self): return CompFullyAntiSym(self._ring, self._frame, self._nid, self._sindex, self._output_formatter) - def __add__(self, other): r""" Component addition. diff --git a/src/sage/tensor/modules/free_module_basis.py b/src/sage/tensor/modules/free_module_basis.py index 7369c93263e..7fb776621b9 100644 --- a/src/sage/tensor/modules/free_module_basis.py +++ b/src/sage/tensor/modules/free_module_basis.py @@ -905,7 +905,6 @@ def _init_from_family(self, family): aut.add_comp(self)[:] = mat fmodule.set_change_of_basis(basis, self, aut) - def module(self): r""" Return the free module on which the basis is defined. diff --git a/src/sage/tensor/modules/free_module_element.py b/src/sage/tensor/modules/free_module_element.py index c8bec392083..d4e3f42a390 100644 --- a/src/sage/tensor/modules/free_module_element.py +++ b/src/sage/tensor/modules/free_module_element.py @@ -273,7 +273,6 @@ def _new_comp(self, basis: FreeModuleBasis) -> Components: return Components(fmodule._ring, basis, 1, start_index=fmodule._sindex, output_formatter=fmodule._output_formatter) - def _new_instance(self): r""" Create an instance of the same class as ``self``. diff --git a/src/sage/tensor/modules/free_module_homset.py b/src/sage/tensor/modules/free_module_homset.py index d240882961e..509ae146d49 100644 --- a/src/sage/tensor/modules/free_module_homset.py +++ b/src/sage/tensor/modules/free_module_homset.py @@ -466,7 +466,6 @@ def _coerce_map_from_(self, other): #### End of methods required for any Parent - #### Monoid methods (case of an endomorphism set) #### def one(self): diff --git a/src/sage/tensor/modules/free_module_linear_group.py b/src/sage/tensor/modules/free_module_linear_group.py index 1041ba71c31..36623143617 100644 --- a/src/sage/tensor/modules/free_module_linear_group.py +++ b/src/sage/tensor/modules/free_module_linear_group.py @@ -407,7 +407,6 @@ def _element_constructor_(self, comp=[], basis=None, name=None, resu.set_comp(basis)[:] = comp return resu - def _an_element_(self): r""" Construct some specific free module automorphism. @@ -550,7 +549,6 @@ def _latex_(self): from sage.misc.latex import latex return r"\mathrm{GL}\left("+ latex(self._fmodule)+ r"\right)" - def base_module(self): r""" Return the free module of which ``self`` is the general linear group. diff --git a/src/sage/tensor/modules/free_module_morphism.py b/src/sage/tensor/modules/free_module_morphism.py index c833d03094d..2f6c6fd4643 100644 --- a/src/sage/tensor/modules/free_module_morphism.py +++ b/src/sage/tensor/modules/free_module_morphism.py @@ -688,7 +688,6 @@ def _lmul_(self, scalar): resu._matrices[bases] = scalar * mat return resu - # # Other module methods # diff --git a/src/sage/tensor/modules/free_module_tensor.py b/src/sage/tensor/modules/free_module_tensor.py index da85d6c455b..41719d222f9 100644 --- a/src/sage/tensor/modules/free_module_tensor.py +++ b/src/sage/tensor/modules/free_module_tensor.py @@ -1149,7 +1149,6 @@ def paral_newcomp(old_comp, ppinv, pp, n_con, rank, local_list_ind): for jj in val: new_comp[[jj[0]]] = jj[1] - else: # Sequential computation for ind_new in new_comp.non_redundant_index_generator(): @@ -1561,7 +1560,6 @@ def __getitem__(self, args) -> Components: basis = self._fmodule._def_basis return self.comp(basis)[args] - def __setitem__(self, args, value): r""" Set a component w.r.t. some basis. @@ -3080,7 +3078,6 @@ def symmetrize(self, *pos, **kwargs): res_comp = self._components[basis].symmetrize(*pos) return self._fmodule.tensor_from_comp(self._tensor_type, res_comp) - def antisymmetrize(self, *pos, **kwargs): r""" Antisymmetrization over some arguments. diff --git a/src/sage/tensor/modules/tensor_with_indices.py b/src/sage/tensor/modules/tensor_with_indices.py index 1e658682d41..c3fbb2be465 100644 --- a/src/sage/tensor/modules/tensor_with_indices.py +++ b/src/sage/tensor/modules/tensor_with_indices.py @@ -385,7 +385,6 @@ def _parse_indices(indices, tensor_type=None, allow_contraction=True, "with the tensor type") return con,cov - def __init__(self, tensor, indices): r""" TESTS:: @@ -740,7 +739,6 @@ def __add__(self, other): result._tensor = result._tensor + other.permute_indices(permutation)._tensor return result - def __sub__(self, other): r""" Subtraction between tensors with indices. diff --git a/src/sage/tests/benchmark.py b/src/sage/tests/benchmark.py index 1eb66f6c28b..d6b9332a39b 100644 --- a/src/sage/tests/benchmark.py +++ b/src/sage/tests/benchmark.py @@ -382,7 +382,6 @@ def mathematica(self): ## f = z**self.exp ## return float(gp.eval('gettime/1000.0')) - def magma(self): """ Time the computation in Magma. @@ -404,7 +403,6 @@ def magma(self): return magma.cputime(t) - class MPolynomialMult(Benchmark): def __init__(self, nvars=2, base=QQ, allow_singular=True): if nvars%2: @@ -747,7 +745,6 @@ def magma(self): return magma.cputime(t) - class CharPolyTp(Benchmark): def __init__(self, N=37,k=2,p=2,sign=1): self.N = N @@ -832,8 +829,6 @@ def magma(self): return magma.cputime(t) - - class PolyFactor(Benchmark): def __init__(self, n, R): self.__n = n @@ -903,7 +898,6 @@ def gp(self): return float(gp.eval('gettime/1000.0')) - class SquareInts(Benchmark): def __init__(self, base=10, ndigits=10**5): self.__ndigits = ndigits @@ -1286,7 +1280,6 @@ def gp(self): return float(gp.eval('gettime/1000.0')) - class SEA(Benchmark): def __init__(self, p): self.__p = p @@ -1840,8 +1833,6 @@ def magma(self): """ - - def suite1(): PolySquare(10000,QQ).run() PolySquare(20000,ZZ).run() diff --git a/src/sage/topology/simplicial_set_examples.py b/src/sage/topology/simplicial_set_examples.py index 0a5760d7a1f..30bfa0fbaab 100644 --- a/src/sage/topology/simplicial_set_examples.py +++ b/src/sage/topology/simplicial_set_examples.py @@ -50,8 +50,7 @@ lazy_import('sage.categories.simplicial_sets', 'SimplicialSets') - -######################################################################## +# ###################################################################### # The nerve of a finite monoid, used in sage.categories.finite_monoid. class Nerve(SimplicialSet_arbitrary): From ba4c09a96b936c59bee1776a53cab56a45f4cc8d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 1 Apr 2023 17:01:30 -0700 Subject: [PATCH 110/135] build/pkgs/argon2_cffi_bindings: New, missing dep of argon2_cffi --- build/pkgs/argon2_cffi/dependencies | 2 +- build/pkgs/argon2_cffi_bindings/SPKG.rst | 18 ++++++++++++++++++ build/pkgs/argon2_cffi_bindings/checksums.ini | 5 +++++ build/pkgs/argon2_cffi_bindings/dependencies | 4 ++++ .../argon2_cffi_bindings/install-requires.txt | 1 + .../argon2_cffi_bindings/package-version.txt | 1 + .../pkgs/argon2_cffi_bindings/spkg-install.in | 2 ++ build/pkgs/argon2_cffi_bindings/type | 1 + 8 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 build/pkgs/argon2_cffi_bindings/SPKG.rst create mode 100644 build/pkgs/argon2_cffi_bindings/checksums.ini create mode 100644 build/pkgs/argon2_cffi_bindings/dependencies create mode 100644 build/pkgs/argon2_cffi_bindings/install-requires.txt create mode 100644 build/pkgs/argon2_cffi_bindings/package-version.txt create mode 100644 build/pkgs/argon2_cffi_bindings/spkg-install.in create mode 100644 build/pkgs/argon2_cffi_bindings/type diff --git a/build/pkgs/argon2_cffi/dependencies b/build/pkgs/argon2_cffi/dependencies index 70a583a0dbf..d1b259926f8 100644 --- a/build/pkgs/argon2_cffi/dependencies +++ b/build/pkgs/argon2_cffi/dependencies @@ -1,4 +1,4 @@ -$(PYTHON) six | $(PYTHON_TOOLCHAIN) cffi +$(PYTHON) argon2_cffi_bindings | $(PYTHON_TOOLCHAIN) flit_core ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/argon2_cffi_bindings/SPKG.rst b/build/pkgs/argon2_cffi_bindings/SPKG.rst new file mode 100644 index 00000000000..3d9a76114f1 --- /dev/null +++ b/build/pkgs/argon2_cffi_bindings/SPKG.rst @@ -0,0 +1,18 @@ +argon2_cffi_bindings: Low-level CFFI bindings for Argon2 +======================================================== + +Description +----------- + +Low-level CFFI bindings for Argon2 + +License +------- + +MIT + +Upstream Contact +---------------- + +https://pypi.org/project/argon2-cffi-bindings/ + diff --git a/build/pkgs/argon2_cffi_bindings/checksums.ini b/build/pkgs/argon2_cffi_bindings/checksums.ini new file mode 100644 index 00000000000..fe2e878a74d --- /dev/null +++ b/build/pkgs/argon2_cffi_bindings/checksums.ini @@ -0,0 +1,5 @@ +tarball=argon2-cffi-bindings-VERSION.tar.gz +sha1=5a9b8906d9ca73c53c2bf0a2f0a8127fda69e965 +md5=f1591e1af7dea9ef3e5b982e2c196c1d +cksum=2420586823 +upstream_url=https://pypi.io/packages/source/a/argon2_cffi_bindings/argon2-cffi-bindings-VERSION.tar.gz diff --git a/build/pkgs/argon2_cffi_bindings/dependencies b/build/pkgs/argon2_cffi_bindings/dependencies new file mode 100644 index 00000000000..0d815c35f4b --- /dev/null +++ b/build/pkgs/argon2_cffi_bindings/dependencies @@ -0,0 +1,4 @@ +$(PYTHON) | $(PYTHON_TOOLCHAIN) cffi setuptools_scm + +---------- +All lines of this file are ignored except the first. diff --git a/build/pkgs/argon2_cffi_bindings/install-requires.txt b/build/pkgs/argon2_cffi_bindings/install-requires.txt new file mode 100644 index 00000000000..50485097375 --- /dev/null +++ b/build/pkgs/argon2_cffi_bindings/install-requires.txt @@ -0,0 +1 @@ +argon2-cffi-bindings diff --git a/build/pkgs/argon2_cffi_bindings/package-version.txt b/build/pkgs/argon2_cffi_bindings/package-version.txt new file mode 100644 index 00000000000..b295a689e74 --- /dev/null +++ b/build/pkgs/argon2_cffi_bindings/package-version.txt @@ -0,0 +1 @@ +21.2.0 diff --git a/build/pkgs/argon2_cffi_bindings/spkg-install.in b/build/pkgs/argon2_cffi_bindings/spkg-install.in new file mode 100644 index 00000000000..37ac1a53437 --- /dev/null +++ b/build/pkgs/argon2_cffi_bindings/spkg-install.in @@ -0,0 +1,2 @@ +cd src +sdh_pip_install . diff --git a/build/pkgs/argon2_cffi_bindings/type b/build/pkgs/argon2_cffi_bindings/type new file mode 100644 index 00000000000..a6a7b9cd726 --- /dev/null +++ b/build/pkgs/argon2_cffi_bindings/type @@ -0,0 +1 @@ +standard From 990ac5ccb5ac7448da446601958bc2080a89226e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 1 Apr 2023 17:02:44 -0700 Subject: [PATCH 111/135] build/pkgs/argon2_cffi_bindings/spkg-install.in: Move handling of SAGE_FAT_BINARY here --- build/pkgs/argon2_cffi/spkg-install.in | 4 ---- build/pkgs/argon2_cffi_bindings/spkg-install.in | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/argon2_cffi/spkg-install.in b/build/pkgs/argon2_cffi/spkg-install.in index 359ae695eac..37ac1a53437 100644 --- a/build/pkgs/argon2_cffi/spkg-install.in +++ b/build/pkgs/argon2_cffi/spkg-install.in @@ -1,6 +1,2 @@ cd src -if [ "$SAGE_FAT_BINARY" = "yes" ]; then - # https://argon2-cffi.readthedocs.io/en/stable/installation.html - export ARGON2_CFFI_USE_SSE2=0 -fi sdh_pip_install . diff --git a/build/pkgs/argon2_cffi_bindings/spkg-install.in b/build/pkgs/argon2_cffi_bindings/spkg-install.in index 37ac1a53437..359ae695eac 100644 --- a/build/pkgs/argon2_cffi_bindings/spkg-install.in +++ b/build/pkgs/argon2_cffi_bindings/spkg-install.in @@ -1,2 +1,6 @@ cd src +if [ "$SAGE_FAT_BINARY" = "yes" ]; then + # https://argon2-cffi.readthedocs.io/en/stable/installation.html + export ARGON2_CFFI_USE_SSE2=0 +fi sdh_pip_install . From 35541966aafa030862b1cb1eec9992e646be112d Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 2 Apr 2023 09:33:25 +0800 Subject: [PATCH 112/135] use correct value of boolean --- .codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codecov.yml b/.codecov.yml index 3662ded4cf4..879a7e5a64f 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -2,7 +2,7 @@ comment: false # https://docs.codecov.com/docs/codecovyml-reference#codecov codecov: - require_ci_to_pass: true + require_ci_to_pass: false # https://docs.codecov.com/docs/commit-status coverage: status: From 0884b8025629519e8c9a33e57686bbaccb7045ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 19 Mar 2023 21:37:57 +0100 Subject: [PATCH 113/135] fixing most of pycodestyle E271 in pyx files --- .../quatalg/quaternion_algebra_element.pyx | 2 +- src/sage/calculus/transforms/fft.pyx | 6 ++---- src/sage/categories/functor.pyx | 3 +-- src/sage/combinat/integer_lists/invlex.pyx | 4 ++-- src/sage/libs/flint/fmpz_poly.pyx | 8 +++---- src/sage/libs/gap/element.pyx | 4 ++-- src/sage/libs/mpmath/ext_impl.pyx | 21 ++++++++++++------- src/sage/libs/mpmath/ext_main.pyx | 4 ++-- src/sage/libs/singular/polynomial.pyx | 14 ++++++------- src/sage/matrix/matrix_cyclo_dense.pyx | 2 +- src/sage/matrix/matrix_mpolynomial_dense.pyx | 2 +- src/sage/matrix/matrix_rational_dense.pyx | 2 +- src/sage/modular/modsym/heilbronn.pyx | 2 +- src/sage/modular/modsym/p1list.pyx | 2 +- src/sage/numerical/backends/glpk_backend.pyx | 4 ++-- .../backends/interactivelp_backend.pyx | 2 +- src/sage/numerical/backends/ppl_backend.pyx | 2 +- src/sage/numerical/mip.pyx | 3 +-- src/sage/plot/plot3d/index_face_set.pyx | 2 +- src/sage/rings/complex_interval.pyx | 2 +- src/sage/rings/complex_mpc.pyx | 2 +- src/sage/rings/complex_mpfr.pyx | 3 +-- src/sage/rings/fraction_field_element.pyx | 6 +++--- src/sage/rings/integer.pyx | 6 +++--- src/sage/rings/polynomial/plural.pyx | 8 +++---- .../rings/polynomial/polynomial_element.pyx | 2 +- src/sage/rings/rational.pyx | 4 ++-- src/sage/rings/real_mpfi.pyx | 2 +- src/sage/rings/real_mpfr.pyx | 2 +- .../schemes/elliptic_curves/mod_sym_num.pyx | 14 ++++++------- src/sage/stats/intlist.pyx | 2 +- src/sage/stats/time_series.pyx | 2 +- 32 files changed, 73 insertions(+), 71 deletions(-) diff --git a/src/sage/algebras/quatalg/quaternion_algebra_element.pyx b/src/sage/algebras/quatalg/quaternion_algebra_element.pyx index 4d4f0ead756..b2da19d4c80 100644 --- a/src/sage/algebras/quatalg/quaternion_algebra_element.pyx +++ b/src/sage/algebras/quatalg/quaternion_algebra_element.pyx @@ -896,7 +896,7 @@ cdef class QuaternionAlgebraElement_rational_field(QuaternionAlgebraElement_abst mpz_init(self.b) mpz_init(self.d) - def __dealloc__(self): + def __dealloc__(self): mpz_clear(self.x) mpz_clear(self.y) mpz_clear(self.z) diff --git a/src/sage/calculus/transforms/fft.pyx b/src/sage/calculus/transforms/fft.pyx index 1ea2cb6b2b2..f0df57f05ec 100644 --- a/src/sage/calculus/transforms/fft.pyx +++ b/src/sage/calculus/transforms/fft.pyx @@ -102,16 +102,15 @@ cdef class FastFourierTransform_complex(FastFourierTransform_base): sage: a = FastFourierTransform(1) # indirect doctest sage: a [(0.0, 0.0)] - """ self.n = n self.stride = stride self.data = sig_malloc(sizeof(double)*(2*n)) cdef int i - for i from 0 <= i < 2*n: + for i in range(2 * n): self.data[i] = 0 - def __dealloc__(self): + def __dealloc__(self): """ Frees allocated memory. @@ -119,7 +118,6 @@ cdef class FastFourierTransform_complex(FastFourierTransform_base): sage: a = FastFourierTransform(128) sage: del a - """ sig_free(self.data) diff --git a/src/sage/categories/functor.pyx b/src/sage/categories/functor.pyx index ccf01cc9177..01b91469fbd 100644 --- a/src/sage/categories/functor.pyx +++ b/src/sage/categories/functor.pyx @@ -292,9 +292,8 @@ cdef class Functor(SageObject): Traceback (most recent call last): ... TypeError: x (=Integer Ring) is not in Category of fields - """ - if not (x in self.__domain): + if x not in self.__domain: raise TypeError("x (=%s) is not in %s" % (x, self.__domain)) return x diff --git a/src/sage/combinat/integer_lists/invlex.pyx b/src/sage/combinat/integer_lists/invlex.pyx index 2f12ada7438..a168491ede7 100644 --- a/src/sage/combinat/integer_lists/invlex.pyx +++ b/src/sage/combinat/integer_lists/invlex.pyx @@ -1215,9 +1215,9 @@ class IntegerListsLexIter(builtins.object): max_sum = self.backend.max_sum min_length = self.backend.min_length max_length = self.backend.max_length - if self._j+1 >= max_length: + if self._j + 1 >= max_length: return False - if self._j+1 >= min_length and self._current_sum == max_sum: + if self._j + 1 >= min_length and self._current_sum == max_sum: # Cannot add trailing zeroes return False diff --git a/src/sage/libs/flint/fmpz_poly.pyx b/src/sage/libs/flint/fmpz_poly.pyx index 23df744b440..38b0e70d143 100644 --- a/src/sage/libs/flint/fmpz_poly.pyx +++ b/src/sage/libs/flint/fmpz_poly.pyx @@ -222,13 +222,13 @@ cdef class Fmpz_poly(SageObject): """ cdef Fmpz_poly res = Fmpz_poly.__new__(Fmpz_poly) if not isinstance(left, Fmpz_poly) or not isinstance(right, Fmpz_poly): - if isinstance(left, int) : + if isinstance(left, int): fmpz_poly_scalar_mul_si(res.poly, (right).poly, left) - elif isinstance(left, Integer) : + elif isinstance(left, Integer): fmpz_poly_scalar_mul_mpz(res.poly, (right).poly, (left).value) - elif isinstance(right, int) : + elif isinstance(right, int): fmpz_poly_scalar_mul_si(res.poly, (left).poly, right) - elif isinstance(right, Integer) : + elif isinstance(right, Integer): fmpz_poly_scalar_mul_mpz(res.poly, (left).poly, (right).value) else: raise TypeError diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx index aac3bbe8590..9ac780bfc9e 100644 --- a/src/sage/libs/gap/element.pyx +++ b/src/sage/libs/gap/element.pyx @@ -769,7 +769,7 @@ cdef class GapElement(RingElement): sage: libgap(0).__str__() '0' """ - if self.value == NULL: + if self.value == NULL: return 'NULL' s = char_to_str(gap_element_str(self.value)) @@ -791,7 +791,7 @@ cdef class GapElement(RingElement): sage: libgap(0)._repr_() '0' """ - if self.value == NULL: + if self.value == NULL: return 'NULL' s = char_to_str(gap_element_repr(self.value)) diff --git a/src/sage/libs/mpmath/ext_impl.pyx b/src/sage/libs/mpmath/ext_impl.pyx index 05653d5b25b..2d1382ef6f1 100644 --- a/src/sage/libs/mpmath/ext_impl.pyx +++ b/src/sage/libs/mpmath/ext_impl.pyx @@ -413,11 +413,16 @@ cdef void MPF_neg(MPF *r, MPF *s): Sets r = -s. MPF_neg(x, x) negates in place. """ if s.special: - if s.special == S_ZERO: r.special = S_ZERO #r.special = S_NZERO - elif s.special == S_NZERO: r.special = S_ZERO - elif s.special == S_INF: r.special = S_NINF - elif s.special == S_NINF: r.special = S_INF - else: r.special = s.special + if s.special == S_ZERO: + r.special = S_ZERO # r.special = S_NZERO + elif s.special == S_NZERO: + r.special = S_ZERO + elif s.special == S_INF: + r.special = S_NINF + elif s.special == S_NINF: + r.special = S_INF + else: + r.special = s.special return r.special = s.special mpz_neg(r.man, s.man) @@ -429,8 +434,10 @@ cdef void MPF_abs(MPF *r, MPF *s): Sets r = abs(s). MPF_abs(r, r) sets the absolute value in place. """ if s.special: - if s.special == S_NINF: r.special = S_INF - else: r.special = s.special + if s.special == S_NINF: + r.special = S_INF + else: + r.special = s.special return r.special = s.special mpz_abs(r.man, s.man) diff --git a/src/sage/libs/mpmath/ext_main.pyx b/src/sage/libs/mpmath/ext_main.pyx index 93b58131b39..e2cb779dd4d 100644 --- a/src/sage/libs/mpmath/ext_main.pyx +++ b/src/sage/libs/mpmath/ext_main.pyx @@ -2068,7 +2068,7 @@ cdef class mpf(mpf_base): """ MPF_init(&self.value) - def __dealloc__(self): + def __dealloc__(self): MPF_clear(&self.value) def __neg__(s): @@ -2359,7 +2359,7 @@ cdef class mpc(mpnumber): MPF_init(&self.re) MPF_init(&self.im) - def __dealloc__(self): + def __dealloc__(self): MPF_clear(&self.re) MPF_clear(&self.im) diff --git a/src/sage/libs/singular/polynomial.pyx b/src/sage/libs/singular/polynomial.pyx index b2efc7dfbcb..580ad500b8c 100644 --- a/src/sage/libs/singular/polynomial.pyx +++ b/src/sage/libs/singular/polynomial.pyx @@ -489,25 +489,25 @@ cdef object singular_polynomial_latex(poly *p, ring *r, object base, object late for j in range(1, n+1): e = p_GetExp(p, j, r) if e > 0: - multi += " "+latex_gens[j-1] + multi += " " + latex_gens[j-1] if e > 1: - multi += "^{%d}"%e + multi += "^{%d}" % e multi = multi.lstrip().rstrip() # Next determine coefficient of multinomial - c = si2sa( p_GetCoeff(p, r), r, base) + c = si2sa(p_GetCoeff(p, r), r, base) if not multi: multi = latex(c) elif c != 1: - if c == -1: - multi = "-%s"%(multi) + if c == -1: + multi = "-%s" % (multi) else: sc = latex(c) # Add parenthesis if the coefficient consists of terms divided by +, - # (starting with - is not enough) and is not the constant term if not atomic_repr and multi and (sc.find("+") != -1 or sc[1:].find("-") != -1): - sc = "\\left(%s\\right)"%sc - multi = "%s %s"%(sc,multi) + sc = "\\left(%s\\right)" % sc + multi = "%s %s" % (sc, multi) # Now add on coefficiented multinomials if poly: diff --git a/src/sage/matrix/matrix_cyclo_dense.pyx b/src/sage/matrix/matrix_cyclo_dense.pyx index 29456daabfe..fbe06c1808b 100644 --- a/src/sage/matrix/matrix_cyclo_dense.pyx +++ b/src/sage/matrix/matrix_cyclo_dense.pyx @@ -1411,7 +1411,7 @@ cdef class Matrix_cyclo_dense(Matrix_dense): # if we've used enough primes as determined by bound, or # if we've used 3 primes, we check to see if the result is # the same. - if prod >= bound or (not proof and (len(v) % 3 == 0)): + if prod >= bound or (not proof and (len(v) % 3 == 0)): M = matrix(ZZ, self._base_ring.degree(), self._nrows+1) L = _lift_crt(M, v) if not proof and L == L_last: diff --git a/src/sage/matrix/matrix_mpolynomial_dense.pyx b/src/sage/matrix/matrix_mpolynomial_dense.pyx index 1fd54027d2d..ae5886b73ed 100644 --- a/src/sage/matrix/matrix_mpolynomial_dense.pyx +++ b/src/sage/matrix/matrix_mpolynomial_dense.pyx @@ -106,7 +106,7 @@ cdef class Matrix_mpolynomial_dense(Matrix_generic_dense): x = self.fetch('echelon_form_'+algorithm) if x is not None: return x - if algorithm == "frac": + if algorithm == "frac": E = self.matrix_over_field() E.echelonize(**kwds) else: diff --git a/src/sage/matrix/matrix_rational_dense.pyx b/src/sage/matrix/matrix_rational_dense.pyx index 10fd2dcabcc..e4625b297e9 100644 --- a/src/sage/matrix/matrix_rational_dense.pyx +++ b/src/sage/matrix/matrix_rational_dense.pyx @@ -158,7 +158,7 @@ cdef class Matrix_rational_dense(Matrix_dense): return Matrix_rational_dense.__new__(Matrix_rational_dense, parent, None, None, None) - def __dealloc__(self): + def __dealloc__(self): fmpq_mat_clear(self._matrix) def __init__(self, parent, entries=None, copy=None, bint coerce=True): diff --git a/src/sage/modular/modsym/heilbronn.pyx b/src/sage/modular/modsym/heilbronn.pyx index 2ba337dddc4..81833bbe3b2 100644 --- a/src/sage/modular/modsym/heilbronn.pyx +++ b/src/sage/modular/modsym/heilbronn.pyx @@ -34,7 +34,7 @@ cdef extern from "": float roundf(float x) cimport sage.modular.modsym.p1list as p1list -from . import p1list +from . import p1list cdef p1list.export export export = p1list.export() diff --git a/src/sage/modular/modsym/p1list.pyx b/src/sage/modular/modsym/p1list.pyx index 4cdb7dec577..68c6df4dadd 100644 --- a/src/sage/modular/modsym/p1list.pyx +++ b/src/sage/modular/modsym/p1list.pyx @@ -749,7 +749,7 @@ cdef class P1List(): self.s[i] = (ll_s % ll_N) self.t[i] = (ll_t % ll_N) - def __dealloc__(self): + def __dealloc__(self): """ Deallocates memory for an object of the class P1List. """ diff --git a/src/sage/numerical/backends/glpk_backend.pyx b/src/sage/numerical/backends/glpk_backend.pyx index c83ddab19aa..a05d6fef2bb 100644 --- a/src/sage/numerical/backends/glpk_backend.pyx +++ b/src/sage/numerical/backends/glpk_backend.pyx @@ -116,7 +116,7 @@ cdef class GLPKBackend(GenericBackend): 1.0 """ cdef int vtype = int(bool(binary)) + int(bool(continuous)) + int(bool(integer)) - if vtype == 0: + if vtype == 0: continuous = True elif vtype != 1: raise ValueError("Exactly one parameter of 'binary', 'integer' and 'continuous' must be 'True'.") @@ -197,7 +197,7 @@ cdef class GLPKBackend(GenericBackend): 42.0 """ cdef int vtype = int(bool(binary)) + int(bool(continuous)) + int(bool(integer)) - if vtype == 0: + if vtype == 0: continuous = True elif vtype != 1: raise ValueError("Exactly one parameter of 'binary', 'integer' and 'continuous' must be 'True'.") diff --git a/src/sage/numerical/backends/interactivelp_backend.pyx b/src/sage/numerical/backends/interactivelp_backend.pyx index 4a4e257596f..773c13b781c 100644 --- a/src/sage/numerical/backends/interactivelp_backend.pyx +++ b/src/sage/numerical/backends/interactivelp_backend.pyx @@ -228,7 +228,7 @@ cdef class InteractiveLPBackend: """ A, b, c, x, constraint_types, variable_types, problem_type, ring, d = self._AbcxCVPRd() cdef int vtype = int(binary) + int(continuous) + int(integer) - if vtype == 0: + if vtype == 0: continuous = True elif vtype != 1: raise ValueError("Exactly one parameter of 'binary', 'integer' and 'continuous' must be 'True'.") diff --git a/src/sage/numerical/backends/ppl_backend.pyx b/src/sage/numerical/backends/ppl_backend.pyx index f4884fbe6b1..1f50c4bdf11 100644 --- a/src/sage/numerical/backends/ppl_backend.pyx +++ b/src/sage/numerical/backends/ppl_backend.pyx @@ -289,7 +289,7 @@ cdef class PPLBackend(GenericBackend): 3 """ cdef int vtype = int(bool(binary)) + int(bool(continuous)) + int(bool(integer)) - if vtype == 0: + if vtype == 0: continuous = True elif vtype != 1: raise ValueError("Exactly one parameter of 'binary', 'integer' and 'continuous' must be 'True'.") diff --git a/src/sage/numerical/mip.pyx b/src/sage/numerical/mip.pyx index bdbee5d974c..decc3a49a53 100644 --- a/src/sage/numerical/mip.pyx +++ b/src/sage/numerical/mip.pyx @@ -2134,11 +2134,10 @@ cdef class MixedIntegerLinearProgram(SageObject): sage: p.remove_constraint(2) sage: p.solve() 6.0 - """ from sage.numerical.linear_functions import is_LinearFunction, is_LinearConstraint from sage.numerical.linear_tensor import is_LinearTensor - from sage.numerical.linear_tensor_constraints import is_LinearTensorConstraint + from sage.numerical.linear_tensor_constraints import is_LinearTensorConstraint if is_LinearFunction(linear_function) or is_LinearTensor(linear_function): # Find the parent for the coefficients if is_LinearFunction(linear_function): diff --git a/src/sage/plot/plot3d/index_face_set.pyx b/src/sage/plot/plot3d/index_face_set.pyx index 642397e9ecf..f594652be28 100644 --- a/src/sage/plot/plot3d/index_face_set.pyx +++ b/src/sage/plot/plot3d/index_face_set.pyx @@ -284,7 +284,7 @@ def cut_edge_by_bisection(pointa, pointb, condition, eps=1.0e-6, N=100): point_c_middle(&midp, b, a, half) - return midp.x, midp.y, midp.z + return midp.x, midp.y, midp.z cdef class IndexFaceSet(PrimitiveObject): diff --git a/src/sage/rings/complex_interval.pyx b/src/sage/rings/complex_interval.pyx index c993ac687b2..88603696b73 100644 --- a/src/sage/rings/complex_interval.pyx +++ b/src/sage/rings/complex_interval.pyx @@ -143,7 +143,7 @@ cdef class ComplexIntervalFieldElement(sage.structure.element.FieldElement): mpfi_set_sage(self.__re, NULL, real, parent, base) mpfi_set_sage(self.__im, NULL, imag, parent, base) - def __dealloc__(self): + def __dealloc__(self): if self._parent is not None: mpfi_clear(self.__re) mpfi_clear(self.__im) diff --git a/src/sage/rings/complex_mpc.pyx b/src/sage/rings/complex_mpc.pyx index 62154af1e96..f6287353dac 100644 --- a/src/sage/rings/complex_mpc.pyx +++ b/src/sage/rings/complex_mpc.pyx @@ -206,7 +206,7 @@ cpdef inline split_complex_string(string, int base=10): else: return None - if z.group(prefix + '_re_abs') is not None: + if z.group(prefix + '_re_abs') is not None: x = z.expand(r'\g<' + prefix + '_re_abs>') if z.group(prefix + '_re_sign') is not None: x = z.expand(r'\g<' + prefix + '_re_sign>') + x diff --git a/src/sage/rings/complex_mpfr.pyx b/src/sage/rings/complex_mpfr.pyx index 0b12280d6e5..4fc6c4c8d35 100644 --- a/src/sage/rings/complex_mpfr.pyx +++ b/src/sage/rings/complex_mpfr.pyx @@ -976,8 +976,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): except TypeError: raise TypeError("unable to coerce to a ComplexNumber: %s" % type(real)) - - def __dealloc__(self): + def __dealloc__(self): """ TESTS: diff --git a/src/sage/rings/fraction_field_element.pyx b/src/sage/rings/fraction_field_element.pyx index 122c07c091f..b4d59afbf6d 100644 --- a/src/sage/rings/fraction_field_element.pyx +++ b/src/sage/rings/fraction_field_element.pyx @@ -310,10 +310,10 @@ cdef class FractionFieldElement(FieldElement): a = self.numerator() b = self.denominator() if not root: - return (a*b).is_square( root = False ) - is_sqr, sq_rt = (a*b).is_square( root = True ) + return (a * b).is_square(root=False) + is_sqr, sq_rt = (a * b).is_square(root=True) if is_sqr: - return True, self._parent( sq_rt/b ) + return True, self._parent(sq_rt / b) return False, None def nth_root(self, n): diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index 61bcda9cf62..092f9c40c34 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -972,7 +972,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): """ return [ self ] - def __dealloc__(self): + def __dealloc__(self): mpz_clear(self.value) def __repr__(self): @@ -3812,11 +3812,11 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): else: limit = bound while m <= limit: - if mpz_divisible_ui_p(self.value, m): + if mpz_divisible_ui_p(self.value, m): mpz_set_ui(x.value, m) sig_off() return x - m += dif[i%8] + m += dif[i % 8] i += 1 mpz_abs(x.value, self.value) sig_off() diff --git a/src/sage/rings/polynomial/plural.pyx b/src/sage/rings/polynomial/plural.pyx index 8839fb92502..1c7a8052ce4 100644 --- a/src/sage/rings/polynomial/plural.pyx +++ b/src/sage/rings/polynomial/plural.pyx @@ -533,7 +533,7 @@ cdef class NCPolynomialRing_plural(Ring): elif isinstance(element, CommutativeRingElement): # base ring elements - if element.parent() is base_ring: + if element.parent() is base_ring: # shortcut for GF(p) if isinstance(base_ring, FiniteField_prime_modn): _p = p_ISet(int(element) % _ring.cf.ch, _ring) @@ -815,7 +815,7 @@ cdef class NCPolynomialRing_plural(Ring): n = self.ngens() for r in range(0, n-1, 1): for c in range(r+1, n, 1): - if (self.gen(c) * self.gen(r) != self.gen(r) * self.gen(c)): + if (self.gen(c) * self.gen(r) != self.gen(r) * self.gen(c)): res[ A.gen(c) * A.gen(r) ] = self.gen(c) * self.gen(r) # C[r, c] * P.gen(r) * P.gen(c) + D[r, c] self._relations = res @@ -1871,7 +1871,7 @@ cdef class NCPolynomial_plural(RingElement): sage: print(f._repr_with_changed_varnames(['FOO', 'BAR', 'FOOBAR'])) -FOO^2*FOOBAR - BAR^2 - 25/27*FOOBAR^3 """ - return singular_polynomial_str_with_changed_varnames(self._poly, (self._parent)._ring, varnames) + return singular_polynomial_str_with_changed_varnames(self._poly, (self._parent)._ring, varnames) def degree(self, NCPolynomial_plural x=None): """ @@ -1881,7 +1881,7 @@ cdef class NCPolynomial_plural(RingElement): INPUT: - - ``x`` - multivariate polynomial (a generator of the parent of + - ``x`` -- multivariate polynomial (a generator of the parent of self) If x is not specified (or is ``None``), return the total degree, which is the maximum degree of any monomial. diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx index 4c6809a4772..b8ecbb7a14b 100644 --- a/src/sage/rings/polynomial/polynomial_element.pyx +++ b/src/sage/rings/polynomial/polynomial_element.pyx @@ -9177,7 +9177,7 @@ cdef class Polynomial(CommutativePolynomial): l = lcm([n.denominator(), d.denominator()]) n *= l d *= l - return P(n), P(d) + return P(n), P(d) # n and d are unique if m.degree() > (n.degree() + d.degree()) if n_deg is None: diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx index b1605651e3b..0e9d1f35f47 100644 --- a/src/sage/rings/rational.pyx +++ b/src/sage/rings/rational.pyx @@ -100,7 +100,7 @@ from sage.libs.gmp.binop cimport mpq_add_z, mpq_mul_z, mpq_div_zz from cpython.int cimport PyInt_AS_LONG cimport sage.rings.fast_arith -import sage.rings.fast_arith +import sage.rings.fast_arith try: @@ -918,7 +918,7 @@ cdef class Rational(sage.structure.element.FieldElement): # immutable return self - def __dealloc__(self): + def __dealloc__(self): """ Free memory occupied by this rational number. diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx index c6573448a93..33e94b93094 100644 --- a/src/sage/rings/real_mpfi.pyx +++ b/src/sage/rings/real_mpfi.pyx @@ -1284,7 +1284,7 @@ cdef class RealIntervalFieldElement(RingElement): """ return (__create__RealIntervalFieldElement_version1, (self._parent, self.upper(), self.lower())) - def __dealloc__(self): + def __dealloc__(self): """ Deallocate ``self``. diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index 32a3e0494f8..5fc5d640ce9 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -1570,7 +1570,7 @@ cdef class RealNumber(sage.structure.element.RingElement): s = self.str(32, no_sci=False, e='@') return (__create__RealNumber_version0, (self._parent, s, 32)) - def __dealloc__(self): + def __dealloc__(self): if self._parent is not None: mpfr_clear(self.value) diff --git a/src/sage/schemes/elliptic_curves/mod_sym_num.pyx b/src/sage/schemes/elliptic_curves/mod_sym_num.pyx index 369cd98a293..9ac2f97cd6d 100644 --- a/src/sage/schemes/elliptic_curves/mod_sym_num.pyx +++ b/src/sage/schemes/elliptic_curves/mod_sym_num.pyx @@ -200,7 +200,7 @@ cdef llong llgcd(llong a, llong b) except -1: return fa.gcd_longlong(a,b) cdef llong llinvmod(llong a, llong m): - return fa.inverse_mod_longlong(a,m) + return fa.inverse_mod_longlong(a, m) DEF TWOPI = 6.28318530717958647 @@ -3356,21 +3356,21 @@ cdef class ModularSymbolNumerical: # level=4) # make the cusp -x/y unitary if possible. B = y.gcd(N) - if B.gcd(N//B) != 1: + if B.gcd(N // B) != 1: if y > 0: y -= m x += a else: y += m x -= a - r2 = - x/y + r2 = - x / y B = y.gcd(N) Q = N // B - if Q.gcd(N//Q) != 1: # r2 is not unitary - return self._symbol_non_unitary_approx(r, eps) + if Q.gcd(N // Q) != 1: # r2 is not unitary + return self._symbol_non_unitary_approx(r, eps) - r2 = - x/y - verbose("Next piece: integrate to the cusp %s "%r2, level=2) + r2 = - x / y + verbose("Next piece: integrate to the cusp %s " % r2, level=2) res = self._from_r_to_rr_approx(r, r2, eps, use_partials=2) res += self._evaluate_approx(r2, eps) diff --git a/src/sage/stats/intlist.pyx b/src/sage/stats/intlist.pyx index f29d6519d97..cf6cccaf537 100644 --- a/src/sage/stats/intlist.pyx +++ b/src/sage/stats/intlist.pyx @@ -150,7 +150,7 @@ cdef class IntList: return rich_to_bool(op, -1 if c < 0 else 1) return rich_to_bool(op, 0) - def __dealloc__(self): + def __dealloc__(self): """ Deallocate memory used by the IntList, if it was allocated. """ diff --git a/src/sage/stats/time_series.pyx b/src/sage/stats/time_series.pyx index dda5f533792..01a735a9679 100644 --- a/src/sage/stats/time_series.pyx +++ b/src/sage/stats/time_series.pyx @@ -223,7 +223,7 @@ cdef class TimeSeries: return rich_to_bool(op, -1 if c < 0 else 1) return rich_to_bool(op, 0) - def __dealloc__(self): + def __dealloc__(self): """ Free up memory used by a time series. From 217a187e7b63df78d88189781bd9f654f3ba28ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 2 Apr 2023 08:48:51 +0200 Subject: [PATCH 114/135] fix the broken linters --- src/sage/combinat/crystals/key_crystals.py | 547 --------------------- src/sage/schemes/elliptic_curves/cm.py | 4 +- 2 files changed, 2 insertions(+), 549 deletions(-) delete mode 100644 src/sage/combinat/crystals/key_crystals.py diff --git a/src/sage/combinat/crystals/key_crystals.py b/src/sage/combinat/crystals/key_crystals.py deleted file mode 100644 index 6d3eac4740d..00000000000 --- a/src/sage/combinat/crystals/key_crystals.py +++ /dev/null @@ -1,547 +0,0 @@ -r""" -Crystals of Key Tableaux - -AUTHORS: - -- Travis Scrimshaw: Initial version -""" - -# **************************************************************************** -# Copyright (C) 2023 Travis Scrimshaw -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# https://www.gnu.org/licenses/ -# **************************************************************************** - -from sage.combinat.root_system.cartan_type import CartanType -from sage.combinat.crystals.tensor_product import CrystalOfTableaux -from sage.categories.highest_weight_crystals import HighestWeightCrystals -from sage.structure.parent import Parent -from sage.structure.unique_representation import UniqueRepresentation -from sage.structure.list_clone import ClonableArray -from sage.rings.integer_ring import ZZ - -from sage.misc.lazy_attribute import lazy_attribute -from sage.misc.cachefunc import cached_method -from collections.abc import Sequence - -class KeyTableau(ClonableArray): - r""" - A key tableau. - - For more information, see - :class:`~sage.combinat.crystals.key_crystals.KeyTableaux`. - """ - def __init__(self, parent, data, check=True): - r""" - EXAMPLES:: - - sage: Y = crystals.infinity.GeneralizedYoungWalls(2) - sage: mg = Y.module_generators[0] - sage: TestSuite(mg).run() - """ - if check: - data = [tuple(row) for row in data] - ClonableArray.__init__(self, parent, data, check=check) - - def check(self): - if list(self) not in self.parent(): - raise ValueError("not a key tableau") - - def _repr_(self): - r""" - EXAMPLES:: - """ - return repr([list(row) for row in self]) - - def _repr_diagram(self): - r""" - Return a string representation of the diagram of ``self``. - - EXAMPLES:: - """ - if not self: - return '0' - ret = "" - width = max(len(repr(val)) for row in self for val in row) - base = f"{{:^{width}}}" - return "\n".join("|" + " ".join(base.format(val) for val in row) - for row in reversed(self)) - - def _latex_(self): - r""" - Return a latex representation of ``self``. - """ - if not self: - return "{\\emptyset}" - from sage.combinat.output import tex_from_array - return tex_from_array(self) - - def _ascii_art_(self): - r""" - Return an ascii art representation of ``self``. - - EXAMPLES:: - """ - from sage.typeset.ascii_art import AsciiArt - return AsciiArt(self._repr_diagram().splitlines()) - - def _unicode_art_(self): - """ - Return a unicode art representation of ``self``. - """ - from sage.typeset.unicode_art import UnicodeArt - if not self.data: - return UnicodeArt(["0"]) - - from sage.combinat.output import ascii_art_table - import unicodedata - v = unicodedata.lookup('BOX DRAWINGS LIGHT VERTICAL') - vl = unicodedata.lookup('BOX DRAWINGS LIGHT VERTICAL AND LEFT') - table = [[None]*(self.cols-len(row)) + row for row in reversed(self)] - ret = [] - for i,row in enumerate(ascii_art_table(table, use_unicode=True).splitlines()): - if row[-1] == " ": - if i % 2 == 0: - ret.append(row[:-1] + vl) - else: - ret.append(row[:-1] + v) - else: - ret.append(row) - return UnicodeArt(ret) - - def pp(self): - r""" - Pretty print ``self``. - """ - print(self._repr_diagram()) - - def _signature_data(self, i): - """ - Return data for the signature rule. - - We cancel `-+` pairs (in that order) to compute the ``i``-signature - and return the relevant data. We replace `i` with `+` and - `i + 1` with a `-`. - - OUTPUT: - - A tuple consisting of the following: - - - the column of the rightmost unpaired `+` (``None`` if does not exist) - - the column of the leftmost unpaired `-` (``None`` if does not exist) - - the number of unpaired `+` - - the number of unpaired `-` - """ - P = self.parent() - num_plus = 0 - pos_plus = [] - num_minus = 0 - pos_minus = None - for width in range(P._width): - for ind, row in enumerate(self): - if len(row) <= width: - continue - if row[width] == i: - pos_plus.append((ind, width)) - elif row[width] == i + 1: - if pos_plus: - pos_plus.pop() - else: - num_minus += 1 - pos_minus = (ind, width) - num_plus = len(pos_plus) - if pos_plus: - pos_plus = pos_plus[0] - else: - pos_plus = None - return (pos_plus, pos_minus, num_plus, num_minus) - - def e(self, i, by_tableau=False): - r""" - Return the application of the Kashiwara raising operator - `e_i` on ``self``. - - EXAMPLES:: - """ - P = self.parent() - n = P._cartan_type.rank() - if by_tableau: - ret = self.to_tableau().f(n+1-i) - if ret is None: - return None - return P.from_tableau(ret) - - pm = self._signature_data(i)[1] - if pm is None: - return None - data = [list(row) for row in self] - P = self.parent() - ind = pm[0] # the row index containing the unpaired i+1 - row = data[ind] - upper = data[ind+1:] - for j in range(pm[1], len(row)): - if row[j] != i + 1: - break - row[j] = i - for r2 in upper: - if len(r2) > j and r2[j] == i: - r2[j] = i + 1 - data = tuple(map(tuple, data)) - return P.element_class(P, data, check=False) - -# e_1 -# 211 -# 3322 - -# 211 -# 3322 -# `\phi`:: -# 1144 -# 455 -# f_4 -# 1144 -# 555 - -# 111 -# 3322 - -# 111 -# 3322 - -# 122 -# 3311 - - def f(self, i, by_tableau=False): - r""" - Return the application of the Kashiwara lowering operator - `f_i` on ``self``. - - EXAMPLES:: - """ - P = self.parent() - n = P._cartan_type.rank() - if by_tableau: - ret = self.to_tableau().e(n+1-i) - if ret is None: - return None - return P.from_tableau(ret) - - pp = self._signature_data(i)[0] - if pp is None: - return None - data = [list(row) for row in self] - P = self.parent() - ind = pp[0] # the row index containing the unpaired i - row = data[ind] - upper = data[ind+1:] - for j in range(pp[1], -1, -1): - if row[j] != i: - break - row[j] = i + 1 - for r2 in upper: - if len(r2) > j and r2[j] == i + 1: - r2[j] = i - if not P._check_content(data): - return None - data = tuple(map(tuple, data)) - return P.element_class(P, data, check=False) - - -# f_1 -# 1 -# 55511 -# 422 - -# 1 -# 422 -# 55511 -# Applying `\phi`:: -# 11155 -# 244 -# 5 -# e_4 -# 11145 -# 244 -# 5 - -# 1 -# 422 -# 55521 - -# 1 -# 55521 -# 422 - - def weight(self, root_lattice=False): - r""" - Return the weight of ``self``. - - INPUT: - - - ``root_lattice`` -- boolean determining whether weight should appear - in root lattice or not in extended affine weight lattice. - - EXAMPLES:: - - sage: x = crystals.infinity.GeneralizedYoungWalls(3)([[],[1,0,3,2],[2,1],[3,2,1,0,3,2],[],[],[2]]) - sage: x.weight() - 2*Lambda[0] + Lambda[1] - 4*Lambda[2] + Lambda[3] - 2*delta - sage: x.weight(root_lattice=True) - -2*alpha[0] - 3*alpha[1] - 5*alpha[2] - 3*alpha[3] - """ - P = self.parent().weight_lattice_realization() - wt = [P.base_ring().zero()] * len(L.basis()) - for row in self: - for val in row: - wt[val-1] += 1 - return L.from_vector(wt, coerce=False) - - def epsilon(self, i): - r""" - Return the number of `i`-colored arrows in the `i`-string above - ``self`` in the crystal graph. - - EXAMPLES:: - - sage: y = crystals.infinity.GeneralizedYoungWalls(3)([[],[1,0,3,2],[2,1],[3,2,1,0,3,2],[],[],[2]]) - sage: y.epsilon(1) - 0 - sage: y.epsilon(2) - 3 - sage: y.epsilon(0) - 0 - """ - n = self.parent()._cartan_type.rank() - return self.to_tableau().phi(n+1-i) - return ZZ(self._signature_data(i)[3]) # number of -'s - - def phi(self, i): - r""" - Return the value `\varepsilon_i(Y) + \langle h_i, - \mathrm{wt}(Y)\rangle`, where `h_i` is the `i`-th simple - coroot and `Y` is ``self``. - - EXAMPLES:: - - sage: y = crystals.infinity.GeneralizedYoungWalls(3)([[0],[1,0,3,2],[2,1],[3,2,1,0,3,2],[0],[],[2]]) - sage: y.phi(1) - 3 - sage: y.phi(2) - -1 - """ - n = self.parent()._cartan_type.rank() - return self.to_tableau().epsilon(n+1-i) - return ZZ(self._signature_data(i)[2]) # number of +'s - - def to_tableau(self): - """ - Return ``self`` as an element of the crystal of semistandard - Young tableaux of type `A_n`. - """ - P = self.parent() - C = P._ssyt - n = P._cartan_type.rank() - ret = sum((sorted((n + 2 - row[i] for row in self if len(row) > i), reverse=True) - for i in range(P._width)), []) - return C(list=ret) - - -class KeyTableaux(UniqueRepresentation, Parent): - r""" - Key tableaux - """ - @staticmethod - def __classcall_private__(cls, shape, n=None, category=None): - r""" - Normalize input to ensure a unique representation. - - INPUT: - - - ``shape`` -- the shape - - ``n`` -- (optional) type `A_n` - - EXAMPLES:: - - sage: Yinf = crystals.infinity.GeneralizedYoungWalls(3) - sage: Yinf2 = crystals.infinity.GeneralizedYoungWalls(int(3)) - sage: Yinf is Yinf2 - True - """ - shape = list(shape) - if n is None: - n = len(shape) - 1 - while shape and not shape[-1]: # standardize by removing trailing 0's - shape.pop() - shape = tuple(shape) - if n < len(shape) - 1: - raise ValueError(f"the rank must be at least {len(shape)-1}") - return super().__classcall__(cls, shape, n, category) - - def __init__(self, shape, n, category): - r""" - EXAMPLES:: - - sage: Yinf = crystals.infinity.GeneralizedYoungWalls(3) - sage: TestSuite(Yinf).run() - """ - self._cartan_type = CartanType(['A', n]) - self._shape = shape - self._width = max(shape, default=0) - self._ssyt = CrystalOfTableaux(self._cartan_type, shape=sorted(shape, reverse=True)) - category = HighestWeightCrystals().Finite().or_subcategory(category) - Parent.__init__(self, category=category) - - Element = KeyTableau - - @lazy_attribute - def module_generators(self): - r""" - Return the highest weight element of ``self``. - - Note that this is not the generator of the corresponding module - of ``self`` as `U_q(\mathfrak{gl}_n)^+`-module (which is instead - :meth:`extremal_module_generator()`). This is for implementation - details in the category of - :class:`~sage.categories.highest_weight_crystals.HighestWeightCrystals` - assuming the ``module_generators`` contains all of the highest weight - elements and those generate ``self`` under `f_i`. - """ - gen = self.extremal_module_generator() - return (gen.to_highest_weight()[0],) - - @cached_method - def extremal_module_generator(self): - """ - Return the generator of ``self``, considered as an extremal weight - module. - """ - data = tuple([(i,)*ell for i, ell in enumerate(self._shape, start=1)]) - return self.element_class(self, data, check=False) - - def _element_constructor_(self, data, check=True): - r""" - Construct an element of ``self`` from ``data``. - - INPUT: - - - ``data`` -- a multilist - - EXAMPLES:: - - sage: GYW = crystals.infinity.GeneralizedYoungWalls(2) - sage: y = GYW([[],[1,0],[2,1]]) # indirect doctest - sage: y - [[], [1, 0], [2, 1]] - """ - return self.element_class(self, data, check=check) - - def _repr_(self): - r""" - EXAMPLES:: - - sage: Y = crystals.infinity.GeneralizedYoungWalls(4) - sage: Y - Crystal of generalized Young walls of type ['A', 4, 1] - """ - return "Crystal of key tableaux of type {} and shape {}".format(self._cartan_type, self._shape) - - def __contains__(self, data): - """ - Check if ``data`` is an element of ``self``. - """ - if isinstance(data, self.element_class): - return data.parent() is self - - # Check the shape agrees - if not isinstance(data, Sequence): - return False - if len(self._shape) != len(data): - return False - if any((not isinstance(row, Sequence)) or len(row) != ell - for row, ell in zip(data, self._shape)): - return False - - # Check entries in each column are distinct - for i in range(self._width): - col = [row[i] for row in data if len(row) > i] - if len(col) != len(set(col)): - return False - - # Check the other nontrivial content conditions - return self._check_content(data) - - def _check_content(self, data): - """ - Check the content of ``data`` is an element of ``self``, where - we assume that ``data`` is a filling of ``self._shape`` with - with distinct entries in the columns. - """ - # Check rows are weakly decreasing - for row in data: - if any(row[i] < row[i+1] for i in range(len(row)-1)): - return False - - # Check the other condition - for ind, row in enumerate(data): - for ri, k in enumerate(row): - i = max((row[ri] for row in data[ind+1:] if len(row) > ri and row[ri] < k), default=None) - if i is None: - continue - if ri == len(row) - 1 or i >= row[ri+1]: - return False - - # Check the semistandard condition - return all(not row or row[0] <= i for i, row in enumerate(data, start=1)) - - def from_tableau(self, T): - """ - Return the element of ``self`` corresponding to ``T`` if the result - is in ``self`` and ``None`` otherwise. - """ - if isinstance(T, self._ssyt.element_class): - T = T.to_tableau() - - # Special case of the empty tableau - if not T: - if T not in self: - return None - return self.element_class(self, [], check=False) - - data = [[None] * ell for ell in self._shape] - n = self._cartan_type.rank() + 2 - T = ([n - val for val in col] for col in reversed(T.conjugate())) - - for j in range(self._width-1,-1,-1): - col = next(T) - for ind, row in enumerate(data): - if len(row) <= j: - continue - - if len(row) == j + 1: # rightmost entry in the row - row[j] = col.pop() - else: - # Necessarily there is an entry to the right - for i in range(len(col)-1,-1,-1): - if col[i] >= row[j+1]: - row[j] = col.pop(i) - break - - # Check the semistandard condition - if row[j] > ind + 1: - return None - if not col: - break - - assert data in self - data = tuple(map(tuple, data)) - return self.element_class(self, data, check=False) - - def shape(self): - """ - Return the shape of ``self``. - """ - return self._shape \ No newline at end of file diff --git a/src/sage/schemes/elliptic_curves/cm.py b/src/sage/schemes/elliptic_curves/cm.py index 94b922a0365..d24c09a72bb 100644 --- a/src/sage/schemes/elliptic_curves/cm.py +++ b/src/sage/schemes/elliptic_curves/cm.py @@ -248,7 +248,7 @@ def is_HCP(f, check_monic_irreducible=True): # Guarantees 4*p > |D| for fundamental D under GRH p = pmin-1 n = 0 - from sage.arith.all import next_prime + from sage.arith.misc import next_prime while True: p = next_prime(p) n += 1 @@ -315,7 +315,7 @@ def OrderClassNumber(D0,h0,f): return h0 ps = f.prime_divisors() from sage.misc.misc_c import prod - from sage.arith.all import kronecker_symbol + from sage.arith.misc import kronecker as kronecker_symbol n = (f // prod(ps)) * prod(p-kronecker_symbol(D0,p) for p in ps) if D0 == -3: #assert h0 == 1 and n%3==0 From 912e520fa7e299bdd77c04e20fd1c5ee83c9a673 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 2 Apr 2023 10:02:13 -0700 Subject: [PATCH 115/135] src/sage/schemes/elliptic_curves/ell_generic.py: Fix up doctest --- src/sage/schemes/elliptic_curves/ell_generic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/schemes/elliptic_curves/ell_generic.py b/src/sage/schemes/elliptic_curves/ell_generic.py index 1025ec5a44b..4989c94d0d2 100644 --- a/src/sage/schemes/elliptic_curves/ell_generic.py +++ b/src/sage/schemes/elliptic_curves/ell_generic.py @@ -1391,7 +1391,7 @@ def change_ring(self, R): sage: F2 = GF(5^2,'a'); a = F2.gen() # optional - sage.rings.finite_rings sage: F4 = GF(5^4,'b'); b = F4.gen() # optional - sage.rings.finite_rings sage: roots = a.charpoly().roots(ring=F4, multiplicities=False) # optional - sage.rings.finite_rings - sage: h = F2.hom([a[0]], F4) # optional - sage.rings.finite_rings + sage: h = F2.hom([roots[0]], F4) # optional - sage.rings.finite_rings sage: E = EllipticCurve(F2, [1,a]); E # optional - sage.rings.finite_rings Elliptic Curve defined by y^2 = x^3 + x + a over Finite Field in a of size 5^2 From 3f142c3ab1d58729a53eade99eac47d86b84aada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 2 Apr 2023 20:15:03 +0200 Subject: [PATCH 116/135] remove deprecation from 26307 --- src/sage/combinat/words/morphism.py | 59 +++-------------------------- 1 file changed, 6 insertions(+), 53 deletions(-) diff --git a/src/sage/combinat/words/morphism.py b/src/sage/combinat/words/morphism.py index da112663af2..0b8e99ce5c5 100644 --- a/src/sage/combinat/words/morphism.py +++ b/src/sage/combinat/words/morphism.py @@ -568,7 +568,7 @@ def __ne__(self, other): """ return not self == other - def __repr__(self): + def __repr__(self) -> str: r""" Return the string representation of the morphism. @@ -587,7 +587,7 @@ def __repr__(self): """ return "WordMorphism: %s" % str(self) - def __str__(self): + def __str__(self) -> str: r""" Return the morphism in str. @@ -625,7 +625,7 @@ def __str__(self): for lettre, image in self._morph.items()] return ', '.join(sorted(L)) - def __call__(self, w, order=1, datatype=None): + def __call__(self, w, order=1): r""" Return the image of ``w`` under self to the given order. @@ -635,8 +635,6 @@ def __call__(self, w, order=1, datatype=None): - ``order`` - integer or plus ``Infinity`` (default: 1) - - ``datatype`` - deprecated - OUTPUT: - ``word`` - order-th iterated image under self of ``w`` @@ -752,7 +750,7 @@ def __call__(self, w, order=1, datatype=None): sage: m('') word: - The default datatype when the input is a finite word is another + When the input is a finite word, the output is another finite word:: sage: w = m('aabb') @@ -764,49 +762,7 @@ def __call__(self, w, order=1, datatype=None): sage: import tempfile sage: with tempfile.NamedTemporaryFile(suffix=".sobj") as f: ....: save(w, filename=f.name) - - The ``datatype`` argument is deprecated:: - - sage: m = WordMorphism('a->ab,b->ba') - sage: w = m('aaab',datatype='list') - doctest:warning - ... - DeprecationWarning: the "datatype" argument is deprecated - See /~https://github.com/sagemath/sage/issues/26307 for details. - - sage: type(w) - - sage: w = m('aaab',datatype='str') - sage: type(w) - - sage: w = m('aaab',datatype='tuple') - sage: type(w) - - - To use str datatype for the output word, the domain and codomain - alphabet must consist of str objects:: - - sage: m = WordMorphism({0:[0,1],1:[1,0]}) - sage: w = m([0],4); type(w) - - sage: w = m([0],4,datatype='list') - doctest:warning - ... - DeprecationWarning: the "datatype" argument is deprecated - See /~https://github.com/sagemath/sage/issues/26307 for details. - sage: type(w) - - sage: w = m([0],4,datatype='str') - Traceback (most recent call last): - ... - ValueError: 0 not in alphabet - sage: w = m([0],4,datatype='tuple'); type(w) - """ - if datatype is not None: - from sage.misc.superseded import deprecation - deprecation(26307, 'the "datatype" argument is deprecated') - if order == 1: D = self.domain() C = self.codomain() @@ -817,10 +773,7 @@ def __call__(self, w, order=1, datatype=None): im = C() for a in w: im += self._morph[a] - if datatype is not None: - return C(im, datatype=datatype) - else: - return im + return im if isinstance(w, Iterable): pass @@ -853,7 +806,7 @@ def __call__(self, w, order=1, datatype=None): return self.fixed_point(letter=letter) elif isinstance(order, (int, Integer)) and order > 1: - return self(self(w, order - 1), datatype=datatype) + return self(self(w, order - 1)) elif order == 0: return self._domain(w) From 69effdd3f278cbf62e9ed66243871f247287db6d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 27 Mar 2023 23:28:37 -0700 Subject: [PATCH 117/135] .relint.yml, src/sage/misc/replace_dot_all.py: Flag/replace .all imports from more packages --- src/.relint.yml | 2 +- src/sage/misc/replace_dot_all.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/.relint.yml b/src/.relint.yml index e0b275296aa..67211bc7414 100644 --- a/src/.relint.yml +++ b/src/.relint.yml @@ -49,7 +49,7 @@ Hint: namespace package. Type import_statements("SOME_IDENTIFIER") to find a more specific import, Hint: or use 'sage --fiximports' to fix automatically in the source file. # Keep in sync with SAGE_ROOT/src/sage/misc/replace_dot_all.py - pattern: 'from\s+sage(|[.](arith|categories|combinat|ext|graphs(|[.]decompositions)|interfaces|libs|matrix|misc|numerical(|[.]backends)|rings(|[.]finite_rings)|sets))[.]all\s+import' + pattern: 'from\s+sage(|[.](arith|categories|combinat|crypto|databases|data_structures|dynamics|ext|game_theory|games|graphs|groups|interfaces|manifolds|matrix|matroids|misc|modules|monoids|numerical|probability|quadratic_forms|quivers|rings|sat|schemes|sets|stats|tensor)[a-z0-9_.]*|[.]libs)[.]all\s+import' # imports from .all are allowed in all.py; also allow in some modules that need sage.all filePattern: '(.*/|)(?!(all|benchmark|dev_tools|parsing|sage_eval))[^/.]*[.](py|pyx|pxi)$' diff --git a/src/sage/misc/replace_dot_all.py b/src/sage/misc/replace_dot_all.py index 320a5a15c06..8b48118aef6 100644 --- a/src/sage/misc/replace_dot_all.py +++ b/src/sage/misc/replace_dot_all.py @@ -72,7 +72,7 @@ # Keep in sync with SAGE_ROOT/src/.relint.yml (namespace_pkg_all_import) default_package_regex = (r"sage(" - r"|[.](arith|categories|combinat|ext|graphs(|[.]decompositions)|interfaces|libs|matrix|misc|numerical(|[.]backends)|rings|sets)" + r"|[.](arith|categories|combinat|crypto|databases|data_structures|dynamics|ext|game_theory|games|graphs|groups|interfaces|manifolds|matrix|matroids|misc|modules|monoids|numerical|probability|quadratic_forms|quivers|rings|sat|schemes|sets|stats|tensor)[a-z0-9_.]*|[.]libs" r")[.]all") @@ -438,7 +438,9 @@ def walkdir_replace_dot_all(dir, file_regex=r'.*[.](py|pyx|pxi)$', package_regex package_regex = None # Execute the main function based on the specified location and verbosity if not args.location: - args.location = [os.path.join(sage.env.SAGE_SRC, 'sage')] + from sage.env import SAGE_SRC + + args.location = [os.path.join(SAGE_SRC, 'sage')] try: for location in args.location: if not (location.endswith('.py') or location.endswith('.pxi')): From d85750e048693000b35c7947f07e91b3ef31e26c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 1 Apr 2023 13:07:00 -0700 Subject: [PATCH 118/135] Run './sage -fiximports' --- .../letterplace/free_algebra_element_letterplace.pyx | 2 +- src/sage/algebras/letterplace/free_algebra_letterplace.pyx | 2 +- src/sage/categories/finite_complex_reflection_groups.py | 3 ++- src/sage/coding/ag_code_decoders.pyx | 2 +- src/sage/coding/linear_code.py | 2 +- src/sage/combinat/root_system/reflection_group_complex.py | 4 ++-- src/sage/combinat/species/characteristic_species.py | 2 +- src/sage/combinat/species/cycle_species.py | 5 +++-- src/sage/combinat/species/linear_order_species.py | 2 +- src/sage/combinat/species/misc.py | 5 ++++- src/sage/combinat/species/partition_species.py | 2 +- src/sage/combinat/species/permutation_species.py | 3 ++- src/sage/combinat/species/product_species.py | 3 ++- src/sage/combinat/species/set_species.py | 2 +- src/sage/combinat/species/subset_species.py | 3 ++- src/sage/combinat/words/word_generators.py | 2 +- src/sage/doctest/parsing.py | 2 +- src/sage/dynamics/arithmetic_dynamics/projective_ds.py | 2 +- src/sage/geometry/hyperplane_arrangement/arrangement.py | 2 +- src/sage/graphs/graph_coloring.pyx | 2 +- src/sage/groups/affine_gps/affine_group.py | 2 +- src/sage/interfaces/chomp.py | 3 ++- src/sage/interfaces/macaulay2.py | 2 +- src/sage/libs/singular/function.pyx | 2 +- src/sage/matrix/matrix_symbolic_dense.pyx | 2 +- src/sage/matroids/catalog.py | 2 +- src/sage/misc/cachefunc.pyx | 4 ++-- src/sage/modular/arithgroup/congroup_generic.py | 2 +- src/sage/modular/local_comp/type_space.py | 2 +- src/sage/modular/modform/numerical.py | 2 +- src/sage/modules/free_quadratic_module_integer_symmetric.py | 2 +- src/sage/numerical/interactive_simplex_method.py | 3 ++- src/sage/quadratic_forms/genera/genus.py | 3 ++- src/sage/quadratic_forms/quadratic_form__automorphisms.py | 2 +- src/sage/rings/finite_rings/finite_field_base.pyx | 2 +- src/sage/rings/finite_rings/integer_mod.pyx | 2 +- src/sage/rings/multi_power_series_ring.py | 2 +- src/sage/rings/number_field/number_field.py | 2 +- src/sage/rings/number_field/splitting_field.py | 4 ++-- src/sage/rings/padics/padic_capped_relative_element.pyx | 2 +- src/sage/rings/polynomial/plural.pyx | 2 +- src/sage/rings/polynomial/polynomial_rational_flint.pyx | 4 +++- src/sage/rings/polynomial/real_roots.pyx | 3 ++- src/sage/rings/qqbar.py | 2 +- src/sage/rings/valuation/valuation_space.py | 2 +- src/sage/schemes/curves/constructor.py | 4 ++-- src/sage/schemes/cyclic_covers/cycliccover_generic.py | 2 +- src/sage/schemes/elliptic_curves/cm.py | 2 +- src/sage/schemes/elliptic_curves/ell_curve_isogeny.py | 2 +- src/sage/schemes/elliptic_curves/heegner.py | 6 +++--- src/sage/schemes/elliptic_curves/isogeny_small_degree.py | 2 +- src/sage/schemes/elliptic_curves/kraus.py | 2 +- src/sage/schemes/elliptic_curves/saturation.py | 4 ++-- .../schemes/hyperelliptic_curves/hyperelliptic_generic.py | 2 +- .../hyperelliptic_curves/hyperelliptic_rational_field.py | 2 +- src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py | 2 +- src/sage/schemes/toric/morphism.py | 2 +- src/sage/schemes/toric/sheaf/klyachko.py | 4 ++-- src/sage/schemes/toric/weierstrass.py | 2 +- src/sage/topology/cell_complex.py | 2 +- 60 files changed, 83 insertions(+), 69 deletions(-) diff --git a/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx b/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx index 80ac48b202c..3ccb1f951ed 100644 --- a/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx +++ b/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx @@ -17,7 +17,7 @@ AUTHOR: # https://www.gnu.org/licenses/ # **************************************************************************** -from sage.groups.perm_gps.all import CyclicPermutationGroup +from sage.groups.perm_gps.permgroup_named import CyclicPermutationGroup from sage.libs.singular.function import lib, singular_function from sage.misc.repr import repr_lincomb from sage.rings.polynomial.multi_polynomial_ideal import MPolynomialIdeal diff --git a/src/sage/algebras/letterplace/free_algebra_letterplace.pyx b/src/sage/algebras/letterplace/free_algebra_letterplace.pyx index 0e1e47efc11..add09456f0b 100644 --- a/src/sage/algebras/letterplace/free_algebra_letterplace.pyx +++ b/src/sage/algebras/letterplace/free_algebra_letterplace.pyx @@ -684,7 +684,7 @@ cdef class FreeAlgebra_letterplace(Algebra): ngens = self.__ngens degbound = self._degbound cdef list G = [C(x._poly) for x in g] - from sage.groups.perm_gps.all import CyclicPermutationGroup + from sage.groups.perm_gps.permgroup_named import CyclicPermutationGroup CG = CyclicPermutationGroup(C.ngens()) for y in G: out.extend([y] + [y * CG[ngens * (n + 1)] diff --git a/src/sage/categories/finite_complex_reflection_groups.py b/src/sage/categories/finite_complex_reflection_groups.py index 13e682a0033..8648f89dbc4 100644 --- a/src/sage/categories/finite_complex_reflection_groups.py +++ b/src/sage/categories/finite_complex_reflection_groups.py @@ -854,7 +854,8 @@ def noncrossing_partition_lattice(self, c=None, L=None, sage: sorted( w.reduced_word() for w in W.noncrossing_partition_lattice(W.from_reduced_word([2])) ) # optional - gap3 [[], [2]] """ - from sage.combinat.posets.all import Poset, LatticePoset + from sage.combinat.posets.posets import Poset + from sage.combinat.posets.lattices import LatticePoset R = self.reflections() if L is None: diff --git a/src/sage/coding/ag_code_decoders.pyx b/src/sage/coding/ag_code_decoders.pyx index 54e3c1d8810..1ff9a5ed47b 100644 --- a/src/sage/coding/ag_code_decoders.pyx +++ b/src/sage/coding/ag_code_decoders.pyx @@ -61,7 +61,7 @@ AUTHORS: cimport cython from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing -from sage.rings.function_field.all import FunctionField +from sage.rings.function_field.constructor import FunctionField from sage.modules.free_module_element import vector from sage.matrix.constructor import matrix diff --git a/src/sage/coding/linear_code.py b/src/sage/coding/linear_code.py index 12468fe6959..b03ef5116ba 100644 --- a/src/sage/coding/linear_code.py +++ b/src/sage/coding/linear_code.py @@ -217,7 +217,7 @@ class should inherit from this class. Also ``AbstractLinearCode`` should never from sage.combinat.subset import Subsets from sage.cpython.string import bytes_to_str from sage.features.gap import GapPackage -from sage.groups.all import SymmetricGroup +from sage.groups.perm_gps.permgroup_named import SymmetricGroup from sage.groups.perm_gps.permgroup import PermutationGroup from sage.interfaces.gap import gap from sage.matrix.matrix_space import MatrixSpace diff --git a/src/sage/combinat/root_system/reflection_group_complex.py b/src/sage/combinat/root_system/reflection_group_complex.py index 68159babb11..346cb59061b 100644 --- a/src/sage/combinat/root_system/reflection_group_complex.py +++ b/src/sage/combinat/root_system/reflection_group_complex.py @@ -764,7 +764,7 @@ def discriminant(self): sage: W.discriminant() # optional - gap3 x0^6*x1^2 - 6*x0^5*x1^3 + 13*x0^4*x1^4 - 12*x0^3*x1^5 + 4*x0^2*x1^6 """ - from sage.rings.polynomial.all import PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing n = self.rank() P = PolynomialRing(QQ, 'x', n) x = P.gens() @@ -1416,7 +1416,7 @@ def fundamental_invariants(self): (x0^3 + x1^3, x0^3*x1^3) """ import re - from sage.rings.polynomial.all import PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing if not self.is_irreducible(): return sum([W.fundamental_invariants() for W in self.irreducible_components() ],tuple()) diff --git a/src/sage/combinat/species/characteristic_species.py b/src/sage/combinat/species/characteristic_species.py index 910ce3e96fc..2110920cb93 100644 --- a/src/sage/combinat/species/characteristic_species.py +++ b/src/sage/combinat/species/characteristic_species.py @@ -88,7 +88,7 @@ def automorphism_group(self): sage: a.automorphism_group() Symmetric group of order 3! as a permutation group """ - from sage.groups.all import SymmetricGroup + from sage.groups.perm_gps.permgroup_named import SymmetricGroup return SymmetricGroup(len(self._labels)) diff --git a/src/sage/combinat/species/cycle_species.py b/src/sage/combinat/species/cycle_species.py index 20d89a770db..335223143ed 100644 --- a/src/sage/combinat/species/cycle_species.py +++ b/src/sage/combinat/species/cycle_species.py @@ -54,7 +54,7 @@ def permutation_group_element(self): sage: a.permutation_group_element() (1,2,3) """ - from sage.groups.all import PermutationGroupElement + from sage.groups.perm_gps.constructor import PermutationGroupElement return PermutationGroupElement(tuple(self._list)) def transport(self, perm): @@ -96,7 +96,8 @@ def automorphism_group(self): sage: [a.transport(perm) for perm in a.automorphism_group()] [(1, 2, 3, 4), (1, 2, 3, 4), (1, 2, 3, 4), (1, 2, 3, 4)] """ - from sage.groups.all import SymmetricGroup, PermutationGroup + from sage.groups.perm_gps.permgroup_named import SymmetricGroup + from sage.groups.perm_gps.permgroup import PermutationGroup S = SymmetricGroup(len(self._labels)) p = self.permutation_group_element() return PermutationGroup(S.centralizer(p).gens()) diff --git a/src/sage/combinat/species/linear_order_species.py b/src/sage/combinat/species/linear_order_species.py index 3f8690da3c2..a62fde28fb5 100644 --- a/src/sage/combinat/species/linear_order_species.py +++ b/src/sage/combinat/species/linear_order_species.py @@ -63,7 +63,7 @@ def automorphism_group(self): sage: a.automorphism_group() Symmetric group of order 1! as a permutation group """ - from sage.groups.all import SymmetricGroup + from sage.groups.perm_gps.permgroup_named import SymmetricGroup return SymmetricGroup(1) diff --git a/src/sage/combinat/species/misc.py b/src/sage/combinat/species/misc.py index f31a0939477..7296c77e54d 100644 --- a/src/sage/combinat/species/misc.py +++ b/src/sage/combinat/species/misc.py @@ -16,7 +16,10 @@ # http://www.gnu.org/licenses/ #***************************************************************************** -from sage.groups.all import PermutationGroup, PermutationGroup_generic, PermutationGroupElement, SymmetricGroup +from sage.groups.perm_gps.permgroup import PermutationGroup +from sage.groups.perm_gps.permgroup import PermutationGroup_generic +from sage.groups.perm_gps.constructor import PermutationGroupElement +from sage.groups.perm_gps.permgroup_named import SymmetricGroup from sage.misc.misc_c import prod from functools import wraps diff --git a/src/sage/combinat/species/partition_species.py b/src/sage/combinat/species/partition_species.py index 7ddd9812ba1..c9b08f1b4bb 100644 --- a/src/sage/combinat/species/partition_species.py +++ b/src/sage/combinat/species/partition_species.py @@ -102,7 +102,7 @@ def automorphism_group(self): sage: a.automorphism_group() Permutation Group with generators [(1,2)] """ - from sage.groups.all import SymmetricGroup + from sage.groups.perm_gps.permgroup_named import SymmetricGroup return reduce(lambda a,b: a.direct_product(b, maps=False), [SymmetricGroup(block._list) for block in self._list]) diff --git a/src/sage/combinat/species/permutation_species.py b/src/sage/combinat/species/permutation_species.py index 9c34eeb9c98..aeb7ad3ca3b 100644 --- a/src/sage/combinat/species/permutation_species.py +++ b/src/sage/combinat/species/permutation_species.py @@ -97,7 +97,8 @@ def automorphism_group(self): ['a', 'c', 'b', 'd'], ['a', 'c', 'b', 'd']] """ - from sage.groups.all import SymmetricGroup, PermutationGroup + from sage.groups.perm_gps.permgroup_named import SymmetricGroup + from sage.groups.perm_gps.permgroup import PermutationGroup S = SymmetricGroup(len(self._labels)) p = self.permutation_group_element() return PermutationGroup(S.centralizer(p).gens()) diff --git a/src/sage/combinat/species/product_species.py b/src/sage/combinat/species/product_species.py index 74004849b79..0989d2a8f8c 100644 --- a/src/sage/combinat/species/product_species.py +++ b/src/sage/combinat/species/product_species.py @@ -176,7 +176,8 @@ def automorphism_group(self): sage: [a.transport(g) for g in a.automorphism_group()] [{2, 3}*{1, 4}, {2, 3}*{1, 4}, {2, 3}*{1, 4}, {2, 3}*{1, 4}] """ - from sage.groups.all import PermutationGroupElement, PermutationGroup + from sage.groups.perm_gps.constructor import PermutationGroupElement + from sage.groups.perm_gps.permgroup import PermutationGroup from sage.combinat.species.misc import change_support left, right = self._list diff --git a/src/sage/combinat/species/set_species.py b/src/sage/combinat/species/set_species.py index 4bc94c220f8..c4942dc653d 100644 --- a/src/sage/combinat/species/set_species.py +++ b/src/sage/combinat/species/set_species.py @@ -77,7 +77,7 @@ def automorphism_group(self): sage: a.automorphism_group() Symmetric group of order 3! as a permutation group """ - from sage.groups.all import SymmetricGroup + from sage.groups.perm_gps.permgroup_named import SymmetricGroup return SymmetricGroup(max(1,len(self._labels))) diff --git a/src/sage/combinat/species/subset_species.py b/src/sage/combinat/species/subset_species.py index 25f4862f4be..2bd89885533 100644 --- a/src/sage/combinat/species/subset_species.py +++ b/src/sage/combinat/species/subset_species.py @@ -102,7 +102,8 @@ def automorphism_group(self): sage: [a.transport(g) for g in a.automorphism_group()] [{1, 3}, {1, 3}, {1, 3}, {1, 3}] """ - from sage.groups.all import SymmetricGroup, PermutationGroup + from sage.groups.perm_gps.permgroup_named import SymmetricGroup + from sage.groups.perm_gps.permgroup import PermutationGroup a = SymmetricGroup(self._list) b = SymmetricGroup(self.complement()._list) return PermutationGroup(a.gens() + b.gens()) diff --git a/src/sage/combinat/words/word_generators.py b/src/sage/combinat/words/word_generators.py index 66c5f25eda7..5cf9625d21f 100644 --- a/src/sage/combinat/words/word_generators.py +++ b/src/sage/combinat/words/word_generators.py @@ -1496,7 +1496,7 @@ def _fibonacci_tile(self, n, q_0=None, q_1=3): [BmBGL09]_ """ - from sage.combinat.words.all import WordMorphism + from sage.combinat.words.morphism import WordMorphism W = FiniteWords([0,1,2,3]) bar = WordMorphism({0:0,1:3,3:1,2:2},codomain=W) if n==0: diff --git a/src/sage/doctest/parsing.py b/src/sage/doctest/parsing.py index 26d793b96bf..2e39bee5704 100644 --- a/src/sage/doctest/parsing.py +++ b/src/sage/doctest/parsing.py @@ -63,7 +63,7 @@ def RIFtol(*args): if _RIFtol is None: try: # We need to import from sage.all to avoid circular imports. - from sage.all import RealIntervalField + from sage.rings.real_mpfi import RealIntervalField except ImportError: from warnings import warn warn("RealIntervalField not available, ignoring all tolerance specifications in doctests") diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index 4dd109036d4..e9eb515efaf 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -99,7 +99,7 @@ class initialization directly. from sage.rings.polynomial.flatten import FlatteningMorphism, UnflatteningMorphism from sage.rings.morphism import RingHomomorphism_im_gens from sage.rings.number_field.number_field_ideal import NumberFieldFractionalIdeal -from sage.rings.padics.all import Qp +from sage.rings.padics.factory import Qp from sage.rings.polynomial.multi_polynomial_ring_base import is_MPolynomialRing from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.polynomial.polynomial_ring import is_PolynomialRing diff --git a/src/sage/geometry/hyperplane_arrangement/arrangement.py b/src/sage/geometry/hyperplane_arrangement/arrangement.py index 2874eb57409..41115fd0452 100644 --- a/src/sage/geometry/hyperplane_arrangement/arrangement.py +++ b/src/sage/geometry/hyperplane_arrangement/arrangement.py @@ -1726,7 +1726,7 @@ def vertices(self, exclude_sandwiched=False): ((0, 0), (0, 8), (8, 0), (8, 8)) """ import itertools - from sage.matroids.all import Matroid + from sage.matroids.constructor import Matroid R = self.parent().base_ring() parallels = self._parallel_hyperplanes() A_list = [parallel[0][1] for parallel in parallels] diff --git a/src/sage/graphs/graph_coloring.pyx b/src/sage/graphs/graph_coloring.pyx index a154942b92c..844969f8b94 100644 --- a/src/sage/graphs/graph_coloring.pyx +++ b/src/sage/graphs/graph_coloring.pyx @@ -1643,7 +1643,7 @@ def _vizing_edge_coloring(g): e_colors[frozenset((fan_center, fan[-1]))] = d matchings = dict() - for edge, c in e_colors.items(): + for edge, c in e_colors.items(): matchings[c] = matchings.get(c, []) + [tuple(edge)] classes = list(matchings.values()) diff --git a/src/sage/groups/affine_gps/affine_group.py b/src/sage/groups/affine_gps/affine_group.py index 44d6bf94900..04f7838bc47 100644 --- a/src/sage/groups/affine_gps/affine_group.py +++ b/src/sage/groups/affine_gps/affine_group.py @@ -22,7 +22,7 @@ from sage.groups.matrix_gps.linear import GL from sage.categories.rings import Rings from sage.matrix.matrix_space import MatrixSpace -from sage.modules.all import FreeModule +from sage.modules.free_module import FreeModule from sage.structure.unique_representation import UniqueRepresentation from sage.misc.cachefunc import cached_method diff --git a/src/sage/interfaces/chomp.py b/src/sage/interfaces/chomp.py index b499f2a33b5..9e1b92d7709 100644 --- a/src/sage/interfaces/chomp.py +++ b/src/sage/interfaces/chomp.py @@ -151,7 +151,8 @@ def __call__(self, program, complex, subcomplex=None, **kwds): from subprocess import Popen, PIPE from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ - from sage.modules.all import VectorSpace, vector + from sage.modules.free_module import VectorSpace + from sage.modules.free_module_element import free_module_element as vector from sage.combinat.free_module import CombinatorialFreeModule deprecation(33777, "the CHomP interface is deprecated") diff --git a/src/sage/interfaces/macaulay2.py b/src/sage/interfaces/macaulay2.py index 09d17c4f2a4..58ec79a48ee 100644 --- a/src/sage/interfaces/macaulay2.py +++ b/src/sage/interfaces/macaulay2.py @@ -1618,7 +1618,7 @@ def _sage_(self): elif cls_str == "String": return str(repr_str) elif cls_str == "Module": - from sage.modules.all import FreeModule + from sage.modules.free_module import FreeModule if self.isFreeModule()._sage_(): ring = self.ring()._sage_() rank = self.rank()._sage_() diff --git a/src/sage/libs/singular/function.pyx b/src/sage/libs/singular/function.pyx index 906f1e6c860..229f6695e09 100644 --- a/src/sage/libs/singular/function.pyx +++ b/src/sage/libs/singular/function.pyx @@ -1299,7 +1299,7 @@ cdef class SingularFunction(SageObject): ring = self.common_ring(args, ring) if ring is None: if dummy_ring is None: - from sage.rings.polynomial.all import PolynomialRing + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.rational_field import QQ dummy_ring = PolynomialRing(QQ, "dummy", implementation="singular") # seems a reasonable default ring = dummy_ring diff --git a/src/sage/matrix/matrix_symbolic_dense.pyx b/src/sage/matrix/matrix_symbolic_dense.pyx index 8774848f2d7..19ca5c85cb2 100644 --- a/src/sage/matrix/matrix_symbolic_dense.pyx +++ b/src/sage/matrix/matrix_symbolic_dense.pyx @@ -154,7 +154,7 @@ Check that :trac:`12778` is fixed:: Full MatrixSpace of 3 by 4 dense matrices over Symbolic Ring """ -from sage.rings.polynomial.all import PolynomialRing +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.structure.element cimport ModuleElement, RingElement, Element from sage.structure.factorization import Factorization diff --git a/src/sage/matroids/catalog.py b/src/sage/matroids/catalog.py index 61071b0c757..769ef123923 100644 --- a/src/sage/matroids/catalog.py +++ b/src/sage/matroids/catalog.py @@ -40,7 +40,7 @@ from sage.rings.integer_ring import ZZ from sage.rings.finite_rings.finite_field_constructor import GF -from sage.schemes.all import ProjectiveSpace +from sage.schemes.projective.projective_space import ProjectiveSpace import sage.matroids.matroid import sage.matroids.basis_exchange_matroid diff --git a/src/sage/misc/cachefunc.pyx b/src/sage/misc/cachefunc.pyx index bae02139bc2..9715726659b 100644 --- a/src/sage/misc/cachefunc.pyx +++ b/src/sage/misc/cachefunc.pyx @@ -107,9 +107,9 @@ By :trac:`11115`, even if a parent does not allow attribute assignment, it can inherit a cached method from the parent class of a category (previously, the cache would have been broken):: - sage: cython_code = ["from sage.misc.cachefunc import cached_method", + sage: cython_code = ["from sage.misc.cachefunc import cached_method", ....: "from sage.misc.cachefunc import cached_in_parent_method", - ....: "from sage.categories.category import Category", + ....: "from sage.categories.category import Category", ....: "from sage.categories.objects import Objects", ....: "class MyCategory(Category):", ....: " @cached_method", diff --git a/src/sage/modular/arithgroup/congroup_generic.py b/src/sage/modular/arithgroup/congroup_generic.py index 99dbc5036fb..75605b1c3dc 100644 --- a/src/sage/modular/arithgroup/congroup_generic.py +++ b/src/sage/modular/arithgroup/congroup_generic.py @@ -22,7 +22,7 @@ ################################################################################ from sage.arith.misc import gcd -from sage.groups.matrix_gps.all import MatrixGroup +from sage.groups.matrix_gps.finitely_generated import MatrixGroup from sage.matrix.matrix_space import MatrixSpace from sage.misc.misc_c import prod from sage.rings.finite_rings.integer_mod_ring import Zmod diff --git a/src/sage/modular/local_comp/type_space.py b/src/sage/modular/local_comp/type_space.py index 2549e5519b0..3b57a2652ae 100644 --- a/src/sage/modular/local_comp/type_space.py +++ b/src/sage/modular/local_comp/type_space.py @@ -497,7 +497,7 @@ def _rho_unramified(self, g): True """ f = self.prime() ** self.u() - from sage.groups.matrix_gps.all import SL + from sage.groups.matrix_gps.linear import SL G = SL(2, Zmod(f)) gg = G(g) s = G([1,1,0,1]) diff --git a/src/sage/modular/modform/numerical.py b/src/sage/modular/modform/numerical.py index ad52403f471..32ef1fc657c 100644 --- a/src/sage/modular/modform/numerical.py +++ b/src/sage/modular/modform/numerical.py @@ -19,7 +19,7 @@ from sage.misc.prandom import randint from sage.modular.arithgroup.all import Gamma0 from sage.modular.modsym.all import ModularSymbols -from sage.modules.all import vector +from sage.modules.free_module_element import free_module_element as vector from sage.rings.complex_double import CDF from sage.rings.integer import Integer from sage.rings.rational_field import QQ diff --git a/src/sage/modules/free_quadratic_module_integer_symmetric.py b/src/sage/modules/free_quadratic_module_integer_symmetric.py index 0902a272f39..7d7c87db87f 100644 --- a/src/sage/modules/free_quadratic_module_integer_symmetric.py +++ b/src/sage/modules/free_quadratic_module_integer_symmetric.py @@ -61,7 +61,7 @@ from sage.arith.misc import gcd from sage.combinat.root_system.cartan_matrix import CartanMatrix from sage.misc.cachefunc import cached_method -from sage.quadratic_forms.all import QuadraticForm +from sage.quadratic_forms.quadratic_form import QuadraticForm ############################################################################### # diff --git a/src/sage/numerical/interactive_simplex_method.py b/src/sage/numerical/interactive_simplex_method.py index b2c7e304e08..26e332cd8d9 100644 --- a/src/sage/numerical/interactive_simplex_method.py +++ b/src/sage/numerical/interactive_simplex_method.py @@ -192,7 +192,8 @@ from sage.misc.prandom import randint, random from sage.misc.html import HtmlFragment from sage.misc.misc import get_main_globals -from sage.modules.all import random_vector, vector +from sage.modules.free_module_element import random_vector +from sage.modules.free_module_element import free_module_element as vector from sage.misc.lazy_import import lazy_import lazy_import("sage.plot.all", ["Graphics", "arrow", "line", "point", "rainbow", "text"]) from sage.rings.infinity import Infinity diff --git a/src/sage/quadratic_forms/genera/genus.py b/src/sage/quadratic_forms/genera/genus.py index 788e7be30c9..4ee20120e1c 100644 --- a/src/sage/quadratic_forms/genera/genus.py +++ b/src/sage/quadratic_forms/genera/genus.py @@ -2940,7 +2940,8 @@ def rational_representative(self): [0 0 0 0 0 0 1 0] [0 0 0 0 0 0 0 2] """ - from sage.quadratic_forms.all import QuadraticForm, quadratic_form_from_invariants + from sage.quadratic_forms.quadratic_form import QuadraticForm + from sage.quadratic_forms.quadratic_form import quadratic_form_from_invariants sminus = self.signature_pair_of_matrix()[1] det = self.determinant() m = self.rank() diff --git a/src/sage/quadratic_forms/quadratic_form__automorphisms.py b/src/sage/quadratic_forms/quadratic_form__automorphisms.py index 48a473f44c4..4e6453b34d3 100644 --- a/src/sage/quadratic_forms/quadratic_form__automorphisms.py +++ b/src/sage/quadratic_forms/quadratic_form__automorphisms.py @@ -12,7 +12,7 @@ from sage.matrix.constructor import Matrix from sage.rings.integer_ring import ZZ -from sage.modules.all import FreeModule +from sage.modules.free_module import FreeModule from sage.modules.free_module_element import vector from sage.arith.misc import GCD diff --git a/src/sage/rings/finite_rings/finite_field_base.pyx b/src/sage/rings/finite_rings/finite_field_base.pyx index 06e57a04952..03966d60ced 100644 --- a/src/sage/rings/finite_rings/finite_field_base.pyx +++ b/src/sage/rings/finite_rings/finite_field_base.pyx @@ -1230,7 +1230,7 @@ cdef class FiniteField(Field): sage: all(to_V(h(c) * e) == c * to_V(e) for e in E for c in F) True """ - from sage.modules.all import VectorSpace + from sage.modules.free_module import VectorSpace from sage.categories.morphism import is_Morphism if subfield is not None: if base is not None: diff --git a/src/sage/rings/finite_rings/integer_mod.pyx b/src/sage/rings/finite_rings/integer_mod.pyx index 8e723be71b7..ec3268dc84e 100644 --- a/src/sage/rings/finite_rings/integer_mod.pyx +++ b/src/sage/rings/finite_rings/integer_mod.pyx @@ -1523,7 +1523,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): return [K(a.lift()*p**(pval // n) + p**(k - (pval - pval//n)) * b) for a in mod(upart, p**(k-pval)).nth_root(n, all=True, algorithm=algorithm) for b in range(p**(pval - pval//n))] else: return K(p**(pval // n) * mod(upart, p**(k-pval)).nth_root(n, algorithm=algorithm).lift()) - from sage.rings.padics.all import ZpFM + from sage.rings.padics.factory import ZpFM R = ZpFM(p,k) self_orig = self if p == 2: diff --git a/src/sage/rings/multi_power_series_ring.py b/src/sage/rings/multi_power_series_ring.py index 7f0d5d1bfb8..0f7aa3b2d43 100644 --- a/src/sage/rings/multi_power_series_ring.py +++ b/src/sage/rings/multi_power_series_ring.py @@ -205,7 +205,7 @@ from sage.rings.ring import CommutativeRing -from sage.rings.polynomial.all import PolynomialRing +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.polynomial.polynomial_ring import is_PolynomialRing from sage.rings.polynomial.multi_polynomial_ring import is_MPolynomialRing from sage.rings.polynomial.term_order import TermOrder diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py index 7a1b08d02ed..b696759489f 100644 --- a/src/sage/rings/number_field/number_field.py +++ b/src/sage/rings/number_field/number_field.py @@ -12153,7 +12153,7 @@ def hilbert_class_polynomial(self, name='x'): if D > 0: raise NotImplementedError("Hilbert class polynomial is not implemented for real quadratic fields.") - from sage.schemes.elliptic_curves.all import hilbert_class_polynomial as HCP + from sage.schemes.elliptic_curves.cm import hilbert_class_polynomial as HCP return QQ[name](HCP(D)) def number_of_roots_of_unity(self): diff --git a/src/sage/rings/number_field/splitting_field.py b/src/sage/rings/number_field/splitting_field.py index 14871fecc05..933660d629a 100644 --- a/src/sage/rings/number_field/splitting_field.py +++ b/src/sage/rings/number_field/splitting_field.py @@ -20,8 +20,8 @@ from sage.rings.integer import Integer from sage.arith.misc import factorial -from sage.rings.number_field.all import NumberField -from sage.rings.polynomial.all import PolynomialRing +from sage.rings.number_field.number_field import NumberField +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.rational_field import RationalField, is_RationalField from sage.libs.pari.all import pari, PariError diff --git a/src/sage/rings/padics/padic_capped_relative_element.pyx b/src/sage/rings/padics/padic_capped_relative_element.pyx index b5843d467a7..d393708979d 100644 --- a/src/sage/rings/padics/padic_capped_relative_element.pyx +++ b/src/sage/rings/padics/padic_capped_relative_element.pyx @@ -604,7 +604,7 @@ def base_p_list(Integer n, bint pos, PowComputer_class prime_pow): raise ValueError("n must be nonnegative") cdef expansion_mode mode = simple_mode if pos else smallest_mode # We need a p-adic element to feed to ExpansionIter before resetting its curvalue - from sage.rings.padics.all import Zp + from sage.rings.padics.factory import Zp p = prime_pow.prime dummy = Zp(p)(0) cdef ExpansionIter expansion = ExpansionIter(dummy, n.exact_log(p) + 2, mode) diff --git a/src/sage/rings/polynomial/plural.pyx b/src/sage/rings/polynomial/plural.pyx index 8839fb92502..423b0a2aba8 100644 --- a/src/sage/rings/polynomial/plural.pyx +++ b/src/sage/rings/polynomial/plural.pyx @@ -657,7 +657,7 @@ cdef class NCPolynomialRing_plural(Ring): Ambient free module of rank 3 over Noncommutative Multivariate Polynomial Ring in x, y, z over Rational Field, nc-relations: {y*x: -x*y} """ - from sage.modules.all import FreeModule + from sage.modules.free_module import FreeModule return FreeModule(self, n) def term_order(self): diff --git a/src/sage/rings/polynomial/polynomial_rational_flint.pyx b/src/sage/rings/polynomial/polynomial_rational_flint.pyx index 0e6970217ab..d85ad4af690 100644 --- a/src/sage/rings/polynomial/polynomial_rational_flint.pyx +++ b/src/sage/rings/polynomial/polynomial_rational_flint.pyx @@ -2163,7 +2163,9 @@ cdef class Polynomial_rational_flint(Polynomial): sage: (zeta^2 + zeta + 1).galois_group(pari_group=True) PARI group [2, -1, 1, "S2"] of degree 2 """ - from sage.groups.all import PariGroup, PermutationGroup, TransitiveGroup + from sage.groups.pari_group import PariGroup + from sage.groups.perm_gps.permgroup import PermutationGroup + from sage.groups.perm_gps.permgroup_named import TransitiveGroup if not self.is_irreducible(): raise ValueError("The polynomial must be irreducible") diff --git a/src/sage/rings/polynomial/real_roots.pyx b/src/sage/rings/polynomial/real_roots.pyx index b939908ef92..94fa0b84d40 100644 --- a/src/sage/rings/polynomial/real_roots.pyx +++ b/src/sage/rings/polynomial/real_roots.pyx @@ -143,7 +143,8 @@ from sage.rings.real_mpfi import RealIntervalField, RIF from sage.rings.real_mpfr import RR, RealField from sage.arith.misc import binomial, factorial from sage.misc.randstate import randstate -from sage.modules.all import vector, FreeModule +from sage.modules.free_module_element import free_module_element as vector +from sage.modules.free_module import FreeModule from sage.matrix.matrix_space import MatrixSpace from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.polynomial.polynomial_ring import polygen diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py index da8b8d71b91..d70b2cd2bc3 100644 --- a/src/sage/rings/qqbar.py +++ b/src/sage/rings/qqbar.py @@ -572,7 +572,7 @@ from sage.rings.cif import CIF from sage.rings.complex_interval_field import ComplexIntervalField from sage.rings.complex_interval import is_ComplexIntervalFieldElement -from sage.rings.polynomial.all import PolynomialRing +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.polynomial.polynomial_element import Polynomial from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ diff --git a/src/sage/rings/valuation/valuation_space.py b/src/sage/rings/valuation/valuation_space.py index ffb13d82917..415a1197ed9 100644 --- a/src/sage/rings/valuation/valuation_space.py +++ b/src/sage/rings/valuation/valuation_space.py @@ -540,7 +540,7 @@ def residue_field(self): return ret from sage.rings.polynomial.polynomial_ring import is_PolynomialRing if is_PolynomialRing(ret): - from sage.rings.function_field.all import FunctionField + from sage.rings.function_field.constructor import FunctionField return FunctionField(ret.base_ring().fraction_field(), names=(ret.variable_name(),)) return ret.fraction_field() diff --git a/src/sage/schemes/curves/constructor.py b/src/sage/schemes/curves/constructor.py index 88f9b95701f..95f37415126 100644 --- a/src/sage/schemes/curves/constructor.py +++ b/src/sage/schemes/curves/constructor.py @@ -49,9 +49,9 @@ from sage.schemes.generic.algebraic_scheme import is_AlgebraicScheme from sage.schemes.projective.projective_space import is_ProjectiveSpace -from sage.schemes.affine.all import AffineSpace +from sage.schemes.affine.affine_space import AffineSpace -from sage.schemes.projective.all import ProjectiveSpace +from sage.schemes.projective.projective_space import ProjectiveSpace from .projective_curve import (ProjectiveCurve, diff --git a/src/sage/schemes/cyclic_covers/cycliccover_generic.py b/src/sage/schemes/cyclic_covers/cycliccover_generic.py index 7531d933c0b..a1df7badef8 100644 --- a/src/sage/schemes/cyclic_covers/cycliccover_generic.py +++ b/src/sage/schemes/cyclic_covers/cycliccover_generic.py @@ -39,7 +39,7 @@ # https://www.gnu.org/licenses/ # ***************************************************************************** -from sage.rings.polynomial.all import PolynomialRing +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.structure.category_object import normalize_names from sage.arith.misc import GCD from sage.schemes.curves.affine_curve import AffinePlaneCurve diff --git a/src/sage/schemes/elliptic_curves/cm.py b/src/sage/schemes/elliptic_curves/cm.py index d24c09a72bb..908aedcac81 100644 --- a/src/sage/schemes/elliptic_curves/cm.py +++ b/src/sage/schemes/elliptic_curves/cm.py @@ -43,7 +43,6 @@ from sage.rings.number_field.number_field import is_fundamental_discriminant from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing -from sage.schemes.elliptic_curves.all import EllipticCurve from sage.misc.cachefunc import cached_function from sage.rings.number_field.number_field_element_base import NumberFieldElement_base @@ -997,6 +996,7 @@ def is_cm_j_invariant(j, algorithm='CremonaSutherland', method=None): # Construct an elliptic curve with j-invariant j, with # integral model: + from sage.schemes.elliptic_curves.constructor import EllipticCurve E = EllipticCurve(j=j).integral_model() D = E.discriminant() prime_bound = 1000 # test primes of degree 1 up to this norm diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index 213ac83d73b..2aaccb5c1de 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -89,7 +89,7 @@ from sage.rings.polynomial.polynomial_element import Polynomial from sage.rings.fraction_field import FractionField -from sage.schemes.elliptic_curves.all import EllipticCurve +from sage.schemes.elliptic_curves.constructor import EllipticCurve from sage.schemes.elliptic_curves.ell_generic import is_EllipticCurve from sage.schemes.elliptic_curves.weierstrass_morphism \ diff --git a/src/sage/schemes/elliptic_curves/heegner.py b/src/sage/schemes/elliptic_curves/heegner.py index e4e19cf154b..86ccab0546f 100644 --- a/src/sage/schemes/elliptic_curves/heegner.py +++ b/src/sage/schemes/elliptic_curves/heegner.py @@ -115,8 +115,8 @@ from sage.rings.number_field.number_field import QuadraticField from sage.rings.rational_field import QQ from sage.rings.real_mpfr import RealField -from sage.quadratic_forms.all import (BinaryQF, - BinaryQF_reduced_representatives) +from sage.quadratic_forms.binary_qf import BinaryQF +from sage.quadratic_forms.binary_qf import BinaryQF_reduced_representatives from sage.rings.number_field.number_field_element_base import NumberFieldElement_base from sage.structure.sage_object import SageObject from sage.structure.richcmp import (richcmp_method, richcmp, @@ -7179,7 +7179,7 @@ def _heegner_forms_list(self, D, beta=None, expected_count=None): beta = Integers(4*N)(D).sqrt(extend=False) else: assert beta**2 == Integers(4*N)(D) - from sage.quadratic_forms.all import BinaryQF + from sage.quadratic_forms.binary_qf import BinaryQF b = ZZ(beta) % (2*N) all = [] seen = [] diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py index 8f740751da4..a6166fe50ac 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py +++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py @@ -34,7 +34,7 @@ from sage.rings.polynomial.polynomial_ring import polygen from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ -from sage.schemes.elliptic_curves.all import EllipticCurve +from sage.schemes.elliptic_curves.constructor import EllipticCurve from sage.misc.cachefunc import cached_function diff --git a/src/sage/schemes/elliptic_curves/kraus.py b/src/sage/schemes/elliptic_curves/kraus.py index 98ec70ecb5a..79b7afa9c2c 100644 --- a/src/sage/schemes/elliptic_curves/kraus.py +++ b/src/sage/schemes/elliptic_curves/kraus.py @@ -52,7 +52,7 @@ # https://www.gnu.org/licenses/ ############################################################################## -from sage.schemes.elliptic_curves.all import EllipticCurve +from sage.schemes.elliptic_curves.constructor import EllipticCurve def c4c6_nonsingular(c4, c6): diff --git a/src/sage/schemes/elliptic_curves/saturation.py b/src/sage/schemes/elliptic_curves/saturation.py index 57367c515d4..fc213840120 100644 --- a/src/sage/schemes/elliptic_curves/saturation.py +++ b/src/sage/schemes/elliptic_curves/saturation.py @@ -123,7 +123,7 @@ def __init__(self, E, verbose=False): self._field = K = E.base_field() if K.absolute_degree() == 1: from sage.rings.rational_field import QQ - from sage.rings.polynomial.all import polygen + from sage.rings.polynomial.polynomial_ring import polygen self._Kpol = polygen(QQ) else: self._Kpol = K.defining_polynomial() @@ -200,7 +200,7 @@ def add_reductions(self, q): self._reductions[q] = redmodq = dict() if q.divides(self._N) or q.divides(self._D): return - from sage.schemes.elliptic_curves.all import EllipticCurve + from sage.schemes.elliptic_curves.constructor import EllipticCurve for amodq in sorted(self._Kpol.roots(GF(q), multiplicities=False)): Eq = EllipticCurve([reduce_mod_q(ai, amodq) for ai in self._curve.ainvs()]) nq = Eq.cardinality() diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py index ad3b7d59a53..bf843ba1ecd 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py @@ -32,7 +32,7 @@ # http://www.gnu.org/licenses/ #***************************************************************************** -from sage.rings.polynomial.all import PolynomialRing +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.big_oh import O from sage.rings.power_series_ring import PowerSeriesRing from sage.rings.laurent_series_ring import LaurentSeriesRing diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_rational_field.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_rational_field.py index 5eab9f7237a..a55a93dd996 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_rational_field.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_rational_field.py @@ -9,7 +9,7 @@ import sage.rings.abc -from sage.rings.padics.all import pAdicField +from sage.rings.padics.factory import Qp as pAdicField from sage.schemes.curves.projective_curve import ProjectivePlaneCurve_field diff --git a/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py b/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py index 0020c79393b..ece985101c8 100644 --- a/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py +++ b/src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py @@ -70,7 +70,7 @@ from sage.rings.ring import IntegralDomain from sage.rings.infinity import Infinity from sage.rings.laurent_series_ring import is_LaurentSeriesRing -from sage.rings.padics.all import pAdicField +from sage.rings.padics.factory import Qp as pAdicField from sage.rings.polynomial.polynomial_element import Polynomial from sage.rings.ring import CommutativeAlgebra from sage.schemes.elliptic_curves.constructor import EllipticCurve diff --git a/src/sage/schemes/toric/morphism.py b/src/sage/schemes/toric/morphism.py index d41c35c5a7b..71c355d20f8 100644 --- a/src/sage/schemes/toric/morphism.py +++ b/src/sage/schemes/toric/morphism.py @@ -1056,7 +1056,7 @@ def factor(self): [z2 : z1 : z0 : z0] """ phi_i, phi_b, phi_s = self.fan_morphism().factor() - from sage.schemes.toric.all import ToricVariety + from sage.schemes.toric.variety import ToricVariety X = self.domain() X_s = ToricVariety(phi_s.codomain_fan()) X_i = ToricVariety(phi_i.domain_fan()) diff --git a/src/sage/schemes/toric/sheaf/klyachko.py b/src/sage/schemes/toric/sheaf/klyachko.py index 77fae4b7545..44b62b2d89d 100644 --- a/src/sage/schemes/toric/sheaf/klyachko.py +++ b/src/sage/schemes/toric/sheaf/klyachko.py @@ -227,7 +227,7 @@ def fiber(self): sage: T_P2.fiber() Vector space of dimension 2 over Rational Field """ - from sage.modules.all import VectorSpace + from sage.modules.free_module import VectorSpace return VectorSpace(self.base_ring(), self.rank()) def rank(self): @@ -702,7 +702,7 @@ def cohomology(self, degree=None, weight=None, dim=False): H^*i(P^2, TP^2)_M(1, -1) = (1, 0, 0) H^*i(P^2, TP^2)_M(1, 0) = (1, 0, 0) """ - from sage.modules.all import FreeModule + from sage.modules.free_module import FreeModule if weight is None: raise NotImplementedError('sum over weights is not implemented') else: diff --git a/src/sage/schemes/toric/weierstrass.py b/src/sage/schemes/toric/weierstrass.py index 552a91093d6..0488c9e50d2 100644 --- a/src/sage/schemes/toric/weierstrass.py +++ b/src/sage/schemes/toric/weierstrass.py @@ -141,7 +141,7 @@ from sage.rings.infinity import Infinity from sage.modules.free_module_element import vector from sage.geometry.polyhedron.ppl_lattice_polytope import LatticePolytope_PPL -from sage.rings.invariants.all import invariant_theory +from sage.rings.invariants.invariant_theory import invariant_theory ###################################################################### diff --git a/src/sage/topology/cell_complex.py b/src/sage/topology/cell_complex.py index 6c18440b90e..24379a7ca7b 100644 --- a/src/sage/topology/cell_complex.py +++ b/src/sage/topology/cell_complex.py @@ -544,7 +544,7 @@ def homology(self, dim=None, base_ring=ZZ, subcomplex=None, """ from sage.topology.cubical_complex import CubicalComplex from sage.topology.simplicial_complex import SimplicialComplex - from sage.modules.all import VectorSpace + from sage.modules.free_module import VectorSpace from sage.homology.homology_group import HomologyGroup if dim is not None: From 3305e3511ccbb369712242fa62b66f425276a970 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 1 Apr 2023 13:08:47 -0700 Subject: [PATCH 119/135] src/.relint.yml: Remove repetition of 'Hint:', no longer needed with current relint --- src/.relint.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/.relint.yml b/src/.relint.yml index 67211bc7414..acf727359fa 100644 --- a/src/.relint.yml +++ b/src/.relint.yml @@ -6,8 +6,8 @@ - name: 'python3: Python3 incompatible code' hint: | # ifilter, imap, izip # __metaclass__ - Hint: # update raise statements # except Exception, var - Hint: # six is no longer allowed + # update raise statements # except Exception, var + # six is no longer allowed pattern: '(import.*[, ]ifilter|import.*[, ]imap|import.*[, ]izip|^\s*raise\s*[A-Za-z]*Error\s*,|__metaclass__|except\s*[A-Za-z]\s*,|import six|from six import)' filePattern: .*[.](py|pyx|rst) @@ -20,9 +20,9 @@ - name: 'blocks: wrong syntax for blocks (INPUT, OUTPUT, EXAMPLES, NOTE, etc.)' hint: | # the correct syntax is .. SEEALSO:: - Hint: # TESTS and EXAMPLES should be plural, NOTE singular - Hint: # no :: after INPUT, OUTPUT, REFERENCE blocks - Hint: # no " :" at the end of lines + # TESTS and EXAMPLES should be plural, NOTE singular + # no :: after INPUT, OUTPUT, REFERENCE blocks + # no " :" at the end of lines pattern: '(\.\.SEE|SEE ALSO|SEEALSO:($|[^:])|^\s*TEST:|^\s*EXAMPLE:|^\s*NOTES:|^\s*[A-Z]*PUT::|^\s*REFERENCES?::$)' - name: 'trac_links: bad trac link' @@ -46,8 +46,8 @@ - name: 'namespace_pkg_all_import: import from .all of a namespace package' hint: | Sage library code should not import from sage.PAC.KAGE.all when sage.PAC.KAGE is an implicit - Hint: namespace package. Type import_statements("SOME_IDENTIFIER") to find a more specific import, - Hint: or use 'sage --fiximports' to fix automatically in the source file. + namespace package. Type import_statements("SOME_IDENTIFIER") to find a more specific import, + or use 'sage --fiximports' to fix automatically in the source file. # Keep in sync with SAGE_ROOT/src/sage/misc/replace_dot_all.py pattern: 'from\s+sage(|[.](arith|categories|combinat|crypto|databases|data_structures|dynamics|ext|game_theory|games|graphs|groups|interfaces|manifolds|matrix|matroids|misc|modules|monoids|numerical|probability|quadratic_forms|quivers|rings|sat|schemes|sets|stats|tensor)[a-z0-9_.]*|[.]libs)[.]all\s+import' # imports from .all are allowed in all.py; also allow in some modules that need sage.all From 0234b304d87201d976dce2a74727290d41f7b970 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 1 Apr 2023 17:12:44 -0700 Subject: [PATCH 120/135] src/sage/schemes/elliptic_curves/cm.py: Add missing import --- src/sage/schemes/elliptic_curves/cm.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sage/schemes/elliptic_curves/cm.py b/src/sage/schemes/elliptic_curves/cm.py index 908aedcac81..e836c900b91 100644 --- a/src/sage/schemes/elliptic_curves/cm.py +++ b/src/sage/schemes/elliptic_curves/cm.py @@ -248,6 +248,8 @@ def is_HCP(f, check_monic_irreducible=True): p = pmin-1 n = 0 from sage.arith.misc import next_prime + from sage.schemes.elliptic_curves.constructor import EllipticCurve + while True: p = next_prime(p) n += 1 From 45b651e95a0ea43a3246a18755ccd44604d813ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Sun, 2 Apr 2023 17:57:53 -0300 Subject: [PATCH 121/135] silence useless output with ipython 8.12 --- src/sage/repl/inputhook.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/sage/repl/inputhook.py b/src/sage/repl/inputhook.py index 165068da8bc..7f7894f6dcf 100644 --- a/src/sage/repl/inputhook.py +++ b/src/sage/repl/inputhook.py @@ -17,6 +17,8 @@ import select import errno +import contextlib +import io from IPython import get_ipython from IPython.terminal.pt_inputhooks import register @@ -65,7 +67,9 @@ def install(): if not ip: return # Not running in ipython, e.g. doctests if ip._inputhook != sage_inputhook: - ip.enable_gui('sage') + # silence `ip.enable_gui()` useless output + with contextlib.redirect_stdout(io.StringIO()): + ip.enable_gui('sage') def uninstall(): @@ -81,4 +85,6 @@ def uninstall(): if not ip: return if ip._inputhook == sage_inputhook: - ip.enable_gui(None) + # silence `ip.enable_gui()` useless output + with contextlib.redirect_stdout(io.StringIO()): + ip.enable_gui(None) From aaa229c4ffcbcdf2088a73564d17b76782abedf2 Mon Sep 17 00:00:00 2001 From: Travis Scrimshaw Date: Sat, 25 Mar 2023 14:09:30 +0900 Subject: [PATCH 122/135] Allow completion() to return a lazy series for infinite precision. --- .../categories/graded_algebras_with_basis.py | 2 + .../laurent_polynomial_ring_base.py | 42 +++++++++++---- .../polynomial/multi_polynomial_ring_base.pyx | 51 ++++++++++++------- src/sage/rings/polynomial/polynomial_ring.py | 49 ++++++++++++------ 4 files changed, 99 insertions(+), 45 deletions(-) diff --git a/src/sage/categories/graded_algebras_with_basis.py b/src/sage/categories/graded_algebras_with_basis.py index f992228ba81..b4df3c3c260 100644 --- a/src/sage/categories/graded_algebras_with_basis.py +++ b/src/sage/categories/graded_algebras_with_basis.py @@ -144,6 +144,8 @@ def formal_series_ring(self): from sage.rings.lazy_series_ring import LazyCompletionGradedAlgebra return LazyCompletionGradedAlgebra(self) + completion = formal_series_ring + class ElementMethods: pass diff --git a/src/sage/rings/polynomial/laurent_polynomial_ring_base.py b/src/sage/rings/polynomial/laurent_polynomial_ring_base.py index 4a52bb965fc..bb6b23e78d3 100644 --- a/src/sage/rings/polynomial/laurent_polynomial_ring_base.py +++ b/src/sage/rings/polynomial/laurent_polynomial_ring_base.py @@ -185,21 +185,39 @@ def construction(self): else: return LaurentPolynomialFunctor(vars[-1], True), LaurentPolynomialRing(self.base_ring(), vars[:-1]) - def completion(self, p, prec=20, extras=None): - """ + + def completion(self, p=None, prec=20, extras=None): + r""" + Return the completion of ``self``. + + Currently only implemented for the ring of formal Laurent series. + The ``prec`` variable controls the precision used in the + Laurent series ring. If ``prec`` is `\infty`, then this + returns a :class:`LazyLaurentSeriesRing`. + EXAMPLES:: - sage: P.=LaurentPolynomialRing(QQ) + sage: P. = LaurentPolynomialRing(QQ) sage: P Univariate Laurent Polynomial Ring in x over Rational Field - sage: PP=P.completion(x) + sage: PP = P.completion(x) sage: PP Laurent Series Ring in x over Rational Field - sage: f=1-1/x + sage: f = 1 - 1/x sage: PP(f) -x^-1 + 1 - sage: 1/PP(f) - -x - x^2 - x^3 - x^4 - x^5 - x^6 - x^7 - x^8 - x^9 - x^10 - x^11 - x^12 - x^13 - x^14 - x^15 - x^16 - x^17 - x^18 - x^19 - x^20 + O(x^21) + sage: g = 1 / PP(f); g + -x - x^2 - x^3 - x^4 - x^5 - x^6 - x^7 - x^8 - x^9 - x^10 - x^11 + - x^12 - x^13 - x^14 - x^15 - x^16 - x^17 - x^18 - x^19 - x^20 + O(x^21) + sage: 1 / g + -x^-1 + 1 + O(x^19) + + sage: PP = P.completion(x, prec=oo); PP + Lazy Laurent Series Ring in x over Rational Field + sage: g = 1 / PP(f); g + -x - x^2 - x^3 + O(x^4) + sage: 1 / g == f + True TESTS: @@ -211,12 +229,16 @@ def completion(self, p, prec=20, extras=None): sage: L.completion('x', 20).default_prec() 20 """ - if str(p) == self._names[0] and self._n == 1: + if p is None or str(p) == self._names[0] and self._n == 1: + if prec == float('inf'): + from sage.rings.lazy_series_ring import LazyLaurentSeriesRing + sparse = self.polynomial_ring().is_sparse() + return LazyLaurentSeriesRing(self.base_ring(), names=(self._names[0],), sparse=sparse) from sage.rings.laurent_series_ring import LaurentSeriesRing R = self.polynomial_ring().completion(self._names[0], prec) return LaurentSeriesRing(R) - else: - raise TypeError("Cannot complete %s with respect to %s" % (self, p)) + + raise TypeError("cannot complete %s with respect to %s" % (self, p)) def remove_var(self, var): """ diff --git a/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx b/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx index 12ff8f2e507..2e887a79895 100644 --- a/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx +++ b/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx @@ -186,44 +186,52 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): """ return self.ideal(self.gens(), check=False) - def completion(self, names, prec=20, extras={}): - """ - Return the completion of self with respect to the ideal + def completion(self, names=None, prec=20, extras={}, **kwds): + r""" + Return the completion of ``self`` with respect to the ideal generated by the variable(s) ``names``. INPUT: - - ``names`` -- variable or list/tuple of variables (given either - as elements of the polynomial ring or as strings) - - - ``prec`` -- default precision of resulting power series ring - - - ``extras`` -- passed as keywords to ``PowerSeriesRing`` + - ``names`` -- (optional) variable or list/tuple of variables + (given either as elements of the polynomial ring or as strings) + the default is all variables of ``self``. + - ``prec`` -- default precision of resulting power series ring, + possibly infinite + - ``extras`` -- passed as keywords to :class:`PowerSeriesRing` + or :class:`LazyPowerSeriesRing`; can also be keyword arguments EXAMPLES:: sage: P. = PolynomialRing(ZZ) sage: P.completion('w') Power Series Ring in w over Multivariate Polynomial Ring in - x, y, z over Integer Ring + x, y, z over Integer Ring sage: P.completion((w,x,y)) - Multivariate Power Series Ring in w, x, y over Univariate - Polynomial Ring in z over Integer Ring + Multivariate Power Series Ring in w, x, y over + Univariate Polynomial Ring in z over Integer Ring sage: Q. = P.completion(); Q Multivariate Power Series Ring in w, x, y, z over Integer Ring sage: H = PolynomialRing(PolynomialRing(ZZ,3,'z'),4,'f'); H Multivariate Polynomial Ring in f0, f1, f2, f3 over - Multivariate Polynomial Ring in z0, z1, z2 over Integer Ring + Multivariate Polynomial Ring in z0, z1, z2 over Integer Ring sage: H.completion(H.gens()) Multivariate Power Series Ring in f0, f1, f2, f3 over - Multivariate Polynomial Ring in z0, z1, z2 over Integer Ring + Multivariate Polynomial Ring in z0, z1, z2 over Integer Ring sage: H.completion(H.gens()[2]) Power Series Ring in f2 over - Multivariate Polynomial Ring in f0, f1, f3 over - Multivariate Polynomial Ring in z0, z1, z2 over Integer Ring + Multivariate Polynomial Ring in f0, f1, f3 over + Multivariate Polynomial Ring in z0, z1, z2 over Integer Ring + + sage: P. = PolynomialRing(ZZ) + sage: P.completion(prec=oo) + Multivariate Lazy Taylor Series Ring in x, y, z, w over Integer Ring + sage: P.completion((w,x,y), prec=oo) + Multivariate Lazy Taylor Series Ring in w, x, y over + Univariate Polynomial Ring in z over Integer Ring TESTS:: @@ -246,7 +254,9 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): ValueError: q is not a variable of Multivariate Polynomial Ring in x, y over Integer Ring """ - if not isinstance(names, (list, tuple)): + if names is None: + names = self.variable_names() + elif not isinstance(names, (list, tuple)): names = [names] # Single variable elif not names: return self # 0 variables => completion is self @@ -265,9 +275,12 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): raise ValueError(f"{v} is not a variable of {self}") vars.append(v) - from sage.rings.power_series_ring import PowerSeriesRing new_base = self.remove_var(*vars) - return PowerSeriesRing(new_base, names=vars, default_prec=prec, **extras) + if prec == float('inf'): + from sage.rings.lazy_series_ring import LazyPowerSeriesRing + return LazyPowerSeriesRing(new_base, names=vars, **extras, **kwds) + from sage.rings.power_series_ring import PowerSeriesRing + return PowerSeriesRing(new_base, names=vars, default_prec=prec, **extras, **kwds) def remove_var(self, *var, order=None): """ diff --git a/src/sage/rings/polynomial/polynomial_ring.py b/src/sage/rings/polynomial/polynomial_ring.py index d2852f1b1db..150f6ce1c06 100644 --- a/src/sage/rings/polynomial/polynomial_ring.py +++ b/src/sage/rings/polynomial/polynomial_ring.py @@ -623,36 +623,53 @@ def construction(self): """ return categories.pushout.PolynomialFunctor(self.variable_name(), sparse=self.__is_sparse), self.base_ring() - def completion(self, p, prec=20, extras=None): - """ - Return the completion of self with respect to the irreducible - polynomial p. Currently only implemented for p=self.gen(), i.e. you - can only complete R[x] with respect to x, the result being a ring - of power series in x. The prec variable controls the precision used - in the power series ring. + def completion(self, p=None, prec=20, extras=None): + r""" + Return the completion of ``self`` with respect to the irreducible + polynomial ``p``. + + Currently only implemented for ``p=self.gen()`` (the default), i.e. you + can only complete `R[x]` with respect to `x`, the result being a ring + of power series in `x`. The ``prec`` variable controls the precision + used in the power series ring. If ``prec`` is `\infty`, then this + returns a :class:`LazyPowerSeriesRing`. EXAMPLES:: - sage: P.=PolynomialRing(QQ) + sage: P. = PolynomialRing(QQ) sage: P Univariate Polynomial Ring in x over Rational Field - sage: PP=P.completion(x) + sage: PP = P.completion(x) sage: PP Power Series Ring in x over Rational Field - sage: f=1-x + sage: f = 1 - x sage: PP(f) 1 - x - sage: 1/f + sage: 1 / f -1/(x - 1) - sage: 1/PP(f) - 1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + x^9 + x^10 + x^11 + x^12 + x^13 + x^14 + x^15 + x^16 + x^17 + x^18 + x^19 + O(x^20) + sage: g = 1 / PP(f); g + 1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + x^9 + x^10 + x^11 + + x^12 + x^13 + x^14 + x^15 + x^16 + x^17 + x^18 + x^19 + O(x^20) + sage: 1 / g + 1 - x + O(x^20) + + sage: PP = P.completion(x, prec=oo); PP + Lazy Taylor Series Ring in x over Rational Field + sage: g = 1 / PP(f); g + 1 + x + x^2 + O(x^3) + sage: 1 / g == f + True """ - if str(p) == self._names[0]: + if p is None or str(p) == self._names[0]: + if prec == float('inf'): + from sage.rings.lazy_series_ring import LazyPowerSeriesRing + return LazyPowerSeriesRing(self.base_ring(), names=(self._names[0],), + sparse=self.is_sparse()) from sage.rings.power_series_ring import PowerSeriesRing return PowerSeriesRing(self.base_ring(), name=self._names[0], default_prec=prec, sparse=self.is_sparse()) - else: - raise TypeError("Cannot complete %s with respect to %s" % (self, p)) + + raise NotImplementedError("cannot complete %s with respect to %s" % (self, p)) def _coerce_map_from_base_ring(self): """ From 069c3dc6451e92fe14c639b05f91dae1e74fc5b9 Mon Sep 17 00:00:00 2001 From: Travis Scrimshaw Date: Sat, 25 Mar 2023 16:04:17 +0900 Subject: [PATCH 123/135] Fixing doctest error in MPolys. --- src/sage/rings/polynomial/multi_polynomial_ring_base.pyx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx b/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx index 2e887a79895..70e1e7c861b 100644 --- a/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx +++ b/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx @@ -194,10 +194,10 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing): INPUT: - ``names`` -- (optional) variable or list/tuple of variables - (given either as elements of the polynomial ring or as strings) - the default is all variables of ``self``. + (given either as elements of the polynomial ring or as strings); + the default is all variables of ``self`` - ``prec`` -- default precision of resulting power series ring, - possibly infinite + possibly infinite - ``extras`` -- passed as keywords to :class:`PowerSeriesRing` or :class:`LazyPowerSeriesRing`; can also be keyword arguments From 74f8c57f0bd08dca4567b8e94b522347baf605fe Mon Sep 17 00:00:00 2001 From: Travis Scrimshaw Date: Sat, 25 Mar 2023 23:04:26 +0900 Subject: [PATCH 124/135] Allowing fraction field conversions and infinite precision Molien series. --- .../groups/matrix_gps/finitely_generated.py | 42 +++++++++----- src/sage/rings/lazy_series_ring.py | 58 ++++++++++++++++++- 2 files changed, 84 insertions(+), 16 deletions(-) diff --git a/src/sage/groups/matrix_gps/finitely_generated.py b/src/sage/groups/matrix_gps/finitely_generated.py index 874b64860e8..0b5f14014ee 100644 --- a/src/sage/groups/matrix_gps/finitely_generated.py +++ b/src/sage/groups/matrix_gps/finitely_generated.py @@ -831,16 +831,19 @@ def invariant_generators(self): def molien_series(self, chi=None, return_series=True, prec=20, variable='t'): r""" Compute the Molien series of this finite group with respect to the - character ``chi``. It can be returned either as a rational function - in one variable or a power series in one variable. The base field - must be a finite field, the rationals, or a cyclotomic field. + character ``chi``. + + It can be returned either as a rational function in one variable + or a power series in one variable. The base field must be a + finite field, the rationals, or a cyclotomic field. Note that the base field characteristic cannot divide the group order (i.e., the non-modular case). ALGORITHM: - For a finite group `G` in characteristic zero we construct the Molien series as + For a finite group `G` in characteristic zero we construct + the Molien series as .. MATH:: @@ -848,29 +851,29 @@ def molien_series(self, chi=None, return_series=True, prec=20, variable='t'): where `I` is the identity matrix and `t` an indeterminate. - For characteristic `p` not dividing the order of `G`, let `k` be the base field - and `N` the order of `G`. Define `\lambda` as a primitive `N`-th root of unity over `k` - and `\omega` as a primitive `N`-th root of unity over `\QQ`. For each `g \in G` + For characteristic `p` not dividing the order of `G`, let `k` be + the base field and `N` the order of `G`. Define `\lambda` as a + primitive `N`-th root of unity over `k` and `\omega` as a + primitive `N`-th root of unity over `\QQ`. For each `g \in G` define `k_i(g)` to be the positive integer such that - `e_i = \lambda^{k_i(g)}` for each eigenvalue `e_i` of `g`. Then the Molien series - is computed as + `e_i = \lambda^{k_i(g)}` for each eigenvalue `e_i` of `g`. + Then the Molien series is computed as .. MATH:: - \frac{1}{|G|}\sum_{g \in G} \frac{\chi(g)}{\prod_{i=1}^n(1 - t\omega^{k_i(g)})}, + \frac{1}{|G|}\sum_{g \in G} \frac{\chi(g)}{\prod_{i=1}^n + (1 - t\omega^{k_i(g)})}, where `t` is an indeterminant. [Dec1998]_ INPUT: - ``chi`` -- (default: trivial character) a linear group character of this group - - ``return_series`` -- boolean (default: ``True``) if ``True``, then returns the Molien series as a power series, ``False`` as a rational function - - ``prec`` -- integer (default: 20); power series default precision - - - ``variable`` -- string (default: ``'t'``); Variable name for the Molien series + (possibly infinite, in which case it is computed lazily) + - ``variable`` -- string (default: ``'t'``); variable name for the Molien series OUTPUT: single variable rational function or power series with integer coefficients @@ -910,6 +913,11 @@ def molien_series(self, chi=None, return_series=True, prec=20, variable='t'): sage: mol.parent() Power Series Ring in t over Integer Ring + sage: mol = S3.molien_series(prec=oo); mol + 1 + t + 2*t^2 + 3*t^3 + 4*t^4 + 5*t^5 + 7*t^6 + O(t^7) + sage: mol.parent() + Lazy Taylor Series Ring in t over Integer Ring + Octahedral Group:: sage: K. = CyclotomicField(8) @@ -1004,7 +1012,11 @@ def molien_series(self, chi=None, return_series=True, prec=20, variable='t'): # divide by group order mol /= N if return_series: - PS = PowerSeriesRing(ZZ, variable, default_prec=prec) + if prec == float('inf'): + from sage.rings.lazy_series_ring import LazyPowerSeriesRing + PS = LazyPowerSeriesRing(ZZ, names=(variable,), sparse=P.is_sparse()) + else: + PS = PowerSeriesRing(ZZ, variable, default_prec=prec) return PS(mol) return mol diff --git a/src/sage/rings/lazy_series_ring.py b/src/sage/rings/lazy_series_ring.py index 9f942c93251..0444afcaba3 100644 --- a/src/sage/rings/lazy_series_ring.py +++ b/src/sage/rings/lazy_series_ring.py @@ -329,6 +329,28 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No ... ValueError: unable to convert ... + Converting from the corresponding rational functions:: + + sage: L = LazyLaurentSeriesRing(QQ, 't') + sage: tt = L.gen() + sage: R. = LaurentPolynomialRing(QQ) + sage: f = (1 + t) / (1 + t + t^2); f + (t + 1)/(t^2 + t + 1) + sage: f.parent() + Fraction Field of Univariate Polynomial Ring in t over Rational Field + sage: L(f) + 1 - t^2 + t^3 - t^5 + t^6 + O(t^7) + sage: L(f) == (1 + tt) / (1 + tt + tt^2) + True + sage: f = (3 + t) / (t^3 - t^5); f + (-t - 3)/(t^5 - t^3) + sage: f.parent() + Fraction Field of Univariate Polynomial Ring in t over Rational Field + sage: L(f) + 3*t^-3 + t^-2 + 3*t^-1 + 1 + 3*t + t^2 + 3*t^3 + O(t^4) + sage: L(f) - (3 + tt) / (tt^3 - tt^5) + O(t^4) + TESTS: Checking the valuation is consistent:: @@ -543,6 +565,15 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No return self.element_class(self, stream) raise ValueError(f"unable to convert {x} into {self}") + # Check if we can realize the input as a rational function + try: + FF = self._laurent_poly_ring.fraction_field() + x = FF(x) + except (TypeError, ValueError, AttributeError): + pass + else: + return self(x.numerator()) / self(x.denominator()) + else: x = coefficients @@ -1879,7 +1910,7 @@ def _element_constructor_(self, x=None, valuation=None, constant=None, degree=No sage: g = L([1,3,5,7,9], 5, -1); g z^5 + 3*z^6 + 5*z^7 + 7*z^8 + 9*z^9 - z^10 - z^11 - z^12 + O(z^13) - Finally, ``x`` can be a polynomial:: + Additionally, ``x`` can be a polynomial:: sage: P. = QQ[] sage: p = x + 3*x^2 + x^5 @@ -1896,6 +1927,22 @@ def _element_constructor_(self, x=None, valuation=None, constant=None, degree=No sage: L(p) x + (x*y+y^2) + Finally ``x`` can be in the corresponding fraction field:: + + sage: R. = PolynomialRing(ZZ) + sage: L = LazyPowerSeriesRing(ZZ, 'a,b,c') + sage: aa, bb, cc = L.gens() + sage: f = (1 + a + b) / (1 + a*b + c^3); f + (a + b + 1)/(c^3 + a*b + 1) + sage: f.parent() + Fraction Field of Multivariate Polynomial Ring in a, b, c over Integer Ring + sage: L(f) + 1 + (a+b) + (-a*b) + (-a^2*b-a*b^2-c^3) + (a^2*b^2-a*c^3-b*c^3) + + (a^3*b^2+a^2*b^3+2*a*b*c^3) + (-a^3*b^3+2*a^2*b*c^3+2*a*b^2*c^3+c^6) + + O(a,b,c)^7 + sage: L(f) == (1 + aa + bb) / (1 + aa*bb + cc^3) + True + TESTS:: sage: L. = LazyPowerSeriesRing(ZZ) @@ -2003,6 +2050,15 @@ def _element_constructor_(self, x=None, valuation=None, constant=None, degree=No valuation=valuation) return self.element_class(self, stream) + # Check if we can realize the input as a rational function + try: + FF = self._laurent_poly_ring.fraction_field() + x = FF(x) + except (TypeError, ValueError, AttributeError): + pass + else: + return self(x.numerator()) / self(x.denominator()) + if callable(x) or isinstance(x, (GeneratorType, map, filter)): if valuation is None: valuation = 0 From 03a1839d84fa689d1a70f00e6080a5f1da3846a7 Mon Sep 17 00:00:00 2001 From: Daniel Bump <75940445+dwbmscz@users.noreply.github.com> Date: Mon, 3 Apr 2023 07:41:40 -0700 Subject: [PATCH 125/135] whitespace in def numgps (permgroup_named.py) --- src/sage/groups/perm_gps/permgroup_named.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index 1e1225898d5..c81789b1b87 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -3476,7 +3476,7 @@ class SmallPermutationGroup(PermutationGroup_generic): [ 1 1 -1 1 -1 -1] [ 2 0 -2 -1 0 1] [ 2 0 2 -1 0 -1] - sage: def numgps(n) : return ZZ(libgap.NumberSmallGroups(n)) + sage: def numgps(n): return ZZ(libgap.NumberSmallGroups(n)) sage: all(SmallPermutationGroup(n,k).id()==[n,k] for n in [1..64] for k in [1..numgps(n)]) True sage: H = SmallPermutationGroup(6,1) From 19867b3679a2d37accb3a0ea198e4732b50fd6a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Labb=C3=A9?= Date: Thu, 30 Mar 2023 15:37:44 +0200 Subject: [PATCH 126/135] added more information on the reason when a latex feature is not functional --- src/sage/features/latex.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/sage/features/latex.py b/src/sage/features/latex.py index 1b01db39f67..19a93e9b924 100644 --- a/src/sage/features/latex.py +++ b/src/sage/features/latex.py @@ -50,6 +50,23 @@ def is_functional(self): sage: from sage.features.latex import latex sage: latex().is_functional() # optional - latex FeatureTestResult('latex', True) + + When the feature is not functional, more information on the reason + can be obtained as follows:: + + sage: result = latex().is_functional() # not tested + sage: print(result.reason) # not tested + Running latex on a sample file + (with command='latex -interaction=nonstopmode tmp_wmpos8ak.tex') + returned non-zero exit status='1' with stderr='' + and stdout='This is pdfTeX, + ... + Runaway argument? + {document + ! File ended while scanning use of \end. + ... + No pages of output. + Transcript written on tmp_wmpos8ak.log.' """ lines = [] lines.append(r"\documentclass{article}") @@ -77,8 +94,12 @@ def is_functional(self): return FeatureTestResult(self, True) else: return FeatureTestResult(self, False, reason="Running latex on " - "a sample file returned non-zero " - "exit status {}".format(result.returncode)) + "a sample file (with command='{}') returned non-zero " + "exit status='{}' with stderr='{}' " + "and stdout='{}'".format(result.args, + result.returncode, + result.stderr.strip(), + result.stdout.strip())) class latex(LaTeX): From 4e0712df04dcf4f46605ee2eb1bf2b1945140ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Labb=C3=A9?= Date: Thu, 30 Mar 2023 15:39:56 +0200 Subject: [PATCH 127/135] adding feature dvips to features/latex.py --- src/sage/features/latex.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/sage/features/latex.py b/src/sage/features/latex.py index 19a93e9b924..f1451e7bc4b 100644 --- a/src/sage/features/latex.py +++ b/src/sage/features/latex.py @@ -186,6 +186,26 @@ def __init__(self): super().__init__("lualatex") +class dvips(Executable): + r""" + A :class:`~sage.features.Feature` describing the presence of ``dvips`` + + EXAMPLES:: + + sage: from sage.features.latex import dvips + sage: dvips().is_present() # optional - dvips + FeatureTestResult('dvips', True) + """ + def __init__(self): + r""" + TESTS:: + + sage: from sage.features.latex import dvips + sage: isinstance(dvips(), dvips) + True + """ + Executable.__init__(self, "dvips", executable="dvips", + url="https://tug.org/texinfohtml/dvips.html") class TeXFile(StaticFile): r""" A :class:`sage.features.Feature` describing the presence of a TeX file @@ -275,4 +295,5 @@ def all_features(): pdflatex(), xelatex(), lualatex(), + dvips(), LaTeXPackage("tkz-graph")] From e313c0fe8049803f8a0fb074955c3be027178dd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Labb=C3=A9?= Date: Thu, 30 Mar 2023 15:43:10 +0200 Subject: [PATCH 128/135] adding dvi and eps methods to Standalone class --- src/sage/misc/latex_standalone.py | 224 ++++++++++++++++++++++++++++++ 1 file changed, 224 insertions(+) diff --git a/src/sage/misc/latex_standalone.py b/src/sage/misc/latex_standalone.py index 09339eddd1e..69b4fa75d10 100644 --- a/src/sage/misc/latex_standalone.py +++ b/src/sage/misc/latex_standalone.py @@ -746,6 +746,125 @@ def pdf(self, filename=None, view=True, program=None): return temp_filename_pdf + def dvi(self, filename=None, view=True, program='latex'): + r""" + Compiles the latex code with latex and create a dvi file. + + INPUT: + + - ``filename`` -- string (default: ``None``), the output filename. + If ``None``, it saves the file in a temporary directory. + + - ``view`` -- bool (default:``True``), whether to open the file in a + dvi viewer. This option is ignored and automatically set to + ``False`` if ``filename`` is not ``None``. + + - ``program`` -- string (default:``'latex'``), ``'latex'`` + + OUTPUT: + + string, path to dvi file + + EXAMPLES:: + + sage: from sage.misc.latex_standalone import Standalone + sage: t = Standalone('Hello World') + sage: _ = t.dvi(view=False) # long time (1s) # optional latex + + Same for instances of :class:`TikzPicture`:: + + sage: from sage.misc.latex_standalone import TikzPicture + sage: s = "\\begin{tikzpicture}\n\\draw (0,0) -- (1,1);\n\\end{tikzpicture}" + sage: t = TikzPicture(s) + sage: _ = t.dvi(view=False) # not tested + + A filename may be provided where to save the file, in which case + the viewer does not open the file:: + + sage: from sage.misc.temporary_file import tmp_filename + sage: filename = tmp_filename('temp','.dvi') + sage: path_to_file = t.dvi(filename) # long time (1s) # optional latex + sage: path_to_file[-4:] # long time (fast) # optional latex + '.dvi' + + The filename may contain spaces:: + + sage: filename = tmp_filename('filename with spaces','.dvi') + sage: path_to_file = t.dvi(filename) # long time (1s) # optional latex + + TESTS: + + We test the behavior when a wrong tex string is provided:: + + sage: s = "\\begin{tikzpicture}\n\\draw (0,0) -- (1,1);\n\\end{tikzpicture}" + sage: s_missing_last_character = s[:-1] + sage: t = TikzPicture(s_missing_last_character) + sage: _ = t.dvi() # optional latex + Traceback (most recent call last): + ... + CalledProcessError: Command '['latex', '-interaction=nonstopmode', + 'tikz_...tex']' returned non-zero exit status 1. + + """ + from sage.features.latex import latex + + # Set default program + if program is None: + program = 'latex' + + # Check availability of programs + if program == 'latex': + latex().require() + else: + raise ValueError("program(={}) should be latex".format(program)) + + # set up filenames + from sage.misc.temporary_file import tmp_filename + temp_filename_tex = tmp_filename('tikz_', '.tex') + with open(temp_filename_tex, 'w') as f: + f.write(str(self)) + base, temp_filename_tex = os.path.split(temp_filename_tex) + temp_filename, ext = os.path.splitext(temp_filename_tex) + + # running pdflatex or lualatex + cmd = [program, '-interaction=nonstopmode', temp_filename_tex] + result = run(cmd, cwd=base, capture_output=True, text=True) + + # If a problem with the tex source occurs, provide the log + if result.returncode != 0: + print("Command \n" + " '{}'\n" + "returned non-zero exit status {}.\n" + "Here is the content of the stderr:{}\n" + "Here is the content of the stdout:" + "{}\n".format(' '.join(result.args), + result.returncode, + result.stderr.strip(), + result.stdout.strip())) + result.check_returncode() + temp_filename_dvi = os.path.join(base, temp_filename + '.dvi') + + # move the pdf into the good location + if filename: + filename = os.path.abspath(filename) + import shutil + shutil.move(temp_filename_dvi, filename) + return filename + + # open the tmp dvi + elif view: + from sage.misc.viewer import dvi_viewer + cmd = dvi_viewer().split() + cmd.append(temp_filename_dvi) + # we use check_call as opposed to run, because + # it gives the sage prompt back to the user + # see https://stackoverflow.com/a/71342967 + # run(cmd, cwd=base, capture_output=True, check=True) + from subprocess import check_call, PIPE + check_call(cmd, cwd=base, stdout=PIPE, stderr=PIPE) + + return temp_filename_dvi + def png(self, filename=None, density=150, view=True): r""" Compiles the latex code with pdflatex and converts to a png file. @@ -935,6 +1054,111 @@ def svg(self, filename=None, view=True, program='pdftocairo'): return temp_filename_svg + def eps(self, filename=None, view=True, program='dvips'): + r""" + Compiles the latex code with pdflatex and converts to a eps file. + + INPUT: + + - ``filename`` -- string (default:``None``), the output filename. + If ``None``, it saves the file in a temporary directory. + + - ``view`` -- bool (default:``True``), whether to open the file in + a browser. This option is ignored and automatically set to + ``False`` if ``filename`` is not ``None``. + + - ``program`` -- string (default:``'dvips'``), + ``'pdftocairo'`` or ``'dvips'`` + + OUTPUT: + + string, path to eps file + + EXAMPLES:: + + sage: from sage.misc.latex_standalone import Standalone + sage: t = Standalone('Hello World') + sage: _ = t.eps(view=False) # not tested + + Same for instances of :class:`TikzPicture`:: + + sage: from sage.misc.latex_standalone import TikzPicture + sage: s = "\\begin{tikzpicture}\n\\draw (0,0) -- (1,1);\n\\end{tikzpicture}" + sage: t = TikzPicture(s) + sage: _ = t.eps(view=False) # not tested + + We test the creation of the files:: + + sage: from sage.misc.temporary_file import tmp_filename + sage: filename = tmp_filename('temp', '.eps') + sage: path_to_file = t.eps(filename, program='dvips') # long time (1s) # optional latex dvips + sage: path_to_file[-4:] # long time (fast) # optional latex dvips + '.eps' + sage: path_to_file = t.eps(filename, program='pdftocairo') # long time (1s) # optional latex pdftocairo + sage: path_to_file[-4:] # long time (fast) # optional latex pdftocairo + '.eps' + + """ + + if program == 'pdftocairo': + from sage.features.poppler import pdftocairo + pdftocairo().require() + # set the temporary filenames + temp_filename_pdf = self.pdf(filename=None, view=False) + temp_filename, ext = os.path.splitext(temp_filename_pdf) + temp_filename_eps = temp_filename + '.eps' + # set the command + cmd = ['pdftocairo', '-eps', temp_filename_pdf, temp_filename_eps] + elif program == 'dvips': + from sage.features.latex import dvips + dvips().require() + # set the temporary filenames + temp_filename_dvi = self.dvi(filename=None, view=False) + temp_filename, ext = os.path.splitext(temp_filename_dvi) + temp_filename_eps = temp_filename + '.eps' + # set the command + cmd = ['dvips', '-E', '-o', temp_filename_eps, temp_filename_dvi] + else: + raise ValueError("program(={}) should be 'pdftocairo' or" + " 'dvips'".format(program)) + + # convert to eps + result = run(cmd, capture_output=True, text=True) + + # If a problem occurs, provide the log + if result.returncode != 0: + print("Command \n" + " '{}'\n" + "returned non-zero exit status {}.\n" + "Here is the content of the stderr:{}\n" + "Here is the content of the stdout:" + "{}\n".format(' '.join(result.args), + result.returncode, + result.stderr.strip(), + result.stdout.strip())) + result.check_returncode() + + # move the eps into the good location + if filename: + filename = os.path.abspath(filename) + import shutil + shutil.move(temp_filename_eps, filename) + return filename + + # open the tmp eps + elif view: + from sage.misc.viewer import viewer + cmd = viewer().split() + cmd.append(temp_filename_eps) + # we use check_call as opposed to run, because + # it gives the sage prompt back to the user + # see https://stackoverflow.com/a/71342967 + # run(cmd, capture_output=True, check=True) + from subprocess import check_call, PIPE + check_call(cmd, stdout=PIPE, stderr=PIPE) + + return temp_filename_eps + def tex(self, filename=None, content_only=False, include_header=None): r""" Writes the latex code to a file. From 069784baa110d539975fe79e5e6d917fc7e5accf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Labb=C3=A9?= Date: Thu, 30 Mar 2023 14:03:46 +0200 Subject: [PATCH 129/135] adding method save to Standalone class (for compatibility with sagetex) --- src/sage/misc/latex_standalone.py | 58 +++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/sage/misc/latex_standalone.py b/src/sage/misc/latex_standalone.py index 69b4fa75d10..6166483d763 100644 --- a/src/sage/misc/latex_standalone.py +++ b/src/sage/misc/latex_standalone.py @@ -1223,6 +1223,64 @@ def tex(self, filename=None, content_only=False, include_header=None): return filename + def save(self, filename, **kwds): + r""" + Save the graphics to an image file. + + INPUT: + + - ``filename`` -- string. The filename and the image format + given by the extension, which can be one of the following: + + * ``.pdf``, + * ``.png``, + * ``.svg``, + * ``.eps``, + * ``.dvi``, + * ``.sobj`` (for a Sage object you can load later), + * empty extension will be treated as ``.sobj``. + + All other keyword arguments will be passed to the plotter. + + OUTPUT: + + - ``None`` + + .. NOTE:: + + This method follows the signature of the method + :meth:`sage.plot.Graphics.save` in order to be compatible with + with sagetex. In particular so that ``\sageplot{t}`` written + in a ``tex`` file works when ``t`` is an instance of + :class:`Standalone` or :class:`TikzPicture`. + + EXAMPLES:: + + sage: from sage.misc.temporary_file import tmp_filename + sage: from sage.misc.latex_standalone import Standalone + sage: t = Standalone('Hello World') + sage: filename = tmp_filename('temp','.pdf') + sage: t.save(filename) # long time (1s) # optional latex + sage: filename = tmp_filename('temp','.eps') + sage: t.save(filename) # long time (1s) # optional latex dvips + + """ + ext = os.path.splitext(filename)[1].lower() + if ext == '' or ext == '.sobj': + raise NotImplementedError() + elif ext == '.pdf': + self.pdf(filename, **kwds) + elif ext == '.png': + self.png(filename, **kwds) + elif ext == '.svg': + self.svg(filename, **kwds) + elif ext == '.eps': + self.eps(filename, **kwds) + elif ext == '.dvi': + self.dvi(filename, **kwds) + else: + raise ValueError("allowed file extensions for images are " + ".pdf, .png, .svg, .eps, .dvi!") class TikzPicture(Standalone): r""" From df984bc471fe500fff1715167e3e18a03c04589a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Labb=C3=A9?= Date: Thu, 30 Mar 2023 23:29:01 +0200 Subject: [PATCH 130/135] fixed one doctest --- src/sage/doctest/external.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sage/doctest/external.py b/src/sage/doctest/external.py index f8374b13473..60299862755 100644 --- a/src/sage/doctest/external.py +++ b/src/sage/doctest/external.py @@ -380,6 +380,7 @@ class AvailableSoftware(): sage: from sage.doctest.external import external_software, available_software sage: external_software ['cplex', + 'dvips', 'ffmpeg', 'gurobi', 'internet', From 155ebb5f1f14cefd8ac0951947cb75234d5e7d51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Labb=C3=A9?= Date: Tue, 4 Apr 2023 17:06:18 +0200 Subject: [PATCH 131/135] Added a newline after class dvips --- src/sage/features/latex.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sage/features/latex.py b/src/sage/features/latex.py index f1451e7bc4b..48b4576961c 100644 --- a/src/sage/features/latex.py +++ b/src/sage/features/latex.py @@ -206,6 +206,7 @@ def __init__(self): """ Executable.__init__(self, "dvips", executable="dvips", url="https://tug.org/texinfohtml/dvips.html") + class TeXFile(StaticFile): r""" A :class:`sage.features.Feature` describing the presence of a TeX file From 95cc4d0a3cf6e9d6209427e49866bd31c1e2dedc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Labb=C3=A9?= Date: Tue, 4 Apr 2023 17:10:10 +0200 Subject: [PATCH 132/135] Fixed Compiles -> Compile and OUTPUT spacing --- src/sage/misc/latex_standalone.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/sage/misc/latex_standalone.py b/src/sage/misc/latex_standalone.py index 6166483d763..7ef0a01f900 100644 --- a/src/sage/misc/latex_standalone.py +++ b/src/sage/misc/latex_standalone.py @@ -622,7 +622,7 @@ def add_macro(self, macro): def pdf(self, filename=None, view=True, program=None): r""" - Compiles the latex code with pdflatex and create a pdf file. + Compile the latex code with pdflatex and create a pdf file. INPUT: @@ -639,7 +639,7 @@ def pdf(self, filename=None, view=True, program=None): OUTPUT: - string, path to pdf file + string, path to pdf file EXAMPLES:: @@ -748,7 +748,7 @@ def pdf(self, filename=None, view=True, program=None): def dvi(self, filename=None, view=True, program='latex'): r""" - Compiles the latex code with latex and create a dvi file. + Compile the latex code with latex and create a dvi file. INPUT: @@ -763,7 +763,7 @@ def dvi(self, filename=None, view=True, program='latex'): OUTPUT: - string, path to dvi file + string, path to dvi file EXAMPLES:: @@ -867,7 +867,7 @@ def dvi(self, filename=None, view=True, program='latex'): def png(self, filename=None, density=150, view=True): r""" - Compiles the latex code with pdflatex and converts to a png file. + Compile the latex code with pdflatex and converts to a png file. INPUT: @@ -883,7 +883,7 @@ def png(self, filename=None, density=150, view=True): OUTPUT: - string, path to png file + string, path to png file EXAMPLES:: @@ -956,7 +956,7 @@ def png(self, filename=None, density=150, view=True): def svg(self, filename=None, view=True, program='pdftocairo'): r""" - Compiles the latex code with pdflatex and converts to a svg file. + Compile the latex code with pdflatex and converts to a svg file. INPUT: @@ -972,7 +972,7 @@ def svg(self, filename=None, view=True, program='pdftocairo'): OUTPUT: - string, path to svg file + string, path to svg file EXAMPLES:: @@ -1056,7 +1056,7 @@ def svg(self, filename=None, view=True, program='pdftocairo'): def eps(self, filename=None, view=True, program='dvips'): r""" - Compiles the latex code with pdflatex and converts to a eps file. + Compile the latex code with pdflatex and converts to a eps file. INPUT: @@ -1072,7 +1072,7 @@ def eps(self, filename=None, view=True, program='dvips'): OUTPUT: - string, path to eps file + string, path to eps file EXAMPLES:: @@ -1173,7 +1173,7 @@ def tex(self, filename=None, content_only=False, include_header=None): OUTPUT: - string, path to tex file + string, path to tex file EXAMPLES:: From fed096b678b3412af6a8956f016f78c4b2013cc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Labb=C3=A9?= Date: Tue, 4 Apr 2023 17:24:39 +0200 Subject: [PATCH 133/135] added doctests testing value errors --- src/sage/misc/latex_standalone.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/sage/misc/latex_standalone.py b/src/sage/misc/latex_standalone.py index 7ef0a01f900..cd42519c5ec 100644 --- a/src/sage/misc/latex_standalone.py +++ b/src/sage/misc/latex_standalone.py @@ -805,6 +805,14 @@ def dvi(self, filename=None, view=True, program='latex'): CalledProcessError: Command '['latex', '-interaction=nonstopmode', 'tikz_...tex']' returned non-zero exit status 1. + We test the behavior when a wrong value is provided:: + + sage: t = Standalone('Hello World') + sage: _ = t.dvi(program='lates') + Traceback (most recent call last): + ... + ValueError: program(=lates) should be latex + """ from sage.features.latex import latex @@ -1098,6 +1106,16 @@ def eps(self, filename=None, view=True, program='dvips'): sage: path_to_file[-4:] # long time (fast) # optional latex pdftocairo '.eps' + TESTS: + + We test the behavior when a wrong value is provided:: + + sage: t = Standalone('Hello World') + sage: _ = t.eps(program='convert') + Traceback (most recent call last): + ... + ValueError: program(=convert) should be 'pdftocairo' or 'dvips' + """ if program == 'pdftocairo': From 839a6e928c264a9863bd42860c78ae95a6d9f3e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Tue, 4 Apr 2023 12:56:57 -0300 Subject: [PATCH 134/135] Ignore deprecation warnings triggered by pythran 0.12.1 These happen with python 3.11, setuptools 67.6.1, numpy 1.24.2. When pythran 0.12.1 is installed, I get 24 doctest failures due to deprecation warnings; they are all gone with this commit. --- src/sage/all__sagemath_repl.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/sage/all__sagemath_repl.py b/src/sage/all__sagemath_repl.py index 95dc2a15a80..6800eb9a27b 100644 --- a/src/sage/all__sagemath_repl.py +++ b/src/sage/all__sagemath_repl.py @@ -37,9 +37,17 @@ warnings.filterwarnings('ignore', category=DeprecationWarning, module='(.*[.]_vendor[.])?packaging') -# Ignore numpy warnings triggered by pythran +# Ignore a few warnings triggered by pythran 0.12.1 warnings.filterwarnings('ignore', category=DeprecationWarning, - module='pythran') + message='\n\n `numpy.distutils` is deprecated since NumPy 1.23.0', + module='pythran.dist') +warnings.filterwarnings('ignore', category=DeprecationWarning, + message='pkg_resources is deprecated as an API|' + 'Deprecated call to `pkg_resources.declare_namespace(.*)`', + module='pkg_resources') +warnings.filterwarnings('ignore', category=DeprecationWarning, + message='msvccompiler is deprecated and slated to be removed', + module='distutils.msvccompiler') warnings.filterwarnings('ignore', category=DeprecationWarning, message='The distutils(.sysconfig module| package) is deprecated', From 27b077e82c11df15482b1c3231aedd5f81955094 Mon Sep 17 00:00:00 2001 From: Release Manager Date: Fri, 7 Apr 2023 00:48:43 +0200 Subject: [PATCH 135/135] Updated SageMath version to 10.0.beta8 --- .zenodo.json | 8 ++++---- VERSION.txt | 2 +- build/pkgs/configure/checksums.ini | 6 +++--- build/pkgs/configure/package-version.txt | 2 +- build/pkgs/sage_conf/install-requires.txt | 2 +- build/pkgs/sage_docbuild/install-requires.txt | 2 +- build/pkgs/sage_setup/install-requires.txt | 2 +- build/pkgs/sage_sws2rst/install-requires.txt | 2 +- build/pkgs/sagelib/install-requires.txt | 2 +- build/pkgs/sagemath_categories/install-requires.txt | 2 +- build/pkgs/sagemath_environment/install-requires.txt | 2 +- build/pkgs/sagemath_objects/install-requires.txt | 2 +- build/pkgs/sagemath_repl/install-requires.txt | 2 +- pkgs/sage-conf/VERSION.txt | 2 +- pkgs/sage-conf_pypi/VERSION.txt | 2 +- pkgs/sage-docbuild/VERSION.txt | 2 +- pkgs/sage-setup/VERSION.txt | 2 +- pkgs/sage-sws2rst/VERSION.txt | 2 +- pkgs/sagemath-categories/VERSION.txt | 2 +- pkgs/sagemath-environment/VERSION.txt | 2 +- pkgs/sagemath-objects/VERSION.txt | 2 +- pkgs/sagemath-repl/VERSION.txt | 2 +- src/VERSION.txt | 2 +- src/bin/sage-version.sh | 6 +++--- src/sage/version.py | 6 +++--- 25 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.zenodo.json b/.zenodo.json index af2b7746dcd..28217d5ff6d 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,10 +1,10 @@ { "description": "Mirror of the Sage https://sagemath.org/ source tree", "license": "other-open", - "title": "sagemath/sage: 10.0.beta7", - "version": "10.0.beta7", + "title": "sagemath/sage: 10.0.beta8", + "version": "10.0.beta8", "upload_type": "software", - "publication_date": "2023-04-01", + "publication_date": "2023-04-06", "creators": [ { "affiliation": "SageMath.org", @@ -15,7 +15,7 @@ "related_identifiers": [ { "scheme": "url", - "identifier": "/~https://github.com/sagemath/sage/tree/10.0.beta7", + "identifier": "/~https://github.com/sagemath/sage/tree/10.0.beta8", "relation": "isSupplementTo" }, { diff --git a/VERSION.txt b/VERSION.txt index be1c5300bf5..91d81a8ce5e 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -SageMath version 10.0.beta7, Release Date: 2023-04-01 +SageMath version 10.0.beta8, Release Date: 2023-04-06 diff --git a/build/pkgs/configure/checksums.ini b/build/pkgs/configure/checksums.ini index 6756ece8685..52b8794dee3 100644 --- a/build/pkgs/configure/checksums.ini +++ b/build/pkgs/configure/checksums.ini @@ -1,4 +1,4 @@ tarball=configure-VERSION.tar.gz -sha1=b998c1d37a74b1abb29f6be8c091c5cbf3728064 -md5=da963ef9ed25e1a36b5dd9d774af7143 -cksum=1581756007 +sha1=c809622a8c0b706231b5c8e02c0fb96b940e2a10 +md5=4ab2cb23636289210afe4a6743b36183 +cksum=1470715760 diff --git a/build/pkgs/configure/package-version.txt b/build/pkgs/configure/package-version.txt index b44f8722552..6fd27d12111 100644 --- a/build/pkgs/configure/package-version.txt +++ b/build/pkgs/configure/package-version.txt @@ -1 +1 @@ -15027934d11e00039607d848697cd9da68bf0536 +adaf3af26892f4a3720cc09d0e21c35281b472a3 diff --git a/build/pkgs/sage_conf/install-requires.txt b/build/pkgs/sage_conf/install-requires.txt index 9abd3f4fe48..2903b5bb1d0 100644 --- a/build/pkgs/sage_conf/install-requires.txt +++ b/build/pkgs/sage_conf/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sage-conf ~= 10.0b7 +sage-conf ~= 10.0b8 diff --git a/build/pkgs/sage_docbuild/install-requires.txt b/build/pkgs/sage_docbuild/install-requires.txt index 2e2d9e5ea78..af0b61ba07d 100644 --- a/build/pkgs/sage_docbuild/install-requires.txt +++ b/build/pkgs/sage_docbuild/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sage-docbuild ~= 10.0b7 +sage-docbuild ~= 10.0b8 diff --git a/build/pkgs/sage_setup/install-requires.txt b/build/pkgs/sage_setup/install-requires.txt index 786ddc5b33b..e10a06a693e 100644 --- a/build/pkgs/sage_setup/install-requires.txt +++ b/build/pkgs/sage_setup/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sage-setup ~= 10.0b7 +sage-setup ~= 10.0b8 diff --git a/build/pkgs/sage_sws2rst/install-requires.txt b/build/pkgs/sage_sws2rst/install-requires.txt index 62a02504436..a37e70c6032 100644 --- a/build/pkgs/sage_sws2rst/install-requires.txt +++ b/build/pkgs/sage_sws2rst/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sage-sws2rst ~= 10.0b7 +sage-sws2rst ~= 10.0b8 diff --git a/build/pkgs/sagelib/install-requires.txt b/build/pkgs/sagelib/install-requires.txt index dfb02de732c..937a8ea52d3 100644 --- a/build/pkgs/sagelib/install-requires.txt +++ b/build/pkgs/sagelib/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagelib ~= 10.0b7 +sagelib ~= 10.0b8 diff --git a/build/pkgs/sagemath_categories/install-requires.txt b/build/pkgs/sagemath_categories/install-requires.txt index fee0fcade50..935fbc776e0 100644 --- a/build/pkgs/sagemath_categories/install-requires.txt +++ b/build/pkgs/sagemath_categories/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-categories ~= 10.0b7 +sagemath-categories ~= 10.0b8 diff --git a/build/pkgs/sagemath_environment/install-requires.txt b/build/pkgs/sagemath_environment/install-requires.txt index 51b0078939f..5f6936d1010 100644 --- a/build/pkgs/sagemath_environment/install-requires.txt +++ b/build/pkgs/sagemath_environment/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-environment ~= 10.0b7 +sagemath-environment ~= 10.0b8 diff --git a/build/pkgs/sagemath_objects/install-requires.txt b/build/pkgs/sagemath_objects/install-requires.txt index 56a5f7b6145..2c4769d9c3a 100644 --- a/build/pkgs/sagemath_objects/install-requires.txt +++ b/build/pkgs/sagemath_objects/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-objects ~= 10.0b7 +sagemath-objects ~= 10.0b8 diff --git a/build/pkgs/sagemath_repl/install-requires.txt b/build/pkgs/sagemath_repl/install-requires.txt index 1469ecf3e94..0e53e35d63d 100644 --- a/build/pkgs/sagemath_repl/install-requires.txt +++ b/build/pkgs/sagemath_repl/install-requires.txt @@ -1,2 +1,2 @@ # This file is updated on every release by the sage-update-version script -sagemath-repl ~= 10.0b7 +sagemath-repl ~= 10.0b8 diff --git a/pkgs/sage-conf/VERSION.txt b/pkgs/sage-conf/VERSION.txt index 8a91076ab17..df74bb50e91 100644 --- a/pkgs/sage-conf/VERSION.txt +++ b/pkgs/sage-conf/VERSION.txt @@ -1 +1 @@ -10.0.beta7 +10.0.beta8 diff --git a/pkgs/sage-conf_pypi/VERSION.txt b/pkgs/sage-conf_pypi/VERSION.txt index 8a91076ab17..df74bb50e91 100644 --- a/pkgs/sage-conf_pypi/VERSION.txt +++ b/pkgs/sage-conf_pypi/VERSION.txt @@ -1 +1 @@ -10.0.beta7 +10.0.beta8 diff --git a/pkgs/sage-docbuild/VERSION.txt b/pkgs/sage-docbuild/VERSION.txt index 8a91076ab17..df74bb50e91 100644 --- a/pkgs/sage-docbuild/VERSION.txt +++ b/pkgs/sage-docbuild/VERSION.txt @@ -1 +1 @@ -10.0.beta7 +10.0.beta8 diff --git a/pkgs/sage-setup/VERSION.txt b/pkgs/sage-setup/VERSION.txt index 8a91076ab17..df74bb50e91 100644 --- a/pkgs/sage-setup/VERSION.txt +++ b/pkgs/sage-setup/VERSION.txt @@ -1 +1 @@ -10.0.beta7 +10.0.beta8 diff --git a/pkgs/sage-sws2rst/VERSION.txt b/pkgs/sage-sws2rst/VERSION.txt index 8a91076ab17..df74bb50e91 100644 --- a/pkgs/sage-sws2rst/VERSION.txt +++ b/pkgs/sage-sws2rst/VERSION.txt @@ -1 +1 @@ -10.0.beta7 +10.0.beta8 diff --git a/pkgs/sagemath-categories/VERSION.txt b/pkgs/sagemath-categories/VERSION.txt index 8a91076ab17..df74bb50e91 100644 --- a/pkgs/sagemath-categories/VERSION.txt +++ b/pkgs/sagemath-categories/VERSION.txt @@ -1 +1 @@ -10.0.beta7 +10.0.beta8 diff --git a/pkgs/sagemath-environment/VERSION.txt b/pkgs/sagemath-environment/VERSION.txt index 8a91076ab17..df74bb50e91 100644 --- a/pkgs/sagemath-environment/VERSION.txt +++ b/pkgs/sagemath-environment/VERSION.txt @@ -1 +1 @@ -10.0.beta7 +10.0.beta8 diff --git a/pkgs/sagemath-objects/VERSION.txt b/pkgs/sagemath-objects/VERSION.txt index 8a91076ab17..df74bb50e91 100644 --- a/pkgs/sagemath-objects/VERSION.txt +++ b/pkgs/sagemath-objects/VERSION.txt @@ -1 +1 @@ -10.0.beta7 +10.0.beta8 diff --git a/pkgs/sagemath-repl/VERSION.txt b/pkgs/sagemath-repl/VERSION.txt index 8a91076ab17..df74bb50e91 100644 --- a/pkgs/sagemath-repl/VERSION.txt +++ b/pkgs/sagemath-repl/VERSION.txt @@ -1 +1 @@ -10.0.beta7 +10.0.beta8 diff --git a/src/VERSION.txt b/src/VERSION.txt index 8a91076ab17..df74bb50e91 100644 --- a/src/VERSION.txt +++ b/src/VERSION.txt @@ -1 +1 @@ -10.0.beta7 +10.0.beta8 diff --git a/src/bin/sage-version.sh b/src/bin/sage-version.sh index 302ce4e0256..4b2a9e4f9bf 100644 --- a/src/bin/sage-version.sh +++ b/src/bin/sage-version.sh @@ -4,6 +4,6 @@ # which stops "setup.py develop" from rewriting it as a Python file. : # This file is auto-generated by the sage-update-version script, do not edit! -SAGE_VERSION='10.0.beta7' -SAGE_RELEASE_DATE='2023-04-01' -SAGE_VERSION_BANNER='SageMath version 10.0.beta7, Release Date: 2023-04-01' +SAGE_VERSION='10.0.beta8' +SAGE_RELEASE_DATE='2023-04-06' +SAGE_VERSION_BANNER='SageMath version 10.0.beta8, Release Date: 2023-04-06' diff --git a/src/sage/version.py b/src/sage/version.py index 79f6bd84626..9c2111ea0f1 100644 --- a/src/sage/version.py +++ b/src/sage/version.py @@ -1,5 +1,5 @@ # Sage version information for Python scripts # This file is auto-generated by the sage-update-version script, do not edit! -version = '10.0.beta7' -date = '2023-04-01' -banner = 'SageMath version 10.0.beta7, Release Date: 2023-04-01' +version = '10.0.beta8' +date = '2023-04-06' +banner = 'SageMath version 10.0.beta8, Release Date: 2023-04-06'